net.sf.mmm.util.cli.base
Class AbstractCliValueContainerContainer

java.lang.Object
  extended by net.sf.mmm.util.cli.base.AbstractCliValueContainer
      extended by net.sf.mmm.util.cli.base.AbstractCliValueContainerContainer
All Implemented Interfaces:
CliValueContainer
Direct Known Subclasses:
CliValueContainerCollection, CliValueContainerMap

public abstract class AbstractCliValueContainerContainer
extends AbstractCliValueContainer

This is the abstract base class for a CliValueContainer that holds a container-value.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  boolean valueAlreadySet
           
 
Constructor Summary
AbstractCliValueContainerContainer(CliParameterContainer parameterContainer, CliState cliState, CliParserDependencies dependencies, org.slf4j.Logger logger)
          The constructor.
 
Method Summary
 boolean isArrayMapOrCollection()
          
 void setValue(String argument)
          This method sets the value given as string.
protected abstract  void setValueEntry(String entry, GenericType<?> propertyType)
          This method is like setValue(String) but for a single entry.
protected abstract  void setValueInternal(Object containerValue)
          This method sets the container value as new object.
protected  void setValueInternal(String argument, char separator, GenericType<?> propertyType)
          This method parses container value as from a single argument and sets it as new object.
 
Methods inherited from class net.sf.mmm.util.cli.base.AbstractCliValueContainer
getCliState, getDependencies, getLogger, getParameterContainer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.mmm.util.cli.base.CliValueContainer
getValue
 

Field Detail

valueAlreadySet

private boolean valueAlreadySet
See Also:
setValueInternal(String, char, GenericType)
Constructor Detail

AbstractCliValueContainerContainer

public AbstractCliValueContainerContainer(CliParameterContainer parameterContainer,
                                          CliState cliState,
                                          CliParserDependencies dependencies,
                                          org.slf4j.Logger logger)
The constructor.

Parameters:
parameterContainer - is the parameter-container.
cliState - is the state.
dependencies - are the dependencies.
logger - is the logger.
Method Detail

setValue

public void setValue(String argument)
This method sets the value given as string. For the parameter-types array, collection or map this method may be called multiple times, one for each item.

Parameters:
argument - is the argument from the commandline containing the value.

setValueInternal

protected void setValueInternal(String argument,
                                char separator,
                                GenericType<?> propertyType)
This method parses container value as from a single argument and sets it as new object.

Parameters:
argument - is the argument representing the container as string.
separator - is the character used as separator for the container values.
propertyType - is the GenericType of the property.

setValueInternal

protected abstract void setValueInternal(Object containerValue)
This method sets the container value as new object.

Parameters:
containerValue - is the container value to set.

setValueEntry

protected abstract void setValueEntry(String entry,
                                      GenericType<?> propertyType)
This method is like setValue(String) but for a single entry.

Parameters:
entry - is a single collection-entry given as string.
propertyType - is the GenericType of the container.
See Also:
CliContainerStyle.MULTIPLE_OCCURRENCE

isArrayMapOrCollection

public final boolean isArrayMapOrCollection()

Specified by:
isArrayMapOrCollection in interface CliValueContainer
Overrides:
isArrayMapOrCollection in class AbstractCliValueContainer
Returns:
true if this is a container for a value of the type array, Collection or Map - false otherwise.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.