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
  • Field Summary

    Fields inherited from interface io.micronaut.core.annotation.AnnotationSource

    EMPTY
  • Method Summary

    Modifier and Type
    Method
    Description
    default @Nullable String
    The alias of the property if used in a query.
    default @NonNull String
    The name with the first letter in upper case as per Java bean conventions.
    default @NonNull String
    Deprecated, for removal: This API element is subject to removal in a future version.
    The method with a type replaced with getCapitalizedName().
    default @Nullable AttributeConverter<Object,Object>
     
    default DataType
     
    default JsonDataType
     
    @NonNull String
    The name of the property.
    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
     
    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

      @NonNull @NonNull String getName()
      The name of the property.
      Specified by:
      getName in interface io.micronaut.core.naming.Named
      Returns:
      The property name
    • getCapitilizedName

      @Deprecated(forRemoval=true) @NonNull default @NonNull String getCapitilizedName()
      Deprecated, for removal: This API element is subject to removal in a future version.
      The method with a type replaced with getCapitalizedName().
      The name with the first letter in upper case as per Java bean conventions.
      Returns:
      The capitilized name
    • getCapitalizedName

      @NonNull default @NonNull String getCapitalizedName()
      The name with the first letter in upper case as per Java bean conventions.
      Returns:
      The capitalized name
      Since:
      4.2.0
    • getTypeName

      @NonNull @NonNull String getTypeName()
      The type of the property.
      Returns:
      The property type
    • getOwner

      @NonNull @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:
    • 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

      boolean isAssignable(@NonNull @NonNull 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 @NonNull 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
    • getJsonDataType

      default JsonDataType getJsonDataType()
      Returns:
      The json data type for DataType.JSON fields. If none specified, default is JsonDataType.DEFAULT.
    • isEnum

      default boolean isEnum()
      Returns:
      Returns whether the property is an enum.
    • getConverter

      @Nullable default @Nullable AttributeConverter<Object,Object> 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

      @Nullable default @Nullable String getAlias()
      The alias of the property if used in a query.
      Returns:
      The alias.
      Since:
      4.2.0