Package org.gradle.api.plugins
Interface ExtensionContainer
- All Known Subinterfaces:
- Convention
public interface ExtensionContainer
Allows adding 'namespaced' DSL extensions to a target object.
- 
Method SummaryModifier and TypeMethodDescription<T> voidAdds a new extension to this container.voidAdds a new extension to this container.<T> voidAdds a new extension to this container.<T> voidLooks for the extension of the specified type and configures it with the supplied action.<T> voidLooks for the extension with the specified name and configures it with the supplied action.<T> voidLooks for the extension of the specified type and configures it with the supplied action.<T> Tcreate(Class<T> publicType, String name, Class<? extends T> instanceType, Object... constructionArguments) Creates and adds a new extension to this container.<T> TCreates and adds a new extension to this container.<T> Tcreate(TypeOf<T> publicType, String name, Class<? extends T> instanceType, Object... constructionArguments) Creates and adds a new extension to this container.findByName(String name) Looks for the extension of a given name.<T> TfindByType(Class<T> type) Looks for the extension of a given type (useful to avoid casting).<T> TfindByType(TypeOf<T> type) Looks for the extension of a given type (useful to avoid casting).Looks for the extension of a given name.<T> TLooks for the extension of a given type (useful to avoid casting).<T> TLooks for the extension of a given type (useful to avoid casting).Provides access to the schema of all known extensions.The extra properties extension in this extension container.
- 
Method Details- 
addAdds a new extension to this container. Adding an extension of name 'foo' will:- add 'foo' dynamic property
- add 'foo' dynamic method that accepts a closure that is a configuration script block
 publicType.- Parameters:
- publicType- The extension public type
- name- The name for the extension
- extension- Any object implementing- publicType
- Throws:
- IllegalArgumentException- When an extension with the given name already exists.
- Since:
- 3.5
 
- 
addAdds a new extension to this container. Adding an extension of name 'foo' will:- add 'foo' dynamic property
- add 'foo' dynamic method that accepts a closure that is a configuration script block
 publicType.- Parameters:
- publicType- The extension public type
- name- The name for the extension
- extension- Any object implementing- publicType
- Throws:
- IllegalArgumentException- When an extension with the given name already exists.
- Since:
- 3.5
 
- 
addAdds a new extension to this container. Adding an extension of name 'foo' will:- add 'foo' dynamic property
- add 'foo' dynamic method that accepts a closure that is a configuration script block
 extension.getClass()unless the extension itself declares a preferred public type via theHasPublicTypeprotocol.- Parameters:
- name- The name for the extension
- extension- Any object
- Throws:
- IllegalArgumentException- When an extension with the given name already exists
 
- 
create<T> T create(Class<T> publicType, String name, Class<? extends T> instanceType, Object... constructionArguments) Creates and adds a new extension to this container. A new instance of the giveninstanceTypewill be created using the givenconstructionArguments. The extension will be exposed aspublicType. The new instance will have been dynamically madeExtensionAware, which means that you can cast it toExtensionAware.- Type Parameters:
- T- the extension public type
- Parameters:
- publicType- The extension public type
- name- The name for the extension
- instanceType- The extension instance type
- constructionArguments- The arguments to be used to construct the extension instance
- Returns:
- The created instance
- Throws:
- IllegalArgumentException- When an extension with the given name already exists.
- Since:
- 3.5
- See Also:
 
- 
create<T> T create(TypeOf<T> publicType, String name, Class<? extends T> instanceType, Object... constructionArguments) Creates and adds a new extension to this container. A new instance of the giveninstanceTypewill be created using the givenconstructionArguments. The extension will be exposed aspublicType. The new instance will have been dynamically madeExtensionAware, which means that you can cast it toExtensionAware.- Type Parameters:
- T- the extension public type
- Parameters:
- publicType- The extension public type
- name- The name for the extension
- instanceType- The extension instance type
- constructionArguments- The arguments to be used to construct the extension instance
- Returns:
- The created instance
- Throws:
- IllegalArgumentException- When an extension with the given name already exists.
- Since:
- 3.5
- See Also:
 
- 
createCreates and adds a new extension to this container. A new instance of the giventypewill be created using the givenconstructionArguments. The extension will be exposed astypeunless the extension itself declares a preferred public type via theHasPublicTypeprotocol. The new instance will have been dynamically madeExtensionAware, which means that you can cast it toExtensionAware.- Parameters:
- name- The name for the extension
- type- The type of the extension
- constructionArguments- The arguments to be used to construct the extension instance
- Returns:
- The created instance
- Throws:
- IllegalArgumentException- When an extension with the given name already exists.
- See Also:
 
- 
getExtensionsSchemaExtensionsSchema getExtensionsSchema()Provides access to the schema of all known extensions.- Since:
- 4.5
 
- 
getByTypeLooks for the extension of a given type (useful to avoid casting). If none found it will throw an exception.- Parameters:
- type- extension type
- Returns:
- extension, never null
- Throws:
- UnknownDomainObjectException- When the given extension is not found.
 
- 
getByTypeLooks for the extension of a given type (useful to avoid casting). If none found it will throw an exception.- Parameters:
- type- extension type
- Returns:
- extension, never null
- Throws:
- UnknownDomainObjectException- When the given extension is not found.
- Since:
- 3.5
 
- 
findByTypeLooks for the extension of a given type (useful to avoid casting). If none found null is returned.- Parameters:
- type- extension type
- Returns:
- extension or null
 
- 
findByTypeLooks for the extension of a given type (useful to avoid casting). If none found null is returned.- Parameters:
- type- extension type
- Returns:
- extension or null
- Since:
- 3.5
 
- 
getByNameLooks for the extension of a given name. If none found it will throw an exception.- Parameters:
- name- extension name
- Returns:
- extension, never null
- Throws:
- UnknownDomainObjectException- When the given extension is not found.
 
- 
findByNameLooks for the extension of a given name. If none found null is returned.- Parameters:
- name- extension name
- Returns:
- extension or null
 
- 
configureLooks for the extension of the specified type and configures it with the supplied action.- Parameters:
- type- extension type
- action- the configure action
- Throws:
- UnknownDomainObjectException- if no extension is found.
 
- 
configureLooks for the extension of the specified type and configures it with the supplied action.- Parameters:
- type- extension type
- action- the configure action
- Throws:
- UnknownDomainObjectException- if no extension is found.
- Since:
- 3.5
 
- 
configureLooks for the extension with the specified name and configures it with the supplied action.- Parameters:
- name- extension name
- action- the configure action
- Throws:
- UnknownDomainObjectException- if no extension is found.
- Since:
- 4.0
 
- 
getExtraPropertiesExtraPropertiesExtension getExtraProperties()The extra properties extension in this extension container. This extension is always present in the container, with the name "ext".- Returns:
- The extra properties extension in this extension container.
 
 
-