io.activej.fs.tcp._RemoteFsCommands$MoveAll_DslJsonConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of activej-fs Show documentation
Show all versions of activej-fs Show documentation
Provides tools for building efficient, scalable local, remote or clustered file servers.
It utilizes ActiveJ CSP for fast and reliable file transfer.
package io.activej.fs.tcp;
public class _RemoteFsCommands$MoveAll_DslJsonConverter implements com.dslplatform.json.Configuration {
private static final java.nio.charset.Charset utf8 = java.nio.charset.Charset.forName("UTF-8");
@Override
public void configure(com.dslplatform.json.DslJson __dsljson) {
ObjectFormatConverter objectConverter = new ObjectFormatConverter(__dsljson);
__dsljson.registerReader(io.activej.fs.tcp.RemoteFsCommands.MoveAll.class, objectConverter);
__dsljson.registerWriter(io.activej.fs.tcp.RemoteFsCommands.MoveAll.class, objectConverter);
}
public final static class ObjectFormatConverter implements com.dslplatform.json.runtime.FormatConverter {
private final boolean alwaysSerialize;
private final com.dslplatform.json.DslJson __dsljson;
private final com.dslplatform.json.JsonReader.ReadObject key_reader_sourceToTarget;
private final com.dslplatform.json.JsonWriter.WriteObject key_writer_sourceToTarget;
private final com.dslplatform.json.JsonReader.ReadObject value_reader_sourceToTarget;
private final com.dslplatform.json.JsonWriter.WriteObject value_writer_sourceToTarget;
public ObjectFormatConverter(com.dslplatform.json.DslJson __dsljson) {
this.alwaysSerialize = !__dsljson.omitDefaults;
this.__dsljson = __dsljson;
this.key_reader_sourceToTarget = com.dslplatform.json.StringConverter.READER;
this.key_writer_sourceToTarget = com.dslplatform.json.StringConverter.WRITER;
this.value_reader_sourceToTarget = com.dslplatform.json.StringConverter.READER;
this.value_writer_sourceToTarget = com.dslplatform.json.StringConverter.WRITER;
}
private static final byte[] quoted_sourceToTarget = "\"sourceToTarget\":".getBytes(utf8);
private static final byte[] name_sourceToTarget = "sourceToTarget".getBytes(utf8);
public final void write(final com.dslplatform.json.JsonWriter writer, final io.activej.fs.tcp.RemoteFsCommands.MoveAll instance) {
if (instance == null) writer.writeNull();
else {
writer.writeByte((byte)'{');
if (alwaysSerialize) { writeContentFull(writer, instance); writer.writeByte((byte)'}'); }
else if (writeContentMinimal(writer, instance)) writer.getByteBuffer()[writer.size() - 1] = '}';
else writer.writeByte((byte)'}');
}
}
public void writeContentFull(final com.dslplatform.json.JsonWriter writer, final io.activej.fs.tcp.RemoteFsCommands.MoveAll instance) {
writer.writeAscii(quoted_sourceToTarget);
if (instance.getSourceToTarget() == null) writer.writeNull();
else writer.serialize(instance.getSourceToTarget(), key_writer_sourceToTarget, value_writer_sourceToTarget);
}
public boolean writeContentMinimal(final com.dslplatform.json.JsonWriter writer, final io.activej.fs.tcp.RemoteFsCommands.MoveAll instance) {
boolean hasWritten = false;
if (instance.getSourceToTarget() != null) {
writer.writeByte((byte)'"'); writer.writeAscii(name_sourceToTarget); writer.writeByte((byte)'"'); writer.writeByte((byte)':');
writer.serialize(instance.getSourceToTarget(), key_writer_sourceToTarget, value_writer_sourceToTarget);
writer.writeByte((byte)','); hasWritten = true;
}
return hasWritten;
}
public io.activej.fs.tcp.RemoteFsCommands.MoveAll read(final com.dslplatform.json.JsonReader reader) throws java.io.IOException {
if (reader.wasNull()) return null;
else if (reader.last() != '{') throw reader.newParseError("Expecting '{' for object start");
reader.getNextToken();
return readContent(reader);
}
public io.activej.fs.tcp.RemoteFsCommands.MoveAll readContent(final com.dslplatform.json.JsonReader reader) throws java.io.IOException {
java.util.Map _sourceToTarget_ = null;
if (reader.last() == '}') {
return new io.activej.fs.tcp.RemoteFsCommands.MoveAll(_sourceToTarget_);
}
switch(reader.fillName()) {
case 1927956516:
reader.getNextToken();
_sourceToTarget_ = reader.readMap(key_reader_sourceToTarget, value_reader_sourceToTarget);
reader.getNextToken();
break;
default:
reader.getNextToken();
reader.skip();
}
while (reader.last() == ','){
reader.getNextToken();
switch(reader.fillName()) {
case 1927956516:
reader.getNextToken();
_sourceToTarget_ = reader.readMap(key_reader_sourceToTarget, value_reader_sourceToTarget);
reader.getNextToken();
break;
default:
reader.getNextToken();
reader.skip();
}
}
if (reader.last() != '}') throw reader.newParseError("Expecting '}' for object end");
return new io.activej.fs.tcp.RemoteFsCommands.MoveAll(_sourceToTarget_);
}
}
}