public static ExtensionRegistry addToRegistry ( final FieldDescriptor extension , final ExtensionRegistry registry ) { if ( extension . getJavaType ( ) == JavaType . MESSAGE ) { registry . add ( extension , DynamicMessage . getDefaultInstance ( extension . getMessageType ( ) ) ) ; } else { registry . add ( extension ) ; } return registry ; }
Adds extension to the registry making a default DynamicMessage if its type is a Message .