org.apache.commons.beanutils2
Class Argument<T>

java.lang.Object
  extended by org.apache.commons.beanutils2.Argument<T>
Type Parameters:
T - the type of the argument.

public final class Argument<T>
extends Object

An argument represents a value of some type that can be passed to a method or constructor.


Method Summary
static
<A> Argument<A>
argument(A value)
          Factory method for arguments.
static
<T,V extends T>
Argument<T>
argument(Class<T> type, V value)
          Creates a new argument of the given type with the given value.
 Class<T> getType()
           
 T getValue()
           
static
<A> Argument<A>
nullArgument(Class<A> type)
          Creates a new null argument of the given type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

argument

public static <A> Argument<A> argument(A value)
Factory method for arguments. Creates an argument by taking a value and determining the type of the given value.

Parameters:
value - the value to be wrapped by the new argument object. Must not be null! If you want to create a null argument use nullArgument(Class) instead.
Returns:
a new argument of type value.getClass()
Throws:
NullPointerException - if value is null

nullArgument

public static <A> Argument<A> nullArgument(Class<A> type)
Creates a new null argument of the given type.

Parameters:
type - the type of the new argument
Returns:
an argument with value == null.
Throws:
NullPointerException - if type is null.

argument

public static <T,V extends T> Argument<T> argument(Class<T> type,
                                                   V value)
Creates a new argument of the given type with the given value.

Parameters:
type - the type of the new argument. Must not be null!
value - the value of the new argument.
Returns:
a new argument of the given type with the given value.
Throws:
NullPointerException - if type is null

getType

public Class<T> getType()

getValue

public T getValue()


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.