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>
TheSimpleComponentDescriptoris 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 protectedSimpleComponentDescriptor(ComponentDescriptor<T> descriptor)Creates a newSimpleComponentDescriptorinstance from the given one.SimpleComponentDescriptor(String name, Class<T> type, ClassLoader classLoader, Supplier<T> supplier, String version, boolean isSingleton, boolean isPrimary, boolean isSecondary, boolean isEager, Condition condition, int order)Creates a newSimpleComponentDescriptorinstance.SimpleComponentDescriptor(String name, Class<T> type, Supplier<T> supplier, boolean isSingleton)Creates a newSimpleComponentDescriptorinstance.SimpleComponentDescriptor(String name, Class<T> type, Supplier<T> supplier, String version, boolean isSingleton)Creates a newSimpleComponentDescriptorinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAliases(Set<String> aliases)Adds new aliases to reference the described component.Set<String>aliases()Gets the set of aliases for this component.ClassLoaderclassLoader()Gets the classloader used to load the component.StringclassName()Gets the name of the describe component.Optional<Condition>condition()Gets theConditionthat need to be fulfilled for this component to be eligible for use in the application.booleanequals(Object o)inthashCode()booleanisEager()Checks if the described component should be create and configure eagerly.booleanisPrimary()Checks if the described component is the primary component that must be selected in the case of multiple possible implementations.booleanisSecondary()Checks if the described component is a secondary component that must be de-prioritize in the case of multiple possible implementations.booleanisSingleton()Checks if the described component is a singleton.ComponentMetadatametadata()Gets the component metadata.voidmetadata(ComponentMetadata metadata)Stringname()Gets the name of the component.intorder()Supplier<T>supplier()Gets the supplier used to create a new component of typeComponentDescriptor.StringtoString()Class<T>type()Gets the type of the described component.Versionversion()Gets the version of the described component.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, 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 newSimpleComponentDescriptorinstance.- 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 newSimpleComponentDescriptorinstance.- 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, boolean isPrimary, boolean isSecondary, boolean isEager, Condition condition, int order)
Creates a newSimpleComponentDescriptorinstance.- 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.isPrimary- is a primary component.isSecondary- is a secondary component.isEager- is the component should be eagerly initializedcondition- is the component should be conditionally enabled.order- the priority of the component.
-
SimpleComponentDescriptor
protected SimpleComponentDescriptor(ComponentDescriptor<T> descriptor)
Creates a newSimpleComponentDescriptorinstance from the given one.- Parameters:
descriptor- theSimpleComponentDescriptorto copy.
-
-
Method Detail
-
name
public String name()
Gets the name of the component.- Specified by:
namein interfaceComponentDescriptor<T>- Returns:
- the name, or
nullif the name is not set.
-
metadata
public ComponentMetadata metadata()
Gets the component metadata.- Specified by:
metadatain 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:
classLoaderin interfaceComponentDescriptor<T>- Returns:
- the
ClassLoader.
-
addAliases
public void addAliases(Set<String> aliases)
Adds new aliases to reference the described component.- Specified by:
addAliasesin interfaceComponentDescriptor<T>- Parameters:
aliases- the aliases to be added.
-
aliases
public Set<String> aliases()
Gets the set of aliases for this component.- Specified by:
aliasesin interfaceComponentDescriptor<T>- Returns:
- the aliases.
-
className
public String className()
Gets the name of the describe component.- Specified by:
classNamein interfaceComponentDescriptor<T>- Returns:
- the name.
-
version
public Version version()
Gets the version of the described component.- Specified by:
versionin 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:
supplierin interfaceComponentDescriptor<T>- Returns:
- the
Supplier.
-
type
public Class<T> type()
Gets the type of the described component.- Specified by:
typein interfaceComponentDescriptor<T>- Returns:
- the class of type
T.
-
isSingleton
public boolean isSingleton()
Checks if the described component is a singleton.- Specified by:
isSingletonin interfaceComponentDescriptor<T>- Returns:
trueif is singleton, otherwisefalse.
-
isPrimary
public boolean isPrimary()
Checks if the described component is the primary component that must be selected in the case of multiple possible implementations.- Specified by:
isPrimaryin interfaceComponentDescriptor<T>- Returns:
trueif is primary, otherwisefalse.- See Also:
Qualifiers.byPrimary()
-
isSecondary
public boolean isSecondary()
Checks if the described component is a secondary component that must be de-prioritize in the case of multiple possible implementations.- Specified by:
isSecondaryin interfaceComponentDescriptor<T>- Returns:
trueif is secondary, otherwisefalse.- See Also:
Qualifiers.bySecondary(),Qualifiers.excludeSecondary()
-
isEager
public boolean isEager()
Checks if the described component should be create and configure eagerly.- Specified by:
isEagerin interfaceComponentDescriptor<T>- Returns:
trueif it s an eager component, otherwisefalse.- See Also:
Eager
-
condition
public Optional<Condition> condition()
Gets theConditionthat need to be fulfilled for this component to be eligible for use in the application.- Specified by:
conditionin interfaceComponentDescriptor<T>- Returns:
- the
Conditions.
-
-