name.pehl.piriti.rebind.type
Class TypeUtils

java.lang.Object
  extended by name.pehl.piriti.rebind.type.TypeUtils

public final class TypeUtils
extends Object

Utility methods for JTypes.

Version:
$Date: 2010-01-14 17:11:02 +0100 (Do, 14. Jan 2010) $ $Revision: 54 $
Author:
$Author: harald.pehl $

Field Summary
protected static Map<String,String> interfaceToImplementation
           
 
Method Summary
static boolean canContainId(com.google.gwt.core.ext.typeinfo.JType type)
           
static void collectConcreteTypes(List<com.google.gwt.core.ext.typeinfo.JClassType> concreteTypes, com.google.gwt.core.ext.typeinfo.JType type)
          Finds all concrete subtypes starting from type.
static String collectionImplementationFor(String classname)
           
static com.google.gwt.core.ext.typeinfo.JField findField(com.google.gwt.core.ext.typeinfo.JClassType type, String property, Modifier... modifiers)
          Tries to find the given field with the given modifier in the given type or in the supertypes of the given type.
static com.google.gwt.core.ext.typeinfo.JMethod findGetter(com.google.gwt.core.ext.typeinfo.JClassType type, String property, com.google.gwt.core.ext.typeinfo.JType returnType, Modifier... modifiers)
           
static com.google.gwt.core.ext.typeinfo.JMethod findSetter(com.google.gwt.core.ext.typeinfo.JClassType type, String property, com.google.gwt.core.ext.typeinfo.JType parameter, Modifier... modifiers)
           
static com.google.gwt.core.ext.typeinfo.JClassType getTypeVariable(com.google.gwt.core.ext.typeinfo.JType type)
          Returns the first type variable of the specified parameterized type or null if type is null or does not have any type variables.
static boolean isBoolean(com.google.gwt.core.ext.typeinfo.JType type)
          Returns true if the type is boolean or Boolean, false otherwise.
static boolean isByte(com.google.gwt.core.ext.typeinfo.JType type)
          Returns true if the type is byte or Byte, false otherwise.
static boolean isCharacter(com.google.gwt.core.ext.typeinfo.JType type)
          Returns true if the type is char or Caharacter, false otherwise.
static boolean isCollection(com.google.gwt.core.ext.typeinfo.JType type)
          Return true if the collection is Collection List ArrayList LinkedList Set HashSet LinkedHashSet SortedSet TreeSet false otherwise,
static boolean isDate(com.google.gwt.core.ext.typeinfo.JType type)
          Returns true if the type is Date, false otherwise.
static boolean isDefaultInstantiable(com.google.gwt.core.ext.typeinfo.JType type)
           
static boolean isDouble(com.google.gwt.core.ext.typeinfo.JType type)
          Returns true if the type is double or Double, false otherwise.
static boolean isFloat(com.google.gwt.core.ext.typeinfo.JType type)
          Returns true if the type is float or Float, false otherwise.
static boolean isGwtType(com.google.gwt.core.ext.typeinfo.JType type)
           
static boolean isInteger(com.google.gwt.core.ext.typeinfo.JType type)
          Returns true if the type is int or Integer, false otherwise.
static boolean isJavaType(com.google.gwt.core.ext.typeinfo.JType type)
           
static boolean isLong(com.google.gwt.core.ext.typeinfo.JType type)
          Returns true if the type is long or Long, false otherwise.
static boolean isMap(com.google.gwt.core.ext.typeinfo.JType type)
          Return true if the map is Map HashMap SortedMap TreeMap false otherwise.
static boolean isNumeric(com.google.gwt.core.ext.typeinfo.JType type)
          Returns true if the type is byte or Byte short or Short int or Integer long or Long float or Float double or Double false otherwise.
static boolean isShort(com.google.gwt.core.ext.typeinfo.JType type)
          Returns true if the type is short or Short, false otherwise.
static boolean isString(com.google.gwt.core.ext.typeinfo.JType type)
          Returns true if the type is String, false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

interfaceToImplementation

protected static Map<String,String> interfaceToImplementation
Method Detail

isBoolean

public static boolean isBoolean(com.google.gwt.core.ext.typeinfo.JType type)
Returns true if the type is boolean or Boolean, false otherwise.

Parameters:
type -
Returns:
true if the type is boolean or Boolean, false otherwise.

isByte

public static boolean isByte(com.google.gwt.core.ext.typeinfo.JType type)
Returns true if the type is byte or Byte, false otherwise.

Parameters:
type -
Returns:
true if the type is byte or Byte, false otherwise.

isCharacter

public static boolean isCharacter(com.google.gwt.core.ext.typeinfo.JType type)
Returns true if the type is char or Caharacter, false otherwise.

Parameters:
type -
Returns:
true if the type is char or Character, false otherwise.

isDate

public static boolean isDate(com.google.gwt.core.ext.typeinfo.JType type)
Returns true if the type is Date, false otherwise.

Parameters:
type -
Returns:
true if the type is Date, false otherwise.

isDouble

public static boolean isDouble(com.google.gwt.core.ext.typeinfo.JType type)
Returns true if the type is double or Double, false otherwise.

Parameters:
type -
Returns:
true if the type is double or Double, false otherwise.

isFloat

public static boolean isFloat(com.google.gwt.core.ext.typeinfo.JType type)
Returns true if the type is float or Float, false otherwise.

Parameters:
type -
Returns:
true if the type is float or Float, false otherwise.

isInteger

public static boolean isInteger(com.google.gwt.core.ext.typeinfo.JType type)
Returns true if the type is int or Integer, false otherwise.

Parameters:
type -
Returns:
true if the type is int or Integer, false otherwise.

isLong

public static boolean isLong(com.google.gwt.core.ext.typeinfo.JType type)
Returns true if the type is long or Long, false otherwise.

Parameters:
type -
Returns:
true if the type is long or Long, false otherwise.

isShort

public static boolean isShort(com.google.gwt.core.ext.typeinfo.JType type)
Returns true if the type is short or Short, false otherwise.

Parameters:
type -
Returns:
true if the type is short or Short, false otherwise.

isString

public static boolean isString(com.google.gwt.core.ext.typeinfo.JType type)
Returns true if the type is String, false otherwise.

Parameters:
type -
Returns:
true if the type is String, false otherwise.

isNumeric

public static boolean isNumeric(com.google.gwt.core.ext.typeinfo.JType type)
Returns true if the type is false otherwise.

Parameters:
type -
Returns:

isCollection

public static boolean isCollection(com.google.gwt.core.ext.typeinfo.JType type)
Return true if the collection is false otherwise,

Parameters:
type -
Returns:

isMap

public static boolean isMap(com.google.gwt.core.ext.typeinfo.JType type)
Return true if the map is false otherwise.

Parameters:
type -
Returns:

isJavaType

public static boolean isJavaType(com.google.gwt.core.ext.typeinfo.JType type)

isGwtType

public static boolean isGwtType(com.google.gwt.core.ext.typeinfo.JType type)

canContainId

public static boolean canContainId(com.google.gwt.core.ext.typeinfo.JType type)

collectionImplementationFor

public static String collectionImplementationFor(String classname)

getTypeVariable

public static com.google.gwt.core.ext.typeinfo.JClassType getTypeVariable(com.google.gwt.core.ext.typeinfo.JType type)
Returns the first type variable of the specified parameterized type or null if type is null or does not have any type variables.

Parameters:
type -
Returns:

collectConcreteTypes

public static void collectConcreteTypes(List<com.google.gwt.core.ext.typeinfo.JClassType> concreteTypes,
                                        com.google.gwt.core.ext.typeinfo.JType type)
Finds all concrete subtypes starting from type. If type itself is concrete the list will only contains type.

Parameters:
types -
type -

isDefaultInstantiable

public static boolean isDefaultInstantiable(com.google.gwt.core.ext.typeinfo.JType type)

findField

public static com.google.gwt.core.ext.typeinfo.JField findField(com.google.gwt.core.ext.typeinfo.JClassType type,
                                                                String property,
                                                                Modifier... modifiers)
Tries to find the given field with the given modifier in the given type or in the supertypes of the given type. If modifiers is null, the fields modifiers are not evaluated, otherwise the field must have at least one of the specified modifiers.

Parameters:
type -
property -
modifier -
Returns:
the specified field or null if no such field was found.

findGetter

public static com.google.gwt.core.ext.typeinfo.JMethod findGetter(com.google.gwt.core.ext.typeinfo.JClassType type,
                                                                  String property,
                                                                  com.google.gwt.core.ext.typeinfo.JType returnType,
                                                                  Modifier... modifiers)

findSetter

public static com.google.gwt.core.ext.typeinfo.JMethod findSetter(com.google.gwt.core.ext.typeinfo.JClassType type,
                                                                  String property,
                                                                  com.google.gwt.core.ext.typeinfo.JType parameter,
                                                                  Modifier... modifiers)


Copyright © 2012 Harald Pehl. All Rights Reserved.