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 @Nullable StringgetAlias()The alias of the property if used in a query.default @NonNull StringThe name with the first letter in upper case as per Java bean conventions.default @NonNull StringDeprecated, for removal: This API element is subject to removal in a future version.default @Nullable AttributeConverter<Object,Object> default DataTypedefault JsonDataType@NonNull StringgetName()The name of the property.@NonNull PersistentEntitygetOwner()Obtains the owner of this persistent property.@NonNull StringThe type of the property.default booleanisAssignable(@NonNull Class<?> type) Is the property assignable to the given type.booleanisAssignable(@NonNull String type) Is the property assignable to the given type name.default booleandefault booleandefault booleanisEnum()default booleanWhether the property is generated.static booleanisNullableMetadata(@NonNull io.micronaut.core.annotation.AnnotationMetadata metadata) Return whether the metadata indicates the instance is nullable.default booleanWhether the property can be set to null.default booleanWhether the property is read-only, for example for generated values.default booleanWhether 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, synthesizeDeclaredAnnotationsByTypeMethods inherited from interface io.micronaut.core.annotation.AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclaredMethods inherited from interface io.micronaut.data.model.PersistentElement
getPersistedName
-
Method Details
-
getName
The name of the property.- Specified by:
getNamein interfaceio.micronaut.core.naming.Named- Returns:
- The property name
-
getCapitilizedName
Deprecated, for removal: This API element is subject to removal in a future version.The method with a type replaced withgetCapitalizedName().The name with the first letter in upper case as per Java bean conventions.- Returns:
- The capitilized name
-
getCapitalizedName
The name with the first letter in upper case as per Java bean conventions.- Returns:
- The capitalized name
- Since:
- 4.2.0
-
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 auto-populated
-
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.JSONfields. 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
-
getAlias
The alias of the property if used in a query.- Returns:
- The alias.
- Since:
- 4.2.0
-
getCapitalizedName().