org.glassfish.jersey.internal
Class ExceptionMapperFactory

java.lang.Object
  extended by org.glassfish.jersey.internal.ExceptionMapperFactory
All Implemented Interfaces:
ExceptionMappers

public class ExceptionMapperFactory
extends java.lang.Object
implements ExceptionMappers

Exception mappers implementation that aggregates exception mappers and server as the main entry point for exception mapper instance lookup.

Author:
Paul Sandoz, Santiago Pericas-Geertsen (Santiago.PericasGeertsen at oracle.com), Marek Potociar (marek.potociar at oracle.com)

Nested Class Summary
static class ExceptionMapperFactory.Module
          Exception mapper factory injection binding registration module.
 
Constructor Summary
ExceptionMapperFactory(java.util.List<ExceptionMapper> mappers)
          Create new exception mapper factory initialized with a set of exception mappers.
ExceptionMapperFactory(ServiceLocator services)
          Create new exception mapper factory initialized with service providers instance that will be used to look up all providers implementing ExceptionMapper interface.
 
Method Summary
<T extends java.lang.Throwable>
ExceptionMapper<T>
find(java.lang.Class<T> type)
          Get an exception mapping provider for a particular class of exception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExceptionMapperFactory

public ExceptionMapperFactory(java.util.List<ExceptionMapper> mappers)
Create new exception mapper factory initialized with a set of exception mappers.

Parameters:
mappers - exception mappers.

ExceptionMapperFactory

public ExceptionMapperFactory(ServiceLocator services)
Create new exception mapper factory initialized with service providers instance that will be used to look up all providers implementing ExceptionMapper interface.

Parameters:
services - HK2 services.
Method Detail

find

public <T extends java.lang.Throwable> ExceptionMapper<T> find(java.lang.Class<T> type)
Description copied from interface: ExceptionMappers
Get an exception mapping provider for a particular class of exception. Returns the provider whose generic type is the nearest superclass of type.

Specified by:
find in interface ExceptionMappers
Type Parameters:
T - type of the exception handled by the exception mapping provider.
Parameters:
type - the class of exception.
Returns:
an ExceptionMapper for the supplied type or null if none is found.


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