Class AbstractPersistentProperty<P extends PersistentProperty<P>>
java.lang.Object
org.springframework.data.mapping.model.AbstractPersistentProperty<P>
- All Implemented Interfaces:
- PersistentProperty<P>
- Direct Known Subclasses:
- AnnotationBasedPersistentProperty
public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>>
extends Object
implements PersistentProperty<P>
Simple implementation of 
PersistentProperty.- Author:
- Jon Brisbin, Oliver Gierke, Christoph Strobl, Mark Paluch
- 
Constructor SummaryConstructorsConstructorDescriptionAbstractPersistentProperty(Property property, PersistentEntity<?, P> owner, SimpleTypeHolder simpleTypeHolder) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected abstract Association<P>booleanClass<?>Returns the actual type of the property.protected TypeInformation<?>Class<?>Return the type the property refers to in case it's an association, i.e.Return the type the property refers to in case it's an association, i.e.Class<?>Returns the component type of the type if it is aCollection.getField()Returns the getter method to access the property value if available.Class<?>Returns the type of the values if the property is aMap.getName()The name of the propertygetOwner()Returns thePersistentEntityowning the currentPersistentProperty.Iterable<? extends TypeInformation<?>>Returns the detectedTypeInformationsif the property references aPersistentEntity.protected PropertyClass<?>Returns the raw type as it's pulled from from the reflected property.Returns the setter method to set a property value.Class<?>getType()The type of the propertyReturns theTypeInformationof the property.Returns the withMethodto set a property value on a new object instance.inthashCode()booleanisArray()Returns whether the property is an array.booleanReturns whether the property is anAssociation.booleanReturns whether the property is aCollection,Iterableor an array.booleanisEntity()Returns whether the type of thePersistentPropertyis actually to be regarded asPersistentEntityin turn.booleanReturns whether the current property is immutable, i.e. if there is no setter or the backingFieldisfinal.booleanisMap()Returns whether the property is aMap.booleanReturns whether the current property is readable throughPersistentPropertyAccessor, i.e. if it is notPersistentProperty.isTransient(), if the value can be set on the current instance or read to create a new instance as perPersistentProperty.getWither()or via Kotlin Copy methods.booleanReturns whether the property is transient.booleanReturns whether the current property is writable, i.e. if the value held for it shall be written to the data store.toString()booleanReturns whether property access shall be used for reading the property value.Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.data.mapping.PersistentPropertyfindAnnotation, findPropertyOrOwnerAnnotation, getAccessorForOwner, getRequiredAnnotation, getRequiredAssociation, getRequiredField, getRequiredGetter, getRequiredSetter, getRequiredWither, hasActualTypeAnnotation, isAnnotationPresent, isIdProperty, isVersionProperty
- 
Constructor Details- 
AbstractPersistentPropertypublic AbstractPersistentProperty(Property property, PersistentEntity<?, P> owner, SimpleTypeHolder simpleTypeHolder) 
 
- 
- 
Method Details- 
createAssociation
- 
getOwnerDescription copied from interface:PersistentPropertyReturns thePersistentEntityowning the currentPersistentProperty.- Specified by:
- getOwnerin interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
- never null.
 
- 
getNameDescription copied from interface:PersistentPropertyThe name of the property- Specified by:
- getNamein interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
- The property name
 
- 
getTypeDescription copied from interface:PersistentPropertyThe type of the property- Specified by:
- getTypein interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
- The property type
 
- 
getRawTypeDescription copied from interface:PersistentPropertyReturns the raw type as it's pulled from from the reflected property.- Specified by:
- getRawTypein interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
- the raw type of the property.
 
- 
getTypeInformationDescription copied from interface:PersistentPropertyReturns theTypeInformationof the property.- Specified by:
- getTypeInformationin interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
 
- 
getPersistentEntityTypeInformationDescription copied from interface:PersistentPropertyReturns the detectedTypeInformationsif the property references aPersistentEntity. Will return an emptyIterablein case it refers to a simple type. Will return theCollection's component types or theMap's value type transparently.- Specified by:
- getPersistentEntityTypeInformationin interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
- never null.
 
- 
getGetterDescription copied from interface:PersistentPropertyReturns the getter method to access the property value if available. Might return null in case there is no getter method with a return type assignable to the actual property's type.- Specified by:
- getGetterin interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
- the getter method to access the property value if available, otherwise null.
 
- 
getSetterDescription copied from interface:PersistentPropertyReturns the setter method to set a property value. Might return null in case there is no setter available.- Specified by:
- getSetterin interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
- the setter method to set a property value if available, otherwise null.
 
- 
getWitherDescription copied from interface:PersistentPropertyReturns the withMethodto set a property value on a new object instance. Might return null in case there is no with available.With methodsare property-bound instancemethodsthat accept a single argument of the property type creating a new object instance.class Person { final String id; final String name; // … Person withName(String name) { return new Person(this.id, name); } }- Specified by:
- getWitherin interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
- the with Methodto set a property value on a new object instance if available, otherwise null.
 
- 
getField- Specified by:
- getFieldin interface- PersistentProperty<P extends PersistentProperty<P>>
 
- 
getSpelExpression- Specified by:
- getSpelExpressionin interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
- null if no expression defined.
 
- 
isTransientpublic boolean isTransient()Description copied from interface:PersistentPropertyReturns whether the property is transient.- Specified by:
- isTransientin interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
 
- 
isWritablepublic boolean isWritable()Description copied from interface:PersistentPropertyReturns whether the current property is writable, i.e. if the value held for it shall be written to the data store.- Specified by:
- isWritablein interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
 
- 
isReadablepublic boolean isReadable()Description copied from interface:PersistentPropertyReturns whether the current property is readable throughPersistentPropertyAccessor, i.e. if it is notPersistentProperty.isTransient(), if the value can be set on the current instance or read to create a new instance as perPersistentProperty.getWither()or via Kotlin Copy methods.- Specified by:
- isReadablein interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
 
- 
isImmutablepublic boolean isImmutable()Description copied from interface:PersistentPropertyReturns whether the current property is immutable, i.e. if there is no setter or the backingFieldisfinal.- Specified by:
- isImmutablein interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
- See Also:
 
- 
isAssociationpublic boolean isAssociation()Description copied from interface:PersistentPropertyReturns whether the property is anAssociation.- Specified by:
- isAssociationin interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
 
- 
getAssociation- Specified by:
- getAssociationin interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
- null if property is not part of an Association.
 
- 
getAssociationTargetTypeDescription copied from interface:PersistentPropertyReturn the type the property refers to in case it's an association, i.e.PersistentProperty.isAssociation()returns true. That means, that implementations must return a non-null value from this method in that case. We also recommend to return null for non-associations right away to establish symmetry between this method andPersistentProperty.isAssociation().- Specified by:
- getAssociationTargetTypein interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
- the type the property refers to in case it's an association, i.e. PersistentProperty.isAssociation()returns true.
 
- 
getAssociationTargetTypeInformationDescription copied from interface:PersistentPropertyReturn the type the property refers to in case it's an association, i.e.PersistentProperty.isAssociation()returns true. That means, that implementations must return a non-null value from this method in that case. We also recommend to return null for non-associations right away to establish symmetry between this method andPersistentProperty.isAssociation().- Specified by:
- getAssociationTargetTypeInformationin interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
- the type the property refers to in case it's an association, i.e. PersistentProperty.isAssociation()returns true.
 
- 
isCollectionLikepublic boolean isCollectionLike()Description copied from interface:PersistentPropertyReturns whether the property is aCollection,Iterableor an array.- Specified by:
- isCollectionLikein interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
 
- 
isMappublic boolean isMap()Description copied from interface:PersistentPropertyReturns whether the property is aMap.- Specified by:
- isMapin interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
 
- 
isArraypublic boolean isArray()Description copied from interface:PersistentPropertyReturns whether the property is an array.- Specified by:
- isArrayin interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
 
- 
isEntitypublic boolean isEntity()Description copied from interface:PersistentPropertyReturns whether the type of thePersistentPropertyis actually to be regarded asPersistentEntityin turn.- Specified by:
- isEntityin interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
- true a PersistentEntity.
 
- 
getComponentTypeDescription copied from interface:PersistentPropertyReturns the component type of the type if it is aCollection. Will return the type of the key if the property is aMap.- Specified by:
- getComponentTypein interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
- the component type, the map's key type or null if neither CollectionnorMap.
 
- 
getMapValueTypeDescription copied from interface:PersistentPropertyReturns the type of the values if the property is aMap.- Specified by:
- getMapValueTypein interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
- the map's value type or null if no Map
 
- 
getActualTypeDescription copied from interface:PersistentPropertyReturns the actual type of the property. This will be the original property type if no generics were used, the component type for collection-like types and arrays as well as the value type for map properties.- Specified by:
- getActualTypein interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
 
- 
usePropertyAccesspublic boolean usePropertyAccess()Description copied from interface:PersistentPropertyReturns whether property access shall be used for reading the property value. This means it will use the getter instead of field access.- Specified by:
- usePropertyAccessin interface- PersistentProperty<P extends PersistentProperty<P>>
- Returns:
 
- 
getProperty
- 
getActualTypeInformation
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
 
-