本文整理汇总了Java中org.pentaho.di.core.xml.XMLHandler.stringToBinary方法的典型用法代码示例。如果您正苦于以下问题:Java XMLHandler.stringToBinary方法的具体用法?Java XMLHandler.stringToBinary怎么用?Java XMLHandler.stringToBinary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.xml.XMLHandler
的用法示例。
在下文中一共展示了XMLHandler.stringToBinary方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ValueMeta
import org.pentaho.di.core.xml.XMLHandler; //导入方法依赖的package包/类
public ValueMeta(Node node) throws IOException
{
this();
type = getType( XMLHandler.getTagValue(node, "type") ) ;
storageType = getStorageType( XMLHandler.getTagValue(node, "storagetype") );
switch(storageType) {
case STORAGE_TYPE_INDEXED:
{
Node indexNode = XMLHandler.getSubNode(node, "index");
int nrIndexes = XMLHandler.countNodes(indexNode, "value");
index = new Object[nrIndexes];
for (int i=0;i<index.length;i++)
{
Node valueNode = XMLHandler.getSubNodeByNr(indexNode, "value", i);
String valueString = XMLHandler.getNodeValue(valueNode);
if (Const.isEmpty(valueString))
{
index[i] = null;
}
else
{
switch(type)
{
case TYPE_STRING: index[i] = valueString; break;
case TYPE_NUMBER: index[i] = Double.parseDouble( valueString ); break;
case TYPE_INTEGER: index[i] = Long.parseLong( valueString ); break;
case TYPE_DATE: index[i] = XMLHandler.stringToDate( valueString ); ; break;
case TYPE_BIGNUMBER: index[i] = new BigDecimal( valueString ); ; break;
case TYPE_BOOLEAN: index[i] = Boolean.valueOf("Y".equalsIgnoreCase( valueString)); break;
case TYPE_BINARY: index[i] = XMLHandler.stringToBinary( valueString ); break;
// -- Begin GeoKettle modification --
// TODO: this would work for WKT, but what if we use GML instead?
case TYPE_GEOMETRY: index[i] = XMLHandler.stringToGeometry(valueString); break;
// -- End GeoKettle modification --
default: throw new IOException(toString()+" : Unable to de-serialize indexe storage type from XML for data type "+getType());
}
}
}
}
break;
case STORAGE_TYPE_BINARY_STRING:
{
// Save the storage meta data...
//
Node storageMetaNode = XMLHandler.getSubNode(node, "storage-meta");
if (storageMetaNode!=null)
{
storageMetadata = new ValueMeta(storageMetaNode);
}
}
break;
default:
break;
}
name = XMLHandler.getTagValue(node, "name");
length = Integer.parseInt( XMLHandler.getTagValue(node, "length") );
precision = Integer.parseInt( XMLHandler.getTagValue(node, "precision") );
origin = XMLHandler.getTagValue(node, "origin");
comments = XMLHandler.getTagValue(node, "comments");
conversionMask = XMLHandler.getTagValue(node, "conversion_Mask");
decimalSymbol = XMLHandler.getTagValue(node, "decimal_symbol");
groupingSymbol = XMLHandler.getTagValue(node, "grouping_symbol");
currencySymbol = XMLHandler.getTagValue(node, "currency_symbol");
trimType = getTrimTypeByCode( XMLHandler.getTagValue(node, "trim_type") );
caseInsensitive = "Y".equalsIgnoreCase( XMLHandler.getTagValue(node, "case_insensitive") );
sortedDescending = "Y".equalsIgnoreCase( XMLHandler.getTagValue(node, "sort_descending") );
outputPaddingEnabled = "Y".equalsIgnoreCase( XMLHandler.getTagValue(node, "output_padding") );
dateFormatLenient = "Y".equalsIgnoreCase( XMLHandler.getTagValue(node, "date_format_lenient") );
String dateFormatLocaleString = XMLHandler.getTagValue(node, "date_format_locale");
if (!Const.isEmpty( dateFormatLocaleString ))
{
dateFormatLocale = new Locale(dateFormatLocaleString);
}
}
示例2: getValue
import org.pentaho.di.core.xml.XMLHandler; //导入方法依赖的package包/类
/**
* Convert a data XML node to an Object that corresponds to the metadata.
* This is basically String to Object conversion that is being done.
* @param node the node to retrieve the data value from
* @return the converted data value
* @throws IOException thrown in case there is a problem with the XML to object conversion
*/
public Object getValue(Node node) throws IOException {
switch(storageType)
{
case STORAGE_TYPE_NORMAL:
String valueString = XMLHandler.getTagValue(node, "value");
if (Const.isEmpty(valueString)) return null;
// Handle Content -- only when not NULL
//
switch(getType())
{
case TYPE_STRING: return valueString;
case TYPE_NUMBER: return Double.parseDouble( valueString );
case TYPE_INTEGER: return Long.parseLong( valueString );
case TYPE_DATE: return XMLHandler.stringToDate( valueString );
case TYPE_BIGNUMBER: return new BigDecimal( valueString );
case TYPE_BOOLEAN: return Boolean.valueOf("Y".equalsIgnoreCase( valueString));
case TYPE_BINARY: return XMLHandler.stringToBinary( valueString );
// -- Begin GeoKettle modification --
// TODO: WKT vs GML?
case TYPE_GEOMETRY: return XMLHandler.stringToGeometry( valueString );
// -- End GeoKettle modification --
default: throw new IOException(toString()+" : Unable to de-serialize '"+valueString+"' from XML for data type "+getType());
}
case STORAGE_TYPE_BINARY_STRING:
// Handle binary string content -- only when not NULL
// In this case, we opt not to convert anything at all for speed.
// That way, we can save on CPU power.
// Since the streams can be compressed, volume shouldn't be an issue at all.
//
String binaryString = XMLHandler.getTagValue(node, "binary-string");
if (Const.isEmpty(binaryString)) return null;
return XMLHandler.stringToBinary(binaryString);
case STORAGE_TYPE_INDEXED:
String indexString = XMLHandler.getTagValue(node, "index-value");
if (Const.isEmpty(indexString)) return null;
return Integer.parseInt(indexString);
default: throw new IOException(toString()+" : Unknown storage type "+getStorageType());
}
}
示例3: ValueMeta
import org.pentaho.di.core.xml.XMLHandler; //导入方法依赖的package包/类
public ValueMeta(Node node) throws KettleException
{
this();
type = getType( XMLHandler.getTagValue(node, "type") ) ;
storageType = getStorageType( XMLHandler.getTagValue(node, "storagetype") );
switch(storageType) {
case STORAGE_TYPE_INDEXED:
{
Node indexNode = XMLHandler.getSubNode(node, "index");
int nrIndexes = XMLHandler.countNodes(indexNode, "value");
index = new Object[nrIndexes];
for (int i=0;i<index.length;i++)
{
Node valueNode = XMLHandler.getSubNodeByNr(indexNode, "value", i);
String valueString = XMLHandler.getNodeValue(valueNode);
if (Const.isEmpty(valueString))
{
index[i] = null;
}
else
{
switch(type)
{
case TYPE_STRING: index[i] = valueString; break;
case TYPE_NUMBER: index[i] = Double.parseDouble( valueString ); break;
case TYPE_INTEGER: index[i] = Long.parseLong( valueString ); break;
case TYPE_DATE: index[i] = XMLHandler.stringToDate( valueString ); ; break;
case TYPE_BIGNUMBER: index[i] = new BigDecimal( valueString ); ; break;
case TYPE_BOOLEAN: index[i] = Boolean.valueOf("Y".equalsIgnoreCase( valueString)); break;
case TYPE_BINARY: index[i] = XMLHandler.stringToBinary( valueString ); break;
default: throw new KettleException(toString()+" : Unable to de-serialize indexe storage type from XML for data type "+getType());
}
}
}
}
break;
case STORAGE_TYPE_BINARY_STRING:
{
// Save the storage meta data...
//
Node storageMetaNode = XMLHandler.getSubNode(node, "storage-meta");
if (storageMetaNode!=null)
{
storageMetadata = new ValueMeta(storageMetaNode);
}
}
break;
default:
break;
}
name = XMLHandler.getTagValue(node, "name");
length = Integer.parseInt( XMLHandler.getTagValue(node, "length") );
precision = Integer.parseInt( XMLHandler.getTagValue(node, "precision") );
origin = XMLHandler.getTagValue(node, "origin");
comments = XMLHandler.getTagValue(node, "comments");
conversionMask = XMLHandler.getTagValue(node, "conversion_Mask");
decimalSymbol = XMLHandler.getTagValue(node, "decimal_symbol");
groupingSymbol = XMLHandler.getTagValue(node, "grouping_symbol");
currencySymbol = XMLHandler.getTagValue(node, "currency_symbol");
trimType = getTrimTypeByCode( XMLHandler.getTagValue(node, "trim_type") );
caseInsensitive = "Y".equalsIgnoreCase( XMLHandler.getTagValue(node, "case_insensitive") );
sortedDescending = "Y".equalsIgnoreCase( XMLHandler.getTagValue(node, "sort_descending") );
outputPaddingEnabled = "Y".equalsIgnoreCase( XMLHandler.getTagValue(node, "output_padding") );
dateFormatLenient = "Y".equalsIgnoreCase( XMLHandler.getTagValue(node, "date_format_lenient") );
String dateFormatLocaleString = XMLHandler.getTagValue(node, "date_format_locale");
if (!Const.isEmpty( dateFormatLocaleString ))
{
dateFormatLocale = EnvUtil.createLocale(dateFormatLocaleString);
}
}
示例4: getValue
import org.pentaho.di.core.xml.XMLHandler; //导入方法依赖的package包/类
/**
* Convert a data XML node to an Object that corresponds to the metadata.
* This is basically String to Object conversion that is being done.
* @param node the node to retrieve the data value from
* @return the converted data value
* @throws IOException thrown in case there is a problem with the XML to object conversion
*/
public Object getValue(Node node) throws KettleException {
switch(storageType)
{
case STORAGE_TYPE_NORMAL:
String valueString = XMLHandler.getNodeValue(node);
if (Const.isEmpty(valueString)) return null;
// Handle Content -- only when not NULL
//
switch(getType())
{
case TYPE_STRING: return valueString;
case TYPE_NUMBER: return Double.parseDouble( valueString );
case TYPE_INTEGER: return Long.parseLong( valueString );
case TYPE_DATE: return XMLHandler.stringToDate( valueString );
case TYPE_BIGNUMBER: return new BigDecimal( valueString );
case TYPE_BOOLEAN: return Boolean.valueOf("Y".equalsIgnoreCase( valueString));
case TYPE_BINARY: return XMLHandler.stringToBinary( XMLHandler.getTagValue(node, "binary-value") );
default: throw new KettleException(toString()+" : Unable to de-serialize '"+valueString+"' from XML for data type "+getType());
}
case STORAGE_TYPE_BINARY_STRING:
// Handle binary string content -- only when not NULL
// In this case, we opt not to convert anything at all for speed.
// That way, we can save on CPU power.
// Since the streams can be compressed, volume shouldn't be an issue at all.
//
String binaryString = XMLHandler.getTagValue(node, "binary-string");
if (Const.isEmpty(binaryString)) return null;
return XMLHandler.stringToBinary(binaryString);
case STORAGE_TYPE_INDEXED:
String indexString = XMLHandler.getTagValue(node, "index-value");
if (Const.isEmpty(indexString)) return null;
return Integer.parseInt(indexString);
default: throw new KettleException(toString()+" : Unknown storage type "+getStorageType());
}
}