-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ReflectionPropagation refactor (#354)
* Refactor GetValueCommand Signed-off-by: Gyúróczki Gergő <gergonoorbi@gmail.com> * Refactor SetValueCommand Signed-off-by: Gyúróczki Gergő <gergonoorbi@gmail.com>
- Loading branch information
Showing
7 changed files
with
50 additions
and
160 deletions.
There are no files selected for viewing
28 changes: 0 additions & 28 deletions
28
src/main/java/org/eclipse/yasson/internal/model/GetFromField.java
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
src/main/java/org/eclipse/yasson/internal/model/GetFromGetter.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 5 additions & 14 deletions
19
src/main/java/org/eclipse/yasson/internal/model/SetValueCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,22 @@ | ||
package org.eclipse.yasson.internal.model; | ||
|
||
import javax.json.bind.JsonbException; | ||
import java.lang.reflect.InvocationTargetException; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Wrapper for setting a value on javabean property. | ||
* | ||
* @author Roman Grigoriadi | ||
*/ | ||
abstract class SetValueCommand { | ||
|
||
abstract void internalSetValue(Object object, Object value) throws IllegalAccessException, InvocationTargetException; | ||
@FunctionalInterface | ||
interface SetValueCommand { | ||
|
||
/** | ||
* Sets a value with reflection on {@link java.lang.reflect.Field field} or {@link java.lang.reflect.Method setter}. | ||
* | ||
* @param object object to invoke set value on, not null. | ||
* @param value object to be set, nullable. | ||
* @throws JsonbException if reflection fails. | ||
* @throws IllegalAccessException if reflection fails. | ||
* @throws InvocationTargetException if reflection fails. | ||
*/ | ||
final void setValue(Object object, Object value) { | ||
Objects.requireNonNull(object); | ||
try { | ||
internalSetValue(object, value); | ||
} catch (InvocationTargetException | IllegalAccessException e) { | ||
throw new JsonbException("Error getting value on: " + object, e); | ||
} | ||
} | ||
void setValue(Object object, Object value) throws IllegalAccessException, InvocationTargetException; | ||
} |
30 changes: 0 additions & 30 deletions
30
src/main/java/org/eclipse/yasson/internal/model/SetWithField.java
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
src/main/java/org/eclipse/yasson/internal/model/SetWithSetter.java
This file was deleted.
Oops, something went wrong.