Interface BusinessObject
public interface BusinessObject
Provides a convenient mechanism to retrieve and modify an instance of a business object.
Supported API: true
Extendable: false
This class is not thread safe. It is the responsibility of users of this class to ensure it is handled correctly if used in multiple threads.
Supported API: true
Extendable: false
This class is not thread safe. It is the responsibility of users of this class to ensure it is handled correctly if used in multiple threads.
-
Method Summary
Modifier and TypeMethodDescriptionget(BusinessField businessField) Get the value(s) of the field.default ConstraintSummarygetConstraintDescriptor(BusinessField businessField) Get the constraint descriptor for the specified business field.default TypeIdentifierGet the type identifier for the object behind this instance.default WTReferenceGet the reference for the object behind this instance.voidmarkAsLoaded(BusinessFieldNamespaceIdentifier namespace) Marks all the namespace's fields which are applicable to this business object as loaded.voidmarkAsLoaded(Collection<BusinessField> businessFields) Marks the business fields which are applicable to this business object as loaded.set(BusinessField businessField, Object value) Set the value(s) of the field.voidvalidate()Validate the values of the loaded fields.
-
Method Details
-
get
Get the value(s) of the field.
Supported API: true- Parameters:
businessField- The field to get the value(s) for.- Returns:
- The value(s) of the field. This could be null if there are no value(s) or if the field passed in is null. It could return an array of objects if the field supports multiple values.
- Throws:
WTException- If the field is applicable to the business object, but has not been loaded yet. If there were errors retrieving the value for the field.
-
getConstraintDescriptor
Get the constraint descriptor for the specified business field.
Supported API: true- Parameters:
businessField- The field to get the constraint descriptor for.- Returns:
- The constraint descriptor to the field. This could be null if the constraints weren't loaded for the field or if the field passed in is null.
- Throws:
WTException- If the field is applicable to the business object, but has not been loaded yet. If there were errors retrieving the constraint descriptor for the field.
-
set
Set the value(s) of the field.
Supported API: true- Parameters:
businessField- The field to set the value(s) for.value- The value(s) to set for the field. It could return an array of objects if the field supports multiple values.- Returns:
- The value(s) actually set for the field. It could return an array of objects if the field supports multiple values. This is not necessarily the value that was passed to be set. There can be data conversion if the value passed in is a String but the datatype of the business field is something that can be converted from a String. Also, constraints can modify the value that actually gets set (e.g. convert a string to upper case).
- Throws:
WTException
-
markAsLoaded
Marks the business fields which are applicable to this business object as loaded. This affects the value(s) and constraints of the objects attributes.
Supported API: true- Parameters:
businessFields- The fields to mark as loaded.- Throws:
WTException
-
markAsLoaded
Marks all the namespace's fields which are applicable to this business object as loaded. This affects the value(s) and constraints of the object's attributes.
Supported API: true- Parameters:
namespace- The namespace whose fields should be marked as loaded.- Throws:
WTException- If there were errors marking the namespace's fields as loaded.
-
getWTReference
Get the reference for the object behind this instance.
Supported API: true- Returns:
- The reference for the object behind this instance. Will return null if the object has not yet been persisted.
- Throws:
WTException- If there were errors getting the reference.
-
getTypeIdentifier
Get the type identifier for the object behind this instance.
Supported API: true- Returns:
- The type identifier for the object behind this instance. Will not return null.
- Throws:
WTException- If there were errors getting the type identifier.
-
validate
Validate the values of the loaded fields. If all values for loaded fields are valid, nothing happens.
Supported API: true- Throws:
ConstraintException- For the first invalid value encountered for a loaded field.
-