public final class EntityRecordWithColumns extends java.lang.Object implements WithLifecycle
EntityRecord
associated with the values of its columns.Modifier and Type | Method and Description |
---|---|
com.google.common.collect.ImmutableSet<ColumnName> |
columnNames()
Obtains the names of storage fields in the record.
|
@Nullable java.lang.Object |
columnValue(ColumnName columnName)
Obtains the value of the storage field by the specified column name.
|
<R> R |
columnValue(ColumnName columnName,
ColumnMapping<R> columnMapping)
Obtains the value of the storage field by the specified column name.
|
static EntityRecordWithColumns |
create(io.spine.server.entity.EntityRecord record,
Entity<?,?> entity,
RecordStorage<?> recordStorage)
Creates a new record extracting the column values from the passed entity.
|
boolean |
equals(java.lang.Object o) |
io.spine.server.entity.LifecycleFlags |
getLifecycleFlags()
Obtains current lifecycle flags.
|
boolean |
hasColumn(ColumnName name)
Determines if there is a column with the specified name among the storage fields.
|
boolean |
hasColumns()
Determines if there are any columns associated with this record.
|
int |
hashCode() |
boolean |
isActive()
Verifies if any of the lifecycle attributes is set.
|
boolean |
isArchived()
Shows if current instance is marked as archived or not.
|
boolean |
isDeleted()
Shows if current instance is marked as deleted or not.
|
static EntityRecordWithColumns |
of(io.spine.server.entity.EntityRecord record)
Wraps a passed entity record.
|
static EntityRecordWithColumns |
of(io.spine.server.entity.EntityRecord record,
java.util.Map<ColumnName,java.lang.Object> storageFields)
Creates a new instance from the passed record and storage fields.
|
io.spine.server.entity.EntityRecord |
record()
Returns the enclosed entity record.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
lifecycleFlags
public static EntityRecordWithColumns create(io.spine.server.entity.EntityRecord record, Entity<?,?> entity, RecordStorage<?> recordStorage)
public static EntityRecordWithColumns of(io.spine.server.entity.EntityRecord record)
Such instance of EntityRecordWithColumns
will contain no storage fields.
public static EntityRecordWithColumns of(io.spine.server.entity.EntityRecord record, java.util.Map<ColumnName,java.lang.Object> storageFields)
public io.spine.server.entity.EntityRecord record()
public com.google.common.collect.ImmutableSet<ColumnName> columnNames()
public @Nullable java.lang.Object columnValue(ColumnName columnName)
The default column mapping will be used. It is suitable for storages that store values "as-is" or that are willing to do the manual column value conversion.
In other cases consider implementing a custom ColumnMapping
and using the
EntityRecordWithColumns.columnValue(ColumnName, ColumnMapping)
overload for convenient column value
conversion.
columnName
- the column namejava.lang.IllegalStateException
- if there is no column with the specified namepublic <R> R columnValue(ColumnName columnName, ColumnMapping<R> columnMapping)
The specified column mapping will be used to do the column value conversion.
public boolean hasColumns()
If returns false
, the columns are not considered by the storage.
true
if the object was constructed using
EntityRecordWithColumns.create(EntityRecord, Entity, RecordStorage)
and the entity has columns;
false
otherwisepublic boolean hasColumn(ColumnName name)
public io.spine.server.entity.LifecycleFlags getLifecycleFlags()
WithLifecycle
getLifecycleFlags
in interface WithLifecycle
WithLifecycle.lifecycleFlags()
public boolean isArchived()
WithLifecycle
isArchived
in interface WithLifecycle
public boolean isDeleted()
WithLifecycle
isDeleted
in interface WithLifecycle
public boolean isActive()
WithLifecycle
isActive
in interface WithLifecycle
false
if any of the attributes is set, true
otherwisepublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object