public class ValueMetaFactory extends Object
Modifier and Type | Field and Description |
---|---|
static PluginRegistry |
pluginRegistry |
Constructor and Description |
---|
ValueMetaFactory() |
Modifier and Type | Method and Description |
---|---|
static ValueMetaInterface |
cloneValueMeta(ValueMetaInterface source) |
static ValueMetaInterface |
cloneValueMeta(ValueMetaInterface source,
int targetType) |
static ValueMetaInterface |
createValueMeta(int type) |
static ValueMetaInterface |
createValueMeta(String name,
int type) |
static ValueMetaInterface |
createValueMeta(String name,
int type,
int length,
int precision) |
static String[] |
getAllValueMetaNames() |
static int |
getIdForValueMeta(String valueMetaName) |
static String |
getValueMetaName(int type) |
static String[] |
getValueMetaNames() |
static List<ValueMetaInterface> |
getValueMetaPluginClasses() |
static ValueMetaInterface |
guessValueMetaInterface(Object object)
This method makes attempt to guess kettle value meta interface based on Object class.
|
public static PluginRegistry pluginRegistry
public static ValueMetaInterface createValueMeta(String name, int type, int length, int precision) throws KettlePluginException
KettlePluginException
public static ValueMetaInterface createValueMeta(String name, int type) throws KettlePluginException
KettlePluginException
public static ValueMetaInterface createValueMeta(int type) throws KettlePluginException
KettlePluginException
public static ValueMetaInterface cloneValueMeta(ValueMetaInterface source) throws KettlePluginException
KettlePluginException
public static ValueMetaInterface cloneValueMeta(ValueMetaInterface source, int targetType) throws KettlePluginException
KettlePluginException
public static String[] getValueMetaNames()
public static String[] getAllValueMetaNames()
public static String getValueMetaName(int type)
public static int getIdForValueMeta(String valueMetaName)
public static List<ValueMetaInterface> getValueMetaPluginClasses() throws KettlePluginException
KettlePluginException
public static ValueMetaInterface guessValueMetaInterface(Object object)
This method makes attempt to guess kettle value meta interface based on Object class. This may be the case when we somehow obtain an Object as a result of any calculation, and we are trying to assign some ValueMeta for it.
As an example - we have target value meta Number (which is java Double under the hood)
and value as a BigDecimal.
This BigDecimal can be converted to a Double value.
we have ValueMetaInterface.convertData(ValueMetaInterface, Object)
call for this
where is ValueMetaInterface object is our target value meta, Object is a BigDecimal - so
we need to pass ValueMetaBigNumber as a first parameter, value Object as a second and
as the result we will have target Double (ValueMetaNumber) value so we can safely
put it into output rowset.
Something similar we had for ValueMetaBase.getValueFromSQLType(...) to guess value meta for java sql type.
Currently this method does not have support for plugin value meta. Hope if this approach will be found usable this may be implemented later.
object
- object to guess applicable ValueMetaInterface.if the kettle value meta is recognized, null otherwise.