Package org.codehaus.jackson

Examples of org.codehaus.jackson.ObjectCodec


  }

  public static class ConfigDeserializer extends JsonDeserializer<Config> {
    @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>>() {
      }));
    }
View Full Code Here


  }

  public static class PartitionDeserializer extends JsonDeserializer<Partition> {
    @Override
    public Partition deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException {
      ObjectCodec oc = jsonParser.getCodec();
      JsonNode node = oc.readTree(jsonParser);
      return new Partition(node.getIntValue());
    }
View Full Code Here

  }

  public static class TaskNameDeserializer extends JsonDeserializer<TaskName> {
    @Override
    public TaskName deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException {
      ObjectCodec oc = jsonParser.getCodec();
      JsonNode node = oc.readTree(jsonParser);
      return new TaskName(node.getTextValue());
    }
View Full Code Here

  }

  public static class SystemStreamPartitionDeserializer extends JsonDeserializer<SystemStreamPartition> {
    @Override
    public SystemStreamPartition deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException {
      ObjectCodec oc = jsonParser.getCodec();
      JsonNode node = oc.readTree(jsonParser);
      String system = node.get("system").getTextValue();
      String stream = node.get("stream").getTextValue();
      Partition partition = new Partition(node.get("partition").getIntValue());
      return new SystemStreamPartition(system, stream, partition);
    }
View Full Code Here

public class StudentDeserializer extends JsonDeserializer<Student>
{
    @Override
    public Student deserialize(JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException
    {
        ObjectCodec codec = parser.getCodec();
        JsonNode node = codec.readTree(parser).get("data");

        // TODO I'm creating a new object mapper here because my original mapper has an instance of the deserializer
        // associated with it. Therefore, if I try to read the value using codec, I'll get an infinite loop (it'll come
        // back here).
        ObjectMapper mapper = new ObjectMapper();
View Full Code Here

public class TeacherDeserializer extends JsonDeserializer<Teacher>
{
    @Override
    public Teacher deserialize(JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException
    {
        ObjectCodec codec = parser.getCodec();
        JsonNode node = codec.readTree(parser).get("data");

        // TODO I'm creating a new object mapper here because my original mapper has an instance of the deserializer
        // associated with it. Therefore, if I try to read the value using codec, I'll get an infinite loop (it'll come
        // back here).
        ObjectMapper mapper = new ObjectMapper();
View Full Code Here

public class SchoolDeserializer extends JsonDeserializer<School>
{
    @Override
    public School deserialize(JsonParser parser, DeserializationContext context) throws IOException
    {
        ObjectCodec codec = parser.getCodec();
        JsonNode node = codec.readTree(parser).get("data");

        // TODO I'm creating a new object mapper here because my original mapper has an instance of the deserializer
        // associated with it. Therefore, if I try to read the value using codec, I'll get an infinite loop (it'll come
        // back here).
        ObjectMapper mapper = new ObjectMapper();
View Full Code Here

public class DistrictDeserializer extends JsonDeserializer<District>
{
    @Override
    public District deserialize(JsonParser parser, DeserializationContext context) throws IOException
    {
        ObjectCodec codec = parser.getCodec();
        JsonNode node = codec.readTree(parser).get("data");

        // TODO I'm creating a new object mapper here because my original mapper has an instance of the deserializer
        // associated with it. Therefore, if I try to read the value using codec, I'll get an infinite loop (it'll come
        // back here).
        ObjectMapper mapper = new ObjectMapper();
View Full Code Here

    register("tel", new TELTypeDeserializer());
  }

  @Override
  public Contact deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
    ObjectCodec oc = jp.getCodec();
    JsonNode node = oc.readTree(jp);

    List<Contact.Property> properties = new ArrayList<Contact.Property>();
    Iterator<JsonNode> propertyNodes = node.getElements();
    while (propertyNodes.hasNext()) {
      JsonNode propertyNode = propertyNodes.next();
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.ObjectCodec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.