fix: Ignore if field does not exist

This commit is contained in:
Krrish Ghimire
2019-12-03 23:25:18 +05:45
parent 8f4f154879
commit 8fc1410cd0
5 changed files with 43 additions and 34 deletions

View File

@@ -1,3 +1,5 @@
package np.com.krrish;
import java.lang.reflect.*;
public class Mapper {
@@ -13,8 +15,9 @@ public class Mapper {
destinationField.setAccessible(true);
destinationField.set(object, sourceField.get(source));
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException | NoSuchFieldException e) {
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
e.printStackTrace();
} catch (NoSuchFieldException ignored) {
}
return object;
}