Spring Data Graph

org.springframework.data.document.mongodb
Class MongoPropertyDescriptors.MongoPropertyDescriptor

java.lang.Object
  extended by org.springframework.data.document.mongodb.MongoPropertyDescriptors.MongoPropertyDescriptor
Enclosing class:
MongoPropertyDescriptors

public static class MongoPropertyDescriptors.MongoPropertyDescriptor
extends Object

Simple value object to have a more suitable abstraction for MongoDB specific property handling.

Author:
Oliver Gierke

Field Summary
static Collection<Class<?>> SUPPORTED_ID_CLASSES
           
 
Constructor Summary
MongoPropertyDescriptors.MongoPropertyDescriptor(PropertyDescriptor descriptor)
          Creates a new MongoPropertyDescriptors.MongoPropertyDescriptor for the given PropertyDescriptor.
 
Method Summary
 boolean equals(Object obj)
           
 String getKeyToMap()
          Returns the key that shall be used for mapping.
 String getName()
          Returns the name of the property.
 Class<?> getPropertyType()
          Returns the plain property type.
 Type getTypeToSet()
          Returns the type type to be set.
 int hashCode()
           
 boolean isCollection()
          Returns whether the descriptor is for a collection.
 boolean isEnum()
          Returns whether the descriptor is for an Enum.
 boolean isMap()
          Returns whther we describe a Map.
 boolean isMappable()
          Returns whether the underlying property is actually mappable.
 boolean isOfIdType()
          Returns whether the property is of one of the supported id types.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUPPORTED_ID_CLASSES

public static Collection<Class<?>> SUPPORTED_ID_CLASSES
Constructor Detail

MongoPropertyDescriptors.MongoPropertyDescriptor

public MongoPropertyDescriptors.MongoPropertyDescriptor(PropertyDescriptor descriptor)
Creates a new MongoPropertyDescriptors.MongoPropertyDescriptor for the given PropertyDescriptor.

Parameters:
descriptor -
Method Detail

isOfIdType

public boolean isOfIdType()
Returns whether the property is of one of the supported id types. Currently we support String, ObjectId and BigInteger.

Returns:

getKeyToMap

public String getKeyToMap()
Returns the key that shall be used for mapping. Will return for the id property and the plain name for all other ones.

Returns:

getName

public String getName()
Returns the name of the property.

Returns:

isMappable

public boolean isMappable()
Returns whether the underlying property is actually mappable. By default this will exclude the class property and only include properties with a getter.

Returns:

getPropertyType

public Class<?> getPropertyType()
Returns the plain property type.

Returns:

getTypeToSet

public Type getTypeToSet()
Returns the type type to be set. Will return the setter method's type and fall back to the getter method's return type in case no setter is available. Useful for further (generics) inspection.

Returns:

isMap

public boolean isMap()
Returns whther we describe a Map.

Returns:

isCollection

public boolean isCollection()
Returns whether the descriptor is for a collection.

Returns:

isEnum

public boolean isEnum()
Returns whether the descriptor is for an Enum.

Returns:

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

Spring Data Graph

Copyright © 2011. All Rights Reserved.