2013/2/7 <brit...@apache.org>

> Author: britter
> Date: Thu Feb  7 20:13:23 2013
> New Revision: 1443696
>
> URL: http://svn.apache.org/r1443696
> Log:
> Fixed checkstyle issues - no functional changes
>
> Modified:
>
> commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java
>
> Modified:
> commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java
> URL:
> http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java?rev=1443696&r1=1443695&r2=1443696&view=diff
>
> ==============================================================================
> ---
> commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java
> (original)
> +++
> commons/sandbox/beanutils2/trunk/src/main/java/org/apache/commons/beanutils2/Argument.java
> Thu Feb  7 20:13:23 2013
> @@ -33,14 +33,12 @@ public final class Argument<T>
>  {
>
>      /**
> -     * Factory method for arguments. Creates an argument by taking a
> value and
> -     * determining the type of the given value.
> +     * Factory method for arguments. Creates an argument by taking a
> value and determining the type of the given value.
>       *
> -     * @param value the value to be wrapped by the new argument object.
> Must not
> -     *              be {@code null}! If you want to create a null
> argument use
> -     *              {@link #nullArgument(Class)} instead.
> +     * @param value the value to be wrapped by the new argument object.
> Must not be {@code null}! If you want to create
> +     *            a null argument use {@link #nullArgument(Class)}
> instead.
> +     * @param <A> the type of the argument.
>       * @return a new argument of type {@code value.getClass()}
> -     * @throws NullPointerException if {@code value} is null
>

How do you feel about this? Checkstyle complains about this, and I think it
is sufficient to tell users that an argument must not be null.

Regards,
Benedikt


>       */
>      public static <A> Argument<A> argument( A value )
>      {
> @@ -51,11 +49,11 @@ public final class Argument<T>
>      }
>
>      /**
> -     * Creates a new null argument of the given type.
> +     * Creates a new null argument of the given type. Shortcut for {@code
> argument( type, null )}.
>       *
> -     * @param type the type of the new argument
> +     * @param type the type of the new argument. Must not be {@code null}!
> +     * @param <A> the type of argument.
>       * @return an argument with {@code value == null}.
> -     * @throws NullPointerException if {@code type} is null.
>       */
>      public static <A> Argument<A> nullArgument( Class<A> type )
>      {
> @@ -67,8 +65,9 @@ public final class Argument<T>
>       *
>       * @param type the type of the new argument. Must not be {@code null}!
>       * @param value the value of the new argument.
> +     * @param <T> the type of the argument.
> +     * @param <V> the type of the value of the argument.
>       * @return a new argument of the given type with the given value.
> -     * @throws NullPointerException if {@code type} is null
>       */
>      public static <T, V extends T> Argument<T> argument( Class<T> type, V
> value )
>      {
> @@ -130,11 +129,24 @@ public final class Argument<T>
>          this.value = value;
>      }
>
> +    /**
> +     * Returns the argument's type. Note that the type returned maybe a
> super type of the actual type of the value
> +     * returned by {@link #getValue()} depending on how the argument was
> created. For example:
> +     * </br>{@code argument( Number.class, Integer.valueOf( 4 ) );}</br>
> +     * will create an argument with an Integer as Value but Number.class
> as type.
> +     *
> +     * @return the argument's type
> +     */
>      public Class<T> getType()
>      {
>          return type;
>      }
>
> +    /**
> +     * Returns the value of the argument. Maybe {@code null} if this is a
> null argument.
> +     *
> +     * @return the value of the argument.
> +     */
>      public T getValue()
>      {
>          return value;
>
>
>

Reply via email to