|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
@Inherited @Target(value=TYPE) @Retention(value=RUNTIME) public @interface Defaulted
Indicates that the class should have a default, by providing a link to a DefaultsProvider, or some
externally-configured mechanism.
This possibly seems a little tortuous. The more obvious means to provide a default would seem to be a
simple @DefaultsTo(new SomeObject()). However, Java only allows primitives, strings and class literals to
be used in annotations. We therefore need delegate to an external implementation. (This
more complex design is also more flexible of course; the implementation of
DefaultsProvider could adjust the default it provides according to circumstance,
for example).
Encodable,
Parseable,
Value| Optional Element Summary | |
|---|---|
Class<?> |
defaultsProviderClass
As per defaultsProviderName(), but specifying a class literal rather than a fully qualified
class name. |
String |
defaultsProviderName
The fully qualified name of a class that implements the DefaultsProvider interface. |
public abstract String defaultsProviderName
DefaultsProvider interface.
This is optional because some implementations may pick up the defaults provider via a configuration
file, or via the equivalent defaultsProviderClass().
Implementation note: the default value provided here is simply an empty string because null is not a valid default.
public abstract Class<?> defaultsProviderClass
defaultsProviderName(), but specifying a class literal rather than a fully qualified
class name.
Implementation note: the default value provided here is simply the Defaulted's own class,
because null is not a valid default.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||