org.argouml.uml.generator
Class PropertySpecialString

java.lang.Object
  |
  +--org.argouml.uml.generator.PropertySpecialString

class PropertySpecialString
extends java.lang.Object

Declares a string that should take special action when it is found as a property in ParserDisplay.setProperties.

Example:

  _attributeSpecialStrings[0] = new PropertySpecialString("frozen",
	new PropertyOperation() {
	    public void found(Object element, String value) {
		if (ModelFacade.isAStructuralFeature(element))
		    ModelFacade.setChangeable(element, (value != null && value.equalsIgnoreCase("false")));
	    }
	});

Taken from the ParserDisplay constructor. It creates a PropertySpecialString that is invoken when the String "frozen" is found as a property name. Then the found mehod in the anonymous inner class defined on the 2nd line is invoked and performs a custom action on the element on which the property was specified by the user. In this case it does a setChangeability on an attribute instead of setting a tagged value, which would not have the desired effect.

Since:
0.11.2
See Also:
PropertyOperation, ParserDisplay.setProperties(java.lang.Object, java.util.Vector, org.argouml.uml.generator.PropertySpecialString[])

Field Summary
private  java.lang.String _name
           
private  PropertyOperation _op
           
 
Constructor Summary
PropertySpecialString(java.lang.String str, PropertyOperation op)
          Constructs a new PropertySpecialString that will invoke the action in op when invoke is called with name equal to str and then return true from invoke.
 
Method Summary
 boolean invoke(java.lang.Object element, java.lang.String name, java.lang.String value)
          Called by ParserDisplay.setProperties while searching for an action to invoke for a property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_name

private java.lang.String _name

_op

private PropertyOperation _op
Constructor Detail

PropertySpecialString

public PropertySpecialString(java.lang.String str,
                             PropertyOperation op)
Constructs a new PropertySpecialString that will invoke the action in op when invoke is called with name equal to str and then return true from invoke.

Parameters:
str - The name of this PropertySpecialString.
op - An object containing the method to invoke on a match.
Method Detail

invoke

public boolean invoke(java.lang.Object element,
                      java.lang.String name,
                      java.lang.String value)
Called by ParserDisplay.setProperties while searching for an action to invoke for a property. If it returns true, then setProperties may assume that all required actions have been taken and stop searching.

Parameters:
name - The name of a property.
value - The value of a property.
Returns:
true if an action is performed, otherwise false.


ArgoUML © 1996-2004 (20040306)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook