Class ComponentDescriptorBuilder<T>
- java.lang.Object
-
- io.streamthoughts.azkarra.runtime.components.ComponentDescriptorBuilder<T>
-
- All Implemented Interfaces:
ComponentDescriptor<T>
,Ordered
,Comparable<Ordered>
public class ComponentDescriptorBuilder<T> extends Object implements ComponentDescriptor<T>
-
-
Field Summary
-
Fields inherited from interface io.streamthoughts.azkarra.api.components.ComponentDescriptor
ORDER_BY_ORDER, ORDER_BY_VERSION
-
Fields inherited from interface io.streamthoughts.azkarra.api.components.Ordered
HIGHEST_ORDER, LOWEST_ORDER
-
-
Constructor Summary
Constructors Constructor Description ComponentDescriptorBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAliases(Set<String> aliases)
Adds new aliases to reference the described component.Set<String>
aliases()
Gets the set of aliases for this component.ComponentDescriptor<T>
build()
ClassLoader
classLoader()
Gets the classloader used to load the component.ComponentDescriptorBuilder<T>
classLoader(ClassLoader classLoader)
Sets the classLoader of the component.static <T> ComponentDescriptorBuilder<T>
create()
Static helper method for creating a newComponentDescriptorBuilder
instance.boolean
isSingleton()
Checks if the described component is a singleton.ComponentDescriptorBuilder<T>
isSingleton(boolean isSingleton)
ComponentMetadata
metadata()
Gets the component metadata.ComponentDescriptorBuilder<T>
metadata(ComponentMetadata metadata)
Sets the metadata of the component.String
name()
Gets the name of the component.ComponentDescriptorBuilder<T>
name(String name)
Sets the name of the component.int
order()
ComponentDescriptorBuilder<T>
order(int order)
Sets the order of the component.Supplier<T>
supplier()
Gets the supplier used to create a new component of typeComponentDescriptor
.ComponentDescriptorBuilder<T>
supplier(Supplier<T> supplier)
Sets the supplier of the component.Class<T>
type()
Gets the type of the described component.ComponentDescriptorBuilder<T>
type(Class<T> type)
Sets the type of the component.Version
version()
Gets the version of the described component.ComponentDescriptorBuilder<T>
version(String version)
Sets the version of the component.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.streamthoughts.azkarra.api.components.ComponentDescriptor
className, isCloseable, isVersioned
-
-
-
-
Method Detail
-
create
public static <T> ComponentDescriptorBuilder<T> create()
Static helper method for creating a newComponentDescriptorBuilder
instance.- Type Parameters:
T
- the component type.- Returns:
- the new
ComponentDescriptorBuilder
instance.
-
name
public String name()
Gets the name of the component.- Specified by:
name
in interfaceComponentDescriptor<T>
- Returns:
- the name, or
null
if the name is not set.
-
name
public ComponentDescriptorBuilder<T> name(String name)
Sets the name of the component.- Parameters:
name
- the name of the component.- Returns:
this
-
metadata
public ComponentMetadata metadata()
Gets the component metadata.- Specified by:
metadata
in interfaceComponentDescriptor<T>
- Returns:
- the
ComponentMetadata
.
-
metadata
public ComponentDescriptorBuilder<T> metadata(ComponentMetadata metadata)
Sets the metadata of the component.- Parameters:
metadata
- the metadata of the component.- Returns:
this
-
classLoader
public ClassLoader classLoader()
Gets the classloader used to load the component.- Specified by:
classLoader
in interfaceComponentDescriptor<T>
- Returns:
- the
ClassLoader
.
-
classLoader
public ComponentDescriptorBuilder<T> classLoader(ClassLoader classLoader)
Sets the classLoader of the component.- Parameters:
classLoader
- the classLoader of the component.- Returns:
this
-
addAliases
public void addAliases(Set<String> aliases)
Adds new aliases to reference the described component.- Specified by:
addAliases
in interfaceComponentDescriptor<T>
- Parameters:
aliases
- the aliases to be added.
-
aliases
public Set<String> aliases()
Gets the set of aliases for this component.- Specified by:
aliases
in interfaceComponentDescriptor<T>
- Returns:
- the aliases.
-
version
public Version version()
Gets the version of the described component.- Specified by:
version
in interfaceComponentDescriptor<T>
- Returns:
- the component version if versioned, otherwise
null
.
-
version
public ComponentDescriptorBuilder<T> version(String version)
Sets the version of the component.- Parameters:
version
- the version of the component.- Returns:
this
-
supplier
public Supplier<T> supplier()
Gets the supplier used to create a new component of typeComponentDescriptor
.- Specified by:
supplier
in interfaceComponentDescriptor<T>
- Returns:
- the
Supplier
.
-
supplier
public ComponentDescriptorBuilder<T> supplier(Supplier<T> supplier)
Sets the supplier of the component.- Parameters:
supplier
- the supplier of the component.- Returns:
this
-
type
public Class<T> type()
Gets the type of the described component.- Specified by:
type
in interfaceComponentDescriptor<T>
- Returns:
- the class of type
T
.
-
type
public ComponentDescriptorBuilder<T> type(Class<T> type)
Sets the type of the component.- Parameters:
type
- the type of the component.- Returns:
this
-
isSingleton
public boolean isSingleton()
Checks if the described component is a singleton.- Specified by:
isSingleton
in interfaceComponentDescriptor<T>
- Returns:
true
if is singleton, otherwisefalse
.
-
order
public ComponentDescriptorBuilder<T> order(int order)
Sets the order of the component.- Parameters:
order
- the order of the component.- Returns:
this
-
isSingleton
public ComponentDescriptorBuilder<T> isSingleton(boolean isSingleton)
-
build
public ComponentDescriptor<T> build()
-
-