ExtensionRegistry but supports only "lite" types.
If all of your types are lite types, then you only need to use ExtensionRegistryLite.
Similarly, if all your types are regular types, then you only need ExtensionRegistry.
Typically it does not make sense to mix the two, since if you have any regular types in your
program, you then require the full runtime and lose all the benefits of the lite runtime, so you
might as well make all your types be regular types. However, in some cases (e.g. when depending
on multiple third-party libraries where one uses lite types and one uses regular), you may find
yourself wanting to mix the two. In this case things get more complicated.
There are three factors to consider: Whether the type being extended is lite, whether the embedded type (in the case of a message-typed extension) is lite, and whether the extension itself is lite. Since all three are declared in different files, they could all be different. Here are all the combinations and which type of registry to use:
Extended type Inner type Extension Use registry ======================================================================= lite lite lite ExtensionRegistryLite lite regular lite ExtensionRegistry regular regular regular ExtensionRegistry all other combinations not supported
Note that just as regular types are not allowed to contain lite-type fields, they are also not allowed to contain lite-type extensions. This is because regular types must be fully accessible via reflection, which in turn means that all the inner messages must also support reflection. On the other hand, since regular types implement the entire lite interface, there is no problem with embedding regular types inside lite types.
| Modifier and Type | Class and Description |
|---|---|
| private static class | ExtensionRegistryLite.ObjectIntPair
A (Object, int) pair, used as a map key. |
| Modifier and Type | Field and Description |
|---|---|
| private static volatile boolean | |
| pack-priv static final ExtensionRegistryLite | |
| pack-priv static final String | |
| private static final Class | |
| private final Map |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public final void | add(final GeneratedMessageLite.
Add an extension from a lite generated file to the registry. |
| public final void | add(ExtensionLite<?, ?> extension)
Add an extension from a lite generated file to the registry only if it is a non-lite extension
i.e. |
| public <ContainingType extends MessageLite> GeneratedMessageLite. | Returns: Information about the extension if found, ornull otherwise.Find an extension by containing type and field number. |
| public static ExtensionRegistryLite | getEmptyRegistry()
Get the unmodifiable singleton empty instance of either ExtensionRegistryLite or |
| public ExtensionRegistryLite | |
| public static boolean | |
| public static ExtensionRegistryLite | |
| pack-priv static Class | |
| public static void |
| eagerlyParseMessageSets | back to summary |
|---|---|
| private static volatile boolean eagerlyParseMessageSets | |
| EMPTY_REGISTRY_LITE | back to summary |
|---|---|
| pack-priv static final ExtensionRegistryLite EMPTY_REGISTRY_LITE | |
| EXTENSION_CLASS_NAME | back to summary |
|---|---|
| pack-priv static final String EXTENSION_CLASS_NAME | |
| extensionClass | back to summary |
|---|---|
| private static final Class<?> extensionClass | |
| extensionsByNumber | back to summary |
|---|---|
| private final Map<ExtensionRegistryLite. | |
| ExtensionRegistryLite | back to summary |
|---|---|
| pack-priv ExtensionRegistryLite() | |
| ExtensionRegistryLite | back to summary |
|---|---|
| pack-priv ExtensionRegistryLite(ExtensionRegistryLite other) | |
| ExtensionRegistryLite | back to summary |
|---|---|
| pack-priv ExtensionRegistryLite(boolean empty) | |
| add | back to summary |
|---|---|
| public final void add(final GeneratedMessageLite. Add an extension from a lite generated file to the registry. | |
| add | back to summary |
|---|---|
| public final void add(ExtensionLite<?, ?> extension) Add an extension from a lite generated file to the registry only if it is a non-lite extension
i.e. | |
| findLiteExtensionByNumber | back to summary |
|---|---|
| public <ContainingType extends MessageLite> GeneratedMessageLite. Find an extension by containing type and field number.
| |
| getEmptyRegistry | back to summary |
|---|---|
| public static ExtensionRegistryLite getEmptyRegistry() Get the unmodifiable singleton empty instance of either ExtensionRegistryLite or | |
| getUnmodifiable | back to summary |
|---|---|
| public ExtensionRegistryLite getUnmodifiable() Returns an unmodifiable view of the registry. | |
| isEagerlyParseMessageSets | back to summary |
|---|---|
| public static boolean isEagerlyParseMessageSets() | |
| newInstance | back to summary |
|---|---|
| public static ExtensionRegistryLite newInstance() Construct a new, empty instance. This may be an | |
| resolveExtensionClass | back to summary |
|---|---|
| pack-priv static Class | |
| setEagerlyParseMessageSets | back to summary |
|---|---|
| public static void setEagerlyParseMessageSets(boolean isEagerlyParse) | |
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final Object |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(final Object
the reference object with which to compare. obj)Overrides java. |
| public int |
| number | back to summary |
|---|---|
| private final int number | |
| object | back to summary |
|---|---|
| private final Object object | |
| ObjectIntPair | back to summary |
|---|---|
| pack-priv ObjectIntPair(final Object object, final int number) | |
| equals | back to summary |
|---|---|
| public boolean equals(final Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |