Class MethodHandler

    • Constructor Detail

      • MethodHandler

        protected MethodHandler()
        Create new instance of a resource method handler model.
      • MethodHandler

        protected MethodHandler​(Collection<Parameter> parameters)
        Create new instance of a resource method handler model.
        Parameters:
        parameters - handler parameters associated directly with the resource method handler (e.g. class-level property setters and fields). May be null.
        Since:
        2.20
    • Method Detail

      • create

        public static MethodHandler create​(Class<?> handlerClass)
        Create a class-based method handler from a class.
        Parameters:
        handlerClass - method handler class.
        Returns:
        new class-based method handler.
      • create

        public static MethodHandler create​(Class<?> handlerClass,
                                           boolean keepConstructorParamsEncoded)
        Create a class-based method handler from a class.
        Parameters:
        handlerClass - method handler class.
        keepConstructorParamsEncoded - if set to true, any injected constructor parameters must be kept encoded and must not be automatically decoded.
        Returns:
        new class-based method handler.
      • create

        public static MethodHandler create​(Object handlerInstance)
        Create a instance-based (singleton) method handler from a class.
        Parameters:
        handlerInstance - method handler instance (singleton).
        Returns:
        new instance-based method handler.
      • create

        public static MethodHandler create​(Object handlerInstance,
                                           Class<?> handlerClass)
        Create a instance-based (singleton) method handler from a class.
        Parameters:
        handlerInstance - method handler instance (singleton).
        handlerClass - declared handler class.
        Returns:
        new instance-based method handler.
      • create

        public static MethodHandler create​(Class<?> handlerClass,
                                           Collection<Parameter> handlerParameters)
        Create a class-based method handler from a class.
        Parameters:
        handlerClass - method handler class.
        handlerParameters - method handler parameters (e.g. class-level property setters and fields).
        Returns:
        new class-based method handler.
      • create

        public static MethodHandler create​(Class<?> handlerClass,
                                           boolean keepConstructorParamsEncoded,
                                           Collection<Parameter> handlerParameters)
        Create a class-based method handler from a class.
        Parameters:
        handlerClass - method handler class.
        keepConstructorParamsEncoded - if set to true, any injected constructor parameters must be kept encoded and must not be automatically decoded.
        handlerParameters - method handler parameters (e.g. class-level property setters and fields).
        Returns:
        new class-based method handler.
        Since:
        2.20
      • create

        public static MethodHandler create​(Object handlerInstance,
                                           Collection<Parameter> handlerParameters)
        Create a instance-based (singleton) method handler from a class.
        Parameters:
        handlerInstance - method handler instance (singleton).
        handlerParameters - method handler parameters (e.g. class-level property setters and fields).
        Returns:
        new instance-based method handler.
        Since:
        2.20
      • create

        public static MethodHandler create​(Object handlerInstance,
                                           Class<?> handlerClass,
                                           Collection<Parameter> handlerParameters)
        Create a instance-based (singleton) method handler from a class.
        Parameters:
        handlerInstance - method handler instance (singleton).
        handlerClass - declared handler class.
        handlerParameters - method handler parameters (e.g. class-level property setters and fields).
        Returns:
        new instance-based method handler.
        Since:
        2.20
      • getHandlerClass

        public abstract Class<?> getHandlerClass()
        Get the resource method handler class.
        Returns:
        resource method handler class.
      • getConstructors

        public List<HandlerConstructor> getConstructors()
        Get the resource method handler constructors.

        The returned is empty by default. Concrete implementations may override the method to return the actual list of constructors that will be used for the handler initialization.

        Returns:
        resource method handler constructors.
      • getInstance

        public abstract Object getInstance​(org.glassfish.jersey.internal.inject.InjectionManager injectionManager)
        Get the injected resource method handler instance.
        Parameters:
        injectionManager - injection manager that can be used to inject get the instance.
        Returns:
        injected resource method handler instance.
      • isClassBased

        public abstract boolean isClassBased()
        Return whether the method handler creates instances based on classes.
        Returns:
        True is instances returned by this method handler are created from classes given to InjectionManager, false otherwise (for example when method handler was initialized from instance)
      • getParameters

        public Collection<Parameter> getParameters()
        Get the parameters associated directly with the resource method handler, if any (e.g. class-level property setters and fields).

        Note that this method does not return any parameters associated with method handler constructors.

        Returns:
        parameters associated with the resource method handler. May return an empty collection but does not return null.
        Since:
        2.20
      • getHandlerInstance

        protected abstract Object getHandlerInstance()
        Get the raw handler instance that is backing this method handler.
        Returns:
        raw handler instance. May return null if the handler is class-based.