fix: Ignore if field does not exist
This commit is contained in:
@@ -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;
|
||||
}
|
Reference in New Issue
Block a user