public class ObjectExporter extends AbstractObjectExporter implements java.beans.PropertyChangeListener
The object exporter is attached to a bean using attachTarget(Object)
and reads out the initial state of the bean and tries to subscribe to the
bean using the method
addPropertyChangeListener
. Changes announced by the bean will then be
reflected in the data items of the exporter.
The difference to the StaticObjectExporter is, that the bean class
type must not be known in advance and data items will be created on the fly
based on the provided target object. If the target bean does not provide the
addPropertyChangeListener
method it still shows the state the target
bean had on attaching but will not update. Attaching to a new target object
is more expensive using the ObjectExporter since all data items will
be destroyed in the process.
attributes, factory, items| Constructor and Description |
|---|
ObjectExporter(ItemFactory itemFactory)
Create a new object exporter
|
ObjectExporter(ItemFactory itemFactory,
boolean readOnly,
boolean nullIsError)
Create a new object exporter
|
ObjectExporter(ItemFactory itemFactory,
boolean readOnly,
boolean nullIsError,
java.lang.String prefix)
Create a new object exporter
|
| Modifier and Type | Method and Description |
|---|---|
void |
attachTarget(java.lang.Object target)
attach a new target.
|
void |
detachTarget()
detach from the current target if we have one
|
void |
dispose() |
protected void |
fillAttributes(java.beans.PropertyDescriptor pd,
java.util.Map<java.lang.String,Variant> attributes) |
protected java.util.Map<java.lang.String,Variant> |
getAdditionalAttributes() |
protected java.lang.reflect.Method |
getEventMethod(java.lang.String methodName) |
protected java.lang.Object |
getTarget()
Get the current target or
null if there is none |
void |
propertyChange(java.beans.PropertyChangeEvent evt) |
void |
setAttributes(java.util.Map<java.lang.String,Variant> additionalAttributes) |
createDataItems, findAnnotation, getOptions, initAttribute, makeItemName, updateAttribute, updateItemsFromTarget, writeAttributepublic ObjectExporter(ItemFactory itemFactory)
itemFactory - the factory used to create items. This factory is disposed
when the object exporter is disposed.public ObjectExporter(ItemFactory itemFactory, boolean readOnly, boolean nullIsError, java.lang.String prefix)
itemFactory - the factory used to create items. This factory is disposed
when the object exporter is disposed.readOnly - set to true in order to make all items read-onlynullIsError - set to true to mark fields that are
null with an error attributeprefix - the prefix of the item idspublic ObjectExporter(ItemFactory itemFactory, boolean readOnly, boolean nullIsError)
itemFactory - the factory used to create items. This factory is disposed
when the object exporter is disposed.readOnly - set to true in order to make all items read-onlynullIsError - set to true to mark fields that are
null with an error attributepublic void attachTarget(java.lang.Object target)
target - the new targetpublic void setAttributes(java.util.Map<java.lang.String,Variant> additionalAttributes)
protected java.util.Map<java.lang.String,Variant> getAdditionalAttributes()
getAdditionalAttributes in class AbstractObjectExporterprotected void fillAttributes(java.beans.PropertyDescriptor pd,
java.util.Map<java.lang.String,Variant> attributes)
fillAttributes in class AbstractObjectExporterpublic void detachTarget()
public void dispose()
dispose in class AbstractObjectExporterprotected java.lang.reflect.Method getEventMethod(java.lang.String methodName)
public void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange in interface java.beans.PropertyChangeListenerprotected java.lang.Object getTarget()
AbstractObjectExporternull if there is nonegetTarget in class AbstractObjectExporter
Copyright (c) IBH SYSTEMS GmbH and others 2010, 2013.
All rights reserved. This program and the accompanying materials
are made available under the terms of the
Eclipse Public License v1.0