@Retention(value=RUNTIME) @Target(value=TYPE) public @interface Priority
Annotates types with a priority value. The priority is split into two components:
ring()- A zero based numeric value where 0 is the
highest priority ring, Integer.MAX_VALUE is the lowest priority ring.
value()- A zero based numeric value where
Integer.MAX_VALUE is the highest priority value, 0 is the lowest
priority ring.
The Priority value of a type is used to choose which type to use when
multiples types provide (via the Provides annotation) the same
service.
@Priority
class Foo {...}
Redundant annotation, gives the type the default ring() and
value() values. A log message should be produced at the
WARNING level if a default Priority annotation is encountered as
it likely indicates a coding error.
@Priority(1)
class Foo {...}
@Priority(2)
class Bar {...}
Type Bar will be chosen over type Foo because they
belong to the same ring and Bar has a higher priority value than
Foo.
@Priority(ring=0)
class Foo {...}
@Priority(ring=1)
class Bar {...}
Type Foo will be chosen over type Bar because
Foo belongs to a higher priority ring than Bar.
@Priority(ring=3,value=9)
class Foo {...}
@Priority(ring=1,value=2)
class Bar {...}
Type Bar will be chosen over type Foo because
Bar belongs to a higher priority ring than Foo.
public abstract int ring
Priority belongs to.public abstract int value
ring() classification. Priority
Integer.MAX_VALUE is the highest priorityring()Oracle REST Data Services Plugin API version: 3.0.0.65.09.35 Copyright © 2015 Oracle Corp. All Rights Reserved.