Skip to content

Commit

Permalink
Merge pull request realtimetech-solution#30 from devjeonghwan/add-wit…
Browse files Browse the repository at this point in the history
…h-type

Add `WithType` description to README.md
  • Loading branch information
devjeonghwan authored Aug 21, 2023
2 parents b70e7a1 + 8f67c1d commit 05a234d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .idea/modules/opack.main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/modules/opack.test.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/opack.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,19 @@ public class SomeObject {
private byte[] bytesField;
}
```
#### 3. Class Transformer
#### 3. Field With Type
```java
public class SomeObject {
// This field will serialize with runtime type, and deserialize actual type instead of ambiguous field type `List`
@WithType
private List<String> stringListField;

// This field will serialize with runtime type, and deserialize actual type instead of ambiguous field type `Object`
@WithType
private Object[] objectArrayField;
}
```
#### 4. Class Transformer
```java
public class AnimalTransformer implements Transformer {
/*
Expand Down Expand Up @@ -271,7 +283,7 @@ public class SomeObject {
}
```

#### 4. Handling Opack Value
#### 5. Handling Opack Value
```java
OpackObject<String, OpackValue> rootObject = new OpackObject<>();

Expand Down Expand Up @@ -316,6 +328,7 @@ System.out.println("First element is " + (opackArray.get(0)));
- [ ] Add generic into transformer for type safety
- [ ] Add field pre/post transformer
- [ ] Remove `fieldTransformer` argument of `Opacker.prepareObjectDeserialize`
- [ ] Remove `withType` argument of `Opacker.prepareObjectDeserialize`

### License

Expand Down

0 comments on commit 05a234d

Please sign in to comment.