org.argouml.uml.generator
Class PropertySpecialString

java.lang.Object
  extended byorg.argouml.uml.generator.PropertySpecialString

class PropertySpecialString
extends 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 (Model.getFacade().isAStructuralFeature(element))
                     Model.getFacade().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  String name
           
private  PropertyOperation op
           
 
Constructor Summary
PropertySpecialString(String str, PropertyOperation propop)
          Constructs a new PropertySpecialString that will invoke the action in op when invoke(Object, String, String) is called with name equal to str and then return true from invoke.
 
Method Summary
 boolean invoke(Object element, String pname, String value)
          Called by ParserDisplay.setProperties(Object, Vector, PropertySpecialString[]) 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 String name

op

private PropertyOperation op
Constructor Detail

PropertySpecialString

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

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

invoke

public boolean invoke(Object element,
                      String pname,
                      String value)
Called by ParserDisplay.setProperties(Object, Vector, PropertySpecialString[]) 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:
pname - The name of a property.
value - The value of a property.
Returns:
true if an action is performed, otherwise false.


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