# Class Extension&lt;ContainingType,Type&gt; (3.19.4)

    public abstract class Extension<ContainingType,Type> extends ExtensionLite<ContainingType,Type>

Interface that generated extensions implement.

## Inheritance

[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> [ExtensionLite](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ExtensionLite) \> Extension\<ContainingType,Type\>

## Inherited Members

[ExtensionLite.getDefaultValue()](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ExtensionLite#com_google_protobuf_ExtensionLite_getDefaultValue__) [ExtensionLite.getLiteType()](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ExtensionLite#com_google_protobuf_ExtensionLite_getLiteType__) [ExtensionLite.getMessageDefaultInstance()](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ExtensionLite#com_google_protobuf_ExtensionLite_getMessageDefaultInstance__) [ExtensionLite.getNumber()](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ExtensionLite#com_google_protobuf_ExtensionLite_getNumber__) [ExtensionLite.isRepeated()](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ExtensionLite#com_google_protobuf_ExtensionLite_isRepeated__) [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-)

| ## Type Parameters ||
|---|---|
| **Name** | **Description** |
| `ContainingType` |   |
| `Type` |   |

## Constructors

### Extension()

    public Extension()

## Methods

### fromReflectionType(Object value)

    protected abstract Object fromReflectionType(Object value)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` |   |

### getDescriptor()

    public abstract Descriptors.FieldDescriptor getDescriptor()

Returns the descriptor of the extension.

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

### getExtensionType()

    protected abstract Extension.ExtensionType getExtensionType()

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

### getMessageDefaultInstance()

    public abstract Message getMessageDefaultInstance()

Returns the default instance of the extension field, if it's a message extension. Overridden to return [Message](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Message) instead of [MessageLite](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.MessageLite).

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

**Overrides** [ExtensionLite\<ContainingType,Type\>.getMessageDefaultInstance()](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ExtensionLite#com_google_protobuf_ExtensionLite_getMessageDefaultInstance__)

### getMessageType()

    public Extension.MessageType getMessageType()

If the extension is a message extension (i.e., getLiteType() == MESSAGE), returns the type of
the message, otherwise undefined.

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

### singularFromReflectionType(Object value)

    protected abstract Object singularFromReflectionType(Object value)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` |   |

### singularToReflectionType(Object value)

    protected abstract Object singularToReflectionType(Object value)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` |   |

### toReflectionType(Object value)

    protected abstract Object toReflectionType(Object value)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` |   |