M
- the type of the extendable message this extension is for.T
- the Java type of the extension; see clazz
.public class Extension<M extends ExtendableMessageNano<M>,T> extends Object
Modifier and Type | Field and Description |
---|---|
protected Class<T> |
clazz
Java type of this extension.
|
protected boolean |
repeated
Whether this extension is repeated.
|
int |
tag
Tag number of this extension.
|
protected int |
type
Protocol Buffer type of this extension; one of the
TYPE_ constants. |
static int |
TYPE_BOOL |
static int |
TYPE_BYTES |
static int |
TYPE_DOUBLE |
static int |
TYPE_ENUM |
static int |
TYPE_FIXED32 |
static int |
TYPE_FIXED64 |
static int |
TYPE_FLOAT |
static int |
TYPE_GROUP |
static int |
TYPE_INT32 |
static int |
TYPE_INT64 |
static int |
TYPE_MESSAGE |
static int |
TYPE_SFIXED32 |
static int |
TYPE_SFIXED64 |
static int |
TYPE_SINT32 |
static int |
TYPE_SINT64 |
static int |
TYPE_STRING |
static int |
TYPE_UINT32 |
static int |
TYPE_UINT64 |
Modifier and Type | Method and Description |
---|---|
protected int |
computeRepeatedSerializedSize(Object array) |
protected int |
computeSingularSerializedSize(Object value) |
static <M extends ExtendableMessageNano<M>,T extends MessageNano> |
createMessageTyped(int type,
Class<T> clazz,
int tag)
Deprecated.
use
createMessageTyped(int, Class, long) instead. |
static <M extends ExtendableMessageNano<M>,T extends MessageNano> |
createMessageTyped(int type,
Class<T> clazz,
long tag)
Creates an
Extension of the given message type and tag number. |
static <M extends ExtendableMessageNano<M>,T> |
createPrimitiveTyped(int type,
Class<T> clazz,
long tag)
Creates an
Extension of the given primitive type and tag number. |
static <M extends ExtendableMessageNano<M>,T extends MessageNano> |
createRepeatedMessageTyped(int type,
Class<T[]> clazz,
long tag)
Creates a repeated
Extension of the given message type and tag number. |
static <M extends ExtendableMessageNano<M>,T> |
createRepeatedPrimitiveTyped(int type,
Class<T> clazz,
long tag,
long nonPackedTag,
long packedTag)
Creates a repeated
Extension of the given primitive type and tag number. |
protected Object |
readData(CodedInputByteBufferNano input) |
protected void |
readDataInto(com.google.protobuf.nano.UnknownFieldData data,
List<Object> resultList) |
protected void |
writeRepeatedData(Object array,
CodedOutputByteBufferNano output) |
protected void |
writeSingularData(Object value,
CodedOutputByteBufferNano out) |
public static final int TYPE_DOUBLE
public static final int TYPE_FLOAT
public static final int TYPE_INT64
public static final int TYPE_UINT64
public static final int TYPE_INT32
public static final int TYPE_FIXED64
public static final int TYPE_FIXED32
public static final int TYPE_BOOL
public static final int TYPE_STRING
public static final int TYPE_GROUP
public static final int TYPE_MESSAGE
public static final int TYPE_BYTES
public static final int TYPE_UINT32
public static final int TYPE_ENUM
public static final int TYPE_SFIXED32
public static final int TYPE_SFIXED64
public static final int TYPE_SINT32
public static final int TYPE_SINT64
protected final int type
TYPE_
constants.protected final Class<T> clazz
type
; for a repeated extension, this is an array type whose
component type is the unboxed Java type for type
. For example, for a singular
int32
/TYPE_INT32
extension, this equals Integer.class
; for a
repeated int32
extension, this equals int[].class
.public final int tag
protected final boolean repeated
@Deprecated public static <M extends ExtendableMessageNano<M>,T extends MessageNano> Extension<M,T> createMessageTyped(int type, Class<T> clazz, int tag)
createMessageTyped(int, Class, long)
instead.Extension
of the given message type and tag number.
Should be used by the generated code only.type
- TYPE_MESSAGE
or TYPE_GROUP
public static <M extends ExtendableMessageNano<M>,T extends MessageNano> Extension<M,T> createMessageTyped(int type, Class<T> clazz, long tag)
Extension
of the given message type and tag number.
Should be used by the generated code only.type
- TYPE_MESSAGE
or TYPE_GROUP
public static <M extends ExtendableMessageNano<M>,T extends MessageNano> Extension<M,T[]> createRepeatedMessageTyped(int type, Class<T[]> clazz, long tag)
Extension
of the given message type and tag number.
Should be used by the generated code only.type
- TYPE_MESSAGE
or TYPE_GROUP
public static <M extends ExtendableMessageNano<M>,T> Extension<M,T> createPrimitiveTyped(int type, Class<T> clazz, long tag)
Extension
of the given primitive type and tag number.
Should be used by the generated code only.type
- one of TYPE_*
, except TYPE_MESSAGE
and TYPE_GROUP
clazz
- the boxed Java type of this extensionpublic static <M extends ExtendableMessageNano<M>,T> Extension<M,T> createRepeatedPrimitiveTyped(int type, Class<T> clazz, long tag, long nonPackedTag, long packedTag)
Extension
of the given primitive type and tag number.
Should be used by the generated code only.type
- one of TYPE_*
, except TYPE_MESSAGE
and TYPE_GROUP
clazz
- the Java array type of this extension, with an unboxed component typeprotected Object readData(CodedInputByteBufferNano input)
protected void readDataInto(com.google.protobuf.nano.UnknownFieldData data, List<Object> resultList)
protected void writeSingularData(Object value, CodedOutputByteBufferNano out)
protected void writeRepeatedData(Object array, CodedOutputByteBufferNano output)
protected int computeRepeatedSerializedSize(Object array)
protected int computeSingularSerializedSize(Object value)
Copyright © 2008–2018. All rights reserved.