Class ContractProvider

  • All Implemented Interfaces:
    NameBound, Scoped

    public final class ContractProvider
    extends java.lang.Object
    implements Scoped, NameBound
    Jersey contract provider model.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ContractProvider.Builder
      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 java.lang.Class<?> implementationClass  
      private java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> nameBindings  
      static int NO_PRIORITY
      "No priority" constant.
      private java.lang.Class<? extends java.lang.annotation.Annotation> scope  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ContractProvider​(java.lang.Class<?> implementationClass, java.lang.Class<? extends java.lang.annotation.Annotation> scope, java.util.Map<java.lang.Class<?>,​java.lang.Integer> contracts, int defaultPriority, java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> nameBindings)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ContractProvider.Builder builder​(java.lang.Class<?> implementationClass)
      Create new contract provider model builder.
      static ContractProvider.Builder builder​(ContractProvider original)
      Create new contract provider model builder from an existing one.
      java.util.Map<java.lang.Class<?>,​java.lang.Integer> getContractMap()
      Get the map of contracts and their priorities.
      java.util.Set<java.lang.Class<?>> getContracts()
      Get provided contracts recognized by Jersey.
      java.lang.Class<?> getImplementationClass()
      Get the implementation class which the contracts belong to.
      java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> getNameBindings()
      Get the collection of name bindings attached to this component.
      int getPriority​(java.lang.Class<?> contract)
      Get the provider contract priority, if set, default component provider, if not set.
      java.lang.Class<? extends java.lang.annotation.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
      • implementationClass

        private final java.lang.Class<?> implementationClass
      • contracts

        private final java.util.Map<java.lang.Class<?>,​java.lang.Integer> contracts
      • defaultPriority

        private final int defaultPriority
      • nameBindings

        private final java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> nameBindings
      • scope

        private final java.lang.Class<? extends java.lang.annotation.Annotation> scope
    • Constructor Detail

      • ContractProvider

        private ContractProvider​(java.lang.Class<?> implementationClass,
                                 java.lang.Class<? extends java.lang.annotation.Annotation> scope,
                                 java.util.Map<java.lang.Class<?>,​java.lang.Integer> contracts,
                                 int defaultPriority,
                                 java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> nameBindings)
    • Method Detail

      • builder

        public static ContractProvider.Builder builder​(java.lang.Class<?> implementationClass)
        Create new contract provider model builder.
        Parameters:
        implementationClass - class which the contracts belong to.
        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 java.lang.Class<? extends java.lang.annotation.Annotation> getScope()
        Description copied from interface: Scoped
        Get model component scope.
        Specified by:
        getScope in interface Scoped
        Returns:
        model component scope.
      • getImplementationClass

        public java.lang.Class<?> getImplementationClass()
        Get the implementation class which the contracts belong to.
        Returns:
        implementation class.
      • getContracts

        public java.util.Set<java.lang.Class<?>> getContracts()
        Get provided contracts recognized by Jersey.
        Returns:
        provided contracts.
        See Also:
        Contract
      • getContractMap

        public java.util.Map<java.lang.Class<?>,​java.lang.Integer> getContractMap()
        Get the map of contracts and their priorities.
        Returns:
        contracts and their priorities.
      • 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​(java.lang.Class<?> contract)
        Get the provider contract priority, if set, default component provider, if not set.
        Parameters:
        contract - provider contract.
        Returns:
        provider priority.
        See Also:
        Priority
      • getNameBindings

        public java.util.Set<java.lang.Class<? extends java.lang.annotation.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.