com.abubusoft.kripton.BinderUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kripton-core Show documentation
Show all versions of kripton-core Show documentation
Kripton Persistence Library - core module
package com.abubusoft.kripton;
import java.lang.reflect.ParameterizedType;
import com.abubusoft.kripton.exception.NoSuchMapperException;
public abstract class BinderUtils {
/**
*
* This method will be used by bean mapper to persists embedded objects.
*
*
* @param cls
* The class for which the JsonMapper should be fetched.
*/
public static > M mapperFor(Class cls) throws NoSuchMapperException {
return AbstractJacksonContext.mapperFor(cls);
}
/**
*
* This method will be used by bean mapper to persists embedded objects.
*
*
* @param type
* @return
* @throws NoSuchMapperException
*/
public static > M mapperFor(ParameterizedType type) throws NoSuchMapperException {
@SuppressWarnings("unchecked")
M mapper = AbstractContext.getMapper((Class) type.getActualTypeArguments()[0]);
if (mapper == null) {
throw new NoSuchMapperException(type.getRawType());
} else {
return mapper;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy