本文整理汇总了Java中org.codehaus.jackson.node.TextNode类的典型用法代码示例。如果您正苦于以下问题:Java TextNode类的具体用法?Java TextNode怎么用?Java TextNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextNode类属于org.codehaus.jackson.node包,在下文中一共展示了TextNode类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: convertToJsonNode
import org.codehaus.jackson.node.TextNode; //导入依赖的package包/类
private JsonNode convertToJsonNode(AvroDefaultConfig defaultConfig) {
switch (defaultConfig.avroType) {
case BOOLEAN:
return Boolean.parseBoolean(defaultConfig.defaultValue) ? BooleanNode.TRUE : BooleanNode.FALSE;
case INTEGER:
return new IntNode(Integer.parseInt(defaultConfig.defaultValue));
case LONG:
return new LongNode(Long.parseLong(defaultConfig.defaultValue));
case FLOAT:
// FloatNode is fairly recent and our Jackson version does not have it yet
return new DoubleNode(Float.parseFloat(defaultConfig.defaultValue));
case DOUBLE:
return new DoubleNode(Double.parseDouble(defaultConfig.defaultValue));
case STRING:
return new TextNode(defaultConfig.defaultValue);
default:
throw new IllegalArgumentException("Unknown type: " + defaultConfig.avroType);
}
}
开发者ID:streamsets,项目名称:datacollector,代码行数:20,代码来源:AvroSchemaGenerator.java
示例2: createOverrideStrategyField
import org.codehaus.jackson.node.TextNode; //导入依赖的package包/类
/**
* Creates the override strategy field.
*
* @return the field
*/
private Field createOverrideStrategyField() {
List<String> overrideStrategySymbols = Arrays.asList(OverrideStrategy.APPEND.name(),
OverrideStrategy.REPLACE.name());
Schema overrideStrategyEnum = Schema.createEnum(OVERRIDE_STRATEGY_TYPE_NAME, null,
BASE_SCHEMA_FORM_NAMESPACE, overrideStrategySymbols);
Field overrideStrategyField = new Field(OVERRIDE_STRATEGY, Schema.createUnion(Arrays.asList(
overrideStrategyEnum, Schema.create(Type.NULL))), null, null);
overrideStrategyField.addProp(DISPLAY_NAME, "Override strategy");
JsonNodeFactory jsonFactory = JsonNodeFactory.instance;
ArrayNode displayNamesNode = jsonFactory.arrayNode();
displayNamesNode.add(TextNode.valueOf("Append"));
displayNamesNode.add(TextNode.valueOf("Replace"));
overrideStrategyField.addProp(DISPLAY_NAMES, displayNamesNode);
overrideStrategyField.addProp(DISPLAY_PROMPT, "Select array override strategy");
return overrideStrategyField;
}
开发者ID:kaaproject,项目名称:kaa,代码行数:22,代码来源:ConfigurationSchemaFormAvroConverter.java
示例3: createClassTypeField
import org.codehaus.jackson.node.TextNode; //导入依赖的package包/类
/**
* Creates the class type field.
*
* @return the field
*/
private Field createClassTypeField() {
List<String> classTypeSymbols = Arrays.asList(OBJECT, EVENT);
Schema classTypeEnum = Schema.createEnum(CLASS_TYPE_TYPE_NAME, null,
BASE_SCHEMA_FORM_NAMESPACE, classTypeSymbols);
Field classTypeField = new Field(CLASS_TYPE, classTypeEnum, null, null);
classTypeField.addProp(DISPLAY_NAME, "Class type");
JsonNodeFactory jsonFactory = JsonNodeFactory.instance;
ArrayNode displayNamesNode = jsonFactory.arrayNode();
displayNamesNode.add(TextNode.valueOf("Object"));
displayNamesNode.add(TextNode.valueOf("Event"));
classTypeField.addProp(DISPLAY_NAMES, displayNamesNode);
classTypeField.addProp(DISPLAY_PROMPT, "Select class type");
classTypeField.addProp(BY_DEFAULT, OBJECT);
return classTypeField;
}
开发者ID:kaaproject,项目名称:kaa,代码行数:21,代码来源:EcfSchemaFormAvroConverter.java
示例4: getWorkflow
import org.codehaus.jackson.node.TextNode; //导入依赖的package包/类
@GET
@Path("{workflowId}")
public Response getWorkflow(@PathParam("clusterId") String clusterId,
@PathParam("workflowId") String workflowId) {
TaskDriver taskDriver = getTaskDriver(clusterId);
WorkflowConfig workflowConfig = taskDriver.getWorkflowConfig(workflowId);
WorkflowContext workflowContext = taskDriver.getWorkflowContext(workflowId);
ObjectNode root = JsonNodeFactory.instance.objectNode();
TextNode id = JsonNodeFactory.instance.textNode(workflowId);
root.put(Properties.id.name(), id);
ObjectNode workflowConfigNode = JsonNodeFactory.instance.objectNode();
ObjectNode workflowContextNode = JsonNodeFactory.instance.objectNode();
if (workflowConfig != null) {
getWorkflowConfigNode(workflowConfigNode, workflowConfig.getRecord());
}
if (workflowContext != null) {
getWorkflowContextNode(workflowContextNode, workflowContext.getRecord());
}
root.put(WorkflowProperties.WorkflowConfig.name(), workflowConfigNode);
root.put(WorkflowProperties.WorkflowContext.name(), workflowContextNode);
JobDag jobDag = workflowConfig.getJobDag();
ArrayNode jobs = OBJECT_MAPPER.valueToTree(jobDag.getAllNodes());
ObjectNode parentJobs = OBJECT_MAPPER.valueToTree(jobDag.getParentsToChildren());
root.put(WorkflowProperties.Jobs.name(), jobs);
root.put(WorkflowProperties.ParentJobs.name(), parentJobs);
return JSONRepresentation(root);
}
开发者ID:apache,项目名称:helix,代码行数:35,代码来源:WorkflowAccessor.java
注:本文中的org.codehaus.jackson.node.TextNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论