org.nakedobjects.applib.annotation
Annotation Type Encodable


@Inherited
@Target(value=TYPE)
@Retention(value=RUNTIME)
public @interface Encodable

Indicates that the class can be encoded or decoded either by delegating to an EncoderDecoder or through some externally-configured mechanism.

See Also:
Defaulted, Parseable, Value

Optional Element Summary
 java.lang.Class<?> encoderDecoderClass
          As per encoderDecoderName(), but specifying a class literal rather than a fully qualified class name.
 java.lang.String encoderDecoderName
          The fully qualified name of a class that implements the EncoderDecoder interface.
 

encoderDecoderName

public abstract java.lang.String encoderDecoderName
The fully qualified name of a class that implements the EncoderDecoder interface.

This is optional because some implementations may pick up encodeability via a configuration file, or via the equivalent encoderDecoderClass().

It is common for value classes to act as their own encoder/decoders. Note that the framework requires that the nominated class provides a public no-arg constructor on the class. It instantiates an instance in order to do the encoding or decoding, uses the result and discards the instantiated object. What that means in particular is that a self-encoding class shouldn't encode its own state, it should encode the state of the object passed to it.

Implementation note: the default value provided here is simply an empty string because null is not a valid default.

Default:
""

encoderDecoderClass

public abstract java.lang.Class<?> encoderDecoderClass
As per encoderDecoderName(), but specifying a class literal rather than a fully qualified class name.

Implementation note: the default value provided here is simply the Encodable's own class, because null is not a valid default.

Default:
org.nakedobjects.applib.annotation.Encodable.class


Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.