Package org.glassfish.jersey.model
Class ContractProvider.Builder
- java.lang.Object
-
- org.glassfish.jersey.model.ContractProvider.Builder
-
- Enclosing class:
- ContractProvider
public static final class ContractProvider.Builder extends java.lang.Object
Contract provider model builder.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Class<?>,java.lang.Integer>
contracts
private int
defaultPriority
private static ContractProvider
EMPTY_MODEL
private java.lang.Class<?>
implementationClass
private java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>>
nameBindings
private java.lang.Class<? extends java.lang.annotation.Annotation>
scope
-
Constructor Summary
Constructors Modifier Constructor Description private
Builder(java.lang.Class<?> implementationClass)
private
Builder(ContractProvider original)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContractProvider.Builder
addContract(java.lang.Class<?> contract)
Add a new provided contract.ContractProvider.Builder
addContract(java.lang.Class<?> contract, int priority)
Add a new provided contract with priority.ContractProvider.Builder
addContracts(java.util.Collection<java.lang.Class<?>> contracts)
Add a new provided contracts.ContractProvider.Builder
addContracts(java.util.Map<java.lang.Class<?>,java.lang.Integer> contracts)
Add a new provided contracts.ContractProvider.Builder
addNameBinding(java.lang.Class<? extends java.lang.annotation.Annotation> binding)
Add a new contract provider name binding.ContractProvider
build()
Build a new contract provider model.ContractProvider.Builder
defaultPriority(int defaultPriority)
Set the contract default provider priority.java.util.Map<java.lang.Class<?>,java.lang.Integer>
getContracts()
Get the map of contracts for the built contract provider model.int
getDefaultPriority()
Get the default priority of the built contract provider model.java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>>
getNameBindings()
Get name bindings of the built contract provider model.java.lang.Class<? extends java.lang.annotation.Annotation>
getScope()
Get the scope of the built contract provider model.ContractProvider.Builder
scope(java.lang.Class<? extends java.lang.annotation.Annotation> scope)
Change contract provider scope.
-
-
-
Field Detail
-
EMPTY_MODEL
private static final ContractProvider EMPTY_MODEL
-
implementationClass
private java.lang.Class<?> implementationClass
-
scope
private java.lang.Class<? extends java.lang.annotation.Annotation> scope
-
contracts
private java.util.Map<java.lang.Class<?>,java.lang.Integer> contracts
-
defaultPriority
private int defaultPriority
-
nameBindings
private java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> nameBindings
-
-
Constructor Detail
-
Builder
private Builder(java.lang.Class<?> implementationClass)
-
Builder
private Builder(ContractProvider original)
-
-
Method Detail
-
scope
public ContractProvider.Builder scope(java.lang.Class<? extends java.lang.annotation.Annotation> scope)
Change contract provider scope. (Default scope isSingleton
.)- Parameters:
scope
- contract provider scope.- Returns:
- updated builder.
-
addContract
public ContractProvider.Builder addContract(java.lang.Class<?> contract)
Add a new provided contract.- Parameters:
contract
- additional provided contract.- Returns:
- updated builder.
-
addContract
public ContractProvider.Builder addContract(java.lang.Class<?> contract, int priority)
Add a new provided contract with priority.- Parameters:
contract
- additional provided contract.priority
- priority for the contract.- Returns:
- updated builder.
-
addContracts
public ContractProvider.Builder addContracts(java.util.Map<java.lang.Class<?>,java.lang.Integer> contracts)
Add a new provided contracts.- Parameters:
contracts
- additional provided contracts.- Returns:
- updated builder.
-
addContracts
public ContractProvider.Builder addContracts(java.util.Collection<java.lang.Class<?>> contracts)
Add a new provided contracts.- Parameters:
contracts
- additional provided contracts.- Returns:
- updated builder.
-
defaultPriority
public ContractProvider.Builder defaultPriority(int defaultPriority)
Set the contract default provider priority. (Default value isContractProvider.NO_PRIORITY
)- Parameters:
defaultPriority
- default contract provider priority.- Returns:
- updated builder.
-
addNameBinding
public ContractProvider.Builder addNameBinding(java.lang.Class<? extends java.lang.annotation.Annotation> binding)
Add a new contract provider name binding.- Parameters:
binding
- name binding.- Returns:
- updated builder.
-
getScope
public java.lang.Class<? extends java.lang.annotation.Annotation> getScope()
Get the scope of the built contract provider model.- Returns:
- scope associated with the model or
null
if no scope has been set explicitly.
-
getContracts
public java.util.Map<java.lang.Class<?>,java.lang.Integer> getContracts()
Get the map of contracts for the built contract provider model.- Returns:
- contracts associated with the model.
-
getDefaultPriority
public int getDefaultPriority()
Get the default priority of the built contract provider model.- Returns:
- default priority associated with the model.
-
getNameBindings
public java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> getNameBindings()
Get name bindings of the built contract provider model.- Returns:
- name bindings associated with the model.
-
build
public ContractProvider build()
Build a new contract provider model.- Returns:
- new contract provider model.
-
-