Package com.google.web.bindery.autobean.shared

Examples of com.google.web.bindery.autobean.shared.Splittable


                c++;
            }
            sb.append("]");
        } else if (AutoBeanUtils.getAutoBean(object) != null) {
            Splittable split = AutoBeanCodex.encode(AutoBeanUtils.getAutoBean(object));
            sb.append("{ ");
            sb.append(encodeValue(split));
            sb.append(" }");
        } else if (object instanceof Splittable) {
            Splittable split = (Splittable)object;
            if (split.isString()) return encodeValue(split.asString());

            int c = 0;
            List<String> keys = split.getPropertyKeys();
            for (String key : keys) {
                sb.append(encodeValue(key));
                sb.append(" : ");
                sb.append(encodeValue(split.get(key)));
                if(c<keys.size()-1)
                    sb.append(", ");
                c++;
            }
        } else {
View Full Code Here


    this.rootType = rootBeanType;
  }

  @Override
  public M read(Object loadConfig, D data) {
    Splittable s = readSplittable(loadConfig, data);

    AutoBean<B> result = AutoBeanCodex.decode(factory, rootType, s);
    return createReturnData(loadConfig, result.as());
  }
View Full Code Here

                c++;
            }
            sb.append("]");
        } else if (AutoBeanUtils.getAutoBean(object) != null) {
            Splittable split = AutoBeanCodex.encode(AutoBeanUtils.getAutoBean(object));
            sb.append("{ ");
            sb.append(encodeValue(split));
            sb.append(" }");
        } else if (object instanceof Splittable) {
            Splittable split = (Splittable)object;
            if (split.isString()) return encodeValue(split.asString());

            int c = 0;
            List<String> keys = split.getPropertyKeys();
            for (String key : keys) {
                sb.append(encodeValue(key));
                sb.append(" : ");
                sb.append(encodeValue(split.get(key)));
                if(c<keys.size()-1)
                    sb.append(", ");
                c++;
            }
        } else {
View Full Code Here

    this.rootType = rootBeanType;
  }

  @Override
  public M read(Object loadConfig, D data) {
    Splittable s = readSplittable(loadConfig, data);

    AutoBean<B> result = AutoBeanCodex.decode(factory, rootType, s);
    return createReturnData(loadConfig, result.as());
  }
View Full Code Here

                c++;
            }
            sb.append("]");
        } else if (AutoBeanUtils.getAutoBean(object) != null) {
            Splittable split = AutoBeanCodex.encode(AutoBeanUtils.getAutoBean(object));
            sb.append("{ ");
            sb.append(encodeValue(split));
            sb.append(" }");
        } else if (object instanceof Splittable) {
            Splittable split = (Splittable)object;
            if (split.isString()) return encodeValue(split.asString());

            int c = 0;
            List<String> keys = split.getPropertyKeys();
            for (String key : keys) {
                sb.append(encodeValue(key));
                sb.append(" : ");
                sb.append(encodeValue(split.get(key)));
                if(c<keys.size()-1)
                    sb.append(", ");
                c++;
            }
        } else {
View Full Code Here

                c++;
            }
            sb.append("]");
        } else if (AutoBeanUtils.getAutoBean(object) != null) {
            Splittable split = AutoBeanCodex.encode(AutoBeanUtils.getAutoBean(object));
            sb.append("{ ");
            sb.append(encodeValue(split));
            sb.append(" }");
        } else if (object instanceof Splittable) {
            Splittable split = (Splittable)object;
            if (split.isString()) return encodeValue(split.asString());

            int c = 0;
            List<String> keys = split.getPropertyKeys();
            for (String key : keys) {
                sb.append(encodeValue(key));
                sb.append(" : ");
                sb.append(encodeValue(split.get(key)));
                if(c<keys.size()-1)
                    sb.append(", ");
                c++;
            }
        } else {
View Full Code Here

    data.setReified(String.valueOf(index), value);
    if (value == null) {
      Splittable.NULL.assign(data, index);
      return;
    }
    Splittable backing = coder.extractSplittable(state, value);
    if (backing == null) {
      /*
       * External data type, such as an ArrayList or a concrete implementation
       * of a setter's interface type. This means that a slow serialization pass
       * is necessary.
       */
      data.setReified(AbstractAutoBean.UNSPLITTABLE_VALUES_KEY, true);
    } else {
      backing.assign(data, index);
    }
  }
View Full Code Here

  /**
   * Load the OperationMessage containing the object state from the backing
   * store.
   */
  private OperationMessage getOperation(String key) {
    Splittable data = store.get(key);
    if (data == null) {
      throw new NoDataException();
    }

    OperationMessage op =
View Full Code Here

  /**
   * Collection support is limited to value types and resolving ids.
   */
  public static Object decode(EntitySource source, Class<?> type, Class<?> elementType,
      String jsonPayload) {
    Splittable split = StringQuoter.split(jsonPayload);
    return decode(source, type, elementType, split);
  }
View Full Code Here

        Object key = (keyType == String.class) ?
            propertyKey : ValueCodex.decode(keyType, StringQuoter.split(propertyKey));
        if (split.isNull(propertyKey)) {
          map.put(key, null);
        } else {
          Splittable valueSplit = split.get(propertyKey);
          Object value = null;
          if (ValueCodex.canDecode(valueType)) {
            value = ValueCodex.decode(valueType, valueSplit);
          } else {
            value = decode(source, valueType, null, valueSplit);
View Full Code Here

TOP

Related Classes of com.google.web.bindery.autobean.shared.Splittable

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.