# Class ExtensionRegistryLite (3.19.4)

    public class ExtensionRegistryLite

Equivalent to [ExtensionRegistry](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.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](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.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.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> ExtensionRegistryLite

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Static Methods

### getEmptyRegistry()

    public static ExtensionRegistryLite getEmptyRegistry()

Get the unmodifiable singleton empty instance of either ExtensionRegistryLite or `
ExtensionRegistry` (if the full (non-Lite) proto libraries are available).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ExtensionRegistryLite` |   |

### isEagerlyParseMessageSets()

    public static boolean isEagerlyParseMessageSets()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### newInstance()

    public static ExtensionRegistryLite newInstance()

Construct a new, empty instance.

This may be an `ExtensionRegistry` if the full (non-Lite) proto libraries are
available.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ExtensionRegistryLite` |   |

### setEagerlyParseMessageSets(boolean isEagerlyParse)

    public static void setEagerlyParseMessageSets(boolean isEagerlyParse)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `isEagerlyParse` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

## Methods

### \<ContainingType\>findLiteExtensionByNumber(ContainingType containingTypeDefaultInstance, int fieldNumber)

    public GeneratedMessageLite.GeneratedExtension<ContainingType,?> <ContainingType>findLiteExtensionByNumber(ContainingType containingTypeDefaultInstance, int fieldNumber)

Find an extension by containing type and field number.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `containingTypeDefaultInstance` | `ContainingType` |
| `fieldNumber` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessageLite.GeneratedExtension<ContainingType,?>` | Information about the extension if found, or `null` otherwise. |

### add(ExtensionLite\<?,?\> extension)

    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. [GeneratedMessageLite.GeneratedExtension](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessageLite.GeneratedExtension).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `extension` | `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ExtensionLite<?,?>` |

### add(GeneratedMessageLite.GeneratedExtension\<?,?\> extension)

    public final void add(GeneratedMessageLite.GeneratedExtension<?,?> extension)

Add an extension from a lite generated file to the registry.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `extension` | `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessageLite.GeneratedExtension<?,?>` |

### getUnmodifiable()

    public ExtensionRegistryLite getUnmodifiable()

Returns an unmodifiable view of the registry.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ExtensionRegistryLite` |   |