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

java.lang.Object
  extended by net.sf.mmm.util.component.base.AbstractComponent
      extended by net.sf.mmm.util.component.base.AbstractLoggableComponent
          extended by net.sf.mmm.util.cli.base.AbstractCliParserBuilder
All Implemented Interfaces:
CliParserBuilder, CliParserDependencies
Direct Known Subclasses:
DefaultCliParserBuilder

public abstract class AbstractCliParserBuilder
extends AbstractLoggableComponent
implements CliParserBuilder, CliParserDependencies

This is the abstract base implementation of the CliParserBuilder interface.

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

Field Summary
private  AnnotationUtil annotationUtil
           
private  CollectionFactoryManager collectionFactoryManager
           
private  CollectionReflectionUtil collectionReflectionUtil
           
private  ComposedValueConverter converter
           
private  PojoDescriptorBuilder descriptorBuilder
           
private  PojoDescriptorBuilderFactory descriptorBuilderFactory
           
private  LineWrapper lineWrapper
           
private  NlsMessageFactory nlsMessageFactory
           
private  NlsTemplateResolver nlsTemplateResolver
           
private  ReflectionUtil reflectionUtil
           
private  StringUtil stringUtil
           
 
Constructor Summary
AbstractCliParserBuilder()
          The constructor.
 
Method Summary
 CliParser build(Object pojo)
          This method builds a CliParser instance from the given Pojo.
protected abstract  CliParser buildInternal(Object state, CliState cliState)
          This method implements build(Object) internally.
protected  void doInitialize()
          This method performs the actual initialization.
 AnnotationUtil getAnnotationUtil()
          
 CollectionFactoryManager getCollectionFactoryManager()
          
 CollectionReflectionUtil getCollectionReflectionUtil()
          
 ComposedValueConverter getConverter()
          
protected  PojoDescriptorBuilder getDescriptorBuilder()
           
protected  PojoDescriptorBuilderFactory getDescriptorBuilderFactory()
           
 LineWrapper getLineWrapper()
          
 NlsMessageFactory getNlsMessageFactory()
          
 NlsTemplateResolver getNlsTemplateResolver()
          
 ReflectionUtil getReflectionUtil()
          
 StringUtil getStringUtil()
          
 void setAnnotationUtil(AnnotationUtil annotationUtil)
           
 void setCollectionFactoryManager(CollectionFactoryManager collectionFactoryManager)
           
 void setCollectionReflectionUtil(CollectionReflectionUtil collectionReflectionUtil)
           
 void setConverter(ComposedValueConverter converter)
           
 void setDescriptorBuilder(PojoDescriptorBuilder descriptorBuilder)
           
 void setDescriptorBuilderFactory(PojoDescriptorBuilderFactory descriptorBuilderFactory)
           
 void setLineWrapper(LineWrapper lineWrapper)
           
 void setNlsMessageFactory(NlsMessageFactory nlsMessageFactory)
           
 void setNlsTemplateResolver(NlsTemplateResolver nlsTemplateResolver)
           
 void setReflectionUtil(ReflectionUtil reflectionUtil)
           
 void setStringUtil(StringUtil stringUtil)
           
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractLoggableComponent
getLogger, setLogger
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractComponent
doInitialized, getInitializationState, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

descriptorBuilderFactory

private PojoDescriptorBuilderFactory descriptorBuilderFactory
See Also:
getDescriptorBuilderFactory()

descriptorBuilder

private PojoDescriptorBuilder descriptorBuilder
See Also:
getDescriptorBuilder()

nlsMessageFactory

private NlsMessageFactory nlsMessageFactory
See Also:
getNlsMessageFactory()

nlsTemplateResolver

private NlsTemplateResolver nlsTemplateResolver
See Also:
getNlsTemplateResolver()

stringUtil

private StringUtil stringUtil
See Also:
getStringUtil()

annotationUtil

private AnnotationUtil annotationUtil
See Also:
getAnnotationUtil()

reflectionUtil

private ReflectionUtil reflectionUtil
See Also:
getReflectionUtil()

collectionReflectionUtil

private CollectionReflectionUtil collectionReflectionUtil
See Also:
getCollectionReflectionUtil()

collectionFactoryManager

private CollectionFactoryManager collectionFactoryManager
See Also:
getCollectionFactoryManager()

converter

private ComposedValueConverter converter
See Also:
getConverter()

lineWrapper

private LineWrapper lineWrapper
See Also:
getLineWrapper()
Constructor Detail

AbstractCliParserBuilder

public AbstractCliParserBuilder()
The constructor.

Method Detail

doInitialize

protected void doInitialize()
This method performs the actual initialization. It is called when AbstractComponent.initialize() is invoked for the first time.
ATTENTION:
When you override this method from a sub-class you need to do a super.AbstractComponent.doInitialize().

Overrides:
doInitialize in class AbstractLoggableComponent

build

public CliParser build(Object pojo)
This method builds a CliParser instance from the given Pojo. The following applies for the class reflecting this pojo:

Specified by:
build in interface CliParserBuilder
Parameters:
pojo - is the annotated object for the CLI-state.
Returns:
the CliParser used to parse the commandline-arguments and potentially print the help.

buildInternal

protected abstract CliParser buildInternal(Object state,
                                           CliState cliState)
This method implements build(Object) internally.

Parameters:
state - is the state object.
cliState - is the according CliState.
Returns:
the new CliParser.

getDescriptorBuilderFactory

protected PojoDescriptorBuilderFactory getDescriptorBuilderFactory()
Returns:
the descriptorBuilderFactory

setDescriptorBuilderFactory

@Inject
public void setDescriptorBuilderFactory(PojoDescriptorBuilderFactory descriptorBuilderFactory)
Parameters:
descriptorBuilderFactory - is the descriptorBuilderFactory to set

getDescriptorBuilder

protected PojoDescriptorBuilder getDescriptorBuilder()
Returns:
the descriptorBuilder

setDescriptorBuilder

public void setDescriptorBuilder(PojoDescriptorBuilder descriptorBuilder)
Parameters:
descriptorBuilder - is the descriptorBuilder to set

getCollectionFactoryManager

public CollectionFactoryManager getCollectionFactoryManager()

Specified by:
getCollectionFactoryManager in interface CliParserDependencies
Returns:
the CollectionFactoryManager instance to use.

setCollectionFactoryManager

@Inject
public void setCollectionFactoryManager(CollectionFactoryManager collectionFactoryManager)
Parameters:
collectionFactoryManager - is the collectionFactoryManager to set

getStringUtil

public StringUtil getStringUtil()

Specified by:
getStringUtil in interface CliParserDependencies
Returns:
the StringUtil instance to use.

setStringUtil

@Inject
public void setStringUtil(StringUtil stringUtil)
Parameters:
stringUtil - is the stringUtil to set

getAnnotationUtil

public AnnotationUtil getAnnotationUtil()

Specified by:
getAnnotationUtil in interface CliParserDependencies
Returns:
the AnnotationUtil instance to use.

setAnnotationUtil

@Inject
public void setAnnotationUtil(AnnotationUtil annotationUtil)
Parameters:
annotationUtil - is the annotationUtil to set

getCollectionReflectionUtil

public CollectionReflectionUtil getCollectionReflectionUtil()

Specified by:
getCollectionReflectionUtil in interface CliParserDependencies
Returns:
the CollectionReflectionUtil instance to use.

setCollectionReflectionUtil

@Inject
public void setCollectionReflectionUtil(CollectionReflectionUtil collectionReflectionUtil)
Parameters:
collectionReflectionUtil - is the collectionReflectionUtil to set

getReflectionUtil

public ReflectionUtil getReflectionUtil()

Specified by:
getReflectionUtil in interface CliParserDependencies
Returns:
the ReflectionUtil instance to use.

setReflectionUtil

@Inject
public void setReflectionUtil(ReflectionUtil reflectionUtil)
Parameters:
reflectionUtil - is the reflectionUtil to set

getNlsMessageFactory

public NlsMessageFactory getNlsMessageFactory()

Specified by:
getNlsMessageFactory in interface CliParserDependencies
Returns:
the NlsMessageFactory instance to use.

setNlsMessageFactory

@Inject
public void setNlsMessageFactory(NlsMessageFactory nlsMessageFactory)
Parameters:
nlsMessageFactory - is the nlsMessageFactory to set

getNlsTemplateResolver

public NlsTemplateResolver getNlsTemplateResolver()

Specified by:
getNlsTemplateResolver in interface CliParserDependencies
Returns:
the NlsTemplateResolver instance to use or null to use the default instance.

setNlsTemplateResolver

public void setNlsTemplateResolver(NlsTemplateResolver nlsTemplateResolver)
Parameters:
nlsTemplateResolver - is the NlsTemplateResolver to use.

getConverter

public ComposedValueConverter getConverter()

Specified by:
getConverter in interface CliParserDependencies
Returns:
the ComposedValueConverter instance used to convert CLI parameters to typed values.

setConverter

@Inject
public void setConverter(ComposedValueConverter converter)
Parameters:
converter - is the converter to set

getLineWrapper

public LineWrapper getLineWrapper()

Specified by:
getLineWrapper in interface CliParserDependencies
Returns:
the LineWrapper used for justification of texts for the help texts.

setLineWrapper

@Inject
public void setLineWrapper(LineWrapper lineWrapper)
Parameters:
lineWrapper - is the lineWrapper to set


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