Class ComponentDescriptor<T>
- java.lang.Object
-
- org.codehaus.plexus.component.repository.ComponentDescriptor<T>
-
public class ComponentDescriptor<T> extends java.lang.Object
Component instantiation description.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
alias
private java.lang.String
componentComposer
private java.lang.String
componentConfigurator
private java.lang.String
componentFactory
private java.lang.String
componentProfile
private ComponentSetDescriptor
componentSetDescriptor
private java.lang.String
componentType
private PlexusConfiguration
configuration
private java.lang.String
description
private java.lang.String
implementation
private java.lang.Class<? extends T>
implementationClass
private java.lang.String
instantiationStrategy
private boolean
isolatedRealm
private java.lang.String
lifecycleHandler
private org.codehaus.plexus.classworlds.realm.ClassRealm
realm
private java.util.List<ComponentRequirement>
requirements
private java.lang.String
role
private java.lang.Class<T>
roleClass
private java.lang.String
roleHint
private java.lang.String
source
private java.lang.String
version
-
Constructor Summary
Constructors Constructor Description ComponentDescriptor()
ComponentDescriptor(java.lang.Class<T> implementationClass, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRequirement(ComponentRequirement requirement)
Add a project requirement to this component.void
addRequirement(ComponentRequirement... requirement)
Add a project requirement to this component.void
addRequirements(java.util.List<ComponentRequirement> requirements)
Adds a list of requirements to this component.private void
attemptImplementationLoad()
private void
attemptRoleLoad()
private static <T> boolean
eq(T o1, T o2)
boolean
equals(java.lang.Object other)
java.lang.String
getAlias()
Returns an alias for this component.java.lang.String
getComponentComposer()
Returns the ID of the type of composer this component will use.java.lang.String
getComponentConfigurator()
Returns the type of component configurator for this project.java.lang.String
getComponentFactory()
Returns an id of the factory used to create this component.java.lang.String
getComponentProfile()
ComponentSetDescriptor
getComponentSetDescriptor()
Returns the component set descriptor.java.lang.String
getComponentType()
Returns the type of this component.PlexusConfiguration
getConfiguration()
Returns configuration values defined for this component.java.lang.String
getDescription()
Return a human-readable description of this component.java.lang.String
getHumanReadableKey()
Returns a human-friendly key, suitable for display.java.lang.String
getImplementation()
Returns the implementation of this componet.java.lang.Class<? extends T>
getImplementationClass()
Returns the implementation class of this componet, or null if the implementation class can not be loaded.java.lang.String
getInstantiationStrategy()
Returns the type of instantiation strategy for this component.java.lang.String
getLifecycleHandler()
Returns the lifecycle-handler for this component.org.codehaus.plexus.classworlds.realm.ClassRealm
getRealm()
The ClassRealm that this component lives under.java.util.List<ComponentRequirement>
getRequirements()
Returns all project requirements of this component.java.lang.String
getRole()
Returns the role of this component.java.lang.Class<T>
getRoleClass()
java.lang.String
getRoleHint()
Returns the role-hint of this component.java.lang.String
getSource()
The location this information came from (descriptor file URI).java.lang.String
getVersion()
Returns a specific point in a components's project timeline.boolean
hasConfiguration()
Returns true if this component has a configuration.private static int
hash(java.lang.Object obj)
int
hashCode()
boolean
isIsolatedRealm()
Returns true if this may be in an isolated classrealm.void
removeRequirement(ComponentRequirement... requirement)
Remove a project requirement from this component.void
removeRequirements(java.util.List<ComponentRequirement> requirements)
Removes a list of requirements from this component.void
setAlias(java.lang.String alias)
Sets the alias for this component.void
setComponentComposer(java.lang.String componentComposer)
Sets a representation of the composer this component uses.void
setComponentConfigurator(java.lang.String componentConfigurator)
Sets the type of component configurator for this project.void
setComponentFactory(java.lang.String componentFactory)
Sets the id of the factory to use to create this component.void
setComponentProfile(java.lang.String componentProfile)
void
setComponentSetDescriptor(ComponentSetDescriptor componentSetDescriptor)
Sets the component set descriptor of components and dependencies for this component.void
setComponentType(java.lang.String componentType)
Sets this component's type.void
setConfiguration(PlexusConfiguration configuration)
Sets the configuration hierarchy for this component.void
setDescription(java.lang.String description)
Sets a description of this component for users to read.void
setImplementation(java.lang.String implementation)
Sets the implementation of this componet.void
setImplementationClass(java.lang.Class<? extends T> implementationClass)
void
setInstantiationStrategy(java.lang.String instantiationStrategy)
Sets the instantiation-strategy for this component.void
setIsolatedRealm(boolean isolatedRealm)
Sets that this component may be in an isolated classrealm.void
setLifecycleHandler(java.lang.String lifecycleHandler)
Sets the lifecycle-handler for this component.void
setRealm(org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Set the ClassRealm that this component lives under.void
setRole(java.lang.String role)
Sets the role of this component.void
setRoleClass(java.lang.Class<T> roleClass)
void
setRoleHint(java.lang.String roleHint)
Sets the role-hint of this component.void
setSource(java.lang.String source)
The location this information came from (descriptor file URI).void
setVersion(java.lang.String version)
Sets the point in a components's project development timelinejava.lang.String
toString()
-
-
-
Field Detail
-
alias
private java.lang.String alias
-
role
private java.lang.String role
-
roleClass
private java.lang.Class<T> roleClass
-
roleHint
private java.lang.String roleHint
-
implementation
private java.lang.String implementation
-
implementationClass
private java.lang.Class<? extends T> implementationClass
-
version
private java.lang.String version
-
componentType
private java.lang.String componentType
-
configuration
private PlexusConfiguration configuration
-
instantiationStrategy
private java.lang.String instantiationStrategy
-
lifecycleHandler
private java.lang.String lifecycleHandler
-
componentProfile
private java.lang.String componentProfile
-
requirements
private final java.util.List<ComponentRequirement> requirements
-
componentFactory
private java.lang.String componentFactory
-
componentComposer
private java.lang.String componentComposer
-
componentConfigurator
private java.lang.String componentConfigurator
-
description
private java.lang.String description
-
realm
private org.codehaus.plexus.classworlds.realm.ClassRealm realm
-
isolatedRealm
private boolean isolatedRealm
-
componentSetDescriptor
private ComponentSetDescriptor componentSetDescriptor
-
source
private java.lang.String source
-
-
Constructor Detail
-
ComponentDescriptor
public ComponentDescriptor()
-
ComponentDescriptor
public ComponentDescriptor(java.lang.Class<T> implementationClass, org.codehaus.plexus.classworlds.realm.ClassRealm realm)
-
-
Method Detail
-
setSource
public void setSource(java.lang.String source)
The location this information came from (descriptor file URI).- Parameters:
source
- The source of the descriptor.
-
getSource
public java.lang.String getSource()
The location this information came from (descriptor file URI).- Returns:
- The source.
-
getHumanReadableKey
public java.lang.String getHumanReadableKey()
Returns a human-friendly key, suitable for display.- Returns:
- a human-friendly key
-
getAlias
public java.lang.String getAlias()
Returns an alias for this component. An alias as an alternate name other than the normal key.- Returns:
- an alias for this component
-
setAlias
public void setAlias(java.lang.String alias)
Sets the alias for this component.- Parameters:
alias
- alternate name to set
-
getRole
public java.lang.String getRole()
Returns the role of this component.- Returns:
- the role of this component
-
getRoleClass
public java.lang.Class<T> getRoleClass()
-
attemptRoleLoad
private void attemptRoleLoad()
-
setRole
public void setRole(java.lang.String role)
Sets the role of this component.- Parameters:
role
- this component's role
-
setRoleClass
public void setRoleClass(java.lang.Class<T> roleClass)
-
getRoleHint
public java.lang.String getRoleHint()
Returns the role-hint of this component.- Returns:
- the role-hint of this component
-
setRoleHint
public void setRoleHint(java.lang.String roleHint)
Sets the role-hint of this component. Pasing null will set the hint to the default value.- Parameters:
roleHint
- this component's role-hint
-
getImplementation
public java.lang.String getImplementation()
Returns the implementation of this componet. Implementation is a string denoting a FQCN in normal Java components, or some other name or file for other component factory implementations.- Returns:
- the implementation of this componet's role.
-
setImplementation
public void setImplementation(java.lang.String implementation)
Sets the implementation of this componet.- Parameters:
implementation
- string denoting a FQCN in normal Java components, or some other name or file for other component factory implementations
-
getImplementationClass
public java.lang.Class<? extends T> getImplementationClass()
Returns the implementation class of this componet, or null if the implementation class can not be loaded.- Returns:
- the implementation of this componet's role.
-
attemptImplementationLoad
private void attemptImplementationLoad()
-
setImplementationClass
public void setImplementationClass(java.lang.Class<? extends T> implementationClass)
-
getVersion
public java.lang.String getVersion()
Returns a specific point in a components's project timeline. i.e. version 1, or 2.1.4- Returns:
- a specific point in a components's project timeline
-
setVersion
public void setVersion(java.lang.String version)
Sets the point in a components's project development timeline- Parameters:
version
- the components's version
-
getComponentType
public java.lang.String getComponentType()
Returns the type of this component.- Returns:
- the type of this component
-
setComponentType
public void setComponentType(java.lang.String componentType)
Sets this component's type.- Parameters:
componentType
- the type to set
-
getInstantiationStrategy
public java.lang.String getInstantiationStrategy()
Returns the type of instantiation strategy for this component.- Returns:
- the type of instantiation strategy for this component
-
getConfiguration
public PlexusConfiguration getConfiguration()
Returns configuration values defined for this component.- Returns:
- configuration values defined for this component
-
setConfiguration
public void setConfiguration(PlexusConfiguration configuration)
Sets the configuration hierarchy for this component.- Parameters:
configuration
- the configuration hierarchy to set
-
hasConfiguration
public boolean hasConfiguration()
Returns true if this component has a configuration.- Returns:
- true if this component has a configuration
-
getLifecycleHandler
public java.lang.String getLifecycleHandler()
Returns the lifecycle-handler for this component.- Returns:
- the lifecycle-handler for this component
-
setLifecycleHandler
public void setLifecycleHandler(java.lang.String lifecycleHandler)
Sets the lifecycle-handler for this component. For example, "basic", "passive", "bootstrap".- Parameters:
lifecycleHandler
- the lifecycle handler string to set
-
getComponentProfile
public java.lang.String getComponentProfile()
-
setComponentProfile
public void setComponentProfile(java.lang.String componentProfile)
-
addRequirement
public void addRequirement(ComponentRequirement requirement)
Add a project requirement to this component.- Parameters:
requirement
- the requirement to add
-
addRequirement
public void addRequirement(ComponentRequirement... requirement)
Add a project requirement to this component.- Parameters:
requirement
- the requirement to add
-
addRequirements
public void addRequirements(java.util.List<ComponentRequirement> requirements)
Adds a list of requirements to this component.- Parameters:
requirements
- the requirements to add
-
removeRequirement
public void removeRequirement(ComponentRequirement... requirement)
Remove a project requirement from this component.- Parameters:
requirement
- the requirement to remove
-
removeRequirements
public void removeRequirements(java.util.List<ComponentRequirement> requirements)
Removes a list of requirements from this component.- Parameters:
requirements
- the requirements to remove
-
getRequirements
public java.util.List<ComponentRequirement> getRequirements()
Returns all project requirements of this component.- Returns:
- all project requirements of this component
-
getComponentFactory
public java.lang.String getComponentFactory()
Returns an id of the factory used to create this component.- Returns:
- an id of the factory used to create this component
-
setComponentFactory
public void setComponentFactory(java.lang.String componentFactory)
Sets the id of the factory to use to create this component. For example, "jruby" will use a JRuby factory.- Parameters:
componentFactory
- The componentFactor.
-
getComponentComposer
public java.lang.String getComponentComposer()
Returns the ID of the type of composer this component will use. For example, "setter" or "field" for the different types of dependency injection.- Returns:
- the ID of the type of composer this component will use
-
setComponentComposer
public void setComponentComposer(java.lang.String componentComposer)
Sets a representation of the composer this component uses.- Parameters:
componentComposer
- string representation of the composer to use
-
getDescription
public java.lang.String getDescription()
Return a human-readable description of this component.- Returns:
- a human-readable description of this component
-
setDescription
public void setDescription(java.lang.String description)
Sets a description of this component for users to read.- Parameters:
description
- a human-readable description of this component
-
setInstantiationStrategy
public void setInstantiationStrategy(java.lang.String instantiationStrategy)
Sets the instantiation-strategy for this component. For example, "container".- Parameters:
instantiationStrategy
- The strategy.
-
isIsolatedRealm
public boolean isIsolatedRealm()
Returns true if this may be in an isolated classrealm.- Returns:
- true if this may be in an isolated classrealm
-
setComponentSetDescriptor
public void setComponentSetDescriptor(ComponentSetDescriptor componentSetDescriptor)
Sets the component set descriptor of components and dependencies for this component.- Parameters:
componentSetDescriptor
- the component set descriptor of components and dependencies
-
getComponentSetDescriptor
public ComponentSetDescriptor getComponentSetDescriptor()
Returns the component set descriptor.- Returns:
- the component set descriptor
-
setIsolatedRealm
public void setIsolatedRealm(boolean isolatedRealm)
Sets that this component may be in an isolated classrealm.- Parameters:
isolatedRealm
- true if this component may be in an isolated classrealm
-
getComponentConfigurator
public java.lang.String getComponentConfigurator()
Returns the type of component configurator for this project. For example "basic" for normal, or "map-oriented" for map oriented components.- Returns:
- the type of component configurator for this project
-
setComponentConfigurator
public void setComponentConfigurator(java.lang.String componentConfigurator)
Sets the type of component configurator for this project.- Parameters:
componentConfigurator
- The component configurator.
-
getRealm
public org.codehaus.plexus.classworlds.realm.ClassRealm getRealm()
The ClassRealm that this component lives under.- Returns:
- ClassRealm that this component lives under
-
setRealm
public void setRealm(org.codehaus.plexus.classworlds.realm.ClassRealm realm)
Set the ClassRealm that this component lives under.- Parameters:
realm
- the ClassRealm that this component lives under
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
eq
private static <T> boolean eq(T o1, T o2)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
hash
private static int hash(java.lang.Object obj)
-
-