com.iternum.swlink
Class Linker

java.lang.Object
  extended bycom.iternum.swlink.Linker

public final class Linker
extends java.lang.Object

Multi purpose linker factory class. Provides various methods that enable creation of links with a single line of code.

Author:
Karl Banke

Method Summary
static Link createDelegateLink(java.lang.Object pSource, java.lang.Object pTarget, java.lang.Class pActivatorType, java.lang.String pMethod, boolean pPassSource, boolean pPassExtraArgs, boolean pIsReentrant, java.util.Map pActivatorParam)
          Creates a delegate method link from a source object to a target object.
static Link createDelegateLink(java.lang.Object pSource, java.lang.Object pTarget, java.lang.String pMethod, java.lang.Class pActivatorType)
          Convenience method that creates a delegate method link from a source object to a target object.
static Link createDelegateLink(java.lang.Object pSource, java.lang.Object pTarget, java.lang.String pSourcePath, java.lang.String pTargetPath, Activator pActivator, java.lang.String pMethod, boolean pPassSource, boolean pPassExtraArgs, boolean pIsReentrant)
          Creates a delegate method link from a source object to a target object.
static Link createDelegateLink(java.lang.Object pSource, java.lang.Object pTarget, java.lang.String pSourcePath, java.lang.String pTargetPath, java.lang.Class pActivatorType, java.lang.String pMethod, boolean pPassSource, boolean pPassExtraArgs, boolean pIsReentrant, java.util.Map pActivatorParam)
          Creates a delegate method link from a source object to a target object.
static Link createLink(java.lang.Object pSource, java.lang.Object pTarget, java.lang.String pTargetPath, java.lang.String pSourcePath, Activator pActivator, Action pLinkAction)
          Create a general unidirectional Link.
static Link createLink(java.lang.Object pSource, java.lang.Object pTarget, java.lang.String pSourcePath, java.lang.String pTargetPath, java.lang.Class pActivatorType, java.lang.Class pActionType, boolean pIsReentrant, java.util.Map pActivatorParam, java.util.Map pActionParam)
          Generic factory method for a one way link.
static Link createPropertySyncLink(java.lang.Object pSource, java.lang.Object pTarget, java.lang.String pSourceProperty, java.lang.String pTargetProperty, boolean pIsBidirectional, boolean pIsReentrant)
          Creates an (optionally bidirectional) synchronization between two property change methods.
static Link createPropertySyncLink(java.lang.Object pSource, java.lang.Object pTarget, java.lang.String pSourceProperty, java.lang.String pTargetProperty, boolean pIsBidirectional, boolean pIsReentrant, Activator pSourceActivator, Activator pTargetActivator)
          Creates an (optionally bidirectional) synchronization between two property change methods.
static Link createPropertySyncLink(java.lang.Object pSource, java.lang.Object pTarget, java.lang.String pSourceProperty, java.lang.String pTargetProperty, java.lang.Class pSourceActivatorType, java.lang.Class pTargetActivatorType, boolean pIsBidirectional, boolean pIsReentrant, java.util.Map pSourceActivatorParam, java.util.Map pTargetActivatorParam)
          Creates an (optionally bidirectional) synchronization between two property change methods.
static Link createTwowayLink(java.lang.Object pSource, java.lang.Object pTarget, java.lang.String pSourcePath, java.lang.String pTargetPath, Activator pActivator, Action pLinkAction, Activator pReverseActivator, Action pReverseLinkAction)
          Creates a general bidirectional Link.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createPropertySyncLink

public static final Link createPropertySyncLink(java.lang.Object pSource,
                                                java.lang.Object pTarget,
                                                java.lang.String pSourceProperty,
                                                java.lang.String pTargetProperty,
                                                java.lang.Class pSourceActivatorType,
                                                java.lang.Class pTargetActivatorType,
                                                boolean pIsBidirectional,
                                                boolean pIsReentrant,
                                                java.util.Map pSourceActivatorParam,
                                                java.util.Map pTargetActivatorParam)
Creates an (optionally bidirectional) synchronization between two property change methods. User this method that the link is activated by Activators of the passed types from both target and source. If one of the passed activators is null, the activation is assumed to occur using PropertyChangeEvents where the property name of the PropertyChangeEvent must match the property to be synchronized.

Parameters:
pSource - The source of the link
pTarget - The target of the link
pSourceProperty - The property of the source to be synchronized
pTargetProperty - The property of the target to be synchronized
pSourceActivatorType - The Class of the source activator
pTargetActivatorType - The activiator type used activating form the target side in case of a bidirectional link
pIsBidirectional - true if link is bidirectional
pIsReentrant - true if the link is reentrant
pSourceActivatorParam - Optional parametrization of the source activator
pTargetActivatorParam - Optional parametrization of the target activator
Returns:
A Link

createPropertySyncLink

public static final Link createPropertySyncLink(java.lang.Object pSource,
                                                java.lang.Object pTarget,
                                                java.lang.String pSourceProperty,
                                                java.lang.String pTargetProperty,
                                                boolean pIsBidirectional,
                                                boolean pIsReentrant,
                                                Activator pSourceActivator,
                                                Activator pTargetActivator)
Creates an (optionally bidirectional) synchronization between two property change methods. User this method that the link is activated by Activators of the passed types from both target and source. If one of the passed activators is null, the activation is assumed to occur using PropertyChangeEvents where the property name of the PropertyChangeEvent must match the property to be synchronized.

Parameters:
pSource - The source of the link
pTarget - The target of the link
pSourceProperty - The property of the source to be synchronized
pTargetProperty - The property of the target to be synchronized
pIsBidirectional - true if link is bidirectional
pIsReentrant - true if the link is reentrant
pSourceActivator - The source activator
pTargetActivator - The activiator used activating from the target side in case of a bidirectional link
Returns:
A Link

createPropertySyncLink

public static final Link createPropertySyncLink(java.lang.Object pSource,
                                                java.lang.Object pTarget,
                                                java.lang.String pSourceProperty,
                                                java.lang.String pTargetProperty,
                                                boolean pIsBidirectional,
                                                boolean pIsReentrant)
Creates an (optionally bidirectional) synchronization between two property change methods. User this method that the link is activated by PropertyChangeEvents from either end, where the property name of the PropertyChangeEvent must match the property to be synchronized.

Parameters:
pSource - - The source
pTarget - - The target
pSourceProperty - - The property name of the source or a property path
pTargetProperty - - The property of the target or a property path
pIsBidirectional - - true if the synchronization is bidirectional.
pIsReentrant - - true if the property accepts changes before the original call returns.
Returns:
Link - The Link that has been created

createDelegateLink

public static final Link createDelegateLink(java.lang.Object pSource,
                                            java.lang.Object pTarget,
                                            java.lang.String pMethod,
                                            java.lang.Class pActivatorType)
Convenience method that creates a delegate method link from a source object to a target object.

Parameters:
pSource - The source object
pTarget - The target object
pMethod - The name of the method to call on the target object
pActivatorType - The type of the source activator
Returns:
The created link

createDelegateLink

public static final Link createDelegateLink(java.lang.Object pSource,
                                            java.lang.Object pTarget,
                                            java.lang.Class pActivatorType,
                                            java.lang.String pMethod,
                                            boolean pPassSource,
                                            boolean pPassExtraArgs,
                                            boolean pIsReentrant,
                                            java.util.Map pActivatorParam)
Creates a delegate method link from a source object to a target object.

Parameters:
pSource - The source object
pTarget - The target object
pActivatorType - The type of the source activator
pMethod - The name of the method to call on the target object
pPassSource - true if the source is passed in the call
pPassExtraArgs - true if the extra args are passed in the call
pIsReentrant - true if the action in the link is reentrant
pActivatorParam - Optional parametrization of the source activator
Returns:
The created link

createDelegateLink

public static final Link createDelegateLink(java.lang.Object pSource,
                                            java.lang.Object pTarget,
                                            java.lang.String pSourcePath,
                                            java.lang.String pTargetPath,
                                            java.lang.Class pActivatorType,
                                            java.lang.String pMethod,
                                            boolean pPassSource,
                                            boolean pPassExtraArgs,
                                            boolean pIsReentrant,
                                            java.util.Map pActivatorParam)
Creates a delegate method link from a source object to a target object.

Parameters:
pSource - The source object
pTarget - The target object
pSourcePath - The (optionally nested) source property path
pTargetPath - The (optionally nested) target property path
pActivatorType - The type of the source activator
pMethod - The name of the method to call on the target object
pPassSource - true if the source is passed in the call
pPassExtraArgs - true if the extra args are passed in the call
pIsReentrant - true if the action in the link is reentrant
pActivatorParam - Optional parametrization of the source activator
Returns:
The created link

createDelegateLink

public static final Link createDelegateLink(java.lang.Object pSource,
                                            java.lang.Object pTarget,
                                            java.lang.String pSourcePath,
                                            java.lang.String pTargetPath,
                                            Activator pActivator,
                                            java.lang.String pMethod,
                                            boolean pPassSource,
                                            boolean pPassExtraArgs,
                                            boolean pIsReentrant)
Creates a delegate method link from a source object to a target object.

Parameters:
pSource - The source object
pTarget - The target object
pSourcePath - The (optionally nested) source property path
pTargetPath - The (optionally nested) target property path
pActivator - The activator for the link
pMethod - The name of the method to call on the target object
pPassSource - true if the source is passed in the call
pPassExtraArgs - true if the extra args are passed in the call
pIsReentrant - true if the action in the link is reentrant
Returns:
The created link

createLink

public static final Link createLink(java.lang.Object pSource,
                                    java.lang.Object pTarget,
                                    java.lang.String pSourcePath,
                                    java.lang.String pTargetPath,
                                    java.lang.Class pActivatorType,
                                    java.lang.Class pActionType,
                                    boolean pIsReentrant,
                                    java.util.Map pActivatorParam,
                                    java.util.Map pActionParam)
Generic factory method for a one way link.

Parameters:
pSource - The source of the link
pTarget - The target of the link
pSourcePath - The path to resolve the source to an (optional) nested proprty
pTargetPath - The path to resolve the target to an (optional) nested proprty
pActivatorType - The activator class name
pActionType - The action class name
pIsReentrant - true if the action is reentrant
pActivatorParam - The optional parameter for the activator
pActionParam - The action param
Returns:
The Link created

createLink

public static Link createLink(java.lang.Object pSource,
                              java.lang.Object pTarget,
                              java.lang.String pTargetPath,
                              java.lang.String pSourcePath,
                              Activator pActivator,
                              Action pLinkAction)
Create a general unidirectional Link.

Parameters:
pSource - The source
pTarget - The target
pSourcePath - The path to resolve the source to an (optional) nested proprty
pTargetPath - The path to resolve the target to an (optional) nested proprty
pActivator - The activator
pLinkAction - The action
Returns:
A Link

createTwowayLink

public static Link createTwowayLink(java.lang.Object pSource,
                                    java.lang.Object pTarget,
                                    java.lang.String pSourcePath,
                                    java.lang.String pTargetPath,
                                    Activator pActivator,
                                    Action pLinkAction,
                                    Activator pReverseActivator,
                                    Action pReverseLinkAction)
Creates a general bidirectional Link.

Parameters:
pSource - The source
pTarget - The target
pSourcePath - The path to resolve the source to an (optional) nested proprty
pTargetPath - The path to resolve the target to an (optional) nested proprty
pActivator - The activator
pLinkAction - The action
pReverseActivator - The reverse activator
pReverseLinkAction - The reverse action
Returns:
A Link