T
- the type we contain as our valueS
- the type the source is frompublic class AspectAdapter<T,S> extends AbstractValueModel<T> implements ValueModel<T>, ChangeListener, DelegateAccess, ExternalUpdate
Modifier and Type | Field and Description |
---|---|
static String |
GET
Default get method name prefix.
|
static String |
SEPARATOR
The separator between attributes.
|
static String |
SET
Default set method name prefix.
|
Constructor and Description |
---|
AspectAdapter(S pSource,
String pAspectName)
Creates a new AspectAdapter.
|
AspectAdapter(S pSource,
String pAspectName,
String pGetterPrefix,
String pSetterPrefix)
Creates a new AspectAdapter.
|
AspectAdapter(ValueModel<S> pTrigger,
Class<S> pSourceClass,
AspectAccessAdapter pAccessAdapter,
String pAspectName)
Creates a new AspectAdapter.
|
AspectAdapter(ValueModel<S> pTrigger,
Class<S> pSourceClass,
AspectAccessAdapter pAccessAdapter,
String pAspectName,
String pGetterPrefix,
String pSetterPrefix)
Creates a new AspectAdapter.
|
AspectAdapter(ValueModel<S> pTrigger,
Class<S> pSourceClass,
String pAspectName)
Creates a new AspectAdapter.
|
AspectAdapter(ValueModel<S> pTrigger,
Class<S> pSourceClass,
String pAspectName,
String pGetterPrefix,
String pSetterPrefix)
Creates a new AspectAdapter.
|
AspectAdapter(ValueModel<S> pTrigger,
String pAspectName)
Creates a new AspectAdapter.
|
AspectAdapter(ValueModel<S> pTrigger,
String pAspectName,
String pGetterPrefix,
String pSetterPrefix)
Creates a new AspectAdapter.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Cleanup all resources: disconnect from any input sources (like
other ValueModel's ...), and remove all listeners.
|
AspectAccessAdapter |
getAccessAdapter() |
String |
getAspectName()
Return the aspect of the aspect adapter.
|
static AspectAdapter<?,?> |
getShared(ValueModel<?> pTrigger,
String pAspectName)
Create a new AspectAdapter or re-use an existing one.
|
ValueModel<? extends S> |
getTrigger()
Returns null or the trigger ValueModel of this aspect adapter.
|
T |
getValue()
Get the current value, during a callback this is the new value.
|
Object |
getValue(Object pValue)
Transform the handed value to a new value.
|
boolean |
isEditable()
Returns true if a setValue() is possible, and doesn't throw always an
UnsupportedOperationException.
|
void |
setAccessAdapter(AspectAccessAdapter pAccessAdapter)
Sets the access adapter to use when setting or getting values.
|
void |
setValue(T pValue,
boolean pIsSetForced)
Set a new value, this will fire a ChangeEvent if the new value
is different from the old value.
|
void |
signalExternalUpdate()
Signal this object that portions of its data changed.
|
void |
stateChanged(ChangeEvent pEvent)
Invoked when the target of the listener has changed its state.
|
addChangeListener, booleanValue, checkDisposed, doubleValue, fireStateChanged, floatValue, getDependents, getName, intValue, isDisposed, isInSetValue, isSetForced, longValue, onChangeSend, removeChangeListener, retractInterestsFor, setInSetValue, setName, setObjectValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueForced, stringValue
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addChangeListener, booleanValue, doubleValue, floatValue, getDependents, getName, intValue, isDisposed, isSetForced, longValue, onChangeSend, removeChangeListener, retractInterestsFor, setName, setObjectValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueForced, stringValue
public static final String SEPARATOR
public static final String GET
public static final String SET
public AspectAdapter(ValueModel<S> pTrigger, String pAspectName)
pTrigger
- the source object of our aspect is the trigger's valuepAspectName
- a string describing the attributes (seperated by SEPARATOR)
to our aspect.IllegalArgumentException
- if pTrigger is null
or pAspectName doesn't map to valid methodspublic AspectAdapter(ValueModel<S> pTrigger, String pAspectName, String pGetterPrefix, String pSetterPrefix)
pTrigger
- the source object of our aspect is the trigger's valuepAspectName
- a string describing the attributes (seperated by SEPARATOR)
to our aspect.pGetterPrefix
- the prefix we use for the "getter", must not be null nor emptypSetterPrefix
- the prefix we use for the "getter", must not be null nor empty nor the getter prefixIllegalArgumentException
- if pTrigger is null
or pAspectName doesn't map to valid methodspublic AspectAdapter(ValueModel<S> pTrigger, Class<S> pSourceClass, String pAspectName)
pTrigger
- the source object of our aspect is the trigger's valuepSourceClass
- the class of the value of pTrigger, if this is a Map, the
Map.get() and Map.put() methods are used to access the aspect.pAspectName
- a string describing the attributes (seperated by SEPARATOR)
to our aspect.IllegalArgumentException
- if pTrigger is null
or pAspectName doesn't map to valid methodspublic AspectAdapter(ValueModel<S> pTrigger, Class<S> pSourceClass, String pAspectName, String pGetterPrefix, String pSetterPrefix)
pTrigger
- the source object of our aspect is the trigger's valuepSourceClass
- the class of the value of pTrigger, if this is a Map, the
Map.get() and Map.put() methods are used to access the aspect.pAspectName
- a string describing the attributes (seperated by SEPARATOR)
to our aspect.pGetterPrefix
- the prefix we use for the "getter", must not be null nor emptypSetterPrefix
- the prefix we use for the "getter", must not be null nor empty nor the getter prefixIllegalArgumentException
- if pTrigger is null
or pAspectName doesn't map to valid methodspublic AspectAdapter(ValueModel<S> pTrigger, Class<S> pSourceClass, AspectAccessAdapter pAccessAdapter, String pAspectName)
pTrigger
- the source object of our aspect is the trigger's valuepSourceClass
- the class of the value of pTrigger, if this is a Map, the
Map.get() and Map.put() methods are used to access the aspect.pAccessAdapter
- the access adapter, may be nullpAspectName
- a string describing the attributes (seperated by SEPARATOR)
to our aspect.IllegalArgumentException
- if pTrigger is null
or pAspectName doesn't map to valid methodspublic AspectAdapter(ValueModel<S> pTrigger, Class<S> pSourceClass, AspectAccessAdapter pAccessAdapter, String pAspectName, String pGetterPrefix, String pSetterPrefix)
pTrigger
- the source object of our aspect is the trigger's valuepSourceClass
- the class of the value of pTrigger, if this is a Map, the
Map.get() and Map.put() methods are used to access the aspect.pAccessAdapter
- the access adapter, may be nullpAspectName
- a string describing the attributes (seperated by SEPARATOR)
to our aspect.pGetterPrefix
- the prefix we use for the "getter", must not be null nor emptypSetterPrefix
- the prefix we use for the "getter", must not be null nor empty nor the getter prefixIllegalArgumentException
- if pTrigger is null
or pAspectName doesn't map to valid methodspublic AspectAdapter(S pSource, String pAspectName)
pSource
- the source object of our aspectpAspectName
- a string describing the attributes (seperated by SEPARATOR)
to our aspect.IllegalArgumentException
- if pSource or pAspectName is null
or pAspectName doesn't map to valid methodspublic AspectAdapter(S pSource, String pAspectName, String pGetterPrefix, String pSetterPrefix)
pSource
- the source object of our aspectpAspectName
- a string describing the attributes (seperated by SEPARATOR)
to our aspect.pGetterPrefix
- the prefix we use for the "getter", must not be null nor emptypSetterPrefix
- the prefix we use for the "getter", must not be null nor empty nor the getter prefixIllegalArgumentException
- if pSource or pAspectName is null
or pAspectName doesn't map to valid methodspublic static AspectAdapter<?,?> getShared(ValueModel<?> pTrigger, String pAspectName)
pTrigger
- the trigger, must not be nullpAspectName
- string describing the attributes (seperated by SEPARATOR) to our aspectpublic AspectAccessAdapter getAccessAdapter()
public void setAccessAdapter(AspectAccessAdapter pAccessAdapter)
pAccessAdapter
- the adapter to use, must not be nullpublic boolean isEditable()
isEditable
in interface ValueModel<T>
public String getAspectName()
public ValueModel<? extends S> getTrigger()
public void dispose()
dispose
in interface ValueModel<T>
dispose
in class AbstractValueModel<T>
public void setValue(T pValue, boolean pIsSetForced)
setValue
in interface ValueModel<T>
pValue
- the new value (null is o.k.)pIsSetForced
- true if a forced setValue should be doneUnsupportedOperationException
- if this ValueModel is not mutablepublic T getValue()
getValue
in interface ValueModel<T>
public Object getValue(Object pValue)
getValue
in interface DelegateAccess
pValue
- the value we should assume as our valuepublic void signalExternalUpdate()
signalExternalUpdate
in interface ExternalUpdate
signalExternalUpdate
in class AbstractValueModel<T>
public void stateChanged(ChangeEvent pEvent)
stateChanged
in interface ChangeListener
pEvent
- a ChangeEvent objectCopyright © 2017 Jürgen Zeller (privat). All rights reserved.