Package de.intarsys.tools.functor
Class DeclaredArgs
java.lang.Object
de.intarsys.tools.functor.DeclaredArgs
- All Implemented Interfaces:
IArgs
This
IArgs
implementation allows the declaration of arguments.
The declaration is matched against the actual arguments defined in
args
. The declaration defines a mapping from indexed to named
and AND vice versa.
If we have indexed args, a declaration associates a name with the argument in the sequence of declaration.
If we have named args, a declaration defines the index of the argument with the same name.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
clear()
static DeclaredArgs
createStrict
(IArgs args) static DeclaredArgs
createStrictIfDeclared
(IArgs args) static DeclaredArgs
createTransparent
(IArgs args) protected void
declare
(IFunctorCall call, ArgumentDeclaration argDecl) protected void
declare
(IFunctorCall call, String name, int index, IFunctor defaultFunctor) get
(int pIndex) The argument at positionindex
.The argument at positionindex
The argument namedname
.The argument namedname
or the defaultValue if not available.boolean
isDefined
(int index) true
if an argument atindex
is defined.boolean
true
if an argument namedname
is defined.boolean
true
if this argument list is indexed.protected boolean
isLazy()
boolean
isNamed()
true
if this argument list is named.protected boolean
isStrict()
names()
The set of all argument names in the argument list if this argument list is not indexed or null.void
void
protected void
setLazy
(boolean lazy) protected void
setStrict
(boolean strict) int
size()
The total number of arguments.protected void
toString()
-
Constructor Details
-
DeclaredArgs
-
-
Method Details
-
createStrict
-
createStrictIfDeclared
-
createTransparent
-
add
-
clear
public void clear() -
declare
- Throws:
DeclarationException
-
declare
protected void declare(IFunctorCall call, String name, int index, IFunctor defaultFunctor) throws DeclarationException - Throws:
DeclarationException
-
get
Description copied from interface:IArgs
The argument at positionindex
. -
get
Description copied from interface:IArgs
The argument at positionindex
-
get
Description copied from interface:IArgs
The argument namedname
. -
get
Description copied from interface:IArgs
The argument namedname
or the defaultValue if not available. -
getArgsIn
-
isDefined
public boolean isDefined(int index) Description copied from interface:IArgs
true
if an argument atindex
is defined. -
isDefined
Description copied from interface:IArgs
true
if an argument namedname
is defined. -
isIndexed
public boolean isIndexed()Description copied from interface:IArgs
true
if this argument list is indexed. This means its elements are available via integer indexes.This does NOT mean the arguments are not available via names - there are implementations that can support both.
-
isLazy
protected boolean isLazy() -
isNamed
public boolean isNamed()Description copied from interface:IArgs
true
if this argument list is named. This means its elements are available via names.This does NOT mean the arguments are not available via indexes - there are implementations that can support both.
-
isStrict
protected boolean isStrict() -
names
Description copied from interface:IArgs
The set of all argument names in the argument list if this argument list is not indexed or null. -
put
-
put
-
setLazy
protected void setLazy(boolean lazy) -
setStrict
protected void setStrict(boolean strict) -
size
public int size()Description copied from interface:IArgs
The total number of arguments. -
switchArgs
protected void switchArgs() -
toString
-