本文整理汇总了Java中org.pentaho.di.core.row.ValueMetaInterface.getTrimType方法的典型用法代码示例。如果您正苦于以下问题:Java ValueMetaInterface.getTrimType方法的具体用法?Java ValueMetaInterface.getTrimType怎么用?Java ValueMetaInterface.getTrimType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.row.ValueMetaInterface
的用法示例。
在下文中一共展示了ValueMetaInterface.getTrimType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formatField
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
/**
* Takes an input field and converts it to bytes to be stored in the temp file.
* @param v The metadata about the column
* @param valueData The column data
* @return The bytes for the value
* @throws KettleValueException
*/
private byte[] formatField( ValueMetaInterface v, Object valueData ) throws KettleValueException {
if ( v.isString() ) {
if ( v.isStorageBinaryString() && v.getTrimType() == ValueMetaInterface.TRIM_TYPE_NONE && v.getLength() < 0
&& Const.isEmpty( v.getStringEncoding() ) ) {
return (byte[]) valueData;
} else {
String svalue = ( valueData instanceof String ) ? (String) valueData : v.getString( valueData );
// trim or cut to size if needed.
//
return convertStringToBinaryString( v, Const.trimToType( svalue, v.getTrimType() ) );
}
} else {
return v.getBinaryString( valueData );
}
}
示例2: formatField
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private byte[] formatField(ValueMetaInterface v, Object valueData) throws KettleValueException
{
if( v.isString() )
{
if (v.isStorageBinaryString()
&& v.getTrimType()==ValueMetaInterface.TRIM_TYPE_NONE
&& v.getLength()<0
&& Const.isEmpty(v.getStringEncoding())
) {
return (byte[])valueData;
} else {
String svalue = (valueData instanceof String)?(String)valueData:v.getString(valueData);
// trim or cut to size if needed.
//
return convertStringToBinaryString(v,Const.trimToType(svalue, v.getTrimType()));
}
}
else
{
return v.getBinaryString(valueData);
}
}
示例3: formatField
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private byte[] formatField(ValueMetaInterface v, Object valueData) throws KettleValueException {
if (v.isString()) {
if (v.isStorageBinaryString() && v.getTrimType() == ValueMetaInterface.TRIM_TYPE_NONE && v.getLength() < 0
&& Const.isEmpty( v.getStringEncoding())) {
return (byte[]) valueData;
} else {
String svalue = (valueData instanceof String) ? (String) valueData : v.getString(valueData);
// trim or cut to size if needed.
return convertStringToBinaryString(v, Const.trimToType(svalue, v.getTrimType()));
}
} else {
return v.getBinaryString(valueData);
}
}
示例4: getValue
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private Object getValue(Object value, ValueMetaInterface valueMeta) {
if(value==null) return null;
Object o=null;
if(value instanceof List) {
value=getYaml().dump(value);
}
switch (valueMeta.getType()) {
case ValueMeta.TYPE_INTEGER:
if(value instanceof Integer) {
o= new Long((Integer) value);
}else if(value instanceof BigInteger) {
o= new Long(((BigInteger) value).longValue());
}else if(value instanceof Long) {
o= new Long((Long) value);
}else {
o= new Long(value.toString());
}
break;
case ValueMeta.TYPE_NUMBER:
if(value instanceof Integer) {
o= new Double((Integer) value);
}else if(value instanceof BigInteger) {
o= new Double(((BigInteger) value).doubleValue());
}else if(value instanceof Long) {
o= new Double((Long) value);
}else if(value instanceof Double) {
o= (Double) value;
}else {
o= new Double((String) value);
}
break;
case ValueMeta.TYPE_BIGNUMBER:
if(value instanceof Integer) {
o = new BigDecimal((Integer) value);
}else if(value instanceof BigInteger) {
o= new BigDecimal((BigInteger) value);
}else if(value instanceof Long) {
o= new BigDecimal((Long) value);
}else if(value instanceof Double) {
o= new BigDecimal((Double) value);
}
break;
case ValueMeta.TYPE_BOOLEAN:
o= (Boolean) value;
break;
case ValueMeta.TYPE_DATE:
o= (Date) value;
break;
case ValueMeta.TYPE_BINARY:
o= (byte[]) value;
break;
default:
String s=setMap(value);
// Do trimming
switch (valueMeta.getTrimType()) {
case YamlInputField.TYPE_TRIM_LEFT:
s = Const.ltrim(s);
break;
case YamlInputField.TYPE_TRIM_RIGHT:
s = Const.rtrim(s);
break;
case YamlInputField.TYPE_TRIM_BOTH:
s = Const.trim(s);
break;
default:
break;
}
o=s;
break;
}
return o;
}