av.tob
Annotation Type UseKinComparator
@Retention(value=CLASS)
public @interface UseKinComparator
Used to annotate a KinSet field that a particular
Comparator should be used to sort kins in the set.
Note:
- The specified
Comparator implementation is required to
produce consistent comparation results regardless of the persistent states
changes of the compared Kins. That is, only immutable attributes
should be used to perform the comparation. The persistent object ID, the
creation time of both the source relation object and the related object are
good candidates. And values of some persistent fields, e.g. a Person
object's Gender value, can be used if they are guarannteed not to
change.
- Even if the comparator reports that a kin equals to another existing one
already in the kin set, adding the new kin to the kin set will not overwrite
the existing one. In this case the order of such equal kins is
undefined.
The specified class must comply with one or more of the following:
- Expose a
public static final field namely
instance, which be type of the specified class, so that this
field value is used to construct KinSet objects at runtime.
- Expose a
public static method namely
singleton(), which with return type of the specified class,
so that this method is invoked to construct KinSet objects at
runtime.
- Expose a public no-arg constructor, so that an instance is created to
construct each
KinSet object at runtime.
If more of the above is implemented by the specified class, the first met
will be used.
This annotation will only take effect when the annotated KinSet field
is left uninitialized or explicitly initilized to null by the
application defined persistent class. TOB will generate code to initialized
KinSet fields for born objects at runtime, regarding this annotation,
but after checked null values. So if a KinSet field
has already been initialized by the application to a non-null value, it will
be left as is.
- Author:
- Compl
value
public abstract Class<? extends Comparator<? extends Kin<?,?>>> value
- Returns:
- a class implemented the comparator interface for kins
- See Also:
UseKinComparator
Copyright© 2006 Ableverse Platform. All rights reserved.