mirror of
https://github.com/valitydev/geck.git
synced 2024-11-06 01:35:22 +00:00
Adding handling for Optional (#33)
* Adding handling for Optional in dev.vality.geck.serializer.kit.tbase.TBaseProcessor#process() * Bump geck version
This commit is contained in:
parent
522cf211f8
commit
b2e1f094dd
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>dev.vality.geck</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<version>1.0.2</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>dev.vality.geck</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<version>1.0.2</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>dev.vality.geck</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<version>1.0.2</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
2
pom.xml
2
pom.xml
@ -12,7 +12,7 @@
|
||||
|
||||
<groupId>dev.vality.geck</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<version>1.0.2</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>Geck</name>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>dev.vality.geck</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<version>1.0.2</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
@ -12,10 +12,7 @@ import org.apache.thrift.meta_data.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public class TBaseProcessor implements StructProcessor<TBase> {
|
||||
|
||||
@ -84,6 +81,13 @@ public class TBaseProcessor implements StructProcessor<TBase> {
|
||||
private void process(Object object, FieldValueMetaData fieldValueMetaData, StructHandler handler) throws IOException {
|
||||
if (object == null) {
|
||||
handler.nullValue();
|
||||
} else if (object instanceof Optional<?> optional) {
|
||||
if (optional.isPresent()) {
|
||||
Object value = optional.get();
|
||||
process(value, fieldValueMetaData, handler);
|
||||
} else {
|
||||
handler.nullValue();
|
||||
}
|
||||
} else {
|
||||
ThriftType type = ThriftType.findByMetaData(fieldValueMetaData);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user