Package com.gwtent.reflection.client

Examples of com.gwtent.reflection.client.ClassType


   */
  public static ClassType getLastClassTypeByPath(Class<?> clazz, String fullPath){
    ReflectionUtils.checkReflection(clazz);
   
    String[] paths = fullPath.split("\\.");
    ClassType parent = TypeOracle.Instance.getClassType(clazz);
    for (int i = 0; i < paths.length - 1; i ++){
      parent = getClassTypeBySubPath(parent, paths[i], fullPath);
    }
   
    return parent;
View Full Code Here


    return parent;
  }
 
  private static Object getInstanceBySubPath(Object instance, String path, String fullPath){
    Object object = null;
    ClassType parent = TypeOracle.Instance.getClassType(instance.getClass());
    if (! isMethod(path)){
      Field field = parent.findField(path);
      if (field == null)
        pathNotFound(path, fullPath);
     
      object = field.getFieldValue(instance);
    }else{
      Method method = parent.findMethod(path, new String[0]);
      if (method == null)
        pathNotFound(path, fullPath);
     
      object = method.invoke(instance, null);
    }
View Full Code Here

   * (non-Javadoc)
   *
   * @see com.gwtent.client.reflection.Type#isClassOrInterface()
   */
  public ClassType isClassOrInterface() {
    ClassType type = isClass();
    if (type != null) {
      return type;
    }
    return isInterface();
  }
View Full Code Here

public abstract class AbstractDataContractSerializer implements DataContractSerializer, DataContractReflectionSerializer{

  public <T extends Object> T deserializeObject(String json, Class<T> clazz) {
    ReflectionUtils.checkReflection(clazz);
    ClassType type = TypeOracle.Instance.getClassType(clazz);
    return (T) deserializeObject(json, type);
  }
View Full Code Here

  protected abstract Object deserializeObject(String json, ClassType type);
  public abstract String serializeObject(Object object, ClassType type);

  public String serializeObject(Object object) {
    ReflectionUtils.checkReflection(object.getClass());
    ClassType type = TypeOracle.Instance.getClassType(object.getClass());
    return serializeObject(object, type);
  }
View Full Code Here

      object.add(objectItem);
    }
  }
 
  private void deserializePureObject(JSONObject value, Object obj){
    ClassType type = TypeOracle.Instance.getClassType(obj.getClass());
    for (Field field : type.getFields()){
     
      if (value.containsKey(field.getName())){
        JSONValue fieldValue = value.get(field.getName());
         
        if (fieldValue instanceof JSONObject){
View Full Code Here

    // return nestedName;
    return ReflectionUtils.getQualifiedSourceName(declaringClass);
  }

  public ClassType getNestedType(String typeName) throws NotFoundException {
    ClassType result = findNestedType(typeName);
    if (result == null) {
      throw new NotFoundException();
    }
    return result;
  }
View Full Code Here

  /**
   * The
   * @param annotation @DataContract and @DataMember
   */
  public ObjectReflectionFactory(DataMember annotation){
    ClassType type = null;
    if (annotation.typeName() != null && annotation.typeName().length() > 0){
      type = TypeOracle.Instance.getClassType(annotation.typeName());
    }else if (!annotation.type().equals(Object.class)){
      type = TypeOracle.Instance.getClassType(annotation.type());
    }
View Full Code Here

    else
      throw new RuntimeException("Can not found ClassType from annotation(DataContract or DataMember request \"clazz\" value when annotation a Collection(ie List)");
  }
 
  public ObjectReflectionFactory(DataContract annotation){
    ClassType type = null;
    if (!annotation.type().equals(Object.class)){
      type = TypeOracle.Instance.getClassType(annotation.type());
    }
   
    if (type != null)
View Full Code Here

    /* (non-Javadoc)
   * @see com.gwtent.client.reflection.Package#getType(java.lang.String)
   */
  public ClassType getType(String typeName) {
      ClassType result = findType(typeName);
      if (result == null) {
        throw new NotFoundException();
      }
      return result;
    }
View Full Code Here

TOP

Related Classes of com.gwtent.reflection.client.ClassType

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.