Class GuiceObjectMapperFactory
- java.lang.Object
-
- ninja.leaping.configurate.objectmapping.GuiceObjectMapperFactory
-
- All Implemented Interfaces:
ObjectMapperFactory
@Singleton public final class GuiceObjectMapperFactory extends Object implements ObjectMapperFactory
A factory forObjectMapper
s that will inherit the injector from wherever it is provided.This class is intended to be constructed through Guice dependency injection.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GuiceObjectMapperFactory(com.google.inject.Injector baseInjector)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> @NonNull ObjectMapper<T>
getMapper(@NonNull TypeToken<T> type)
Creates anObjectMapper
for the given type.<T> @NonNull ObjectMapper<T>
getMapper(@NonNull Class<T> type)
Creates anObjectMapper
for the given type.String
toString()
-
-
-
Constructor Detail
-
GuiceObjectMapperFactory
@Inject protected GuiceObjectMapperFactory(com.google.inject.Injector baseInjector)
-
-
Method Detail
-
getMapper
public <T> @NonNull ObjectMapper<T> getMapper(@NonNull Class<T> type) throws ObjectMappingException
Description copied from interface:ObjectMapperFactory
Creates anObjectMapper
for the given type.- Specified by:
getMapper
in interfaceObjectMapperFactory
- Type Parameters:
T
- The type- Parameters:
type
- The type- Returns:
- An object mapper
- Throws:
ObjectMappingException
- If an exception occured whilst mapping
-
getMapper
public <T> @NonNull ObjectMapper<T> getMapper(@NonNull TypeToken<T> type) throws ObjectMappingException
Description copied from interface:ObjectMapperFactory
Creates anObjectMapper
for the given type.- Specified by:
getMapper
in interfaceObjectMapperFactory
- Type Parameters:
T
- The type- Parameters:
type
- The type- Returns:
- An object mapper
- Throws:
ObjectMappingException
- If an exception occured whilst mapping
-
-