Package org.codehaus.jackson

Examples of org.codehaus.jackson.JsonNode


    super(node, field);
  }

  @Override
  String parse() throws ParseException {
    final JsonNode value = node.path(this.getProperty());

    if (!value.isTextual()) {
      throw new ParseException("Invalid property '" + this.getProperty() + "': value is not textual");
    }

    return value.asText();
  }
View Full Code Here


  @Override
  TwigQueryNode parse() throws ParseException {
    final TwigQueryNode twigNode = new TwigQueryNode();
    twigNode.setField(field);

    final JsonNode objectNode = node.path(this.getProperty());

    final RootPropertyParser rootParser = new RootPropertyParser(objectNode, field);
    rootParser.setOptional(true);
    if (rootParser.isPropertyDefined()) {
      twigNode.setRoot(rootParser.parse());
View Full Code Here

        this.id = UUID.fromString(obj.get("id").asText());
        this.question = obj.path("question").asText();
        this.type = EnqueteAnswerType.safeValueOf(obj.get("type").asText());
        this.options = new ArrayList<String>();

        JsonNode array = obj.get("options");
        for (int i = 0; i < array.size(); ++i)
            options.add(array.get(i).asText());
    }
View Full Code Here

            this.endDate = new DateTime(json.get("endDate").asLong());
        this.url = json.path("url").asText();
        this.place = json.path("place").asText();
        this.address = json.path("address").asText();
        this.description = json.get("description").asText();
        JsonNode hashTagProp = json.path("hashTag");
        this.hashTag = hashTagProp.isNull() ? null : hashTagProp.asText();
        this.ownerId = json.get("ownerId").asText();
        this.foreImageId = Strings.emptyToNull(json.path("foreImageId").asText());
        this.backImageId = Strings.emptyToNull(json.path("backImageId").asText());
        JsonNode passcodeProp = json.path("passcode");
        this.passcode = passcodeProp.isNull() ? null : passcodeProp.asText();
        this.draft = json.path("draft").asBoolean(false);
        {
            JsonNode ar = json.get("editorIds");
            if (ar != null) {
                this.editorIds = new ArrayList<String>();
                for (int i = 0; i < ar.size(); ++i)
                    editorIds.add(ar.get(i).asText());
            }
        }
        {
            JsonNode ar = json.get("relatedEventIds");
            if (ar != null) {
                this.relatedEventIds = new ArrayList<String>();
                for (int i = 0; i < ar.size(); ++i)
                    relatedEventIds.add(ar.get(i).asText());
            }
        }
        {
            JsonNode ar = json.get("enquetes");
            if (ar != null) {
                this.enquetes = new ArrayList<EnqueteQuestion>();
                for (int i = 0; i < ar.size(); ++i)
                    enquetes.add(new EnqueteQuestion(ar.get(i)));
            }
        }

        if (json.has("createdAt"))
            this.createdAt = new DateTime(json.get("createdAt").asLong());
View Full Code Here

    public UserSentMessage(ObjectNode obj) {
        this.id = UUID.fromString(obj.get("id").asText());
        this.senderId = obj.get("senderId").asText();
        this.receiverIds = new ArrayList<String>();
        JsonNode array = obj.get("receiverIds");
        if (array != null) {
            for (int i = 0; i < array.size(); ++i)
                this.receiverIds.add(array.get(i).asText());
        }
        this.eventId = Strings.emptyToNull(obj.path("eventId").asText());
        this.messageId = obj.get("messageId").asText();

        this.createdAt = new DateTime(obj.get("createdAt").asLong());
View Full Code Here

    throws IOException {
    switch (s.getType()) {
    case RECORD:
      for (Field f : s.getFields()) {
        String name = f.name();
        JsonNode v = n.get(name);
        if (v == null) {
          v = f.defaultValue();
        }
        if (v == null) {
          throw new AvroTypeException("No default value for: " + name);
View Full Code Here

            return;

        ObjectMapper m = new ObjectMapper();
        try
        {
            JsonNode rootNode = m.readValue(manifestFile, JsonNode.class);
            JsonNode generations = rootNode.get("generations");
            assert generations.isArray();
            for (JsonNode generation : generations)
            {
                int level = generation.get("generation").getIntValue();
                JsonNode generationValues = generation.get("members");
                for (JsonNode generationValue : generationValues)
                {
                    for (SSTableReader ssTableReader : cfs.getSSTables())
                    {
                        if (ssTableReader.descriptor.generation == generationValue.getIntValue())
View Full Code Here

    // ///////////////////////////////////////////////////////////////////////

    public JsonRepresentation getRepresentation(final String pathTemplate, final Object... args) {
        final String pathStr = String.format(pathTemplate, args);

        final JsonNode node = getNode(pathStr);

        if (representsNull(node)) {
            return null;
        }
View Full Code Here

   
    /**
     * Use {@link #isIntegralNumber(String)} to test if number (it is not possible to check if a byte, however).
     */
    public Byte getByte(final String path) {
        final JsonNode node = getNode(path);
        return getByte(path, node);
    }
View Full Code Here

    /**
     * Use {@link #isIntegralNumber(String)} to check if number (it is not possible to check if a short, however).
     */
    public Short getShort(final String path) {
        final JsonNode node = getNode(path);
        return getShort(path, node);
    }
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.JsonNode

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.