com.googlecode.objectify.annotation
Annotation Type Subclass


@Retention(value=RUNTIME)
@Target(value=TYPE)
public @interface Subclass

Indicates that a class is part of a polymorphic persistence hierarchy. Subclasses of an @Entity should be flagged with this annotation.

This is used for Objectify's implementation of polymorphism. Place this on any class in an inheritance hierarchy that should be queryable except the root. For example, in the hierarchy Animal->Mammal->Cat, annotations should be:

The @Entity annotation must be present on the class that identifies the root of the hierarchy. This class will define the kind of the entire hierarchy. The @Entity annotation must NOT be present on any subclasses.

Actual Java subclasses are not required to have @Subclass, but only Java classes which have @Subclass can be persisted and queried for.

Author:
Jeff Schnitzer

Optional Element Summary
 java.lang.String[] alsoLoad
          Additional discriminators which, when encountered, will be interpreted as indicating this subclass.
 java.lang.String name
          Optionally define the discriminator value for the subclass; default is Class.getSimpleName()
 boolean unindexed
          If true, the discriminator will not be indexed, and a query for the specific subclass will not return results.
 

name

public abstract java.lang.String name
Optionally define the discriminator value for the subclass; default is Class.getSimpleName()

Default:
""

unindexed

public abstract boolean unindexed
If true, the discriminator will not be indexed, and a query for the specific subclass will not return results. However, superclasses and further subclasses may be indexed.

Default:
false

alsoLoad

public abstract java.lang.String[] alsoLoad
Additional discriminators which, when encountered, will be interpreted as indicating this subclass. Facilitates schema changes in a way analagous to @AlsoLoad.

Default:
{}


Copyright © 2011 Jeff Schnitzer and a gang of pirates. All Rights Reserved. Build version: 3.1