com.levigo.util.swing.action.injection
Annotation Type Argument


@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface Argument

An annotation used to specify arguments to be injected into InjectedCommands.


Optional Element Summary
 boolean allowOtherMatches
          Specifies whether to allow additional matching elements in the context.
 Class<? extends Object> match
          Specifies the class to be matched.
 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.
 boolean optional
          Specifies whether the argument is optional.
 

optional

public abstract 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

public abstract 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

public abstract Class<? extends Object> match
Specifies the class to be matched. Normally, the class to be matched is extracted from the method parameter 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 parameter type must be assignable from the specified match class.

Returns:
the match class to be used.
Default:
com.levigo.util.swing.action.injection.Argument.class

matchSubclasses

public abstract 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


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.