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

java.lang.Object
  extended by net.sf.mmm.util.cli.base.CliParameterContainer
Direct Known Subclasses:
CliArgumentContainer, CliOptionContainer

public abstract class CliParameterContainer
extends Object

This is the abstract base class for a container with the metadata of a CLI-parameter. A parameter is either an option or an argument.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
See Also:
CliArgumentContainer, CliOptionContainer

Field Summary
private  PojoPropertyAccessorNonArg getter
           
private  PojoPropertyAccessorOneArg setter
           
private  ValueValidator<Object> validator
           
 
Constructor Summary
CliParameterContainer(PojoPropertyAccessorOneArg setter, PojoPropertyAccessorNonArg getter, ValueValidator validator)
          The constructor.
 
Method Summary
abstract  CliContainerStyle getContainerStyle(CliStyle cliStyle)
          This method gets the style of this parameter.
 PojoPropertyAccessorNonArg getGetter()
          This method gets the accessor used to get the value of the according option or argument.
protected abstract  String getName()
          This method gets the name of the option or argument.
protected abstract  Annotation getParameterAnnotation()
          This method gets the annotation with the metadata of the option or argument.
 PojoPropertyAccessorOneArg getSetter()
          This method gets the accessor used to set the value of the according option or argument.
 ValueValidator<Object> getValidator()
          This method gets the ValueValidator.
 boolean isArrayMapOrCollection()
          This method determines if the property-type of the setter is a container-type (an array, Collection or Map).
protected static boolean isArrayMapOrCollection(Class<?> type)
          This method determines if the given type is a container-type (an array, Collection or Map).
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

setter

private final PojoPropertyAccessorOneArg setter
See Also:
getSetter()

getter

private final PojoPropertyAccessorNonArg getter
See Also:
getGetter()

validator

private final ValueValidator<Object> validator
See Also:
getValidator()
Constructor Detail

CliParameterContainer

public CliParameterContainer(PojoPropertyAccessorOneArg setter,
                             PojoPropertyAccessorNonArg getter,
                             ValueValidator validator)
The constructor.

Parameters:
setter - is the setter.
getter - is the getter.
validator - is the validator.
Method Detail

getSetter

public PojoPropertyAccessorOneArg getSetter()
This method gets the accessor used to set the value of the according option or argument.

Returns:
the setter.

getGetter

public PojoPropertyAccessorNonArg getGetter()
This method gets the accessor used to get the value of the according option or argument.

Returns:
the getter or null if NOT available.

getName

protected abstract String getName()
This method gets the name of the option or argument.

Returns:
the name of this parameter.

getParameterAnnotation

protected abstract Annotation getParameterAnnotation()
This method gets the annotation with the metadata of the option or argument.

Returns:
the Annotation.

getValidator

public ValueValidator<Object> getValidator()
This method gets the ValueValidator.

Returns:
the validator.

isArrayMapOrCollection

public boolean isArrayMapOrCollection()
This method determines if the property-type of the setter is a container-type (an array, Collection or Map).

Returns:
true if the property-type is a container-type.
See Also:
CliValueContainer.isArrayMapOrCollection()

isArrayMapOrCollection

protected static boolean isArrayMapOrCollection(Class<?> type)
This method determines if the given type is a container-type (an array, Collection or Map).

Parameters:
type - is the Class to check.
Returns:
true if the given type is a container-type.
See Also:
CliValueContainer.isArrayMapOrCollection()

toString

public String toString()

Overrides:
toString in class Object

getContainerStyle

public abstract CliContainerStyle getContainerStyle(CliStyle cliStyle)
This method gets the style of this parameter. If the style of the parameter-annotation ( CliArgument.containerStyle() or CliOption.containerStyle()) is CliContainerStyle.DEFAULT this method will return CliStyle.containerStyle().

Parameters:
cliStyle - TODO
Returns:
the style for this parameter.


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