
com.dyuproject.protostuff.ds.PS Maven / Gradle / Ivy
The newest version!
// Generated by fbsgen from p/ds/prk.proto
package com.dyuproject.protostuff.ds;
import java.io.IOException;
import com.dyuproject.protostuff.ByteString;
import com.dyuproject.protostuff.Input;
import com.dyuproject.protostuff.Message;
import com.dyuproject.protostuff.Output;
import com.dyuproject.protostuff.Pipe;
import com.dyuproject.protostuff.Schema;
import com.dyuproject.protostuff.UninitializedMessageException;
/**
*
* message PS {
* required string value = 1;
* optional string end = 2;
* optional string pgstart = 3;
* required ParamRangeKey prk = 4;
* }
*
*/
public final class PS implements Message
{
public static final int FN_VALUE = 1;
public static final int FN_END = 2;
public static final int FN_PGSTART = 3;
public static final int FN_PRK = 4;
static final String VALUE_REQUIRED_ERR_MESSAGE = "Value is required.";
static final String END_NOT_EMPTY_ERR_MESSAGE = "End is invalid.";
static final String PGSTART_NOT_EMPTY_ERR_MESSAGE = "Pgstart is invalid.";
static final String PRK_REQUIRED_ERR_MESSAGE = "Prk is required.";
public static PS create(String value) { return new PS(value, new ParamRangeKey(false)); }
public static PS createPrefix(String prefix, String pgstart) { PS ps = create(prefix); ps.pgstart = pgstart; return ps; }
//public PS(String value) { this(value, new ParamRangeKey(false)); }
/** Required. */
public String value;
/** Optional. */
public String end = ByteString.EMPTY_STRING;
/** Optional. */
public String pgstart = ByteString.EMPTY_STRING;
/** Required. */
public ParamRangeKey prk;
public PS() {}
public PS(
String value,
ParamRangeKey prk
)
{
this.value = value;
this.prk = prk;
}
public Schema cachedSchema() { return SCHEMA; }
static final Schema SCHEMA = new Schema()
{
// schema methods
public PS newMessage()
{
return new PS();
}
public Class typeClass()
{
return PS.class;
}
public String messageName()
{
return PS.class.getSimpleName();
}
public String messageFullName()
{
return PS.class.getName();
}
public boolean isInitialized(final PS message)
{
com.dyuproject.protostuff.RpcValidation.verifyNotNull(
VALUE_REQUIRED_ERR_MESSAGE, message.value);
if (/*message.end != null && */message.end != ByteString.EMPTY_STRING)
{
com.dyuproject.protostuff.RpcValidation.verifyNotEmpty(END_NOT_EMPTY_ERR_MESSAGE, message.end);
com.dyuproject.protostuff.RpcValidation.invalidIf(message.value != null &&
message.value.compareTo(message.end) > 0,
END_NOT_EMPTY_ERR_MESSAGE);
}
if (/*message.pgstart != null && */message.pgstart != ByteString.EMPTY_STRING)
{
com.dyuproject.protostuff.RpcValidation.verifyNotEmpty(PGSTART_NOT_EMPTY_ERR_MESSAGE, message.pgstart);
com.dyuproject.protostuff.RpcValidation.invalidIf(message.value != null &&
message.value.compareTo(message.pgstart) > 0,
PGSTART_NOT_EMPTY_ERR_MESSAGE);
}
com.dyuproject.protostuff.RpcValidation.verifyNotNull(
PRK_REQUIRED_ERR_MESSAGE, message.prk);
return true;
}
public void mergeFrom(final Input input, final PS message) throws IOException
{
for (int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
{
switch (number)
{
case 0:
return;
case 1:
message.value = input.readString();
break;
case 2:
message.end = input.readString();
break;
case 3:
message.pgstart = input.readString();
break;
case 4:
message.prk = input.mergeObject(message.prk, ParamRangeKey.getSchema());
break;
default:
input.handleUnknownField(number, this);
}
}
}
public void writeTo(final Output output, final PS message) throws IOException
{
if (message.value == null)
throw new UninitializedMessageException("value", message);
output.writeString(1, message.value, false);
if (message.end != null && message.end != ByteString.EMPTY_STRING)
output.writeString(2, message.end, false);
if (message.pgstart != null && message.pgstart != ByteString.EMPTY_STRING)
output.writeString(3, message.pgstart, false);
if (message.prk == null)
throw new UninitializedMessageException("prk", message);
output.writeObject(4, message.prk, ParamRangeKey.getSchema(), false);
}
public String getFieldName(final int number)
{
switch(number)
{
case 1: return "value";
case 2: return "end";
case 3: return "pgstart";
case 4: return "prk";
default: return null;
}
}
public int getFieldNumber(final String name)
{
final Integer number = fieldMap.get(name);
return number == null ? 0 : number.intValue();
}
final java.util.HashMap fieldMap = new java.util.HashMap();
{
fieldMap.put("value", 1);
fieldMap.put("end", 2);
fieldMap.put("pgstart", 3);
fieldMap.put("prk", 4);
}
};
/**
* Useful for filtering (called by your custom pipe schema).
*/
public static void transferField(int number, Pipe pipe, Input input, Output output,
Schema wrappedSchema) throws IOException
{
switch (number)
{
case 1:
input.transferByteRangeTo(output, true, number, false);
break;
case 2:
input.transferByteRangeTo(output, true, number, false);
break;
case 3:
input.transferByteRangeTo(output, true, number, false);
break;
case 4:
output.writeObject(number, pipe, ParamRangeKey.getPipeSchema(), false);
break;
default:
input.handleUnknownField(number, wrappedSchema);
}
}
static final Pipe.Schema PIPE_SCHEMA = new Pipe.Schema(SCHEMA)
{
protected void transfer(final Pipe pipe, final Input input, final Output output) throws IOException
{
for (int number = input.readFieldNumber(wrappedSchema);
number != 0;
number = input.readFieldNumber(wrappedSchema))
{
transferField(number, pipe, input, output, wrappedSchema);
}
}
};
public static Schema getSchema() { return SCHEMA; }
public static Pipe.Schema getPipeSchema() { return PIPE_SCHEMA; }
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy