public CloneMapper(final Mapper mapper) {
this.mapper = mapper;
}
void map(final Class sourceClass, final Class destClass) {
final MappedClass destMC = mapper.getMappedClass(destClass);
final MappedClass sourceMC = mapper.getMappedClass(sourceClass);
//copy the class level annotations
for (final Entry<Class<? extends Annotation>, List<Annotation>> e : sourceMC.getRelevantAnnotations().entrySet()) {
if (e.getValue() != null && !e.getValue().isEmpty()) {
for (final Annotation ann : e.getValue()) {
destMC.addAnnotation(e.getKey(), ann);
}
}
}
//copy the fields.
for (final MappedField mf : sourceMC.getPersistenceFields()) {
final Map<Class<? extends Annotation>, Annotation> annMap = mf.getAnnotations();
final MappedField destMF = destMC.getMappedFieldByJavaField(mf.getJavaFieldName());
if (destMF != null && annMap != null && !annMap.isEmpty()) {
for (final Entry<Class<? extends Annotation>, Annotation> e : annMap.entrySet()) {
destMF.addAnnotation(e.getKey(), e.getValue());