Class SimpleComponentDescriptor<T>
- java.lang.Object
-
- io.streamthoughts.azkarra.api.components.SimpleComponentDescriptor<T>
-
- Type Parameters:
T
- the component-type.
- All Implemented Interfaces:
ComponentDescriptor<T>
,Ordered
,Comparable<Ordered>
- Direct Known Subclasses:
TopologyDescriptor
public class SimpleComponentDescriptor<T> extends Object implements ComponentDescriptor<T>
TheSimpleComponentDescriptor
is the base class used fro describing components.
-
-
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 Modifier Constructor Description protected
SimpleComponentDescriptor(ComponentDescriptor<T> descriptor)
Creates a newSimpleComponentDescriptor
instance from the given one.SimpleComponentDescriptor(String name, Class<T> type, ClassLoader classLoader, Supplier<T> supplier, String version, boolean isSingleton, int order)
Creates a newSimpleComponentDescriptor
instance.SimpleComponentDescriptor(String name, Class<T> type, Supplier<T> supplier, boolean isSingleton)
Creates a newSimpleComponentDescriptor
instance.SimpleComponentDescriptor(String name, Class<T> type, Supplier<T> supplier, String version, boolean isSingleton)
Creates a newSimpleComponentDescriptor
instance.
-
Method Summary
All 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.ClassLoader
classLoader()
Gets the classloader used to load the component.String
className()
Gets the name of the describe component.boolean
isSingleton()
Checks if the described component is a singleton.ComponentMetadata
metadata()
Gets the component metadata.void
metadata(ComponentMetadata metadata)
String
name()
Gets the name of the component.int
order()
Supplier<T>
supplier()
Gets the supplier used to create a new component of typeComponentDescriptor
.String
toString()
Class<T>
type()
Gets the type of the described component.Version
version()
Gets the version of the described component.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.streamthoughts.azkarra.api.components.ComponentDescriptor
isCloseable, isVersioned
-
-
-
-
Constructor Detail
-
SimpleComponentDescriptor
public SimpleComponentDescriptor(String name, Class<T> type, Supplier<T> supplier, boolean isSingleton)
Creates a newSimpleComponentDescriptor
instance.- Parameters:
name
- the name of the component.type
- the type of the component.supplier
- the supplier of the component.isSingleton
- is the component singleton.
-
SimpleComponentDescriptor
public SimpleComponentDescriptor(String name, Class<T> type, Supplier<T> supplier, String version, boolean isSingleton)
Creates a newSimpleComponentDescriptor
instance.- Parameters:
name
- the name of the component.type
- the type of the component.supplier
- the supplier of the component.version
- the version of the component.isSingleton
- is the component singleton.
-
SimpleComponentDescriptor
public SimpleComponentDescriptor(String name, Class<T> type, ClassLoader classLoader, Supplier<T> supplier, String version, boolean isSingleton, int order)
Creates a newSimpleComponentDescriptor
instance.- Parameters:
name
- the name of the component.type
- the type of the component.classLoader
- the component classloader.supplier
- the supplier of the component.version
- the version of the component.isSingleton
- is the component singleton.
-
SimpleComponentDescriptor
protected SimpleComponentDescriptor(ComponentDescriptor<T> descriptor)
Creates a newSimpleComponentDescriptor
instance from the given one.- Parameters:
descriptor
- theSimpleComponentDescriptor
to copy.
-
-
Method Detail
-
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.
-
metadata
public ComponentMetadata metadata()
Gets the component metadata.- Specified by:
metadata
in interfaceComponentDescriptor<T>
- Returns:
- the
ComponentMetadata
.
-
metadata
public void metadata(ComponentMetadata metadata)
-
classLoader
public ClassLoader classLoader()
Gets the classloader used to load the component.- Specified by:
classLoader
in interfaceComponentDescriptor<T>
- Returns:
- the
ClassLoader
.
-
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.
-
className
public String className()
Gets the name of the describe component.- Specified by:
className
in interfaceComponentDescriptor<T>
- Returns:
- the name.
-
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
.
-
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
.
-
type
public Class<T> type()
Gets the type of the described component.- Specified by:
type
in interfaceComponentDescriptor<T>
- Returns:
- the class of type
T
.
-
isSingleton
public boolean isSingleton()
Checks if the described component is a singleton.- Specified by:
isSingleton
in interfaceComponentDescriptor<T>
- Returns:
true
if is singleton, otherwisefalse
.
-
-