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 java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
Extension.PrimitiveExtension<M extends ExtendableMessageNano<M>,T>
Represents an extension of a primitive (including enum) type.
|
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.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 | Constructor and Description |
|---|---|
private |
Extension(int type,
java.lang.Class<T> clazz,
int tag,
boolean repeated) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
computeRepeatedSerializedSize(java.lang.Object array) |
(package private) int |
computeSerializedSize(java.lang.Object value) |
protected int |
computeSingularSerializedSize(java.lang.Object value) |
static <M extends ExtendableMessageNano<M>,T extends MessageNano> |
createMessageTyped(int type,
java.lang.Class<T> clazz,
int tag)
Deprecated.
use
createMessageTyped(int, Class, long) instead. |
static <M extends ExtendableMessageNano<M>,T extends MessageNano> |
createMessageTyped(int type,
java.lang.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,
java.lang.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,
java.lang.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,
java.lang.Class<T> clazz,
long tag,
long nonPackedTag,
long packedTag)
Creates a repeated
Extension of the given primitive type and tag number. |
private T |
getRepeatedValueFrom(java.util.List<UnknownFieldData> unknownFields) |
private T |
getSingularValueFrom(java.util.List<UnknownFieldData> unknownFields) |
(package private) T |
getValueFrom(java.util.List<UnknownFieldData> unknownFields)
Returns the value of this extension stored in the given list of unknown fields, or
null if no unknown fields matches this extension. |
protected java.lang.Object |
readData(CodedInputByteBufferNano input) |
protected void |
readDataInto(UnknownFieldData data,
java.util.List<java.lang.Object> resultList) |
protected void |
writeRepeatedData(java.lang.Object array,
CodedOutputByteBufferNano output) |
protected void |
writeSingularData(java.lang.Object value,
CodedOutputByteBufferNano out) |
(package private) void |
writeTo(java.lang.Object value,
CodedOutputByteBufferNano output) |
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 java.lang.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
private Extension(int type,
java.lang.Class<T> clazz,
int tag,
boolean repeated)
@Deprecated public static <M extends ExtendableMessageNano<M>,T extends MessageNano> Extension<M,T> createMessageTyped(int type, java.lang.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_GROUPpublic static <M extends ExtendableMessageNano<M>,T extends MessageNano> Extension<M,T> createMessageTyped(int type, java.lang.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_GROUPpublic static <M extends ExtendableMessageNano<M>,T extends MessageNano> Extension<M,T[]> createRepeatedMessageTyped(int type, java.lang.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_GROUPpublic static <M extends ExtendableMessageNano<M>,T> Extension<M,T> createPrimitiveTyped(int type, java.lang.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_GROUPclazz - the boxed Java type of this extensionpublic static <M extends ExtendableMessageNano<M>,T> Extension<M,T> createRepeatedPrimitiveTyped(int type, java.lang.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_GROUPclazz - the Java array type of this extension, with an unboxed component typefinal T getValueFrom(java.util.List<UnknownFieldData> unknownFields)
null if no unknown fields matches this extension.unknownFields - a list of UnknownFieldData. All of the elements must have a tag
that matches this Extension's tag.private T getRepeatedValueFrom(java.util.List<UnknownFieldData> unknownFields)
private T getSingularValueFrom(java.util.List<UnknownFieldData> unknownFields)
protected java.lang.Object readData(CodedInputByteBufferNano input)
protected void readDataInto(UnknownFieldData data, java.util.List<java.lang.Object> resultList)
void writeTo(java.lang.Object value,
CodedOutputByteBufferNano output)
throws java.io.IOException
java.io.IOExceptionprotected void writeSingularData(java.lang.Object value,
CodedOutputByteBufferNano out)
protected void writeRepeatedData(java.lang.Object array,
CodedOutputByteBufferNano output)
int computeSerializedSize(java.lang.Object value)
protected int computeRepeatedSerializedSize(java.lang.Object array)
protected int computeSingularSerializedSize(java.lang.Object value)