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
Models a persistent property. That is a property that is saved and retrieved from the database.
- Since:
- 1.0
- Author:
- graemerocher
-
Field Summary
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY
-
Method Summary
Modifier and TypeMethodDescriptiondefault @NonNull String
The name with the first letter in upper case as per Java bean conventions.default @Nullable AttributeConverter<Object,
Object> default DataType
default JsonDataType
@NonNull String
getName()
The name of the property.@NonNull PersistentEntity
getOwner()
Obtains the owner of this persistent property.@NonNull String
The type of the property.default boolean
isAssignable
(@NonNull Class<?> type) Is the property assignable to the given type.boolean
isAssignable
(@NonNull String type) Is the property assignable to the given type name.default boolean
default boolean
default boolean
isEnum()
default boolean
Whether the property is generated.static boolean
isNullableMetadata
(@NonNull io.micronaut.core.annotation.AnnotationMetadata metadata) Return whether the metadata indicates the instance is nullable.default boolean
Whether the property can be set to null.default boolean
Whether the property is read-only, for example for generated values.default boolean
Whether a property is required to be specified.Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getAnnotationMetadata, getTargetAnnotationMetadata, 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 Details
-
getName
The name of the property.- Specified by:
getName
in interfaceio.micronaut.core.naming.Named
- Returns:
- The property name
-
getCapitilizedName
The name with the first letter in upper case as per Java bean conventions.- Returns:
- The capitilized name
-
getTypeName
The type of the property.- Returns:
- The property type
-
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:
-
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
Is the property assignable to the given type name.- Parameters:
type
- The type name- Returns:
- True if it is
-
isAssignable
Is the property assignable to the given type.- Parameters:
type
- The type- Returns:
- True it is
-
getDataType
- Returns:
- The data type
-
getJsonDataType
- Returns:
- The json data type for
DataType.JSON
fields. If none specified, default isJsonDataType.DEFAULT
.
-
isEnum
default boolean isEnum()- Returns:
- Returns whether the property is an enum.
-
getConverter
- Returns:
- Returns possible property convertor.
-
isNullableMetadata
static boolean isNullableMetadata(@NonNull @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
-