本文整理汇总了Java中org.codehaus.jackson.JsonParser.getCodec方法的典型用法代码示例。如果您正苦于以下问题:Java JsonParser.getCodec方法的具体用法?Java JsonParser.getCodec怎么用?Java JsonParser.getCodec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.jackson.JsonParser
的用法示例。
在下文中一共展示了JsonParser.getCodec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildScoreRule
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
private void buildScoreRule(JsonParser jsonParser,JsonNode ruleNode,ScoreRule rule){
rule.setScoringBean(JsonUtils.getJsonValue(ruleNode, "scoringBean"));
AssignTargetType assignTargetType=AssignTargetType.valueOf(JsonUtils.getJsonValue(ruleNode, "assignTargetType"));
rule.setAssignTargetType(assignTargetType);
rule.setVariableCategory(JsonUtils.getJsonValue(ruleNode, "variableCategory"));
rule.setVariableName(JsonUtils.getJsonValue(ruleNode, "variableName"));
rule.setVariableLabel(JsonUtils.getJsonValue(ruleNode, "variableLabel"));
String datatypeStr=JsonUtils.getJsonValue(ruleNode, "datatype");
if(StringUtils.isNotBlank(datatypeStr)){
rule.setDatatype(Datatype.valueOf(datatypeStr));
}
try{
JsonNode knowledgePackageWrapperNode=ruleNode.get("knowledgePackageWrapper");
ObjectMapper mapper = (ObjectMapper)jsonParser.getCodec();
KnowledgePackageWrapper wrapper=mapper.readValue(knowledgePackageWrapperNode, KnowledgePackageWrapper.class);
wrapper.buildDeserialize();
rule.setKnowledgePackageWrapper(wrapper);
}catch(Exception ex){
throw new RuleException(ex);
}
}
示例2: deserialize
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
@Override
public StatePair deserialize(JsonParser parser,
DeserializationContext context)
throws IOException, JsonProcessingException {
ObjectMapper mapper = (ObjectMapper) parser.getCodec();
// set the state-pair object tree
ObjectNode statePairObject = (ObjectNode) mapper.readTree(parser);
Class<?> stateClass = null;
try {
stateClass =
Class.forName(statePairObject.get("className").getTextValue().trim());
} catch (ClassNotFoundException cnfe) {
throw new RuntimeException("Invalid classname!", cnfe);
}
String stateJsonString = statePairObject.get("state").toString();
State state = (State) mapper.readValue(stateJsonString, stateClass);
return new StatePair(state);
}
示例3: deserialize
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
@Override
public JsonUpdateWebServer deserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException {
final ObjectCodec obj = jp.getCodec();
final JsonNode node = obj.readTree(jp).get(0);
final Set<String> groupIds = deserializeGroupIdentifiers(node);
return new JsonUpdateWebServer(node.get("webserverId").getValueAsText(),
node.get("webserverName").getTextValue(),
node.get("hostName").getTextValue(),
node.get("portNumber").getValueAsText(),
node.get("httpsPort").getValueAsText(),
groupIds,
node.get("statusPath").getTextValue(),
node.get("apacheHttpdMediaId").getTextValue());
}
示例4: deserialize
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
@Override
public JsonCreateWebServer deserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException {
final ObjectCodec obj = jp.getCodec();
final JsonNode node = obj.readTree(jp).get(0);
final JsonNode apacheHttpdMediaId = node.get("apacheHttpdMediaId");
final JsonCreateWebServer jcws = new JsonCreateWebServer(node.get("webserverName").getTextValue(),
node.get("hostName").getTextValue(),
node.get("portNumber").asText(),
node.get("httpsPort").asText(),
deserializeGroupIdentifiers(node),
node.get("statusPath").getTextValue(),
apacheHttpdMediaId == null ? null : apacheHttpdMediaId.asText());
return jcws;
}
示例5: deserialize
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
@Override
public Website deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
ObjectCodec oc = jp.getCodec();
JsonNode nodes = oc.readTree(jp);
String websitePushID = nodes.get("websitePushID").getTextValue();
String websiteName = nodes.get("websiteName").getTextValue();
List<String> allowedDomains = new ArrayList<String>();
for (JsonNode node : nodes.get("allowedDomains")) {
allowedDomains.add(node.getTextValue());
}
String urlFormatString = nodes.get("urlFormatString").getTextValue();
String authenticationToken = nodes.get("authenticationToken").getTextValue();
String webServiceUrl = nodes.get("webServiceURL").getTextValue();
return new WebsiteBuilder()
.setWebsiteName(websiteName)
.setWebsitePushId(websitePushID)
.setAllowedDomains(allowedDomains)
.setUrlFormatString(urlFormatString)
.setAuthenticationToken(authenticationToken)
.setWebServiceUrl(webServiceUrl)
.build();
}
示例6: deserialize
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
@Override
public List<Rule> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
ObjectCodec oc = jp.getCodec();
JsonNode jsonNode = oc.readTree(jp);
Iterator<JsonNode> childrenNodesIter=jsonNode.getElements();
List<Rule> rules=new ArrayList<Rule>();
while(childrenNodesIter.hasNext()){
JsonNode childNode=childrenNodesIter.next();
rules.add(parseRule(jp,childNode));
}
return rules;
}
示例7: deserialize
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
@Override
public JsonControlJvm deserialize(final JsonParser jp,
final DeserializationContext ctxt) throws IOException {
final ObjectCodec obj = jp.getCodec();
final JsonNode rootNode = obj.readTree(jp);
final JsonNode operation = rootNode.get("controlOperation");
return new JsonControlJvm(operation.getTextValue());
}
示例8: deserialize
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
@Override
public JsonUpdateGroup deserialize(final JsonParser jp,
final DeserializationContext ctxt) throws IOException {
final ObjectCodec obj = jp.getCodec();
final JsonNode node = obj.readTree(jp);
return new JsonUpdateGroup(node.get("id").getTextValue(),
node.get("name").getTextValue());
}
示例9: deserialize
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
@Override
public JsonJvms deserialize(final JsonParser jp,
final DeserializationContext ctxt) throws IOException {
final ObjectCodec obj = jp.getCodec();
final JsonNode rootNode = obj.readTree(jp);
final Set<String> rawJvmIds = deserializeJvmIdentifiers(rootNode);
return new JsonJvms(rawJvmIds);
}
示例10: deserialize
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
@Override
public JsonControlGroup deserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException {
final ObjectCodec obj = jp.getCodec();
final JsonNode rootNode = obj.readTree(jp);
final JsonNode operation = rootNode.get("controlOperation");
return new JsonControlGroup(operation.getTextValue());
}
示例11: deserialize
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
@Override
public JsonControlWebServer deserialize(final JsonParser jp,
final DeserializationContext ctxt) throws IOException {
final ObjectCodec obj = jp.getCodec();
final JsonNode rootNode = obj.readTree(jp);
final JsonNode operation = rootNode.get("controlOperation");
return new JsonControlWebServer(operation.getTextValue());
}
示例12: deserialize
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
@Override
public Config deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException {
ObjectCodec oc = jsonParser.getCodec();
JsonNode node = oc.readTree(jsonParser);
return new MapConfig(OBJECT_MAPPER.<Map<String, String>>readValue(node, new TypeReference<Map<String, String>>() {
}));
}
示例13: deserialize
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
@Override
public EventNotification deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException {
EventNotification notification = new EventNotification();
ObjectMapper mapper = (ObjectMapper) jp.getCodec();
ObjectNode root = (ObjectNode) mapper.readTree(jp);
String actionString = root.get("action").getTextValue();
notification.setAction(Action.valueOf(actionString));
JsonNode data = root.get("data");
switch (notification.getAction()) {
case JOB_SUBMITTED:
notification.setData(mapper.readValue(data, JobStateData.class));
break;
case JOB_STATE_UPDATED:
notification.setData(mapper.readValue(data, JobInfoData.class));
break;
case JOB_FULL_DATA_UPDATED:
notification.setData(mapper.readValue(data, JobStateData.class));
break;
case TASK_STATE_UPDATED:
notification.setData(mapper.readValue(data, TaskInfoData.class));
break;
case USERS_UPDATED:
notification.setData(mapper.readValue(data, SchedulerUserData.class));
break;
default:
break;
}
notification.setSchedulerEvent(root.get("schedulerEvent").asText());
return notification;
}
示例14: deserialize
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
@Override
public TaskConfig deserialize(JsonParser parser,
DeserializationContext context) throws IOException {
JsonNode jsonNode = parser.readValueAsTree();
TaskConfig config = new TaskConfig();
ObjectMapper mapper;
ObjectCodec codec = parser.getCodec();
if (codec instanceof ObjectMapper) {
mapper = (ObjectMapper) codec;
} else {
mapper = new ObjectMapper();
}
if (jsonNode.has("steps")) {
Iterator<JsonNode> steps = jsonNode.get("steps").getElements();
while (steps.hasNext()) {
JsonNode next = steps.next();
if (isDtoType(next)) {
config.add(mapper.readValue(next, TaskConfigStepDto.class));
} else {
config.add(mapper.readValue(next, TaskConfigStep.class));
}
}
}
return config;
}
示例15: deserialize
import org.codehaus.jackson.JsonParser; //导入方法依赖的package包/类
@Override
public SubCommands deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException
{
ObjectMapper mapper = (ObjectMapper) jp.getCodec();
JsonNode node = jp.getCodec().readTree(jp);
SubCommands compositeCommand = new SubCommands();
// we got the json node for the command tag
// it can either be a set of name value pairs
// i.e. Map<String, String> as it is today
// or it can have an array with tag sub_commands
// which will have Command objects for all the sub commands
Iterator<Map.Entry<String, JsonNode>> elementsIterator =
node.getFields();
while (elementsIterator.hasNext())
{
Map.Entry<String, JsonNode> element = elementsIterator.next();
String name = element.getKey();
JsonNode val = element.getValue();
if (name.equalsIgnoreCase("sub_commands")) {
Command[] subCommands = mapper.readValue(val, Command[].class);
if (subCommands != null) {
compositeCommand.setsub_commands(subCommands);
}
}
else {
// put it in hash map as earlier
compositeCommand.put(name, val.getTextValue());
}
}
return compositeCommand;
}