Spring Data Core

org.springframework.data.mapping.model
Class AnnotationBasedPersistentProperty<P extends PersistentProperty<P>>

java.lang.Object
  extended by org.springframework.data.mapping.model.AbstractPersistentProperty<P>
      extended by org.springframework.data.mapping.model.AnnotationBasedPersistentProperty<P>
All Implemented Interfaces:
PersistentProperty<P>

public abstract class AnnotationBasedPersistentProperty<P extends PersistentProperty<P>>
extends AbstractPersistentProperty<P>

Special PersistentProperty that takes annotations at a property into account.

Author:
Oliver Gierke

Field Summary
 
Fields inherited from class org.springframework.data.mapping.model.AbstractPersistentProperty
association, field, information, name, owner, propertyDescriptor, rawType
 
Constructor Summary
AnnotationBasedPersistentProperty(Field field, PropertyDescriptor propertyDescriptor, PersistentEntity<?,P> owner, SimpleTypeHolder simpleTypeHolder)
          Creates a new AnnotationBasedPersistentProperty.
 
Method Summary
<A extends Annotation>
A
findAnnotation(Class<? extends A> annotationType)
          Returns the annotation found for the current AnnotationBasedPersistentProperty.
 String getSpelExpression()
          Inspects a potentially available Value annotation at the property and returns the String value of it.
protected  boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
          Returns whether the property carries the an annotation of the given type.
 boolean isAssociation()
          Considers the property an Association if it is annotated with Reference.
 boolean isIdProperty()
          Returns whether the property is a potential identifier property of the owning PersistentEntity.
 boolean isTransient()
          Considers plain transient fields, fields annotated with Transient, Value or Autowired as transien.
 boolean isVersionProperty()
          Returns whether the current property is a potential version property of the owning PersistentEntity.
 String toString()
           
 
Methods inherited from class org.springframework.data.mapping.model.AbstractPersistentProperty
createAssociation, equals, getActualType, getAssociation, getComponentType, getField, getGetter, getMapValueType, getName, getOwner, getPersistentEntityType, getRawType, getSetter, getType, getTypeInformation, hashCode, isArray, isCollectionLike, isEntity, isMap, shallBePersisted
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnnotationBasedPersistentProperty

public AnnotationBasedPersistentProperty(Field field,
                                         PropertyDescriptor propertyDescriptor,
                                         PersistentEntity<?,P> owner,
                                         SimpleTypeHolder simpleTypeHolder)
Creates a new AnnotationBasedPersistentProperty.

Parameters:
field - must not be null.
propertyDescriptor - can be null.
owner - must not be null.
Method Detail

getSpelExpression

public String getSpelExpression()
Inspects a potentially available Value annotation at the property and returns the String value of it.

Specified by:
getSpelExpression in interface PersistentProperty<P extends PersistentProperty<P>>
Overrides:
getSpelExpression in class AbstractPersistentProperty<P extends PersistentProperty<P>>
See Also:
AbstractPersistentProperty.getSpelExpression()

isTransient

public boolean isTransient()
Considers plain transient fields, fields annotated with Transient, Value or Autowired as transien.

Specified by:
isTransient in interface PersistentProperty<P extends PersistentProperty<P>>
Overrides:
isTransient in class AbstractPersistentProperty<P extends PersistentProperty<P>>
Returns:
See Also:
BasicPersistentProperty

isIdProperty

public boolean isIdProperty()
Description copied from interface: PersistentProperty
Returns whether the property is a potential identifier property of the owning PersistentEntity. This method is mainly used by PersistentEntity implementation to discover id property candidates on PersistentEntity creation you should rather call PersistentEntity.isIdProperty(PersistentProperty) to determine whether the current property is the id property of that PersistentEntity under consideration.

Returns:

isVersionProperty

public boolean isVersionProperty()
Description copied from interface: PersistentProperty
Returns whether the current property is a potential version property of the owning PersistentEntity. This method is mainly used by PersistentEntity implementation to discover version property candidates on PersistentEntity creation you should rather call PersistentEntity.isVersionProperty(PersistentProperty) to determine whether the current property is the version property of that PersistentEntity under consideration.

Returns:

isAssociation

public boolean isAssociation()
Considers the property an Association if it is annotated with Reference.

Specified by:
isAssociation in interface PersistentProperty<P extends PersistentProperty<P>>
Overrides:
isAssociation in class AbstractPersistentProperty<P extends PersistentProperty<P>>
Returns:

findAnnotation

public <A extends Annotation> A findAnnotation(Class<? extends A> annotationType)
Returns the annotation found for the current AnnotationBasedPersistentProperty. Will prefer field annotations over ones found at getters or setters.

Parameters:
annotationType - must not be null.
Returns:

isAnnotationPresent

protected boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
Returns whether the property carries the an annotation of the given type.

Parameters:
annotationType - the annotation type to look up.
Returns:

toString

public String toString()
Overrides:
toString in class AbstractPersistentProperty<P extends PersistentProperty<P>>

Spring Data Core

Copyright © 2011-2013-2013 Pivotal. All Rights Reserved.