org.argouml.uml.generator
Class PropertySpecialString
java.lang.Object
org.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[])
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
name
private String name
op
private PropertyOperation op
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.
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
.