InterfaceBasedColumn

public final class InterfaceBasedColumn extends AbstractColumn implements ColumnDeclaredInProto, ColumnWithCustomGetter

A column declared with the help of io.spine.base.EntityWithColumns-derived interface.

An interface-based column is:

  1. Declared in Protobuf with (column) option:
            int32 year_of_registration = 8 [(column) = true];
    
  2. Implemented using custom Spine-generated interface:
            interface UserProfileWithColumns extends EntityWithColumns {
                int getYearOfRegistration();
            }
    
            // ...
            class UserProfileProjection
    extends Projection<UserId, UserProfile, UserProfile.Builder>
                implements UserProfileWithColumns {
    
               @Override
                public int getYearOfRegistration() {
                    return yearOfRegistration;
                }
            }
    
  3. Extracted from the entity and propagated to the entity state at the moment of transaction commit. The column value is finalized by this moment.

Functions

Link copied to clipboard
public FieldDeclaration protoField()
Obtains the corresponding proto field declaration.
Link copied to clipboard
public Object valueIn(EntityState state)
Extracts the column value currently stored in the entity state.
public Object valueIn(Entity<? extends Object, ? extends Object> entity)
Extracts the actual column value from the source.

Inherited functions

Link copied to clipboard
public ColumnName name()
The name of the column in the storage.
Link copied to clipboard
public Class<? extends Object> type()
The type of the column.