|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
@Documented @Retention(value=RUNTIME) @Target(value=METHOD) public @interface Derived
Identifies a Storable property which is not directly persisted, but
is instead derived from other property values. A derived property cannot be
abstract, and a "set" method is optional.
Derived properties can be used just like a normal property in most
cases. They can be used in query filters, indexes, alternate keys, and they
can also be used to define a Version property.
If the derived property depends on Join properties and is also
used in an index or alternate key, dependencies must be listed in order for
the index to be properly updated.
Example:
@Indexes(@Index("uppercaseName"))
public abstract class UserInfo implements Storable<UserInfo> {
/**
* Derive an uppercase name for case-insensitive searches.
*/
@Derived
public String getUppercaseName() {
String name = getName();
return name == null ? null : name.toUpperCase();
}
...
}
| Optional Element Summary | |
|---|---|
String[] |
from
List of properties that this property is derived from. |
boolean |
shouldCopy
Returns whether this property should be included when copying a storable. |
public abstract String[] from
public abstract boolean shouldCopy
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||