Page History
...
There are several required methods to implement in order to create a view converter:
- public String getName()
- public boolean acceptsNativeType(int type)
- public abstract int getReturnType()
- public Object convertObject(Object data) throws Exception
Anchor | ||||
---|---|---|---|---|
|
public String getName()
This defines the name that will be shown to the user when applying this converter.
...
public boolean acceptsNativeType(int type)
This method returns whether or not this converter will accept a field of the type specified by the “type” argument. This argument will be one of UserInputParameters.TYPE_* (ie. TYPE_NUMERIC, TYPE_TEXT, etc.).
...
Styleclass | ||
---|---|---|
| ||
...
Anchor getReturnType getReturnType
public abstract int getReturnType()
...
Styleclass | ||
---|---|---|
| ||
...
Anchor | ||||
---|---|---|---|---|
|
public Object convertObject(Object data) throws Exception
...
Code Block | ||
---|---|---|
| ||
@Override public Object convertObject(Object data) { if (data == null) return null; try { return new BigDecimal((String)data); } catch (NumberFormatException e) { return null; } } |
Styleclass | ||
---|---|---|
| ||
Anchor | ||
---|---|---|
|
|
public Object convertObjectReverse(Object data) throws Exception
This method is used in order for Yellowfin to retrieve the initial values of a converted data set after-the-fact. It should perform the opposite conversion which was applied in convertObject and will receive an object of the type specified as the return type of this Converter.
...