Package com.google.protobuf

# Class Extension<ContainingType extends MessageLite,Type>

java.lang.Object
com.google.protobuf.ExtensionLite<ContainingType,Type>
com.google.protobuf.Extension<ContainingType,Type>

Direct Known Subclasses:
  `GeneratedMessage.GeneratedExtension`

public abstract class Extension<ContainingType extends MessageLite,Type> extends ExtensionLite<ContainingType,Type>
Interface that generated extensions implement.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`protected static enum`
`Extension.ExtensionType`
The API type that the extension is used for.
`static enum`
`Extension.MessageType`
Type of a message extension.

## Constructor Summary

Constructors
Constructor
Description
`Extension()`

## Method Summary

Modifier and Type
Method
Description
`protected abstract Object`
`fromReflectionType(Object value)`
`abstract Descriptors.FieldDescriptor`
`getDescriptor()`
Returns the descriptor of the extension.
`protected abstract Extension.ExtensionType`
`getExtensionType()`
`abstract Message`
`getMessageDefaultInstance()`
Returns the default instance of the extension field, if it's a message extension.
`Extension.MessageType`
`getMessageType()`
If the extension is a message extension (i.e., getLiteType() == MESSAGE), returns the type of the message, otherwise undefined.
`protected abstract Object`
`singularFromReflectionType(Object value)`
`protected abstract Object`
`singularToReflectionType(Object value)`
`protected abstract Object`
`toReflectionType(Object value)`

### Methods inherited from class com.google.protobuf.ExtensionLite

`getDefaultValue, getLiteType, getNumber, isRepeated`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### Extension

public Extension()

## Method Details

### getMessageDefaultInstance

public abstract Message getMessageDefaultInstance()
Returns the default instance of the extension field, if it's a message extension. Overridden to return `Message` instead of `MessageLite`.

Specified by:
  `getMessageDefaultInstance` in class `ExtensionLite<ContainingType extends MessageLite,Type>`

### getDescriptor

public abstract Descriptors.FieldDescriptor getDescriptor()
Returns the descriptor of the extension.

### getExtensionType

protected abstract Extension.ExtensionType getExtensionType()

### getMessageType

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

### fromReflectionType

protected abstract Object fromReflectionType(Object value)

### singularFromReflectionType

protected abstract Object singularFromReflectionType(Object value)

### toReflectionType

protected abstract Object toReflectionType(Object value)

### singularToReflectionType

protected abstract Object singularToReflectionType(Object value)