
com.dyuproject.protostuff.ds.ParamId 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 ParamId {
* required uint32 id = 1;
* }
*
*/
public final class ParamId implements Message
{
public static final int FN_ID = 1;
static final String ID_REQUIRED_ERR_MESSAGE = "Id is required.";
static final String ID_MIN_ERR_MESSAGE = "Id is invalid.";
/** Required. */
public Integer id;
public ParamId() {}
public ParamId(
Integer id
)
{
this.id = id;
}
public Schema cachedSchema() { return SCHEMA; }
static final Schema SCHEMA = new Schema()
{
// schema methods
public ParamId newMessage()
{
return new ParamId();
}
public Class typeClass()
{
return ParamId.class;
}
public String messageName()
{
return ParamId.class.getSimpleName();
}
public String messageFullName()
{
return ParamId.class.getName();
}
public boolean isInitialized(final ParamId message)
{
if (com.dyuproject.protostuff.RpcValidation.verifyNotNull(
ID_REQUIRED_ERR_MESSAGE, message.id))
{
com.dyuproject.protostuff.RpcValidation.verifyMin(ID_MIN_ERR_MESSAGE, message.id, 1);
}
return true;
}
public void mergeFrom(final Input input, final ParamId message) throws IOException
{
for (int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
{
switch (number)
{
case 0:
return;
case 1:
message.id = input.readFixed32();
break;
default:
input.handleUnknownField(number, this);
}
}
}
public void writeTo(final Output output, final ParamId message) throws IOException
{
if (message.id == null)
throw new UninitializedMessageException("id", message);
output.writeFixed32(1, message.id, false);
}
public String getFieldName(final int number)
{
return number == 1 ? "id" : null;
}
public int getFieldNumber(final String name)
{
return "id".equals(name) ? 1 : 0;
}
};
/**
* 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.writeFixed32(number, input.readFixed32(), 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