Package com.smeup.kokos.sdk.entity.model
Class AbstractEntity
java.lang.Object
com.smeup.kokos.sdk.entity.model.AbstractEntity
The model of generic entity
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal List<ActionDescriptor> Gets back the list of Action descriptors for this entity, derived purely from theActionannotations on its declared methods.final StringGets back the value of the field annotated with @Description, otherwise it fallbacks on the getId() method.abstract StringgetId()getOavFields(boolean includeId) Gets back the list of fields annotated with @SmeupOav, optionally including those also annotated with @Id.getOavFields(Class<? extends AbstractEntity> entityClass, boolean includeId) Gets back the list of fields annotated with @SmeupOav for the given entity class, optionally including those also annotated with @Id.final List<OavDescriptor> getOavs()static List<OavDescriptor> getOavs(Class<? extends AbstractEntity> entityClass) getOavValue(String oavId) Gets back the value of the field annotated with @SmeupOav with the given id.getType()static booleanDetermines if the given field is the id field, either by being annotated with @Id or by having an OAV id matching the default id.final StringreadFieldValue(Field field) Reads the value of the given field from this entity instance, returning it as a String.abstract voidvoidsetParameter(String parameter) void
-
Constructor Details
-
AbstractEntity
public AbstractEntity()
-
-
Method Details
-
getType
-
setType
-
getParameter
-
setParameter
-
getId
-
setId
-
getDescriptionValue
Gets back the value of the field annotated with @Description, otherwise it fallbacks on the getId() method. -
getOavs
Gets back the list of OAV descriptors for this entity, derived purely from theSmeupOavandIdannotations on its declared fields.- Returns:
- an ordered list of
OavDescriptormatching field declaration order
-
getActions
Gets back the list of Action descriptors for this entity, derived purely from theActionannotations on its declared methods.- Returns:
- an ordered list of
ActionDescriptormatching method declaration order
-
getOavValue
Gets back the value of the field annotated with @SmeupOav with the given id.- Parameters:
oavId- the id of the OAV to look for- Returns:
- an Optional containing the value of the OAV field, or empty if not found or inaccessible
-
getOavFields
Gets back the list of fields annotated with @SmeupOav, optionally including those also annotated with @Id.- Parameters:
includeId- if true, includes fields annotated with @Id; if false, excludes them- Returns:
- a list of Fields annotated with @SmeupOav, filtered by the includeId flag
-
readFieldValue
Reads the value of the given field from this entity instance, returning it as a String.- Parameters:
field- the Field to read, which should be accessible and belong to this entity class- Returns:
- the String representation of the field's value, or an empty string if the field is inaccessible or null
-
getOavFields
public static List<Field> getOavFields(Class<? extends AbstractEntity> entityClass, boolean includeId) Gets back the list of fields annotated with @SmeupOav for the given entity class, optionally including those also annotated with @Id.- Parameters:
entityClass- the entity class to inspectincludeId- if true, includes fields annotated with @Id; if false, excludes them- Returns:
- a list of Fields annotated with @SmeupOav, filtered by the includeId flag
-
isIdField
Determines if the given field is the id field, either by being annotated with @Id or by having an OAV id matching the default id.- Parameters:
field- the Field to check, which should be one of the OAV fields of the entitysmeupOav- the SmeupOav annotation of the field, which should be provided to avoid repeated annotation lookupsidOav- the default id OAV to compare against, typically obtained from getIdOav()- Returns:
- true if the field is annotated with @Id or has an OAV id equal to idOav; false otherwise
-
getOavs
Gets back the list of OAV descriptors for this entity, derived purely from theSmeupOavandIdannotations on its declared fields.- Returns:
- an ordered list of
OavDescriptormatching field declaration order
-