Class MetisField<T extends MetisFieldItem>
java.lang.Object
io.github.tonywasher.joceanus.metis.field.MetisField<T>
- Type Parameters:
T- the data type
- All Implemented Interfaces:
MetisFieldItem.MetisFieldDef
- Direct Known Subclasses:
MetisFieldVersioned
public class MetisField<T extends MetisFieldItem>
extends Object
implements MetisFieldItem.MetisFieldDef
Metis Data Field.
-
Constructor Summary
ConstructorsConstructorDescriptionMetisField(MetisFieldSet<T> pAnchor, MetisDataItem.MetisDataFieldId pId) Constructor.MetisField(MetisFieldSet<T> pAnchor, MetisDataItem.MetisDataFieldId pId, MetisDataType pDataType, Integer pMaxLength) Constructor.MetisField(MetisFieldSet<T> pAnchor, MetisDataItem.MetisDataFieldId pId, BiFunction<T, MetisDataItem.MetisDataFieldId, Object> pValue) Constructor.MetisField(MetisFieldSet<T> pAnchor, MetisDataItem.MetisDataFieldId pId, Function<T, Object> pValue) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCheck validity of Field Definition.booleanObtain the anchor for the field.Get the dataType of the field.Obtain the id of the field.getFieldValue(Object pObject) Obtain the value of a field.<X> XgetFieldValue(Object pObject, Class<X> pClazz) Obtain the value of a field cast to a particular class.Get the maximum length.inthashCode()booleanIs the field calculated?toString()
-
Constructor Details
-
MetisField
MetisField(MetisFieldSet<T> pAnchor, MetisDataItem.MetisDataFieldId pId, MetisDataType pDataType, Integer pMaxLength) Constructor.- Parameters:
pAnchor- the anchorpId- the id of the fieldpDataType- the dataType of the fieldpMaxLength- the maximum length of the field
-
MetisField
MetisField(MetisFieldSet<T> pAnchor, MetisDataItem.MetisDataFieldId pId) Constructor.- Parameters:
pAnchor- the anchorpId- the id of the field
-
MetisField
MetisField(MetisFieldSet<T> pAnchor, MetisDataItem.MetisDataFieldId pId, Function<T, Object> pValue) Constructor.- Parameters:
pAnchor- the anchorpId- the id of the fieldpValue- the value supplier
-
MetisField
MetisField(MetisFieldSet<T> pAnchor, MetisDataItem.MetisDataFieldId pId, BiFunction<T, MetisDataItem.MetisDataFieldId, Object> pValue) Constructor.- Parameters:
pAnchor- the anchorpId- the id of the fieldpValue- the value supplier
-
-
Method Details
-
getFieldId
Description copied from interface:MetisFieldItem.MetisFieldDefObtain the id of the field.- Specified by:
getFieldIdin interfaceMetisFieldItem.MetisFieldDef- Returns:
- the name of the field.
-
getDataType
Description copied from interface:MetisFieldItem.MetisFieldDefGet the dataType of the field.- Specified by:
getDataTypein interfaceMetisFieldItem.MetisFieldDef- Returns:
- the dataType
-
getMaxLength
Description copied from interface:MetisFieldItem.MetisFieldDefGet the maximum length.- Specified by:
getMaxLengthin interfaceMetisFieldItem.MetisFieldDef- Returns:
- the maxLength
-
getAnchor
Obtain the anchor for the field.- Returns:
- the anchor
-
isCalculated
public boolean isCalculated()Description copied from interface:MetisFieldItem.MetisFieldDefIs the field calculated?- Specified by:
isCalculatedin interfaceMetisFieldItem.MetisFieldDef- Returns:
- true/false
-
checkValidity
protected void checkValidity()Check validity of Field Definition. -
equals
-
hashCode
public int hashCode() -
toString
-
getFieldValue
Description copied from interface:MetisFieldItem.MetisFieldDefObtain the value of a field.- Specified by:
getFieldValuein interfaceMetisFieldItem.MetisFieldDef- Parameters:
pObject- the object- Returns:
- the value
-
getFieldValue
Description copied from interface:MetisFieldItem.MetisFieldDefObtain the value of a field cast to a particular class.- Specified by:
getFieldValuein interfaceMetisFieldItem.MetisFieldDef- Type Parameters:
X- the value type- Parameters:
pObject- the objectpClazz- the class of the value- Returns:
- the value
-