Package com.gwtent.reflection.client

Examples of com.gwtent.reflection.client.Type


  public Type getType(String name) throws ReflectionRequiredException {
  // Remove all internal and external whitespace.
    //
    name = name.replaceAll("\\\\s", "");
    try {
      Type result = parseImpl(name);
      if (result == null)
        throw new ReflectionRequiredException();
      else
        return result;
    } catch (ReflectionRequiredException e) {
      Type result = doGetType(name);
      if (result == null)
        throw new ReflectionRequiredException(ReflectionUtils.createReflectionRequireMsg(name, ""));
      else
        return result;
    }
View Full Code Here


        return result;
    }
  }
 
  public static Type findType(String name) {
    Type type = typeMap.get(name);
    return type;
  }
View Full Code Here

    Type type = typeMap.get(name);
    return type;
  }
 
  public static Type findType(Class<?> clazz) {
    Type type = typeMap.get(clazz.getName().replace('$', '.'));
    return type;
  }
View Full Code Here

    Type type = typeMap.get(clazz.getName().replace('$', '.'));
    return type;
  }

  public ClassType getClassType(String name) throws ReflectionRequiredException {
    Type type = this.getType(name);

    if (type instanceof ClassType)
        return (ClassType)type;
      else
        throw new RuntimeException(name + " not a class type.");
View Full Code Here

 
 
  private Type parseImpl(String type) throws ReflectionRequiredException {
    if (type.endsWith("[]")) {
      String remainder = type.substring(0, type.length() - 2);
      Type componentType = this.getType(remainder);
      return getArrayType(componentType);
    }
   
    if (type.endsWith(">")) {
      int bracket = type.indexOf('<');
      if (bracket == -1) {
        throw new RuntimeException(
            "Mismatched brackets; expected '<' to match subsequent '>'");
      }

      // Resolve the raw type.
      //
      String rawTypeName = type.substring(0, bracket);
      Type rawType = getType(rawTypeName);
     
      //For parameterised type, we just erase it.
     
      if (rawType != null)
        return rawType;
    }

    Type result = findPrimitiveType(type);
    if (result != null) {
      return result;
    }

    result = findType(type);
View Full Code Here

  }
 
  private ClassType<T> getBaseType(){
    if (baseType == null){
      //Type type = TypeOracleImpl.findType(baseTypeName);
      Type type = TypeOracle.Instance.getType(baseTypeName);
      if (type == null)
        ReflectionUtils.checkReflection(baseTypeName);
     
      baseType = (ClassTypeImpl<T>)type.isClassOrInterface();
      if (baseType == null)
        throw new RuntimeException("Super class of a parameterized type must a class or interface. current type name:" + baseTypeName);
    }
   
    return baseType;
View Full Code Here

TOP

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

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.