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 forIDeclarationElement
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
Constructors Constructor Description DeclarationElement(java.lang.Object declarationContext, java.lang.String name, java.lang.String modifiers)
DeclarationElement(java.lang.Object declarationContext, java.lang.String name, java.lang.String modifiers, IDeclaration[] nestedDeclarations)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IDeclaration[]
getDeclarations()
The array ofIDeclaration
instances in this block.java.lang.String
getName()
An optional name for the declaration element.boolean
hasModifier(java.lang.String modifier)
true
if the declaration has the requested modifier.boolean
isBlock()
true
if this declaration has child elements itself.int
size()
The number of declarations in this block.java.lang.String
toString()
-
Methods inherited from class de.intarsys.tools.functor.Declaration
getDeclarationContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.intarsys.tools.functor.IDeclaration
accept, getDeclarationContext
-
-
-
-
Constructor Detail
-
DeclarationElement
public DeclarationElement(java.lang.Object declarationContext, java.lang.String name, java.lang.String modifiers)
-
DeclarationElement
public DeclarationElement(java.lang.Object declarationContext, java.lang.String name, java.lang.String modifiers, IDeclaration[] nestedDeclarations)
-
-
Method Detail
-
getDeclarations
public IDeclaration[] getDeclarations()
Description copied from interface:IDeclarationBlock
The array ofIDeclaration
instances in this block.- Specified by:
getDeclarations
in interfaceIDeclarationBlock
- Returns:
- The array of
IDeclaration
instances in this block.
-
getName
public java.lang.String getName()
Description copied from interface:IDeclarationElement
An optional name for the declaration element.- Specified by:
getName
in interfaceIDeclarationElement
- Returns:
- An optional name for the declaration element.
-
hasModifier
public boolean hasModifier(java.lang.String modifier)
Description copied from interface:IDeclarationElement
true
if 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:
hasModifier
in interfaceIDeclarationElement
- Parameters:
modifier
- The modifier name.- Returns:
true
if the declaration has the requested modifier.
-
isBlock
public boolean isBlock()
Description copied from interface:IDeclaration
true
if this declaration has child elements itself.A
IDeclarationElement
may be aIDeclarationBlock
, supporting nested declarations. You should not use "instanceof IDeclarationBlock" to check this behavior but this method.- Specified by:
isBlock
in interfaceIDeclaration
- Overrides:
isBlock
in classDeclaration
- Returns:
true
if this declaration has child elements itself.
-
size
public int size()
Description copied from interface:IDeclarationBlock
The number of declarations in this block.- Specified by:
size
in interfaceIDeclarationBlock
- Returns:
- The number of declarations in this block.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-