Class ProxyImpl
- All Implemented Interfaces:
EventListener
The proxy property does not transport private properties or properties with null values (or what the IProxyImplementor refuses): these are left out of the target, and a property that stops qualifying is removed from it. A property carrying an error IS transported, and its error travels with the clone.
Echo suppression between the two instances of a bidirectional pair: every mirrored operation marks the property it is about to touch in the opposite instance, on the CURRENT THREAD, so that the event the operation fires there is not mirrored back. The slot is saved and restored around the operation in a finally block, so a nested operation cannot clear the outer one's slot, an exception cannot leave it pinned, and a thread never sees the slot of another thread.
- Author:
- Christopher Mindus
Field Summary
FieldsConstructor Summary
ConstructorsConstructorDescriptionProxyImpl(PropCnr source, PropCnr target, IProxyRemovedListener sourceRemoved, IProxyImplementor proxyImplementor) Constructs the proxy implementation.Method Summary
Modifier and TypeMethodDescriptionvoidassignOppositeProxy(ProxyImpl oppositeProxy) Assigns the opposite proxy in case two directional updates is used.voiddispose()Disposes of the proxy implementation.voidSource events.voidsetDebug(boolean on) Enables debugging output of operations.voidReplicates the entire source to target structure for all properties that should be proxied.
Field Details
target
The target property container.source
The source property container.
Constructor Details
ProxyImpl
public ProxyImpl(PropCnr source, PropCnr target, IProxyRemovedListener sourceRemoved, IProxyImplementor proxyImplementor) Constructs the proxy implementation.- Parameters:
source- The source property container.target- The target property container.sourceRemoved- Callback if the source is removed, null for none.proxyImplementor- The proxy implementor that decides which properties to proxy, null for none (i.e. all non-private properties).
Method Details
assignOppositeProxy
Assigns the opposite proxy in case two directional updates is used.- Parameters:
oppositeProxy- The opposite proxy implementation for target-to-source proxy.
setDebug
public void setDebug(boolean on) Enables debugging output of operations.- Parameters:
on- The debug flag.
dispose
public void dispose()Disposes of the proxy implementation. Called by the owner, byonDisposed(GEvent)when the source is disposed of, and bytargetDisposedwhen the target is.syncSourceToTarget
public void syncSourceToTarget()Replicates the entire source to target structure for all properties that should be proxied.onEvent
Source events.- Specified by:
onEventin interfaceEventListener- Parameters:
e- The event.