Class SmartListenerConfig
- java.lang.Object
 - 
- com.nomagic.uml2.ext.jmi.smartlistener.SmartListenerConfig
 
 
- 
@OpenApiAll public class SmartListenerConfig extends java.lang.ObjectSmart listener configuration describes how to reach a specific property in the model from a given model element. Smart listener uses the configuration to create a chain of properties through which listener events map.
This class also contains predefined smart listener configurations which can be widely reused. Reusable smart listener configurations cannot be modified.
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static SmartListenerConfigAPPLIED_STEREOTYPE_AND_TAGGED_VALUE_SHALLOW_CONFIGListens to applied stereotypes and tagged values values.static SmartListenerConfigAPPLIED_STEREOTYPE_CONFIGListen to the applied stereotype.static SmartListenerConfigAPPLIED_STEREOTYPE_NAME_AND_TAGGED_VALUE_DEEP_CONFIGListens to applied stereotype's name, tagged value values and tag definition properties.static SmartListenerConfigAPPLIED_STEREOTYPE_NAME_CONFIGListen to the applied stereotype's name.static SmartListenerConfigAPPLIED_STEREOTYPE_NAME_ICON_AND_TAGGED_VALUE_DEEP_CONFIGListens to applied stereotype (name and icon), tagged values (value and names of values), tag definition's name.static SmartListenerConfigAPPLIED_STEREOTYPE_NAME_ICON_AND_TAGGED_VALUE_SHALLOW_CONFIGListens to applied stereotype (name and icon), tagged values values.static SmartListenerConfigAPPLIED_STEREOTYPE_NAME_ICON_CONFIGListen to the applied stereotype's name and iconstatic SmartListenerConfigCOMBINED_FRAGMENT_CONFIGListens to combined fragment.static SmartListenerConfigCONVEYED_INFORMATION_CONFIGListens to conveyed information.static SmartListenerConfigDIAGRAM_CONTEXT_CONFIGListens to diagram context.static SmartListenerConfigDOCUMENTATION_CONFIGListen to the documentation of the element.static SmartListenerConfigEMPTY_CONFIGConfiguration that does not listen to any propertiesstatic SmartListenerConfigINSTANCE_SLOT_VALUE_CONFIGListen to properties of Slot of InstanceSpecification.static SmartListenerConfigMESSAGE_CONFIGListens to the message.static SmartListenerConfigMESSAGE_SIGNATURE_CONFIGListens to message signature.static SmartListenerConfigMULTIPLICITY_CONFIGListens to the multiplicity.static SmartListenerConfigNAME_CONFIGListen to the name of the element.static SmartListenerConfigPARAMETER_SUBSTITUTION_CONFIGListens to parameter substitution.static SmartListenerConfigQUALIFIED_NAME_CONFIGListen to the qualified name of the element.private java.util.Map<java.lang.String,SmartListenerConfig>referencesReferences which can be reached from this configuration.static SmartListenerConfigSLOT_VALUE_CONFIGListen to the value of Slot.static SmartListenerConfigSTEREOTYPE_METACLASS_CONFIGListen to the metaclass of Stereotype.static SmartListenerConfigTAGGED_VALUE_DEEP_CONFIGListens to applied tagged values properties.static SmartListenerConfigTAGGED_VALUE_SHALLOW_CONFIGListens to applied tagged values values.static SmartListenerConfigTRANSITION_CONFIGListens to transition.static SmartListenerConfigTRIGGER_CONFIGListens to trigger.private booleanunmodifiableIndicates if smart listener config is unmodifiable.static SmartListenerConfigVALUE_OF_TAGGED_VALUE_CONFIGListen to the properties of values of TaggedValue.static SmartListenerConfigVALUE_SPECIFICATION_CONFIGListen to properties of ValueSpecification. 
- 
Constructor Summary
Constructors Constructor Description SmartListenerConfig()Constructs empty configuration.SmartListenerConfig(java.lang.String propertyName)Constructs the configuration with a property name.SmartListenerConfig(java.lang.String propertyName, SmartListenerConfig config)Constructs the configuration.SmartListenerConfig(java.util.Map<java.lang.String,SmartListenerConfig> references)Constructs the configuration. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private static java.lang.StringbuildSpace(int number)private voidcheckUnmodifiable()Checks if smart listener configuration can be modified.voidcopy(SmartListenerConfig config)Makes a shallow copy of the passed config to this config.private static SmartListenerConfigcreateElementAsValueConfig()SmartListenerConfigdeepCopy()Creates a deep copy of the specified smart listener config.voiddeepCopy(SmartListenerConfig config)Deep copies a passed config to this config.private voiddeepCopyImpl(SmartListenerConfig config, java.util.Map<SmartListenerConfig,SmartListenerConfig> alreadyClonedConfigs)Deep copies passed config to this config.private static SmartListenerConfigdoMerge(java.util.Collection<SmartListenerConfig> configurations)Performs configuration merge.voiddump()Dumps property configuration to the standard output.private voiddump(java.util.Set<SmartListenerConfig> configs, int delta)Dumps property configurations to the standard output.SmartListenerConfiggetPropertyConfig(java.lang.String propertyName)Gets property config which is used for a particular property.java.util.Map<java.lang.String,SmartListenerConfig>getReferences()Gets references of this configuration.static voidinitValueSpecificationConfig(SmartListenerConfig valueSpecificationConfig, SmartListenerConfig elementAsValueConfig)Initializes value specification config.SmartListenerConfiglistenTo(SmartListenerConfig config)Merges information from given config.SmartListenerConfiglistenTo(java.lang.String propertyName)Listens to a given property name.SmartListenerConfiglistenTo(java.lang.String... propertyNames)Listens to given properties' names.SmartListenerConfiglistenTo(java.lang.String referenceName, SmartListenerConfig config)Listens to a given property and passes a smart listener configuration for it to apply if references are found among property values.SmartListenerConfiglistenTo(java.util.Collection<java.lang.String> propertyNames)Listens to given properties' names.SmartListenerConfiglistenTo2(java.lang.String referenceName, SmartListenerConfig config)Deprecated.uselistenTo(String, SmartListenerConfig), because it merges configs too.SmartListenerConfiglistenToNested(java.lang.String propertyName)Listens to a nested property configuration.private SmartListenerConfiglistenToOld(java.lang.String referenceName, SmartListenerConfig config)private static voidmakePredefinedConfigsUnmodifiable()voidmakeUnmodifiable()Make config unmodifiable.private voidmakeUnmodifiable(java.util.Set<SmartListenerConfig> alreadyVisited)Makes config unmodifiable.static SmartListenerConfigmergeConfigurations(SmartListenerConfig c1, SmartListenerConfig c2)Merges two configurations into a single configuration.static SmartListenerConfigmergeConfigurations(java.util.Collection<SmartListenerConfig> configurations)Merges given configurations into a single configuration.private static voidreplaceConfigInstances(SmartListenerConfig replaceWith, SmartListenerConfig config, java.util.List<SmartListenerConfig> configsToReplace, java.util.Set<SmartListenerConfig> checkedConfigs)Replaces config instances with other instances in a given config tree. 
 - 
 
- 
- 
Field Detail
- 
references
private java.util.Map<java.lang.String,SmartListenerConfig> references
References which can be reached from this configuration. 
- 
unmodifiable
private boolean unmodifiable
Indicates if smart listener config is unmodifiable. 
- 
NAME_CONFIG
public static final SmartListenerConfig NAME_CONFIG
Listen to the name of the element. 
- 
DOCUMENTATION_CONFIG
public static final SmartListenerConfig DOCUMENTATION_CONFIG
Listen to the documentation of the element. 
- 
QUALIFIED_NAME_CONFIG
public static final SmartListenerConfig QUALIFIED_NAME_CONFIG
Listen to the qualified name of the element. 
- 
VALUE_SPECIFICATION_CONFIG
public static final SmartListenerConfig VALUE_SPECIFICATION_CONFIG
Listen to properties of ValueSpecification. 
- 
SLOT_VALUE_CONFIG
public static final SmartListenerConfig SLOT_VALUE_CONFIG
Listen to the value of Slot. 
- 
INSTANCE_SLOT_VALUE_CONFIG
public static final SmartListenerConfig INSTANCE_SLOT_VALUE_CONFIG
Listen to properties of Slot of InstanceSpecification. 
- 
STEREOTYPE_METACLASS_CONFIG
public static final SmartListenerConfig STEREOTYPE_METACLASS_CONFIG
Listen to the metaclass of Stereotype. 
- 
APPLIED_STEREOTYPE_CONFIG
public static final SmartListenerConfig APPLIED_STEREOTYPE_CONFIG
Listen to the applied stereotype. 
- 
APPLIED_STEREOTYPE_AND_TAGGED_VALUE_SHALLOW_CONFIG
public static final SmartListenerConfig APPLIED_STEREOTYPE_AND_TAGGED_VALUE_SHALLOW_CONFIG
Listens to applied stereotypes and tagged values values. 
- 
APPLIED_STEREOTYPE_NAME_CONFIG
public static final SmartListenerConfig APPLIED_STEREOTYPE_NAME_CONFIG
Listen to the applied stereotype's name. 
- 
APPLIED_STEREOTYPE_NAME_ICON_CONFIG
public static final SmartListenerConfig APPLIED_STEREOTYPE_NAME_ICON_CONFIG
Listen to the applied stereotype's name and icon 
- 
APPLIED_STEREOTYPE_NAME_AND_TAGGED_VALUE_DEEP_CONFIG
public static final SmartListenerConfig APPLIED_STEREOTYPE_NAME_AND_TAGGED_VALUE_DEEP_CONFIG
Listens to applied stereotype's name, tagged value values and tag definition properties. 
- 
APPLIED_STEREOTYPE_NAME_ICON_AND_TAGGED_VALUE_DEEP_CONFIG
public static final SmartListenerConfig APPLIED_STEREOTYPE_NAME_ICON_AND_TAGGED_VALUE_DEEP_CONFIG
Listens to applied stereotype (name and icon), tagged values (value and names of values), tag definition's name. 
- 
APPLIED_STEREOTYPE_NAME_ICON_AND_TAGGED_VALUE_SHALLOW_CONFIG
public static final SmartListenerConfig APPLIED_STEREOTYPE_NAME_ICON_AND_TAGGED_VALUE_SHALLOW_CONFIG
Listens to applied stereotype (name and icon), tagged values values. Does not listen deeper (properties of values). 
- 
TAGGED_VALUE_SHALLOW_CONFIG
public static final SmartListenerConfig TAGGED_VALUE_SHALLOW_CONFIG
Listens to applied tagged values values. Does not listen deeper (properties of values). 
- 
TAGGED_VALUE_DEEP_CONFIG
public static final SmartListenerConfig TAGGED_VALUE_DEEP_CONFIG
Listens to applied tagged values properties. 
- 
VALUE_OF_TAGGED_VALUE_CONFIG
public static final SmartListenerConfig VALUE_OF_TAGGED_VALUE_CONFIG
Listen to the properties of values of TaggedValue. 
- 
PARAMETER_SUBSTITUTION_CONFIG
public static final SmartListenerConfig PARAMETER_SUBSTITUTION_CONFIG
Listens to parameter substitution. 
- 
TRIGGER_CONFIG
public static final SmartListenerConfig TRIGGER_CONFIG
Listens to trigger. 
- 
TRANSITION_CONFIG
public static final SmartListenerConfig TRANSITION_CONFIG
Listens to transition. 
- 
MESSAGE_SIGNATURE_CONFIG
public static final SmartListenerConfig MESSAGE_SIGNATURE_CONFIG
Listens to message signature. 
- 
MESSAGE_CONFIG
public static final SmartListenerConfig MESSAGE_CONFIG
Listens to the message. 
- 
COMBINED_FRAGMENT_CONFIG
public static final SmartListenerConfig COMBINED_FRAGMENT_CONFIG
Listens to combined fragment. 
- 
CONVEYED_INFORMATION_CONFIG
public static final SmartListenerConfig CONVEYED_INFORMATION_CONFIG
Listens to conveyed information. 
- 
DIAGRAM_CONTEXT_CONFIG
public static final SmartListenerConfig DIAGRAM_CONTEXT_CONFIG
Listens to diagram context. 
- 
MULTIPLICITY_CONFIG
public static final SmartListenerConfig MULTIPLICITY_CONFIG
Listens to the multiplicity. 
- 
EMPTY_CONFIG
public static final SmartListenerConfig EMPTY_CONFIG
Configuration that does not listen to any properties 
 - 
 
- 
Constructor Detail
- 
SmartListenerConfig
public SmartListenerConfig()
Constructs empty configuration. 
- 
SmartListenerConfig
public SmartListenerConfig(java.lang.String propertyName)
Constructs the configuration with a property name.- Parameters:
 propertyName- property name to use as a reference- See Also:
 listenTo(String)
 
- 
SmartListenerConfig
public SmartListenerConfig(java.lang.String propertyName, SmartListenerConfig config)Constructs the configuration.- Parameters:
 propertyName- property name to use as a referenceconfig- config to use with a property reference- See Also:
 listenTo(String, SmartListenerConfig)
 
- 
SmartListenerConfig
public SmartListenerConfig(java.util.Map<java.lang.String,SmartListenerConfig> references)
Constructs the configuration.- Parameters:
 references- map of references to use
 
 - 
 
- 
Method Detail
- 
makePredefinedConfigsUnmodifiable
private static void makePredefinedConfigsUnmodifiable()
 
- 
createElementAsValueConfig
private static SmartListenerConfig createElementAsValueConfig()
 
- 
initValueSpecificationConfig
public static void initValueSpecificationConfig(SmartListenerConfig valueSpecificationConfig, SmartListenerConfig elementAsValueConfig)
Initializes value specification config.- Parameters:
 valueSpecificationConfig- config to initialize.elementAsValueConfig- element config to use.
 
- 
listenToOld
private SmartListenerConfig listenToOld(java.lang.String referenceName, @CheckForNull SmartListenerConfig config)
 
- 
makeUnmodifiable
public void makeUnmodifiable()
Make config unmodifiable. This means that new references can not be added or existing can not be changed. Any attempt to change unmodifiable config will end up with runtime exception. 
- 
makeUnmodifiable
private void makeUnmodifiable(java.util.Set<SmartListenerConfig> alreadyVisited)
Makes config unmodifiable.- Parameters:
 alreadyVisited- for infinite loop avoiding
 
- 
checkUnmodifiable
private void checkUnmodifiable()
Checks if smart listener configuration can be modified. Logs stack trace if smart listener cannot be modified. 
- 
copy
public void copy(SmartListenerConfig config)
Makes a shallow copy of the passed config to this config. Instances of configs in the tree are reused and not re-created.- Parameters:
 config- passed configuration for copying.
 
- 
deepCopy
public void deepCopy(SmartListenerConfig config)
Deep copies a passed config to this config. Whole config tree is copied by recreating referenced config instances.- Parameters:
 config- config to copy
 
- 
deepCopy
public SmartListenerConfig deepCopy()
Creates a deep copy of the specified smart listener config.- Returns:
 - copy
 
 
- 
deepCopyImpl
private void deepCopyImpl(SmartListenerConfig config, java.util.Map<SmartListenerConfig,SmartListenerConfig> alreadyClonedConfigs)
Deep copies passed config to this config. Whole config tree is copied by recreating referenced config instances.- Parameters:
 config- config to copyalreadyClonedConfigs- holds already cloned configs to avoid looping in the tree
 
- 
getReferences
public java.util.Map<java.lang.String,SmartListenerConfig> getReferences()
Gets references of this configuration.- Returns:
 - references of this configuration
 
 
- 
getPropertyConfig
public SmartListenerConfig getPropertyConfig(java.lang.String propertyName)
Gets property config which is used for a particular property.- Parameters:
 propertyName- property for which to get property config- Returns:
 - property config for a given property
 
 
- 
listenTo
public SmartListenerConfig listenTo(java.lang.String referenceName, @CheckForNull SmartListenerConfig config)
Listens to a given property and passes a smart listener configuration for it to apply if references are found among property values.- Parameters:
 referenceName- property name for which configuration should be applied.config- passed configuration for the property. If for a given property an existing configuration is found, the two configurations will be merged and the merged configuration will be stored.- Returns:
 - self or a merged config if the configurations had to be merged
 
 
- 
replaceConfigInstances
private static void replaceConfigInstances(SmartListenerConfig replaceWith, SmartListenerConfig config, java.util.List<SmartListenerConfig> configsToReplace, java.util.Set<SmartListenerConfig> checkedConfigs)
Replaces config instances with other instances in a given config tree.- Parameters:
 replaceWith- config with which to replaceconfig- config tree in which to perform replacementconfigsToReplace- configs to replacecheckedConfigs- hold traversed configs to avoid infinite loop
 
- 
listenTo2
@Deprecated public SmartListenerConfig listenTo2(java.lang.String referenceName, SmartListenerConfig config)
Deprecated.uselistenTo(String, SmartListenerConfig), because it merges configs too.Makes the same thing aslistenTo(String, SmartListenerConfig). Only if founds already registered property doesn't emit warning, but makes merge with already registered configuration. If configurations are merged, then passedconfigVALUE is replaced with a contents of merge result.- Parameters:
 referenceName- property name for which configuration is applicableconfig- passed configuration. It's VALUE will be edited if another configuration will be found already registered by given reference name. VALUE of passed reference will be changed to the merged one- Returns:
 - self or a merged config if the configurations had to be merged
 
 
- 
listenTo
public SmartListenerConfig listenTo(java.lang.String propertyName)
Listens to a given property name.- Parameters:
 propertyName- property name ot listen to.- Returns:
 - self or a merged config if the configurations had to be merged
 
 
- 
listenTo
public SmartListenerConfig listenTo(java.util.Collection<java.lang.String> propertyNames)
Listens to given properties' names.- Parameters:
 propertyNames- properties' names to listen to- Returns:
 - self
 
 
- 
listenTo
public SmartListenerConfig listenTo(java.lang.String... propertyNames)
Listens to given properties' names.- Parameters:
 propertyNames- properties' names to listen to- Returns:
 - self
 
 
- 
listenToNested
public SmartListenerConfig listenToNested(java.lang.String propertyName)
Listens to a nested property configuration.- Parameters:
 propertyName- property name to listen to.- Returns:
 - property config of a given property, allows performing nested calls.
 
 
- 
listenTo
public SmartListenerConfig listenTo(SmartListenerConfig config)
Merges information from given config.- Parameters:
 config- config- Returns:
 - self
 
 
- 
mergeConfigurations
public static SmartListenerConfig mergeConfigurations(SmartListenerConfig c1, SmartListenerConfig c2)
Merges two configurations into a single configuration.- Parameters:
 c1- first configuration to merge.c2- second configuration to merge.- Returns:
 - merged configuration.
 
 
- 
mergeConfigurations
public static SmartListenerConfig mergeConfigurations(java.util.Collection<SmartListenerConfig> configurations)
Merges given configurations into a single configuration.- Parameters:
 configurations- configurations to merge- Returns:
 - merged configuration
 
 
- 
doMerge
private static SmartListenerConfig doMerge(java.util.Collection<SmartListenerConfig> configurations)
Performs configuration merge.- Parameters:
 configurations- configurations to merge- Returns:
 - merged configuration
 
 
- 
dump
public void dump()
Dumps property configuration to the standard output. 
- 
dump
private void dump(java.util.Set<SmartListenerConfig> configs, int delta)
Dumps property configurations to the standard output.- Parameters:
 configs- configurations to dumpdelta- number of spaces to use as separators
 
- 
buildSpace
private static java.lang.String buildSpace(int number)
 
 - 
 
 -