public <S, D> void map(S sourceObject, D destinationObject, Type<S> sourceType, Type<D> destinationType, MappingContext context) {
try {
if (destinationObject == null) {
throw new MappingException("[destinationObject] can not be null.");
}
if (destinationType == null) {
throw new MappingException("[destinationType] can not be null.");
}
if (sourceObject == null) {
throw new MappingException("[sourceObject] can not be null.");
}
if (context.getMappedObject(sourceObject, destinationType) == null) {
MappingStrategy strategy = resolveMappingStrategy(sourceObject, sourceType, destinationType, true, context);
strategy.map(sourceObject, destinationObject, context);
}
} catch (MappingException e) {
/* don't wrap our own exceptions */
throw e;
} catch (RuntimeException e) {
if (!ExceptionUtility.originatedByOrika(e)) {
throw e;
}
throw new MappingException("Error encountered while mapping for the following inputs: " + "\nrawSource=" + sourceObject
+ "\nsourceClass=" + (sourceObject != null ? sourceObject.getClass() : null) + "\nsourceType=" + sourceType
+ "\nrawDestination=" + destinationObject + "\ndestinationClass="
+ (destinationObject != null ? destinationObject.getClass() : null) + "\ndestinationType=" + destinationType, e);
}