Class Property

  • All Implemented Interfaces:
    HasParsedElement

    public class Property
    extends java.lang.Object
    implements HasParsedElement
    Model class for an entity's property: a Java property mapped to a data base representation.
    • Constructor Detail

      • Property

        public Property​(Schema schema,
                        Entity entity,
                        PropertyType propertyType,
                        java.lang.String propertyName)
    • Method Detail

      • getPropertyName

        public java.lang.String getPropertyName()
      • getModelId

        public io.objectbox.generator.IdUid getModelId()
      • setModelId

        public void setModelId​(io.objectbox.generator.IdUid modelId)
      • getModelIndexId

        public io.objectbox.generator.IdUid getModelIndexId()
      • setModelIndexId

        public void setModelIndexId​(io.objectbox.generator.IdUid modelIndexId)
      • getDbName

        public java.lang.String getDbName()
      • getDbType

        public java.lang.String getDbType()
        String representation of a PropertyType enum.
      • getDbTypeId

        public java.lang.Short getDbTypeId()
        ID of the PropertyType.
      • isPrimaryKey

        public boolean isPrimaryKey()
        If this property is a primary key and PropertyFlags.ID should be set.
      • isIdCompanion

        public boolean isIdCompanion()
        If PropertyFlags.ID_COMPANION should be set on this property.
      • isTypeNotNull

        public boolean isTypeNotNull()
        If a property value may never be null, so e.g. null checks in generated code are not necessary.

        Note: this is not related to PropertyFlags.NOT_NULL, use isNotNullFlag() instead.

      • isNotNullFlag

        public boolean isNotNullFlag()
        If PropertyFlags.NOT_NULL should be set on this property.

        Note: this does not indicate if the property value may never be null, use isTypeNotNull() instead.

      • isNonPrimitiveFlag

        public boolean isNonPrimitiveFlag()
        If PropertyFlags.NON_PRIMITIVE_TYPE should be set on this property.

        Note: use isTypeNotNull() instead to check if the property value can be null.

      • isUnsigned

        public boolean isUnsigned()
        If PropertyFlags.UNSIGNED should be set on this property.
      • isIdAssignable

        public boolean isIdAssignable()
        If PropertyFlags.ID_SELF_ASSIGNABLE should be set on this property.
      • getJavaType

        public java.lang.String getJavaType()
        Returns the type including type parameters, e.g. List<String>.
      • getJavaRawType

        public java.lang.String getJavaRawType()
        If the Java type is generic, returns the raw type. E.g. List instead of List<String>. Otherwise, returns the same as getJavaType().
      • getJavaTypeInEntity

        public java.lang.String getJavaTypeInEntity()
      • getOrdinal

        public int getOrdinal()
      • getCustomType

        public java.lang.String getCustomType()
      • getCustomTypeClassName

        public java.lang.String getCustomTypeClassName()
      • getConverter

        public java.lang.String getConverter()
      • getConverterClassName

        public java.lang.String getConverterClassName()
      • isVirtual

        public boolean isVirtual()
        If this property does not actually exist in the entity class, but only in the model and PropertyFlags.VIRTUAL should be set.
      • getVirtualTargetValueExpression

        public java.lang.String getVirtualTargetValueExpression()
      • getVirtualTargetName

        public java.lang.String getVirtualTargetName()
      • getGetterMethodName

        public java.lang.String getGetterMethodName()
      • getTargetEntity

        public Entity getTargetEntity()
      • getValueExpression

        public java.lang.String getValueExpression()
      • getSetValueExpression

        public java.lang.String getSetValueExpression​(java.lang.String value)
      • getDatabaseValueExpression

        public java.lang.String getDatabaseValueExpression()
      • getDatabaseValueExpression

        public java.lang.String getDatabaseValueExpression​(java.lang.String entityValue)
      • getEntity

        public Entity getEntity()
      • getIndex

        @Nullable
        public io.objectbox.generator.model.Index getIndex()
        Note: index is not set until after finishing schema.
      • setIndex

        public void setIndex​(io.objectbox.generator.model.Index index)
      • getPropertyFlagsForModelFile

        @Nullable
        public java.lang.Integer getPropertyFlagsForModelFile()
        Returns combined PropertyFlags value of only those flags that should be stored in the model file. Returns null if there would be no flags.

        These may be different from getPropertyFlagsForGeneratedCode(), see computePropertyFlags().

      • getPropertyFlagsForGeneratedCode

        public java.util.Set<java.lang.String> getPropertyFlagsForGeneratedCode()
        Returns names of PropertyFlags to be used in generated model builder code.

        These may be different from getPropertyFlagsForModelFile(), see computePropertyFlags().

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object