public <S, D> void map(S sourceObject, D destinationObject, MappingContext context) {
try {
if (destinationObject == null) {
throw new MappingException("[destinationObject] can not be null.");
}
if (sourceObject == null) {
throw new MappingException("[sourceObject] can not be null.");
}
if (context.getMappedObject(sourceObject, destinationObject.getClass()) == null) {
MappingStrategy strategy = resolveMappingStrategy(sourceObject, null, destinationObject.getClass(), 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)
+ "\nrawDestination=" + destinationObject + "\ndestinationClass="
+ (destinationObject != null ? destinationObject.getClass() : null), e);
}
}