Package com.github.dozermapper.core.util
Class MappingUtils
- java.lang.Object
-
- com.github.dozermapper.core.util.MappingUtils
-
public final class MappingUtils extends Object
Internal class that provides various mapping utilities used throughout the code base. Only intended for internal use.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidapplyGlobalCopyByReference(Configuration globalConfig, FieldMap fieldMap, ClassMap classMap)static <T> TdeProxy(T object, BeanContainer beanContainer)static Class<?>determineCustomConverter(FieldMap fieldMap, Cache converterByDestTypeCache, CustomConverterContainer customConverterContainer, Class<?> srcClass, Class<?> destClass)static Class<?>findCustomConverter(Cache converterByDestTypeCache, CustomConverterContainer customConverterContainer, Class<?> srcClass, Class<?> destClass)static StringgetClassNameWithoutPackage(Class<?> clazz)static ObjectgetIndexedValue(Object collection, int index)static List<Class<?>>getInterfaceHierarchy(Class<?> srcClass, BeanContainer beanContainer)static StringgetMappedParentFieldKey(Object destObj, FieldMap destFieldMap)static Class<?>getRealClass(Class<?> clazz, BeanContainer beanContainer)static ThrowablegetRootCause(Throwable ex)static List<Class<?>>getSuperClassesAndInterfaces(Class<?> srcClass, BeanContainer beanContainer)static booleanisBlankOrNull(String value)static booleanisDeepMapping(String mapping)static booleanisEnumType(Class<?> srcFieldClass)Used to test ifsrcFieldClassis enum.static booleanisEnumType(Class<?> srcFieldClass, Class<?> destFieldType)Used to test if bothsrcFieldClassanddestFieldTypeare enum.static booleanisProxy(Class<?> clazz, BeanContainer beanContainer)static booleanisSupportedCollection(Class<?> aClass)static booleanisSupportedMap(Class<?> aClass)static Class<?>loadClass(String name, BeanContainer beanContainer)static ObjectprepareIndexedCollection(Class<?> collectionType, Object existingCollection, Object collectionEntry, int index)static voidreverseFields(ClassMap source, ClassMap destination, BeanContainer beanContainer)static voidreverseFields(FieldMap source, FieldMap reversed)static voidthrowMappingException(String msg)static voidthrowMappingException(String msg, Throwable cause)static voidthrowMappingException(Throwable e)
-
-
-
Method Detail
-
isSupportedCollection
public static boolean isSupportedCollection(Class<?> aClass)
-
isSupportedMap
public static boolean isSupportedMap(Class<?> aClass)
-
throwMappingException
public static void throwMappingException(Throwable e) throws MappingException
- Throws:
MappingException
-
throwMappingException
public static void throwMappingException(String msg) throws MappingException
- Throws:
MappingException
-
throwMappingException
public static void throwMappingException(String msg, Throwable cause) throws MappingException
- Throws:
MappingException
-
isBlankOrNull
public static boolean isBlankOrNull(String value)
-
getMappedParentFieldKey
public static String getMappedParentFieldKey(Object destObj, FieldMap destFieldMap)
-
findCustomConverter
public static Class<?> findCustomConverter(Cache converterByDestTypeCache, CustomConverterContainer customConverterContainer, Class<?> srcClass, Class<?> destClass)
-
determineCustomConverter
public static Class<?> determineCustomConverter(FieldMap fieldMap, Cache converterByDestTypeCache, CustomConverterContainer customConverterContainer, Class<?> srcClass, Class<?> destClass)
-
reverseFields
public static void reverseFields(ClassMap source, ClassMap destination, BeanContainer beanContainer)
-
applyGlobalCopyByReference
public static void applyGlobalCopyByReference(Configuration globalConfig, FieldMap fieldMap, ClassMap classMap)
-
loadClass
public static Class<?> loadClass(String name, BeanContainer beanContainer)
-
getRealClass
public static Class<?> getRealClass(Class<?> clazz, BeanContainer beanContainer)
-
deProxy
public static <T> T deProxy(T object, BeanContainer beanContainer)
-
isProxy
public static boolean isProxy(Class<?> clazz, BeanContainer beanContainer)
-
prepareIndexedCollection
public static Object prepareIndexedCollection(Class<?> collectionType, Object existingCollection, Object collectionEntry, int index)
-
isDeepMapping
public static boolean isDeepMapping(String mapping)
-
isEnumType
public static boolean isEnumType(Class<?> srcFieldClass)
Used to test ifsrcFieldClassis enum.- Parameters:
srcFieldClass- the source field to be tested.- Returns:
trueif and only if current running JRE is 1.5 or above, andsrcFieldClassis enum; otherwise returnfalse.
-
isEnumType
public static boolean isEnumType(Class<?> srcFieldClass, Class<?> destFieldType)
Used to test if bothsrcFieldClassanddestFieldTypeare enum.- Parameters:
srcFieldClass- the source field to be tested.destFieldType- the destination field to be tested.- Returns:
trueif and only if current running JRE is 1.5 or above, and bothsrcFieldClassanddestFieldTypeare enum; otherwise returnfalse.
-
getSuperClassesAndInterfaces
public static List<Class<?>> getSuperClassesAndInterfaces(Class<?> srcClass, BeanContainer beanContainer)
-
getInterfaceHierarchy
public static List<Class<?>> getInterfaceHierarchy(Class<?> srcClass, BeanContainer beanContainer)
-
-