dsl_json.java.util.OptionalDslJsonConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dsl-json-java8 Show documentation
Show all versions of dsl-json-java8 Show documentation
DSL Platform compatible Java JSON library (https://dsl-platform.com)
package dsl_json.java.util;
import com.dslplatform.json.*;
import com.dslplatform.json.runtime.OptionalAnalyzer;
import java.util.Optional;
public class OptionalDslJsonConverter implements Configuration {
@Override
public void configure(DslJson json) {
json.registerDefault(Optional.class, Optional.empty());
json.registerWriterFactory(OptionalAnalyzer.WRITER);
json.registerReaderFactory(OptionalAnalyzer.READER);
OptionalAnalyzer.WRITER.tryCreate(Optional.class, json);
OptionalAnalyzer.READER.tryCreate(Optional.class, json);
}
}