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 for
ObjectMapper
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
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 Details
-
Method Details
-
getMapper
public <T> @NonNull ObjectMapper<T> getMapper(@NonNull Class<T> type) throws ObjectMappingExceptionDescription 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 ObjectMappingExceptionDescription 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
-
toString
-