public abstract class EnumAdapter<E extends WireEnum> extends ProtoAdapter<E>
ProtoAdapter that converts values of an enum to and from integers.ProtoAdapter.EnumConstantNotFoundException| Modifier | Constructor and Description |
|---|---|
protected |
EnumAdapter(Class<E> type) |
| Modifier and Type | Method and Description |
|---|---|
E |
decode(ProtoReader reader)
Read a non-null value from
reader. |
void |
encode(ProtoWriter writer,
E value)
Write non-null
value to writer. |
int |
encodedSize(E value)
The size of the non-null data
value. |
protected abstract E |
fromValue(int value)
Converts an integer to an enum.
|
asPacked, asRepeated, decode, decode, decode, decode, encode, encode, encode, encodedSizeWithTag, encodeWithTag, get, get, get, newEnumAdapter, newMapAdapter, newMessageAdapter, redact, toStringpublic final int encodedSize(E value)
ProtoAdaptervalue. This does not include the size required for
a length-delimited prefix (should the type require one).encodedSize in class ProtoAdapter<E extends WireEnum>public final void encode(ProtoWriter writer, E value) throws IOException
ProtoAdaptervalue to writer.encode in class ProtoAdapter<E extends WireEnum>IOExceptionpublic final E decode(ProtoReader reader) throws IOException
ProtoAdapterreader.decode in class ProtoAdapter<E extends WireEnum>IOExceptionprotected abstract E fromValue(int value)
Copyright © 2013–2017 Square, Inc.. All rights reserved.