本文整理匯總了Java中com.marklogic.xcc.ValueFactory.newValue方法的典型用法代碼示例。如果您正苦於以下問題:Java ValueFactory.newValue方法的具體用法?Java ValueFactory.newValue怎麽用?Java ValueFactory.newValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.marklogic.xcc.ValueFactory
的用法示例。
在下文中一共展示了ValueFactory.newValue方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: constructTransformOption
import com.marklogic.xcc.ValueFactory; //導入方法依賴的package包/類
private static XdmValue constructTransformOption(Configuration conf,
String functionParam, String functionNs) {
HashMap<String, String> transMap = new HashMap<>();
String modules = conf.get(ConfigConstants.CONF_INPUT_MODULES_DATABASE);
String modulesRoot = conf.get(ConfigConstants.CONF_INPUT_MODULES_ROOT);
if (modules != null) {
transMap.put("modules", modules);
}
if (modulesRoot != null) {
transMap.put("modules-root", modulesRoot);
}
if (!"".equals(functionNs)) {
transMap.put("transform-namespace", functionNs);
}
if (!"".equals(functionParam)) {
transMap.put("transform-param", functionParam);
}
if (transMap.isEmpty()) {
return ValueFactory.newJSNull();
} else {
ObjectNode node = mapToNode(transMap);
return ValueFactory.newValue(ValueType.JS_OBJECT, node);
}
}
示例2: newValue
import com.marklogic.xcc.ValueFactory; //導入方法依賴的package包/類
/**
* Create new XdmValue from value type and Writables.
*
*/
public static XdmValue newValue(ValueType valueType, Object value) {
if (value instanceof Text) {
return ValueFactory.newValue(valueType, ((Text)value).toString());
} else if (value instanceof BytesWritable) {
return ValueFactory.newValue(valueType, ((BytesWritable)value).getBytes());
} else if (value instanceof IntWritable) {
return ValueFactory.newValue(valueType, ((IntWritable)value).get());
} else if (value instanceof LongWritable) {
return ValueFactory.newValue(valueType, ((LongWritable)value).get());
} else if (value instanceof VIntWritable) {
return ValueFactory.newValue(valueType, ((VIntWritable)value).get());
} else if (value instanceof VLongWritable) {
return ValueFactory.newValue(valueType, ((VLongWritable)value).get());
} else if (value instanceof BooleanWritable) {
return ValueFactory.newValue(valueType, ((BooleanWritable)value).get());
} else if (value instanceof FloatWritable) {
return ValueFactory.newValue(valueType, ((FloatWritable)value).get());
} else if (value instanceof DoubleWritable) {
return ValueFactory.newValue(valueType, ((DoubleWritable)value).get());
} else if (value instanceof MarkLogicNode) {
return ValueFactory.newValue(valueType, ((MarkLogicNode)value).get());
} else {
throw new UnsupportedOperationException("Value " +
value.getClass().getName() + " is unsupported.");
}
}
示例3: bindParams
import com.marklogic.xcc.ValueFactory; //導入方法依賴的package包/類
private void bindParams(Map<String, Parameter> params, Request request) { //throws RequestException {
for (Map.Entry<String, Parameter> e: params.entrySet()) {
XName name = new XName(e.getKey());
XdmValue value;
switch (e.getValue().getType()) {
case "boolean": {
value = ValueFactory.newXSBoolean(new Boolean(e.getValue().getName()));
break;
}
case "byte":
case "int":
case "long":
case "short": {
value = ValueFactory.newXSInteger(new Integer(e.getValue().getName()));
break;
}
case "double": {
value = ValueFactory.newValue(ValueType.XS_DOUBLE, new Double(e.getValue().getName()));
break;
}
case "float": {
value = ValueFactory.newValue(ValueType.XS_FLOAT, new Float(e.getValue().getName()));
break;
}
default:
value = ValueFactory.newXSString(e.getValue().getName());
}
request.setVariable(ValueFactory.newVariable(name, value));
}
}
示例4: getXdmValue
import com.marklogic.xcc.ValueFactory; //導入方法依賴的package包/類
private XdmValue getXdmValue(String type, String value) {
XQueryItemType itemType = XQueryItemType.valueFor(type);
ValueType xdmType = typeMapper.getType(itemType);
return ValueFactory.newValue(xdmType, value);
}