Package io.micronaut.data.model
Interface PersistentProperty
-
- All Superinterfaces:
io.micronaut.core.annotation.AnnotationMetadataProvider
,io.micronaut.core.annotation.AnnotationSource
,io.micronaut.core.naming.Named
,PersistentElement
- All Known Subinterfaces:
Association
,Embedded
- All Known Implementing Classes:
RuntimeAssociation
,RuntimePersistentProperty
,SourceAssociation
,SourcePersistentProperty
public interface PersistentProperty extends PersistentElement
Models a persistent property. That is a property that is saved and retrieved from the database.- Since:
- 1.0
- Author:
- graemerocher
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.lang.String
getCapitilizedName()
The name with the first letter in upper case as per Java bean conventions.default AttributeConverter<java.lang.Object,java.lang.Object>
getConverter()
default DataType
getDataType()
java.lang.String
getName()
The name of the property.PersistentEntity
getOwner()
Obtains the owner of this persistent property.java.lang.String
getTypeName()
The type of the property.default boolean
isAssignable(java.lang.Class<?> type)
Is the property assignable to the given type.boolean
isAssignable(java.lang.String type)
Is the property assignable to the given type name.default boolean
isAutoPopulated()
default boolean
isConstructorArgument()
default boolean
isEnum()
default boolean
isGenerated()
Whether the property is generated.static boolean
isNullableMetadata(io.micronaut.core.annotation.AnnotationMetadata metadata)
Return whether the metadata indicates the instance is nullable.default boolean
isOptional()
Whether the property can be set to null.default boolean
isReadOnly()
Whether the property is read-only, for example for generated values.default boolean
isRequired()
Whether a property is required to be specified.-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclared
-
Methods inherited from interface io.micronaut.data.model.PersistentElement
getPersistedName
-
-
-
-
Method Detail
-
getName
@NonNull java.lang.String getName()
The name of the property.- Specified by:
getName
in interfaceio.micronaut.core.naming.Named
- Returns:
- The property name
-
getCapitilizedName
@NonNull default java.lang.String getCapitilizedName()
The name with the first letter in upper case as per Java bean conventions.- Returns:
- The capitilized name
-
getTypeName
@NonNull java.lang.String getTypeName()
The type of the property.- Returns:
- The property type
-
getOwner
@NonNull PersistentEntity getOwner()
Obtains the owner of this persistent property.- Returns:
- The owner
-
isOptional
default boolean isOptional()
Whether the property can be set to null.- Returns:
- True if it can
-
isRequired
default boolean isRequired()
Whether a property is required to be specified. This returns false if the property is both not nullable and not generated.- Returns:
- True if the property is required
- See Also:
isOptional()
,isGenerated()
-
isReadOnly
default boolean isReadOnly()
Whether the property is read-only, for example for generated values.- Returns:
- True if it is read-only
-
isConstructorArgument
default boolean isConstructorArgument()
- Returns:
- Is the property also a constructor argument.
-
isGenerated
default boolean isGenerated()
Whether the property is generated.- Returns:
- True if is generated
-
isAutoPopulated
default boolean isAutoPopulated()
- Returns:
- True if the property is autopopulated
-
isAssignable
boolean isAssignable(@NonNull java.lang.String type)
Is the property assignable to the given type name.- Parameters:
type
- The type name- Returns:
- True if it is
-
isAssignable
default boolean isAssignable(@NonNull java.lang.Class<?> type)
Is the property assignable to the given type.- Parameters:
type
- The type- Returns:
- True it is
-
getDataType
default DataType getDataType()
- Returns:
- The data type
-
isEnum
default boolean isEnum()
- Returns:
- Returns whether the property is an enum.
-
getConverter
@Nullable default AttributeConverter<java.lang.Object,java.lang.Object> getConverter()
- Returns:
- Returns possible property convertor.
-
isNullableMetadata
static boolean isNullableMetadata(@NonNull io.micronaut.core.annotation.AnnotationMetadata metadata)
Return whether the metadata indicates the instance is nullable.- Parameters:
metadata
- The metadata- Returns:
- True if it is nullable
-
-