Class ChainedArgs

java.lang.Object
de.intarsys.tools.functor.ChainedArgs
All Implemented Interfaces:
IArgs

public class ChainedArgs extends Object implements IArgs
An IArgs implementation allowing to concat two IArgs together. Lookup will be performed in "args" first. If nothing is found, lookup is done in "fallbackArgs".
  • Constructor Details

    • ChainedArgs

      public ChainedArgs(IArgs args, IArgs fallbackArgs)
      Create new ChainedArgs where args are always looked up first. If lookup fails, fallbackArgs are used.
      Parameters:
      args - The main IArgs to use for lookup
      fallbackArgs - The fallback IArgs for lookup
  • Method Details

    • add

      public void add(Object object)
      Specified by:
      add in interface IArgs
    • clear

      public void clear()
      Specified by:
      clear in interface IArgs
    • get

      public Object get(int index)
      Description copied from interface: IArgs
      The argument at position index.
      Specified by:
      get in interface IArgs
      Parameters:
      index - The index of the argument to return.
      Returns:
      The argument at position index.
    • get

      public Object get(int index, Object defaultValue)
      Description copied from interface: IArgs
      The argument at position index
      Specified by:
      get in interface IArgs
      Parameters:
      index - The index of the argument to return.
      defaultValue - The default value to be returned if argument is not available.
      Returns:
      The argument at position index
    • get

      public Object get(String name)
      Description copied from interface: IArgs
      The argument named name.
      Specified by:
      get in interface IArgs
      Parameters:
      name - The name of the argument to return.
      Returns:
      The argument named name .
    • get

      public Object get(String name, Object defaultValue)
      Description copied from interface: IArgs
      The argument named name or the defaultValue if not available.
      Specified by:
      get in interface IArgs
      Parameters:
      name - The name of the argument to return.
      defaultValue - The default value to be returned if argument is not available.
      Returns:
      The argument named name
    • getArgs

      public IArgs getArgs()
      The main (primary) IArgs.
      Returns:
      The main (primary) IArgs.
    • getFallbackArgs

      public IArgs getFallbackArgs()
      The fallback (secondary) IArgs;
      Returns:
      The fallback (secondary) IArgs;
    • isDefined

      public boolean isDefined(int index)
      Description copied from interface: IArgs
      true if an argument at index is defined.
      Specified by:
      isDefined in interface IArgs
      Parameters:
      index -
      Returns:
      true if an argument at index is defined.
    • isDefined

      public boolean isDefined(String name)
      Description copied from interface: IArgs
      true if an argument named name is defined.
      Specified by:
      isDefined in interface IArgs
      Parameters:
      name -
      Returns:
      true if an argument named name 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.

      Specified by:
      isIndexed in interface IArgs
      Returns:
      true if this argument list is indexed.
    • 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.

      Specified by:
      isNamed in interface IArgs
      Returns:
      true if this argument list is named.
    • names

      public Set 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.
      Specified by:
      names in interface IArgs
      Returns:
      The set of all argument names in the argument list if this argument list is not indexed or null.
    • put

      public void put(int index, Object value)
      Specified by:
      put in interface IArgs
    • put

      public void put(String name, Object value)
      Specified by:
      put in interface IArgs
    • size

      public int size()
      Description copied from interface: IArgs
      The total number of arguments.
      Specified by:
      size in interface IArgs
      Returns:
      The total number of arguments.
    • toString

      public String toString()
      Overrides:
      toString in class Object