Interface KastRow
-
public interface KastRow
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()Clears all fields of this row.intgetArity()Returns the number of fields in the row.ObjectgetField(int pos)Returns the field's content at the specified field position.ObjectgetField(String name)Returns the field's content using the specified field name.<T> TgetFieldAs(int pos)Returns the field's content at the specified field position.<T> TgetFieldAs(String name)Returns the field's content using the specified field name.Set<String>getFieldNames(boolean includeNamedPositions)Returns the set of field names if this row operates in name-based field mode, otherwise null.KastRowKindgetKind()Returns the kind of change that this row describes in a changelog.voidsetField(int pos, Object value)Sets the field's content at the specified position.voidsetField(String name, Object value)Sets the field's content using the specified field name.voidsetKind(KastRowKind kind)Sets the kind of change that this row describes in a changelog.
-
-
-
Method Detail
-
getKind
KastRowKind getKind()
Returns the kind of change that this row describes in a changelog.By default, a row describes an
KastRowKind.INSERTchange.- See Also:
KastRowKind
-
setKind
void setKind(KastRowKind kind)
Sets the kind of change that this row describes in a changelog.By default, a row describes an
KastRowKind.INSERTchange.- See Also:
KastRowKind
-
getArity
int getArity()
Returns the number of fields in the row.Note: The row kind is kept separate from the fields and is not included in this number.
- Returns:
- the number of fields in the row
-
getField
@Nullable Object getField(int pos)
Returns the field's content at the specified field position.Note: The row must operate in position-based field mode.
- Parameters:
pos- the position of the field, 0-based- Returns:
- the field's content at the specified position
-
getFieldAs
<T> T getFieldAs(int pos)
Returns the field's content at the specified field position.Note: The row must operate in position-based field mode.
This method avoids a lot of manual casting in the user implementation.
- Parameters:
pos- the position of the field, 0-based- Returns:
- the field's content at the specified position
-
getField
@Nullable Object getField(String name)
Returns the field's content using the specified field name.Note: The row must operate in name-based field mode.
- Parameters:
name- the name of the field or null if not set previously- Returns:
- the field's content
-
getFieldAs
<T> T getFieldAs(String name)
Returns the field's content using the specified field name.Note: The row must operate in name-based field mode.
This method avoids a lot of manual casting in the user implementation.
- Parameters:
name- the name of the field, set previously- Returns:
- the field's content
-
setField
void setField(int pos, @Nullable Object value)Sets the field's content at the specified position.Note: The row must operate in position-based field mode.
- Parameters:
pos- the position of the field, 0-basedvalue- the value to be assigned to the field at the specified position
-
setField
void setField(String name, @Nullable Object value)
Sets the field's content using the specified field name.Note: The row must operate in name-based field mode.
- Parameters:
name- the name of the fieldvalue- the value to be assigned to the field
-
getFieldNames
@Nullable Set<String> getFieldNames(boolean includeNamedPositions)
Returns the set of field names if this row operates in name-based field mode, otherwise null.This method is a helper method for serializers and converters but can also be useful for other row transformations.
- Parameters:
includeNamedPositions- whether or not to include named positions when this row operates in a hybrid field mode
-
clear
void clear()
Clears all fields of this row.
-
-