Package org.codehaus.jackson

Examples of org.codehaus.jackson.JsonToken


        try
        {
            JsonParser jp = this.jsonFactory.createJsonParser( inputStream );
            DirectMemoryResponse rs = new DirectMemoryResponse();

            JsonToken jsonToken = jp.nextToken();

            while ( jsonToken != JsonToken.END_OBJECT && jsonToken != null)
            {
                String fieldName = jp.getCurrentName();
                if ( DirectMemoryConstants.FOUND_FIELD_NAME.equals( fieldName ) )
View Full Code Here


        discoveredI18nMap.put(locale, keys);
      }
      is = TranslationServiceGenerator.class.getClassLoader().getResourceAsStream(bundlePath);
      JsonFactory jsonFactory = new JsonFactory();
      JsonParser jp = jsonFactory.createJsonParser(is);
      JsonToken token = jp.nextToken();
      while (token != null) {
        token = jp.nextToken();
        if (token == JsonToken.FIELD_NAME) {
          String name = jp.getCurrentName();
          keys.add(name);
View Full Code Here

                b.setHeight(y2 - y1);
                this._bounds.put(resourceId, b);
            } else if ("dockers".equals(fieldname)) {
                // "dockers":[{"x":50,"y":40},{"x":353.5,"y":115},{"x":353.5,"y":152},{"x":50,"y":40}],
              List<Point> dockers = new ArrayList<Point>();
              JsonToken nextToken = parser.nextToken();
              boolean end = JsonToken.END_ARRAY.equals(nextToken);
              while (!end) {
                nextToken = parser.nextToken();
                nextToken = parser.nextToken();
                Integer x = parser.getIntValue();
View Full Code Here

            {
                try
                {
                    JsonFactory f = new JsonFactory();
                    JsonParser p = f.createJsonParser(assumptionFile);
                    JsonToken token = p.nextToken();
                    while (token != JsonToken.END_OBJECT)
                    {
                        if (token == JsonToken.FIELD_NAME)
                        {
                            String keyspace = p.getText();
View Full Code Here

        try {
            p = jsonFactory.createJsonParser(new ByteArrayInputStream((t.getBytes())));
            if (p.nextToken() != JsonToken.START_OBJECT) {
                throw new IOException("Start token not found where expected");
            }
            JsonToken token;
            while (((token = p.nextToken()) != JsonToken.END_OBJECT) && (token != null)) {
                // iterate through each token, and create appropriate object here.
                populateRecord(r, token, p, schema);
            }
        } catch (JsonParseException e) {
View Full Code Here

     */
    private Object extractCurrentField(JsonParser p, Type t,
                                       HCatFieldSchema hcatFieldSchema, boolean isTokenCurrent) throws IOException, JsonParseException,
        HCatException {
        Object val = null;
        JsonToken valueToken;
        if (isTokenCurrent) {
            valueToken = p.getCurrentToken();
        } else {
            valueToken = p.nextToken();
        }
View Full Code Here

        while ((jp.nextToken()) != JsonToken.END_OBJECT) {
            // Must point to field name
            String fieldName = jp.getCurrentName();
            Object key = (keyDes == null) ? fieldName : keyDes.deserializeKey(fieldName, ctxt);
            // And then the value...
            JsonToken t = jp.nextToken();
            // Note: must handle null explicitly here; value deserializers won't
            Object value = (t == JsonToken.VALUE_NULL) ? null : valueDes.deserialize(jp, ctxt);
            /* !!! 23-Dec-2008, tatu: should there be an option to verify
             *   that there are no duplicate field names? (and/or what
             *   to do, keep-first or keep-last)
View Full Code Here

    public boolean shouldBeCached() { return true; }
   
    public Enum<?> deserialize(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException
    {
        JsonToken curr = jp.getCurrentToken();
       
        // Usually should just get string value:
        if (curr == JsonToken.VALUE_STRING) {
            String name = jp.getText();
            Enum<?> result = _resolver.findEnum(name);
View Full Code Here

    */

    protected int _parseInt(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException
    {
        JsonToken t = jp.getCurrentToken();
       
        if (t == JsonToken.VALUE_NUMBER_INT) {
            return jp.getIntValue();
        }
        if (t == JsonToken.VALUE_NUMBER_FLOAT) { // coercing should work too
View Full Code Here

    protected double _parseDouble(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException
    {
            // We accept couple of different types; obvious ones first:
            JsonToken t = jp.getCurrentToken();

            if (t == JsonToken.VALUE_NUMBER_FLOAT) {
                return jp.getDoubleValue();
            }
            if (t == JsonToken.VALUE_NUMBER_INT) {
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.JsonToken

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.