當前位置: 首頁>>代碼示例>>Java>>正文


Java ValueFactory類代碼示例

本文整理匯總了Java中com.marklogic.xcc.ValueFactory的典型用法代碼示例。如果您正苦於以下問題:Java ValueFactory類的具體用法?Java ValueFactory怎麽用?Java ValueFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ValueFactory類屬於com.marklogic.xcc包,在下文中一共展示了ValueFactory類的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);
    }
}
 
開發者ID:marklogic,項目名稱:marklogic-contentpump,代碼行數:25,代碼來源:TransformWriter.java

示例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.");
    }
}
 
開發者ID:marklogic,項目名稱:marklogic-contentpump,代碼行數:31,代碼來源:InternalUtilities.java

示例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));
    }
}
 
開發者ID:dsukhoroslov,項目名稱:bagri,代碼行數:31,代碼來源:MarkLogicXCCPlugin.java

示例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);
}
 
開發者ID:ligasgr,項目名稱:intellij-xquery,代碼行數:6,代碼來源:MarklogicRunnerApp.java


注:本文中的com.marklogic.xcc.ValueFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。