Class AbstractConfigurableExtension<T>
- Type Parameters:
- T- the type for which this- AbstractConfigurableExtensionimplementation installs instances
- All Implemented Interfaces:
- Extension
- Direct Known Subclasses:
- AbstractDataSourceExtension,- UniversalConnectionPoolExtension
Extension whose subclasses arrange for instances of a particular type to be configured
 and added as CDI beans.
 There are four kinds of names defined by this extension:
- Type name: the class name of the kind of object this extension manages. Example: javax.sql.DataSource
- Name: a name designating one of potentially many such objects. Example: prod
- Property name: a name of a property of the kind of object this extension manages. Example:
 user
- Configuration property name: a name of a configuration property that logically contains at least
 the other three kinds of names. Example: javax.sql.DataSource.prod.user
Thread Safety
As with all CDI portable extensions, this class' instances are not safe for concurrent use by multiple threads.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected abstract voidaddBean(BeanConfigurator<T> beanConfigurator, Named name, Properties properties) Called internally to permit subclasses to add aT-typed bean, qualified with at least the suppliedNamed, using the suppliedBeanConfigurator.Returns aSetof all known configuration property names.configPropertyValue(String configPropertyName) Given a configuration property name, returns anOptional<String>containing its value, or an emptyOptionalif no such configuration property value exists.protected final voidClears, and then builds or rebuilds, an internal set of properties whose contents will be processed eventually by theaddBean(BeanConfigurator, Named, Properties)method.protected abstract MatcherReturns aMatchergiven a configuration property name that can logically identify and provide access to at least its three component names.protected abstract StringGiven aMatcherthat has been produced by thematcher(String)method, returns the relevant name.names()Returns aSetof names known to thisAbstractConfigurableExtensionimplementation.protected abstract StringpropertyName(Matcher configPropertyNameMatcher) Given aMatcherthat has been produced by thematcher(String)method, returns the relevant property name, ornullif there is no such property name.protected final Propertiesput(String name, Properties properties) Adds additional synthesized properties (property names and their values) to an internal map of such properties whose contents will be processed eventually by theaddBean(BeanConfigurator, Named, Properties)method.
- 
Constructor Details- 
AbstractConfigurableExtensionprotected AbstractConfigurableExtension()Creates a newAbstractConfigurableExtension.
 
- 
- 
Method Details- 
matcherReturns aMatchergiven a configuration property name that can logically identify and provide access to at least its three component names.Implementations of this method must not return null.Given a Stringthat is a configuration property name, likecom.foo.Bar.name.propertyName, any implementation of this method must return a non-nullMatcherthat is capable of being supplied to thename(Matcher)andpropertyName(Matcher)methods.- Parameters:
- configPropertyName- a configuration property name that logically contains a type name, a name and a property name; must not be- null
- Returns:
- a non-nullMatcher
- Throws:
- NullPointerException- if- configPropertyNameis- null
- See Also:
 
- 
nameGiven aMatcherthat has been produced by thematcher(String)method, returns the relevant name.Implementations of this method may return null.- Parameters:
- configPropertyNameMatcher- a- Matcherproduced by the- matcher(String)method; must not be- null
- Returns:
- a name, or null
- Throws:
- NullPointerException- if- configPropertyNameMatcheris- null
- See Also:
 
- 
propertyNameGiven aMatcherthat has been produced by thematcher(String)method, returns the relevant property name, ornullif there is no such property name.Most implementations of this method will use the Matcher.group(int)method to produce the required property name.Implementations of this method may return null.- Parameters:
- configPropertyNameMatcher- a- Matcherproduced by the- matcher(String)method; must not be- null
- Returns:
- a property name, or null
- Throws:
- NullPointerException- if- configPropertyNameMatcheris- null
- See Also:
 
- 
addBeanprotected abstract void addBean(BeanConfigurator<T> beanConfigurator, Named name, Properties properties) Called internally to permit subclasses to add aT-typed bean, qualified with at least the suppliedNamed, using the suppliedBeanConfigurator.Implementations of this method will be called from an observer method that is observing the AfterBeanDiscoverycontainer lifecycle event.- Parameters:
- beanConfigurator- the- BeanConfiguratorto use to actually add a new bean; must not be- null
- name- a- Namedinstance qualifying the- T-typed bean to be added; may be- null
- properties- a- Propertiesinstance containing properties relevant to the object; must not be- null
- Throws:
- NullPointerException- if- beanConfiguratoror- propertiesis- null
- See Also:
 
- 
configPropertyValueGiven a configuration property name, returns anOptional<String>containing its value, or an emptyOptionalif no such configuration property value exists.This method never returns null.Overrides of this method must not return null.- Parameters:
- configPropertyName- a configuration property name; must not be- null
- Returns:
- a non-nullOptional
- Throws:
- NullPointerException- if- configPropertyNameis- null
 
- 
namesReturns aSetof names known to thisAbstractConfigurableExtensionimplementation.This method never returns null.The Setreturned by this method is unmodifiable.- Returns:
- a non-null, unmodifiableSetof known names
 
- 
putAdds additional synthesized properties (property names and their values) to an internal map of such properties whose contents will be processed eventually by theaddBean(BeanConfigurator, Named, Properties)method.This method may return null.- Parameters:
- name- the name of the object under which the supplied- Propertieswill be indexed; may be- null
- properties- the- Propertiesto put consisting of property names and their values; must not be- null
- Returns:
- the prior Propertiesindexed under the suppliedname, ornull
- Throws:
- NullPointerException- if- propertiesis- null
 
- 
initializeNamedPropertiesprotected final void initializeNamedProperties()Clears, and then builds or rebuilds, an internal set of properties whose contents will be processed eventually by theaddBean(BeanConfigurator, Named, Properties)method.If no subclass explicitly calls this method, as is common, it will be called by the addBean(BeanConfigurator, Named, Properties)method just prior to its other activities.Once the addBean(BeanConfigurator, Named, Properties)method has run to completion, while this method may be called freely, its use is discouraged and its effects will no longer be used.- See Also:
 
- 
configPropertyNamesReturns aSetof all known configuration property names.This method never returns null.Overrides of this method must not return null.The Setreturned by this method is unmodifiable.Overrides of this method must ensure that the returned Setis unmodifiable.The Setreturned by this method is not safe for concurrent use by multiple threads.Overrides of this method may return Setinstances that are not safe for concurrent use by multiple threads.The Setreturned by this method and its overrides may be empty.The ordering of the elements contained by the Setreturned by this method and its overrides is indeterminate.- Returns:
- a non-null, unmodifiableSetof all known configuration property names
 
 
-