Examples of DecodingContext


Examples of org.jboss.errai.common.client.types.DecodingContext

import static org.jboss.errai.common.client.types.TypeDemarshallers.hasDemarshaller;


public class JSONDecoderCli {
  public static Object decode(Object value) {
    DecodingContext ctx = new DecodingContext();
    Object v = null;

    if (value instanceof String) {
      v = _decode(JSONParser.parseStrict((String) value), ctx);
    }
    else if (value instanceof JSONValue) {
      v = _decode((JSONValue) value, ctx);
    }
    else if (value != null) {
      throw new RuntimeException("could not decode type: " + value.getClass());
    }

    if (ctx.isUnsatisfiedDependencies()) {
      JSONTypeHelper.resolveDependencies(ctx);
    }

    return v;
  }
View Full Code Here

Examples of org.jboss.errai.common.client.types.DecodingContext

   * @return - Value in the specified type.
   */
  @SuppressWarnings({"UnusedDeclaration"})
  public <T> T get(Class<T> type, String part) {
    Object value = parts.get(part);
    return value == null ? null : (T) TypeHandlerFactory.convert(value.getClass(), type, value, new DecodingContext());
  }
View Full Code Here

Examples of org.jboss.errai.common.client.types.DecodingContext

   */
  @SuppressWarnings({"UnusedDeclaration"})
  public <T> T get(Class<T> type, Enum<?> part) {
    //noinspection unchecked
    Object value = parts.get(part.toString());
    return value == null ? null : TypeHandlerFactory.convert(value.getClass(), type, value, new DecodingContext());
  }
View Full Code Here

Examples of org.jboss.errai.common.client.types.DecodingContext

   */
  @SuppressWarnings({"UnusedDeclaration"})
  public <T> T get(Class<T> type, String part) {
    //noinspection unchecked
    Object value = parts.get(part);
    return value == null ? null : TypeHandlerFactory.convert(value.getClass(), type, value, new DecodingContext());
  }
View Full Code Here

Examples of org.jboss.errai.common.client.types.DecodingContext

  }

  @SuppressWarnings({"unchecked"})
  public static Map<String, Object> decodeMap(Object value) {
    try {
      DecodingContext ctx = new DecodingContext();
      Map<String, Object> map = (Map<String, Object>) JSONDecoderCli.decode(value, ctx);

      if (ctx.isUnsatisfiedDependencies()) {
        JSONTypeHelper.resolveDependencies(ctx);
      }

      return map;
    }
View Full Code Here

Examples of org.jboss.errai.common.client.types.DecodingContext

import static org.jboss.errai.common.client.types.TypeDemarshallers.hasDemarshaller;


public class JSONDecoderCli {
  public static Object decode(Object value) {
    DecodingContext ctx = new DecodingContext();
    Object v = null;

    if (value instanceof String) {
      v = _decode(JSONParser.parseStrict((String) value), ctx);
    }
    else if (value instanceof JSONValue) {
      v = _decode((JSONValue) value, ctx);
    }
    else if (value != null) {
      throw new RuntimeException("could not decode type: " + value.getClass());
    }

    if (ctx.isUnsatisfiedDependencies()) {
      JSONTypeHelper.resolveDependencies(ctx);
    }

    return v;
  }
View Full Code Here

Examples of org.jboss.errai.common.client.types.DecodingContext

     * @return - Value in the specified type.
     */
    @SuppressWarnings({"UnusedDeclaration"})
    public <T> T get(Class<T> type, String part) {
        Object value = parts.get(part);
        return value == null ? null : (T) TypeHandlerFactory.convert(value.getClass(), type, value, new DecodingContext());
    }
View Full Code Here

Examples of org.jboss.errai.common.client.types.DecodingContext

     */
    @SuppressWarnings({"UnusedDeclaration"})
    public <T> T get(Class<T> type, Enum<?> part) {
        //noinspection unchecked
        Object value = parts.get(part.toString());
        return value == null ? null : TypeHandlerFactory.convert(value.getClass(), type, value, new DecodingContext());
    }
View Full Code Here

Examples of org.jboss.errai.common.client.types.DecodingContext

     */
    @SuppressWarnings({"UnusedDeclaration"})
    public <T> T get(Class<T> type, String part) {
        //noinspection unchecked
        Object value = parts.get(part);
        return value == null ? null : TypeHandlerFactory.convert(value.getClass(), type, value, new DecodingContext());
    }
View Full Code Here

Examples of org.jboss.errai.common.client.types.DecodingContext

        }
    }

    @SuppressWarnings({"unchecked"})
    public static Map<String, Object> decodeMap(Object value) {
        DecodingContext ctx = new DecodingContext();
        Map<String,Object> map = (Map<String, Object>) JSONDecoderCli.decode(value, ctx);

        if (ctx.isUnsatisfiedDependencies()) {
            JSONTypeHelper.resolveDependencies(ctx);
        }
    

        return map;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.