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


Java JsonParser.getCodec方法代碼示例

本文整理匯總了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);
	}
	
}
 
開發者ID:youseries,項目名稱:urule,代碼行數:23,代碼來源:AbstractJsonDeserializer.java

示例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);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:22,代碼來源:StateDeserializer.java

示例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());
}
 
開發者ID:cerner,項目名稱:jwala,代碼行數:18,代碼來源:JsonUpdateWebServer.java

示例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;
}
 
開發者ID:cerner,項目名稱:jwala,代碼行數:18,代碼來源:JsonCreateWebServer.java

示例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();
}
 
開發者ID:chriskearney,項目名稱:stickypunch,代碼行數:24,代碼來源:WebsiteDeserializer.java

示例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;
}
 
開發者ID:youseries,項目名稱:urule,代碼行數:13,代碼來源:RuleJsonDeserializer.java

示例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());
}
 
開發者ID:cerner,項目名稱:jwala,代碼行數:11,代碼來源:JsonControlJvm.java

示例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());
}
 
開發者ID:cerner,項目名稱:jwala,代碼行數:11,代碼來源:JsonUpdateGroup.java

示例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);
}
 
開發者ID:cerner,項目名稱:jwala,代碼行數:11,代碼來源:JsonJvms.java

示例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());
}
 
開發者ID:cerner,項目名稱:jwala,代碼行數:11,代碼來源:JsonControlGroup.java

示例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());
}
 
開發者ID:cerner,項目名稱:jwala,代碼行數:11,代碼來源:JsonControlWebServer.java

示例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>>() {
  }));
}
 
開發者ID:apache,項目名稱:samza,代碼行數:8,代碼來源:SamzaObjectMapper.java

示例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;

}
 
開發者ID:ow2-proactive,項目名稱:scheduling,代碼行數:33,代碼來源:EventCodecUtil.java

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

示例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;
}
 
開發者ID:qubole,項目名稱:qds-sdk-java,代碼行數:35,代碼來源:SubCommandsDeserializer.java


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