
com.dslplatform.json.runtime.AttributeDecoder 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 com.dslplatform.json.runtime;
import com.dslplatform.json.JsonReader;
import java.io.IOException;
class AttributeDecoder implements JsonReader.BindObject {
private final Settings.BiConsumer write;
private final JsonReader.ReadObject decoder;
AttributeDecoder(
final Settings.BiConsumer write,
final JsonReader.ReadObject decoder) {
if (write == null) throw new IllegalArgumentException("write can't be null");
if (decoder == null) throw new IllegalArgumentException("decoder can't be null");
this.write = write;
this.decoder = decoder;
}
@Override
public T bind(final JsonReader reader, final T instance) throws IOException {
final P attr = decoder.read(reader);
write.accept(instance, attr);
return instance;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy