org.constretto.internal
Class GenericCollectionTypeResolver

java.lang.Object
  extended by org.constretto.internal.GenericCollectionTypeResolver

public abstract class GenericCollectionTypeResolver
extends java.lang.Object

Helper class for determining element types of collections and maps.

Mainly intended for usage within the framework, determining the target type of values to be added to a collection or map (to be able to attempt type conversion if appropriate).

Author:
Juergen Hoeller

Constructor Summary
GenericCollectionTypeResolver()
           
 
Method Summary
static java.lang.Class<?> getCollectionFieldType(java.lang.reflect.Field collectionField)
          Determine the generic element type of the given Collection field.
static java.lang.Class<?> getCollectionParameterType(MethodParameter methodParam)
          Determine the generic element type of the given Collection parameter.
static java.lang.Class<?> getMapKeyFieldType(java.lang.reflect.Field mapField)
          Determine the generic key type of the given Map field.
static java.lang.Class<?> getMapKeyParameterType(MethodParameter methodParam)
          Determine the generic key type of the given Map parameter.
static java.lang.Class<?> getMapValueFieldType(java.lang.reflect.Field mapField)
          Determine the generic value type of the given Map field.
static java.lang.Class<?> getMapValueParameterType(MethodParameter methodParam)
          Determine the generic value type of the given Map parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericCollectionTypeResolver

public GenericCollectionTypeResolver()
Method Detail

getCollectionFieldType

public static java.lang.Class<?> getCollectionFieldType(java.lang.reflect.Field collectionField)
Determine the generic element type of the given Collection field.

Parameters:
collectionField - the collection field to introspect
Returns:
the generic type, or null if none

getMapKeyFieldType

public static java.lang.Class<?> getMapKeyFieldType(java.lang.reflect.Field mapField)
Determine the generic key type of the given Map field.

Parameters:
mapField - the map field to introspect
Returns:
the generic type, or null if none

getMapValueFieldType

public static java.lang.Class<?> getMapValueFieldType(java.lang.reflect.Field mapField)
Determine the generic value type of the given Map field.

Parameters:
mapField - the map field to introspect
Returns:
the generic type, or null if none

getCollectionParameterType

public static java.lang.Class<?> getCollectionParameterType(MethodParameter methodParam)
Determine the generic element type of the given Collection parameter.

Parameters:
methodParam - the method parameter specification
Returns:
the generic type, or null if none

getMapKeyParameterType

public static java.lang.Class<?> getMapKeyParameterType(MethodParameter methodParam)
Determine the generic key type of the given Map parameter.

Parameters:
methodParam - the method parameter specification
Returns:
the generic type, or null if none

getMapValueParameterType

public static java.lang.Class<?> getMapValueParameterType(MethodParameter methodParam)
Determine the generic value type of the given Map parameter.

Parameters:
methodParam - the method parameter specification
Returns:
the generic type, or null if none


Copyright © 2008-2011. All Rights Reserved.