|
|
@ -10,11 +10,13 @@ public class Mapper { |
|
|
|
object = aClass.getConstructor().newInstance(); |
|
|
|
object = aClass.getConstructor().newInstance(); |
|
|
|
Field[] sourceFields = source.getClass().getDeclaredFields(); |
|
|
|
Field[] sourceFields = source.getClass().getDeclaredFields(); |
|
|
|
for (Field sourceField : sourceFields) { |
|
|
|
for (Field sourceField : sourceFields) { |
|
|
|
|
|
|
|
if (!sourceField.isSynthetic()) { |
|
|
|
sourceField.setAccessible(true); |
|
|
|
sourceField.setAccessible(true); |
|
|
|
Field destinationField = object.getClass().getDeclaredField(sourceField.getName()); |
|
|
|
Field destinationField = object.getClass().getDeclaredField(sourceField.getName()); |
|
|
|
destinationField.setAccessible(true); |
|
|
|
destinationField.setAccessible(true); |
|
|
|
destinationField.set(object, sourceField.get(source)); |
|
|
|
destinationField.set(object, sourceField.get(source)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { |
|
|
|
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
} catch (NoSuchFieldException ignored) { |
|
|
|
} catch (NoSuchFieldException ignored) { |
|
|
|