org.schmant.arg
Class ArgumentInterpretationResult<T>

java.lang.Object
  extended by org.schmant.arg.ArgumentInterpretationResult<T>

public class ArgumentInterpretationResult<T>
extends Object

This immutable object contains the result from ArgumentInterpreter.interpret(Object, ArgumentInterpretationStrategy).

Since:
1.0
Author:
Karl Gustafsson

Constructor Summary
protected ArgumentInterpretationResult(List<T> interpreted, List<NotInterpretedObject> notInterpreted)
          Create a new result object.
 
Method Summary
 T get()
          Get the first object in the list returned from getInterpreted().
 List<T> getInterpreted()
          Get the list of interpreted objects.
 List<NotInterpretedObject> getNotInterpreted()
          Get a list of the objects that the interpreter was not able to interpret.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArgumentInterpretationResult

protected ArgumentInterpretationResult(List<T> interpreted,
                                       List<NotInterpretedObject> notInterpreted)
Create a new result object.

Parameters:
interpreted - The list of interpreted objects.
notInterpreted - The list of objects that the interpreter was not able to interpret.
Method Detail

get

public T get()
Get the first object in the list returned from getInterpreted(). This shortcut method can be used when only one result object is expected.

Returns:
The first interpreted object or null if there are no interpreted objects.

getInterpreted

public List<T> getInterpreted()
Get the list of interpreted objects.

If the ArgumentInterpretationStrategy is configured with ArgumentInterpretationStrategy.ALLOW_ONE_AND_ONLY_ONE_RESULT_OBJECT, this list will always contain exactly one object.

Returns:
The list of interpreted objects. This list may be empty, but is never null.

getNotInterpreted

public List<NotInterpretedObject> getNotInterpreted()
Get a list of the objects that the interpreter was not able to interpret.

The ArgumentInterpreter.interpret(Object, ArgumentInterpretationStrategy) method may only return a non-empty list if it is configured with ArgumentInterpretationStrategy.ALLOW_NOT_INTERPRETED.

Returns:
The list of not interpreted objects. This list may be empty but never null.