Class RuntimeCapability.Builder<T>
- java.lang.Object
-
- org.jboss.as.controller.capability.RuntimeCapability.Builder<T>
-
- Type Parameters:
T
- the type of the runtime API object exposed by the capability
- Enclosing class:
- RuntimeCapability<T>
public static class RuntimeCapability.Builder<T> extends Object
Builder for aRuntimeCapability
.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description RuntimeCapability.Builder<T>
addAdditionalRequiredPackages(String... packages)
RuntimeCapability.Builder<T>
addRequirements(String... requirements)
Adds the names of other capabilities that this capability requires.RuntimeCapability<T>
build()
Builds the capability.static RuntimeCapability.Builder<Void>
of(String name)
Create a builder for a non-dynamic capability with no custom runtime API.static RuntimeCapability.Builder<Void>
of(String name, boolean dynamic)
Create a builder for a possibly dynamic capability with no custom runtime API.static RuntimeCapability.Builder<Void>
of(String name, boolean dynamic, Class<?> serviceValueType)
Create a builder for a possibly dynamic capability that installs a service with the given value type.static <T> RuntimeCapability.Builder<T>
of(String name, boolean dynamic, T runtimeAPI)
Create a builder for a possibly dynamic capability that provides the given custom runtime API.static RuntimeCapability.Builder<Void>
of(String name, Class<?> serviceValueType)
Create a builder for a non-dynamic capability that installs a service with the given value type.static <T> RuntimeCapability.Builder<T>
of(String name, T runtimeAPI)
Create a builder for a non-dynamic capability that provides the given custom runtime API.RuntimeCapability.Builder<T>
setAllowMultipleRegistrations(boolean allowMultipleRegistrations)
Sets whether this capability can be registered at more than one point within the same overall scope.RuntimeCapability.Builder<T>
setDynamicNameMapper(Function<PathAddress,String[]> mapper)
RuntimeCapability.Builder<T>
setServiceType(Class<?> type)
Sets that the capability installs a service with the given value type.
-
-
-
Method Detail
-
of
public static RuntimeCapability.Builder<Void> of(String name)
Create a builder for a non-dynamic capability with no custom runtime API.- Parameters:
name
- the name of the capability. Cannot benull
or empty.- Returns:
- the builder
-
of
public static RuntimeCapability.Builder<Void> of(String name, boolean dynamic)
Create a builder for a possibly dynamic capability with no custom runtime API.- Parameters:
name
- the name of the capability. Cannot benull
or empty.dynamic
-true
if the capability is a base capability for dynamically named capabilities- Returns:
- the builder
-
of
public static RuntimeCapability.Builder<Void> of(String name, Class<?> serviceValueType)
Create a builder for a non-dynamic capability that installs a service with the given value type.- Parameters:
name
- the name of the capability. Cannot benull
or empty.serviceValueType
- the value type of the service installed by the capability- Returns:
- the builder
-
of
public static RuntimeCapability.Builder<Void> of(String name, boolean dynamic, Class<?> serviceValueType)
Create a builder for a possibly dynamic capability that installs a service with the given value type.- Parameters:
name
- the name of the capability. Cannot benull
or empty.dynamic
-true
if the capability is a base capability for dynamically named capabilitiesserviceValueType
- the value type of the service installed by the capability- Returns:
- the builder
-
of
public static <T> RuntimeCapability.Builder<T> of(String name, T runtimeAPI)
Create a builder for a non-dynamic capability that provides the given custom runtime API.- Type Parameters:
T
- the type of the runtime API object exposed by the capability- Parameters:
name
- the name of the capability. Cannot benull
or empty.runtimeAPI
- the custom API implementation exposed by the capability- Returns:
- the builder
-
of
public static <T> RuntimeCapability.Builder<T> of(String name, boolean dynamic, T runtimeAPI)
Create a builder for a possibly dynamic capability that provides the given custom runtime API.- Type Parameters:
T
- the type of the runtime API object exposed by the capability- Parameters:
name
- the name of the capability. Cannot benull
or empty.dynamic
-true
if the capability is a base capability for dynamically named capabilitiesruntimeAPI
- the custom API implementation exposed by the capability- Returns:
- the builder
-
setServiceType
public RuntimeCapability.Builder<T> setServiceType(Class<?> type)
Sets that the capability installs a service with the given value type.- Parameters:
type
- the value type of the service installed by the capability. May benull
- Returns:
- the builder
-
addRequirements
public RuntimeCapability.Builder<T> addRequirements(String... requirements)
Adds the names of other capabilities that this capability requires. The requirement for these capabilities will automatically be registered when this capability is registered.- Parameters:
requirements
- the capability names- Returns:
- the builder
-
setAllowMultipleRegistrations
public RuntimeCapability.Builder<T> setAllowMultipleRegistrations(boolean allowMultipleRegistrations)
Sets whether this capability can be registered at more than one point within the same overall scope.- Parameters:
allowMultipleRegistrations
-true
if the capability can legally be registered in more than one location in the same scope;false
if an attempt to do this should result in an exception- Returns:
- the builder
-
setDynamicNameMapper
public RuntimeCapability.Builder<T> setDynamicNameMapper(Function<PathAddress,String[]> mapper)
-
addAdditionalRequiredPackages
public RuntimeCapability.Builder<T> addAdditionalRequiredPackages(String... packages)
Deprecated.Adds the names of any "additional" Galleon packages that must be installed in order for this capability to function. The purpose of providing this information is to make it available to the Galleon tooling that produces Galleon feature-specs, in order to allow the tooling to include the package information in the relevant spec. It is not necessary to provide the names of "standard" packages here and because of this, this method is not expected to be frequently used. SeeCapability.getAdditionalRequiredPackages()
for more information on what makes a package "standard" versus "additional".- Parameters:
packages
- the package names- Returns:
- the builder
-
build
public RuntimeCapability<T> build()
Builds the capability.- Returns:
- the capability. Will not return
null
-
-