Annotation Interface Argument


@Retention(RUNTIME) @Target(METHOD) public @interface Argument
An annotation used to specify arguments to be injected into InjectedCommands.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Specifies whether to allow additional matching elements in the context.
    Class<? extends Object>
    Specifies the class to be matched.
    boolean
    Specifies whether the elements eligible for this argument must match the declared type or the type specified by match() exactly or if sub-classes are allowed as well.
    boolean
    Specifies whether the argument is optional.
  • Element Details

    • optional

      boolean optional
      Specifies whether the argument is optional. For scalar arguments this means that they may be null, for Collection valued arguments the collection may be empty.
      Returns:
      true if the argument is optional.
      Default:
      false
    • allowOtherMatches

      boolean allowOtherMatches
      Specifies whether to allow additional matching elements in the context. This parameter is used for scalar arguments only. If this is set to true, additional matches for a scalar argument are ignored, i.e. the command "sees" only the first match for the argument. If set to false, the command becomes invalid if there is more than one match for the argument.
      Returns:
      true if additional matches are allowed, false otherwise.
      Default:
      true
    • match

      Class<? extends Object> match
      Specifies the class to be matched. Normally, the class to be matched is extracted from the method parameter or field type that is annotated by this annotation. In some cases, however, it may be desirable to match only a sub-class or implementor of the declared type. Caveat: the declared field/parameter type must be assignable from the specified match class.
      Returns:
      the match class to be used.
      Default:
      com.levigo.jadice.web.client.util.command.Argument.class
    • matchSubclasses

      boolean matchSubclasses
      Specifies whether the elements eligible for this argument must match the declared type or the type specified by match() exactly or if sub-classes are allowed as well.
      Returns:
      true if sub-classes are also eligible for injection to the annotated argument.
      Default:
      true