
com.dyuproject.protostuff.ds.P8 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.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 P8 {
* required uint64 value = 1;
* optional uint64 end = 2;
* optional uint64 pgstart = 3;
* required ParamRangeKey prk = 4;
* }
*
*/
public final class P8 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 VALUE_MIN_ERR_MESSAGE = "Value is invalid.";
static final String END_MIN_ERR_MESSAGE = "End is invalid.";
static final String PGSTART_MIN_ERR_MESSAGE = "Pgstart is invalid.";
static final String PRK_REQUIRED_ERR_MESSAGE = "Prk is required.";
public static final long DEFAULT_END = -1l;
public static final long DEFAULT_PGSTART = -1l;
public static P8 create(double value) { return create(Double.doubleToRawLongBits(value)); }
public static P8 create(long value) { return new P8(value, new ParamRangeKey(false)); }
//public P8(long value) { this(value, new ParamRangeKey(false)); }
/** Required. */
public Long value;
/** Optional. */
public long end = DEFAULT_END;
/** Optional. */
public long pgstart = DEFAULT_PGSTART;
/** Required. */
public ParamRangeKey prk;
public P8() {}
public P8(
Long value,
ParamRangeKey prk
)
{
this.value = value;
this.prk = prk;
}
public Schema cachedSchema() { return SCHEMA; }
static final Schema SCHEMA = new Schema()
{
// schema methods
public P8 newMessage()
{
return new P8();
}
public Class typeClass()
{
return P8.class;
}
public String messageName()
{
return P8.class.getSimpleName();
}
public String messageFullName()
{
return P8.class.getName();
}
public boolean isInitialized(final P8 message)
{
if (com.dyuproject.protostuff.RpcValidation.verifyNotNull(
VALUE_REQUIRED_ERR_MESSAGE, message.value))
{
com.dyuproject.protostuff.RpcValidation.verifyMin(VALUE_MIN_ERR_MESSAGE, message.value, 0);
}
if (message.end != DEFAULT_END)
{
// default value configured to be out-of-range
com.dyuproject.protostuff.RpcValidation.verifyMin(END_MIN_ERR_MESSAGE, message.end, 0);
}
if (message.pgstart != DEFAULT_PGSTART)
{
// default value configured to be out-of-range
com.dyuproject.protostuff.RpcValidation.verifyMin(PGSTART_MIN_ERR_MESSAGE, message.pgstart, 0);
}
com.dyuproject.protostuff.RpcValidation.verifyNotNull(
PRK_REQUIRED_ERR_MESSAGE, message.prk);
com.dyuproject.protostuff.RpcValidation.invalidIf(
message.end != -1 && message.value > message.end, "Invalid end.");
com.dyuproject.protostuff.RpcValidation.invalidIf(
message.pgstart != -1 && message.value > message.pgstart, "Invalid pgstart.");
return true;
}
public void mergeFrom(final Input input, final P8 message) throws IOException
{
for (int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
{
switch (number)
{
case 0:
return;
case 1:
message.value = input.readFixed64();
break;
case 2:
message.end = input.readFixed64();
break;
case 3:
message.pgstart = input.readFixed64();
break;
case 4:
message.prk = input.mergeObject(message.prk, ParamRangeKey.getSchema());
break;
default:
input.handleUnknownField(number, this);
}
}
}
public void writeTo(final Output output, final P8 message) throws IOException
{
if (message.value == null)
throw new UninitializedMessageException("value", message);
output.writeFixed64(1, message.value, false);
if (message.end != DEFAULT_END)
output.writeFixed64(2, message.end, false);
if (message.pgstart != DEFAULT_PGSTART)
output.writeFixed64(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:
output.writeFixed64(number, input.readFixed64(), false);
break;
case 2:
output.writeFixed64(number, input.readFixed64(), false);
break;
case 3:
output.writeFixed64(number, input.readFixed64(), 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