org.glassfish.jersey.model
Class ContractProvider

java.lang.Object
  extended by org.glassfish.jersey.model.ContractProvider
All Implemented Interfaces:
NameBound, Scoped

public final class ContractProvider
extends Object
implements Scoped, NameBound

Jersey contract provider model.

Author:
Marek Potociar (marek.potociar at oracle.com)

Nested Class Summary
static class ContractProvider.Builder
          Contract provider model builder.
 
Field Summary
static int NO_PRIORITY
          "No priority" constant.
 
Method Summary
static ContractProvider.Builder builder()
          Create new contract provider model builder.
static ContractProvider.Builder builder(ContractProvider original)
          Create new contract provider model builder from an existing one.
static ContractProvider from(Class<?> serviceClass)
          Create a contract provider model by introspecting a contract provider/service class.
static ContractProvider from(Class<?> serviceClass, int bindingPriority, Set<Class<?>> contracts)
          Create a contract provider model by introspecting a contract provider/service class.
static ContractProvider from(Object service)
          Create a contract provider model by introspecting the class of a contract provider/service instance.
static ContractProvider from(Object service, int bindingPriority, Set<Class<?>> contracts)
          Create a contract provider model by introspecting the class of a contract provider/service instance.
 Set<Class<?>> getContracts()
          Get provided contracts recognized by Jersey.
 Set<Class<? extends Annotation>> getNameBindings()
          Get the collection of name bindings attached to this component.
 int getPriority(Class<?> contract)
          Get the default provider priority, if set, -1 if not set.
 Class<? extends Annotation> getScope()
          Get model component scope.
 boolean isNameBound()
          Check if the component is bound or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_PRIORITY

public static final int NO_PRIORITY
"No priority" constant.

See Also:
Constant Field Values
Method Detail

from

public static ContractProvider from(Class<?> serviceClass)
Create a contract provider model by introspecting a contract provider/service class.

Parameters:
serviceClass - contract provider/service class.
Returns:
contract provider model for the class or null if the class does not implement any recognized provider contracts.

from

public static ContractProvider from(Class<?> serviceClass,
                                    int bindingPriority,
                                    Set<Class<?>> contracts)
Create a contract provider model by introspecting a contract provider/service class.

Parameters:
serviceClass - contract provider/service class.
bindingPriority - binding priority of contracts.
contracts - contracts to bind the provider/service to.
Returns:
contract provider model for the class or null if the class does not implement any recognized provider contracts.

from

public static ContractProvider from(Object service)
Create a contract provider model by introspecting the class of a contract provider/service instance.

Parameters:
service - contract provider/service instance.
Returns:
contract provider model for the instance or null if the instance does not implement any recognized provider contracts.

from

public static ContractProvider from(Object service,
                                    int bindingPriority,
                                    Set<Class<?>> contracts)
Create a contract provider model by introspecting the class of a contract provider/service instance.

Parameters:
service - contract provider/service instance.
bindingPriority - binding priority of contracts.
contracts - contracts to bind the provider/service to.
Returns:
contract provider model for the instance or null if the instance does not implement any recognized provider contracts.

builder

public static ContractProvider.Builder builder()
Create new contract provider model builder.

Returns:
new contract provider builder.

builder

public static ContractProvider.Builder builder(ContractProvider original)
Create new contract provider model builder from an existing one.

Parameters:
original - existing contract provider model.
Returns:
new contract provider builder.

getScope

public Class<? extends Annotation> getScope()
Description copied from interface: Scoped
Get model component scope.

Specified by:
getScope in interface Scoped
Returns:
model component scope.

getContracts

public Set<Class<?>> getContracts()
Get provided contracts recognized by Jersey.

Returns:
provided contracts.
See Also:
Contract

isNameBound

public boolean isNameBound()
Description copied from interface: NameBound
Check if the component is bound or not.

Specified by:
isNameBound in interface NameBound
Returns:
true if the component is bound, false otherwise.

getPriority

public int getPriority(Class<?> contract)
Get the default provider priority, if set, -1 if not set.

Returns:
provider priority.
See Also:
BindingPriority

getNameBindings

public Set<Class<? extends Annotation>> getNameBindings()
Description copied from interface: NameBound
Get the collection of name bindings attached to this component.

Specified by:
getNameBindings in interface NameBound
Returns:
collection of name binding annotation types.


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.