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 TypeMethodDescriptionvoidvoidclear()static DeclaredArgscreateStrict(IArgs args) static DeclaredArgscreateStrictIfDeclared(IArgs args) static DeclaredArgscreateTransparent(IArgs args) protected voiddeclare(IFunctorCall call, ArgumentDeclaration argDecl) protected voiddeclare(IFunctorCall call, String name, int index, IFunctor defaultFunctor) get(int pIndex) The argument at positionindex.The argument at positionindexThe argument namedname.The argument namednameor the defaultValue if not available.booleanisDefined(int index) trueif an argument atindexis defined.booleantrueif an argument namednameis defined.booleantrueif this argument list is indexed.protected booleanisLazy()booleanisNamed()trueif this argument list is named.protected booleanisStrict()names()The set of all argument names in the argument list if this argument list is not indexed or null.voidvoidprotected voidsetLazy(boolean lazy) protected voidsetStrict(boolean strict) intsize()The total number of arguments.protected voidtoString()
-
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:IArgsThe argument at positionindex. -
get
Description copied from interface:IArgsThe argument at positionindex -
get
Description copied from interface:IArgsThe argument namedname. -
get
Description copied from interface:IArgsThe argument namednameor the defaultValue if not available. -
getArgsIn
-
isDefined
public boolean isDefined(int index) Description copied from interface:IArgstrueif an argument atindexis defined. -
isDefined
Description copied from interface:IArgstrueif an argument namednameis defined. -
isIndexed
public boolean isIndexed()Description copied from interface:IArgstrueif 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:IArgstrueif 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:IArgsThe 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:IArgsThe total number of arguments. -
switchArgs
protected void switchArgs() -
toString
-