Class TenantIdGeneration

    • Constructor Detail

      • TenantIdGeneration

        public TenantIdGeneration()
    • Method Detail

      • initialize

        public void initialize​(TenantId annotation,
                               Class<?> propertyType,
                               String entityName,
                               String propertyName)
        Description copied from interface: AnnotationValueGeneration
        Initializes this generation strategy for the given annotation instance.
        Specified by:
        initialize in interface AnnotationValueGeneration<TenantId>
        Parameters:
        annotation - an instance of the strategy's annotation type. Typically implementations will retrieve the annotation's attribute values and store them in fields.
        propertyType - the type of the property annotated with the generator annotation. Implementations may use the type to determine the right ValueGenerator to be applied.
        entityName - the name of the entity to which the annotated property belongs
        propertyName - the name of the annotated property
      • initialize

        public void initialize​(TenantId annotation,
                               Class<?> propertyType)
        Description copied from interface: AnnotationValueGeneration
        Initializes this generation strategy for the given annotation instance.
        Specified by:
        initialize in interface AnnotationValueGeneration<TenantId>
        Parameters:
        annotation - an instance of the strategy's annotation type. Typically implementations will retrieve the annotation's attribute values and store them in fields.
        propertyType - the type of the property annotated with the generator annotation. Implementations may use the type to determine the right ValueGenerator to be applied.
      • getValueGenerator

        public ValueGenerator<?> getValueGenerator()
        Description copied from interface: ValueGeneration
        Obtain the in-VM value generator.

        May return null. In fact for values that are generated "in the database" via execution of the INSERT/UPDATE statement, the expectation is that null be returned here

        Specified by:
        getValueGenerator in interface ValueGeneration
        Returns:
        The strategy for performing in-VM value generation
      • generateValue

        public Object generateValue​(Session session,
                                    Object owner,
                                    Object currentValue)
        Description copied from interface: ValueGenerator
        Generate the value.
        Specified by:
        generateValue in interface ValueGenerator<Object>
        Parameters:
        session - The Session from which the request originates.
        owner - The instance of the object owning the attribute for which we are generating a value.
        currentValue - The current value assigned to the property
        Returns:
        The generated value
      • generateValue

        public Object generateValue​(Session session,
                                    Object owner)
        Description copied from interface: ValueGenerator
        Generate the value.
        Specified by:
        generateValue in interface ValueGenerator<Object>
        Parameters:
        session - The Session from which the request originates.
        owner - The instance of the object owning the attribute for which we are generating a value.
        Returns:
        The generated value
      • referenceColumnInSql

        public boolean referenceColumnInSql()
        Description copied from interface: ValueGeneration
        For values which are generated in the database (ValueGeneration.getValueGenerator() == null), should the column be referenced in the INSERT / UPDATE SQL?

        This will be false most often to have a DDL-defined DEFAULT value be applied on INSERT

        Specified by:
        referenceColumnInSql in interface ValueGeneration
        Returns:
        true indicates the column should be included in the SQL.