Spring Data Commons

org.springframework.data.util
Class ArrayTypeDiscoverer

java.lang.Object
  extended by org.springframework.data.util.ArrayTypeDiscoverer
All Implemented Interfaces:
TypeInformation

public class ArrayTypeDiscoverer
extends Object

Special TypeDiscoverer handling GenericArrayTypes.

Author:
Oliver Gierke

Constructor Summary
protected ArrayTypeDiscoverer(GenericArrayType type, org.springframework.data.util.TypeDiscoverer parent)
           
 
Method Summary
protected  TypeInformation createInfo(Type fieldType)
          Creates TypeInformation for the given Type.
 boolean equals(Object obj)
           
 TypeInformation getComponentType()
          Returns the component type for Collections or the key type for Maps.
 TypeInformation getMapValueType()
          Will return the type of the value in case the underlying type is a Map.
 TypeInformation getProperty(String fieldname)
          Returns the property information for the property with the given name.
 Class<?> getType()
          Returns the type of the property.
 int hashCode()
           
 boolean isCollectionLike()
          Returns whether the type can be considered a collection, which means it's a container of elements, e.g. a Collection and Array or anything implementing Iterable.
 boolean isMap()
          Returns whether the property is a Map.
protected  Class<?> resolveType(Type type)
          Resolves the given type into a plain Class.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayTypeDiscoverer

protected ArrayTypeDiscoverer(GenericArrayType type,
                              org.springframework.data.util.TypeDiscoverer parent)
Parameters:
type -
parent -
parent -
Method Detail

getType

public Class<?> getType()
Description copied from interface: TypeInformation
Returns the type of the property. Will resolve generics and the generic context of

Specified by:
getType in interface TypeInformation
Returns:

getComponentType

public TypeInformation getComponentType()
Description copied from interface: TypeInformation
Returns the component type for Collections or the key type for Maps.

Specified by:
getComponentType in interface TypeInformation
Returns:

createInfo

protected TypeInformation createInfo(Type fieldType)
Creates TypeInformation for the given Type.

Parameters:
fieldType -
Returns:

resolveType

protected Class<?> resolveType(Type type)
Resolves the given type into a plain Class.

Parameters:
type -
Returns:

getProperty

public TypeInformation getProperty(String fieldname)
Description copied from interface: TypeInformation
Returns the property information for the property with the given name. Supports proeprty traversal through dot notation.

Specified by:
getProperty in interface TypeInformation
Returns:

isMap

public boolean isMap()
Description copied from interface: TypeInformation
Returns whether the property is a Map. If this returns true you can expect TypeInformation.getComponentType() as well as TypeInformation.getMapValueType() to return something not null.

Specified by:
isMap in interface TypeInformation
Returns:

getMapValueType

public TypeInformation getMapValueType()
Description copied from interface: TypeInformation
Will return the type of the value in case the underlying type is a Map.

Specified by:
getMapValueType in interface TypeInformation
Returns:

isCollectionLike

public boolean isCollectionLike()
Description copied from interface: TypeInformation
Returns whether the type can be considered a collection, which means it's a container of elements, e.g. a Collection and Array or anything implementing Iterable. If this returns true you can expect TypeInformation.getComponentType() to return a non-null value.

Specified by:
isCollectionLike in interface TypeInformation
Returns:

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

Spring Data Commons

Copyright © 2011. All Rights Reserved.