T
- the object typepublic class StaticObjectExporter<T> extends AbstractObjectExporter
The object can be set using setTarget(Object)
or
setTarget(Object, Map)
and object data will be extracted once.
The difference to the ObjectExporter
is that this exporter must know
the class of the target object in advance and can therefore create the data
items in advance. Setting a target is a quick operation and does not destroy
the data items in the process.
attributes, factory, items
Constructor and Description |
---|
StaticObjectExporter(ItemFactory itemFactory,
Class<T> modelClazz,
boolean readOnly,
boolean nullIsError) |
StaticObjectExporter(ItemFactory itemFactory,
Class<T> modelClazz,
boolean readOnly,
boolean nullIsError,
String prefix)
Create a new static object exporter
|
Modifier and Type | Method and Description |
---|---|
protected Map<String,Variant> |
getAdditionalAttributes() |
protected Object |
getTarget()
Get the current target or
null if there is none |
void |
setAttributes(Map<String,Variant> attributes) |
void |
setTarget(T target) |
void |
setTarget(T target,
Map<String,Variant> attributes) |
createDataItems, dispose, fillAttributes, findAnnotation, getOptions, initAttribute, makeItemName, updateAttribute, updateItemsFromTarget, writeAttribute
public StaticObjectExporter(ItemFactory itemFactory, Class<T> modelClazz, boolean readOnly, boolean nullIsError, String prefix)
itemFactory
- the factory used to create items. This factory is disposed
when the object exporter is disposed.modelClazz
- the class of the object to exportreadOnly
- set to true
so all fields will be read-onlynullIsError
- set to true
to mark fields that are
null
with an error attributeprefix
- a local prefixpublic StaticObjectExporter(ItemFactory itemFactory, Class<T> modelClazz, boolean readOnly, boolean nullIsError)
public void setTarget(T target)
protected Map<String,Variant> getAdditionalAttributes()
getAdditionalAttributes
in class AbstractObjectExporter
protected Object getTarget()
AbstractObjectExporter
null
if there is nonegetTarget
in class AbstractObjectExporter