Package de.intarsys.tools.functor
Class DeclarationElement
java.lang.Object
de.intarsys.tools.functor.Declaration
de.intarsys.tools.functor.DeclarationElement
- All Implemented Interfaces:
IDeclaration,IDeclarationBlock,IDeclarationElement
- Direct Known Subclasses:
ArgumentDeclaration
public abstract class DeclarationElement
extends Declaration
implements IDeclarationElement, IDeclarationBlock
A common superclass for
IDeclarationElement instances. This one has a
very simple implementation for modifiers. Only the presence of the modifier
string fragment in declared modifier string is checked.-
Constructor Summary
ConstructorsConstructorDescriptionDeclarationElement(Object declarationContext, String name, String modifiers) DeclarationElement(Object declarationContext, String name, String modifiers, IDeclaration[] nestedDeclarations) -
Method Summary
Modifier and TypeMethodDescriptionThe array ofIDeclarationinstances in this block.getName()An optional name for the declaration element.booleanhasModifier(String modifier) trueif the declaration has the requested modifier.booleanisBlock()trueif this declaration has child elements itself.intsize()The number of declarations in this block.toString()Methods inherited from class de.intarsys.tools.functor.Declaration
getDeclarationContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface de.intarsys.tools.functor.IDeclaration
accept, getDeclarationContext
-
Constructor Details
-
DeclarationElement
-
DeclarationElement
public DeclarationElement(Object declarationContext, String name, String modifiers, IDeclaration[] nestedDeclarations)
-
-
Method Details
-
getDeclarations
Description copied from interface:IDeclarationBlockThe array ofIDeclarationinstances in this block.- Specified by:
getDeclarationsin interfaceIDeclarationBlock- Returns:
- The array of
IDeclarationinstances in this block.
-
getName
Description copied from interface:IDeclarationElementAn optional name for the declaration element.- Specified by:
getNamein interfaceIDeclarationElement- Returns:
- An optional name for the declaration element.
-
hasModifier
Description copied from interface:IDeclarationElementtrueif the declaration has the requested modifier.An implementation is free to support modifiers and define their respective semantics.
An example for a modifier may be "persistent" to indicate the implementation should store argument values to be able to present them again in a later call (in a wizard for example).
- Specified by:
hasModifierin interfaceIDeclarationElement- Parameters:
modifier- The modifier name.- Returns:
trueif the declaration has the requested modifier.
-
isBlock
public boolean isBlock()Description copied from interface:IDeclarationtrueif this declaration has child elements itself.A
IDeclarationElementmay be aIDeclarationBlock, supporting nested declarations. You should not use "instanceof IDeclarationBlock" to check this behavior but this method.- Specified by:
isBlockin interfaceIDeclaration- Overrides:
isBlockin classDeclaration- Returns:
trueif this declaration has child elements itself.
-
size
public int size()Description copied from interface:IDeclarationBlockThe number of declarations in this block.- Specified by:
sizein interfaceIDeclarationBlock- Returns:
- The number of declarations in this block.
-
toString
-