Package org.glassfish.hk2.utilities
Class DescriptorImpl
- java.lang.Object
-
- org.glassfish.hk2.utilities.DescriptorImpl
-
- All Implemented Interfaces:
java.io.Externalizable
,java.io.Serializable
,Descriptor
- Direct Known Subclasses:
AbstractActiveDescriptor
public class DescriptorImpl extends java.lang.Object implements Descriptor, java.io.Externalizable
The implementation of the descriptor itself, with the bonus of being externalizable, and having writeable fields- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
ANALYSIS_KEY
private java.lang.String
analysisName
private static java.lang.String
CONTRACT_KEY
private java.util.Set<java.lang.String>
contracts
private DescriptorType
descriptorType
private DescriptorVisibility
descriptorVisibility
private static java.util.Set<java.lang.String>
EMPTY_CONTRACTS_SET
private static java.util.Map<java.lang.String,java.util.List<java.lang.String>>
EMPTY_METADATAS_MAP
private static java.util.Set<java.lang.String>
EMPTY_QUALIFIER_SET
private static java.lang.String
END_START
private static char
END_START_CHAR
private java.lang.Long
id
private java.lang.String
implementation
private HK2Loader
loader
private static java.lang.String
LOCAL_DT
private java.lang.Long
locatorId
private static java.lang.String
METADATA_KEY
private java.util.Map<java.lang.String,java.util.List<java.lang.String>>
metadatas
private java.lang.String
name
private static java.lang.String
NAME_KEY
private static java.lang.String
NOT_IN_CONTRACTS_DIRECTIVE
private static char
NOT_IN_CONTRACTS_DIRECTIVE_CHAR
private static java.lang.String
PROVIDE_METHOD_DT
private java.lang.Boolean
proxiable
private static java.lang.String
PROXIABLE_KEY
private static java.lang.String
PROXY_FOR_SAME_SCOPE_KEY
private java.lang.Boolean
proxyForSameScope
private static java.lang.String
QUALIFIER_KEY
private java.util.Set<java.lang.String>
qualifiers
private int
rank
private static java.lang.String
RANKING_KEY
private java.lang.String
scope
private static java.lang.String
SCOPE_KEY
private static long
serialVersionUID
For serializationprivate static java.lang.String
SINGLETON_DIRECTIVE
private static char
SINGLETON_DIRECTIVE_CHAR
private static java.lang.String
START_START
private static java.lang.String
TYPE_KEY
private static java.lang.String
VISIBILITY_KEY
-
Constructor Summary
Constructors Constructor Description DescriptorImpl()
For serializationDescriptorImpl(java.util.Set<java.lang.String> contracts, java.lang.String name, java.lang.String scope, java.lang.String implementation, java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadatas, java.util.Set<java.lang.String> qualifiers, DescriptorType descriptorType, DescriptorVisibility descriptorVisibility, HK2Loader loader, int rank, java.lang.Boolean proxiable, java.lang.Boolean proxyForSameScope, java.lang.String analysisName, java.lang.Long id, java.lang.Long locatorId)
This creates this descriptor impl, taking all of the fields as givenDescriptorImpl(Descriptor copyMe)
Does a deep copy of the incoming descriptor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAdvertisedContract(java.lang.String addMe)
Adds an advertised contract to the set of contracts advertised by this descriptorvoid
addMetadata(java.lang.String key, java.lang.String value)
Adds a value to the list of values associated with this keyvoid
addMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadata)
Adds all of the entries from this map to the existing descriptor's metadata.void
addQualifier(java.lang.String addMe)
Adds the given string to the list of qualifiersvoid
clearMetadata()
Removes all metadata valuesstatic boolean
descriptorEquals(Descriptor a, Descriptor b)
Tests if two descriptors are equal not taking into account the locator-id and server-id by comparing the following fields: implementation contracts name scope qualifiers descriptorType descriptorVisibility metadata proxiable proxyForSameScope analysisNameprivate static <T> boolean
equalMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> a, java.util.Map<java.lang.String,java.util.List<java.lang.String>> b)
private static <T> boolean
equalOrderedCollection(java.util.Collection<T> a, java.util.Collection<T> b)
boolean
equals(java.lang.Object a)
This equals matches only if the following fields of the descriptor match: implementation contracts name scope qualifiers descriptorType descriptorVisibility metadata proxiable proxyForSameScope analysisNamejava.util.Set<java.lang.String>
getAdvertisedContracts()
Returns the base class name of the contracts that this service describes.java.lang.String
getClassAnalysisName()
Returns the name of theClassAnalyzer
service that should be used to discover the constructors, initialization methods, field and postConstruct and preDestory methods.DescriptorType
getDescriptorType()
Returns CLASS if this is a class descriptor and FACTORY if this is a descriptor describing a factory for a type, in which case the implClass should point to the implementation class of the factoryDescriptorVisibility
getDescriptorVisibility()
Returns the visibility of this descriptor.java.lang.String
getImplementation()
Returns the fully qualified class name of the implementation class.HK2Loader
getLoader()
This returns the loader that should be used when classloading this descriptor.java.lang.Long
getLocatorId()
This returns the id of the ServiceLocator which this descriptor is registered with.java.util.Map<java.lang.String,java.util.List<java.lang.String>>
getMetadata()
Returns all of the metadata associated that this object should be registered with or looked up byjava.lang.String
getName()
The name of this descriptor.java.util.Set<java.lang.String>
getQualifiers()
Returns all of the annotation classes that this object should be registered with or looked up byint
getRanking()
Returns the ranking of this descriptor.java.lang.String
getScope()
Returns the fully qualified class name of the scope annotation that should be associated with this descriptor.java.lang.Long
getServiceId()
This returns the unique identifier for this descriptor.int
hashCode()
java.lang.Boolean
isProxiable()
If this returns true then the system will create a proxy for instances of this descriptor.java.lang.Boolean
isProxyForSameScope()
This value determines whether or not this service should be proxied when being injected into other services of the same scope.static void
pretty(java.lang.StringBuffer sb, Descriptor d)
Will pretty print a descriptorvoid
readExternal(java.io.ObjectInput in)
boolean
readObject(java.io.BufferedReader in)
This can be used to read in instances of this object that were previously written out with writeObject.private void
reinitialize()
boolean
removeAdvertisedContract(java.lang.String removeMe)
Removes an advertised contract from the set of contracts advertised by this descriptorboolean
removeAllMetadata(java.lang.String key)
Removes all the metadata values associated with keyboolean
removeMetadata(java.lang.String key, java.lang.String value)
Removes the given value from the given keyboolean
removeQualifier(java.lang.String removeMe)
Removes the given qualifier from the list of qualifiersvoid
setClassAnalysisName(java.lang.String name)
Sets the name of the service that will be used to analyze this classvoid
setDescriptorType(DescriptorType descriptorType)
Sets the descriptor typevoid
setDescriptorVisibility(DescriptorVisibility descriptorVisibility)
Sets the descriptor visilibityvoid
setImplementation(java.lang.String implementation)
Sets the implementationvoid
setLoader(HK2Loader loader)
Sets the loader to use with this descriptorvoid
setLocatorId(java.lang.Long locatorId)
Sets the locator id for this descriptorvoid
setMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadata)
Sets the metadata of this DescriptorImpl to exactly the set of metadata in the incoming map.void
setName(java.lang.String name)
Sets the name this descriptor should havevoid
setProxiable(java.lang.Boolean proxiable)
Sets whether or not this descriptor should be proxiedvoid
setProxyForSameScope(java.lang.Boolean proxyForSameScope)
Sets whether or not to proxy this descriptor for other services in the same scopeint
setRanking(int ranking)
Returns the ranking of this descriptor.void
setScope(java.lang.String scope)
Sets the scope this descriptor should havevoid
setServiceId(java.lang.Long id)
Sets the service id for this descriptorjava.lang.String
toString()
void
writeExternal(java.io.ObjectOutput out)
void
writeObject(java.io.PrintWriter out)
This writes this object to the data output stream in a human-readable format, excellent for writing out data files
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization- See Also:
- Constant Field Values
-
CONTRACT_KEY
private static final java.lang.String CONTRACT_KEY
- See Also:
- Constant Field Values
-
NAME_KEY
private static final java.lang.String NAME_KEY
- See Also:
- Constant Field Values
-
SCOPE_KEY
private static final java.lang.String SCOPE_KEY
- See Also:
- Constant Field Values
-
QUALIFIER_KEY
private static final java.lang.String QUALIFIER_KEY
- See Also:
- Constant Field Values
-
TYPE_KEY
private static final java.lang.String TYPE_KEY
- See Also:
- Constant Field Values
-
VISIBILITY_KEY
private static final java.lang.String VISIBILITY_KEY
- See Also:
- Constant Field Values
-
METADATA_KEY
private static final java.lang.String METADATA_KEY
- See Also:
- Constant Field Values
-
RANKING_KEY
private static final java.lang.String RANKING_KEY
- See Also:
- Constant Field Values
-
PROXIABLE_KEY
private static final java.lang.String PROXIABLE_KEY
- See Also:
- Constant Field Values
-
PROXY_FOR_SAME_SCOPE_KEY
private static final java.lang.String PROXY_FOR_SAME_SCOPE_KEY
- See Also:
- Constant Field Values
-
ANALYSIS_KEY
private static final java.lang.String ANALYSIS_KEY
- See Also:
- Constant Field Values
-
PROVIDE_METHOD_DT
private static final java.lang.String PROVIDE_METHOD_DT
- See Also:
- Constant Field Values
-
LOCAL_DT
private static final java.lang.String LOCAL_DT
- See Also:
- Constant Field Values
-
START_START
private static final java.lang.String START_START
- See Also:
- Constant Field Values
-
END_START
private static final java.lang.String END_START
- See Also:
- Constant Field Values
-
END_START_CHAR
private static final char END_START_CHAR
- See Also:
- Constant Field Values
-
SINGLETON_DIRECTIVE
private static final java.lang.String SINGLETON_DIRECTIVE
- See Also:
- Constant Field Values
-
NOT_IN_CONTRACTS_DIRECTIVE
private static final java.lang.String NOT_IN_CONTRACTS_DIRECTIVE
- See Also:
- Constant Field Values
-
SINGLETON_DIRECTIVE_CHAR
private static final char SINGLETON_DIRECTIVE_CHAR
- See Also:
- Constant Field Values
-
NOT_IN_CONTRACTS_DIRECTIVE_CHAR
private static final char NOT_IN_CONTRACTS_DIRECTIVE_CHAR
- See Also:
- Constant Field Values
-
EMPTY_CONTRACTS_SET
private static final java.util.Set<java.lang.String> EMPTY_CONTRACTS_SET
-
EMPTY_QUALIFIER_SET
private static final java.util.Set<java.lang.String> EMPTY_QUALIFIER_SET
-
EMPTY_METADATAS_MAP
private static final java.util.Map<java.lang.String,java.util.List<java.lang.String>> EMPTY_METADATAS_MAP
-
contracts
private java.util.Set<java.lang.String> contracts
-
implementation
private java.lang.String implementation
-
name
private java.lang.String name
-
scope
private java.lang.String scope
-
metadatas
private java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadatas
-
qualifiers
private java.util.Set<java.lang.String> qualifiers
-
descriptorType
private DescriptorType descriptorType
-
descriptorVisibility
private DescriptorVisibility descriptorVisibility
-
loader
private transient HK2Loader loader
-
rank
private int rank
-
proxiable
private java.lang.Boolean proxiable
-
proxyForSameScope
private java.lang.Boolean proxyForSameScope
-
analysisName
private java.lang.String analysisName
-
id
private java.lang.Long id
-
locatorId
private java.lang.Long locatorId
-
-
Constructor Detail
-
DescriptorImpl
public DescriptorImpl()
For serialization
-
DescriptorImpl
public DescriptorImpl(Descriptor copyMe)
Does a deep copy of the incoming descriptor- Parameters:
copyMe
- The descriptor to copy
-
DescriptorImpl
public DescriptorImpl(java.util.Set<java.lang.String> contracts, java.lang.String name, java.lang.String scope, java.lang.String implementation, java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadatas, java.util.Set<java.lang.String> qualifiers, DescriptorType descriptorType, DescriptorVisibility descriptorVisibility, HK2Loader loader, int rank, java.lang.Boolean proxiable, java.lang.Boolean proxyForSameScope, java.lang.String analysisName, java.lang.Long id, java.lang.Long locatorId)
This creates this descriptor impl, taking all of the fields as given- Parameters:
contracts
- The set of contracts this descriptor impl should advertise (should not be null)name
- The name of this descriptor (may be null)scope
- The scope of this descriptor. If null PerLookup is assumedimplementation
- The name of the implementation class (should not be null)metadatas
- The metadata associated with this descriptor (should not be null)qualifiers
- The set of qualifiers associated with this descriptor (should not be null)descriptorType
- The type of this descriptor (should not be null)descriptorVisibility
- The visibility this descriptor should haveloader
- The HK2Loader to associated with this descriptor (may be null)rank
- The rank to initially associate with this descriptorproxiable
- The proxiable value to associate with this descriptor (may be null)proxyForSameScope
- The proxyForSameScope value to associate with this descriptor (may be null)analysisName
- The name of the ClassAnalysis service to useid
- The ID this descriptor should take (may be null)locatorId
- The locator ID this descriptor should take (may be null)
-
-
Method Detail
-
getAdvertisedContracts
public java.util.Set<java.lang.String> getAdvertisedContracts()
Description copied from interface:Descriptor
Returns the base class name of the contracts that this service describes. If the contract is a paramterized type this will return the raw class. If this service can be looked up by its implementation class then the name of the implementation class must also be found in this list- Specified by:
getAdvertisedContracts
in interfaceDescriptor
- Returns:
- Will never return null, but may return an empty set. The returned strings are the fully qualified class names of contracts the predicate describes
-
addAdvertisedContract
public void addAdvertisedContract(java.lang.String addMe)
Adds an advertised contract to the set of contracts advertised by this descriptor- Parameters:
addMe
- The contract to add. May not be null
-
removeAdvertisedContract
public boolean removeAdvertisedContract(java.lang.String removeMe)
Removes an advertised contract from the set of contracts advertised by this descriptor- Parameters:
removeMe
- The contract to remove. May not be null- Returns:
- true if removeMe was removed from the set
-
getImplementation
public java.lang.String getImplementation()
Description copied from interface:Descriptor
Returns the fully qualified class name of the implementation class. If this is a factory descriptor then this will return the fully qualified name of the class implementing the factory interface.- Specified by:
getImplementation
in interfaceDescriptor
- Returns:
- Might return null in some cases, but will usually return the fully qualified class name of the implementation class or of the factory class for this descriptor
-
setImplementation
public void setImplementation(java.lang.String implementation)
Sets the implementation- Parameters:
implementation
- The implementation this descriptor should have
-
getScope
public java.lang.String getScope()
Description copied from interface:Descriptor
Returns the fully qualified class name of the scope annotation that should be associated with this descriptor.- Specified by:
getScope
in interfaceDescriptor
- Returns:
- If this returns null then this descriptor is assumed to be in the default scope, which is PerLookup
-
setScope
public void setScope(java.lang.String scope)
Sets the scope this descriptor should have- Parameters:
scope
- The scope of this descriptor
-
getName
public java.lang.String getName()
Description copied from interface:Descriptor
The name of this descriptor. Note that if this returns not null then there must also be the Named qualifier in the set of qualifiers with the same value- Specified by:
getName
in interfaceDescriptor
- Returns:
- The name of this descriptor, or null if there is no name associated with this qualifier
-
setName
public void setName(java.lang.String name)
Sets the name this descriptor should have- Parameters:
name
- The name for this descriptor
-
getQualifiers
public java.util.Set<java.lang.String> getQualifiers()
Description copied from interface:Descriptor
Returns all of the annotation classes that this object should be registered with or looked up by- Specified by:
getQualifiers
in interfaceDescriptor
- Returns:
- Never returns null, but may return an empty set. The set of fully qualified class names that are annotations that this object must have
-
addQualifier
public void addQualifier(java.lang.String addMe)
Adds the given string to the list of qualifiers- Parameters:
addMe
- The fully qualified class name of the qualifier to add. May not be null
-
removeQualifier
public boolean removeQualifier(java.lang.String removeMe)
Removes the given qualifier from the list of qualifiers- Parameters:
removeMe
- The fully qualifier class name of the qualifier to remove. May not be null- Returns:
- true if the given qualifier was removed
-
getDescriptorType
public DescriptorType getDescriptorType()
Description copied from interface:Descriptor
Returns CLASS if this is a class descriptor and FACTORY if this is a descriptor describing a factory for a type, in which case the implClass should point to the implementation class of the factory- Specified by:
getDescriptorType
in interfaceDescriptor
- Returns:
- Either CLASS or PROVIDE_METHOD
-
setDescriptorType
public void setDescriptorType(DescriptorType descriptorType)
Sets the descriptor type- Parameters:
descriptorType
- The descriptor type. May not be null
-
getDescriptorVisibility
public DescriptorVisibility getDescriptorVisibility()
Description copied from interface:Descriptor
Returns the visibility of this descriptor.If the visibility is NORMAL then this descriptor may be seen by all children locators of the locator in which this descriptor is bound
If the visibility is LOCAL then this descriptor may only be seen by the servcie locator in which it is bound, and in none of the children of that locator
- Specified by:
getDescriptorVisibility
in interfaceDescriptor
- Returns:
- Either NORMAL or LOCAL
-
setDescriptorVisibility
public void setDescriptorVisibility(DescriptorVisibility descriptorVisibility)
Sets the descriptor visilibity- Parameters:
descriptorVisibility
- The visibility this descriptor should have
-
getMetadata
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getMetadata()
Description copied from interface:Descriptor
Returns all of the metadata associated that this object should be registered with or looked up by- Specified by:
getMetadata
in interfaceDescriptor
- Returns:
- Never returns null, but may return an empty set. The set of metadata associated with the object. The values in the returned map will never be null, and will always have at least one member
-
setMetadata
public void setMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadata)
Sets the metadata of this DescriptorImpl to exactly the set of metadata in the incoming map. Any previous metadata values will be removed. A deep copy of the incoming map will be made, so it is safe to use the input map after use of this API- Parameters:
metadata
- The non-null metadata that this descriptor should have
-
addMetadata
public void addMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> metadata)
Adds all of the entries from this map to the existing descriptor's metadata. None of the keys in the map may have the '=' character- Parameters:
metadata
- The non-null but possibly empty list of fields to add to the metadata map
-
addMetadata
public void addMetadata(java.lang.String key, java.lang.String value)
Adds a value to the list of values associated with this key- Parameters:
key
- The key to which to add the value. May not be null. May not contain the character '='value
- The value to add. May not be null
-
removeMetadata
public boolean removeMetadata(java.lang.String key, java.lang.String value)
Removes the given value from the given key- Parameters:
key
- The key of the value to remove. May not be null, and may not contain the character '='value
- The value to remove. May not be null- Returns:
- true if the value was removed
-
removeAllMetadata
public boolean removeAllMetadata(java.lang.String key)
Removes all the metadata values associated with key- Parameters:
key
- The key of the metadata values to remove- Returns:
- true if any value was removed
-
clearMetadata
public void clearMetadata()
Removes all metadata values
-
getLoader
public HK2Loader getLoader()
Description copied from interface:Descriptor
This returns the loader that should be used when classloading this descriptor. If this method returns null then the class will be loaded with the classloader of the Injectee if there is one, or with the classloader that loaded HK2 itself; failing that the context class loader on the thread will be tried.- Specified by:
getLoader
in interfaceDescriptor
- Returns:
- An HK2Loader that can be used to load this descriptor, or null if the default classloading algorithm should be used
-
setLoader
public void setLoader(HK2Loader loader)
Sets the loader to use with this descriptor- Parameters:
loader
- The loader to use with this descriptor
-
getRanking
public int getRanking()
Description copied from interface:Descriptor
Returns the ranking of this descriptor. Rankings with higher value will be considered "better" than rankings of lower value. Descriptors with the same ranking will be returned in the reverse ServiceID order (in other words, the least service ID is considered "better" than any higher service ID).- Specified by:
getRanking
in interfaceDescriptor
- Returns:
- the ranking that should be associated with this descriptor
-
setRanking
public int setRanking(int ranking)
Description copied from interface:Descriptor
Returns the ranking of this descriptor. Rankings with higher value will be considered "better" than rankings of lower value. Descriptors with the same ranking will be returned in the reverse ServiceID order (in other words, the least service ID is considered "better" than any higher service ID).The ranking of a service may change at any time during the life of the descriptor
- Specified by:
setRanking
in interfaceDescriptor
- Parameters:
ranking
- The new ranking this descriptor should have- Returns:
- the previous ranking that this descriptor had
-
getServiceId
public java.lang.Long getServiceId()
Description copied from interface:Descriptor
This returns the unique identifier for this descriptor. This field will be ignored upon binding, and will then be assigned by the system. However, this field can be set on search operations, in which case this search will match exactly one Provider in the system.- Specified by:
getServiceId
in interfaceDescriptor
- Returns:
- The service id for this object. Note that this field may return null if this is an initial bind, as it is not the responsibility of the binder to set this value. If this returns non-null on a bind operation the return value will be ignored
-
setServiceId
public void setServiceId(java.lang.Long id)
Sets the service id for this descriptor- Parameters:
id
- the service id for this descriptor
-
isProxiable
public java.lang.Boolean isProxiable()
Description copied from interface:Descriptor
If this returns true then the system will create a proxy for instances of this descriptor. As with all proxies, the proxy created will also implement theProxyCtl
interfaceIt is an error for this method to return true if the scope that this descriptor is in is
Unproxiable
(such as PerLookup).- Specified by:
isProxiable
in interfaceDescriptor
- Returns:
- true if this descriptor must be proxied, false if this
descriptor must NOT be proxied (even if it is in an Unproxiable scope)
and null if this descriptor should take its proxiable status from
the scope it is in (i.e., it will only be proxied if the scope is
marked
Proxiable
)
-
setProxiable
public void setProxiable(java.lang.Boolean proxiable)
Sets whether or not this descriptor should be proxied- Parameters:
proxiable
- if true then this descriptor will be proxied. If false then this descriptor will not be proxied. If null this descriptor will follow the rules of the scope it is in
-
isProxyForSameScope
public java.lang.Boolean isProxyForSameScope()
Description copied from interface:Descriptor
This value determines whether or not this service should be proxied when being injected into other services of the same scope. If a scope is proxiable then it will have a default setting for whether or not its services should be proxied when being injected into the same scope. If this method returns null then the default setting for the scope will be used. Otherwise the value returned will determine whether or not this service will be proxied when being injected into a service of the same scope.- Specified by:
isProxyForSameScope
in interfaceDescriptor
- Returns:
- null if this descriptor should use the default ProxyForSameScope value for the scope. If it returns true then this service will be proxied even when being injected into the same scope. If it returns false then this service will NOT be proxied when being injected into the same scope (i.e., it cannot be used for lazy initialization of the service when injected into the same scope)
-
setProxyForSameScope
public void setProxyForSameScope(java.lang.Boolean proxyForSameScope)
Sets whether or not to proxy this descriptor for other services in the same scope- Parameters:
proxyForSameScope
- if true then this descriptor will be proxied for services in the same scope. If false then this descriptor will not be proxied for services in the same scope. If null this descriptor will follow the rules of the scope it is in
-
getClassAnalysisName
public java.lang.String getClassAnalysisName()
Description copied from interface:Descriptor
Returns the name of theClassAnalyzer
service that should be used to discover the constructors, initialization methods, field and postConstruct and preDestory methods. If null the default implementation will be used. Will be ignored for descriptors that are not automatically analyzed by hk2- Specified by:
getClassAnalysisName
in interfaceDescriptor
- Returns:
- the possibly null name of the ClassAnalysis service that should be used to analyze the class represented by this descriptor. If null then the HK2 default analysis will be performed
-
setClassAnalysisName
public void setClassAnalysisName(java.lang.String name)
Sets the name of the service that will be used to analyze this class- Parameters:
name
- The name of theClassAnalyzer
service that should be used to analyze this descriptor
-
getLocatorId
public java.lang.Long getLocatorId()
Description copied from interface:Descriptor
This returns the id of the ServiceLocator which this descriptor is registered with. Returns null if this descriptor is not yet registered with a ServiceLocator- Specified by:
getLocatorId
in interfaceDescriptor
- Returns:
- The id of the ServiceLocator this Descriptor is registered with, or null if this Descriptor is not registered with a ServiceLocator
-
setLocatorId
public void setLocatorId(java.lang.Long locatorId)
Sets the locator id for this descriptor- Parameters:
locatorId
- the locator id for this descriptor
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equalOrderedCollection
private static <T> boolean equalOrderedCollection(java.util.Collection<T> a, java.util.Collection<T> b)
-
equalMetadata
private static <T> boolean equalMetadata(java.util.Map<java.lang.String,java.util.List<java.lang.String>> a, java.util.Map<java.lang.String,java.util.List<java.lang.String>> b)
-
descriptorEquals
public static boolean descriptorEquals(Descriptor a, Descriptor b)
Tests if two descriptors are equal not taking into account the locator-id and server-id by comparing the following fields:- implementation
- contracts
- name
- scope
- qualifiers
- descriptorType
- descriptorVisibility
- metadata
- proxiable
- proxyForSameScope
- analysisName
- Parameters:
a
- The possibly null descriptor to compareb
- The possibly null descriptor to compare- Returns:
- true if they are the same, false otherwise
-
equals
public boolean equals(java.lang.Object a)
This equals matches only if the following fields of the descriptor match:- implementation
- contracts
- name
- scope
- qualifiers
- descriptorType
- descriptorVisibility
- metadata
- proxiable
- proxyForSameScope
- analysisName
- Overrides:
equals
in classjava.lang.Object
- Parameters:
a
- The object to compare to this one. May be null (which will result in a false)- Returns:
- true if the descriptors are equal
-
pretty
public static void pretty(java.lang.StringBuffer sb, Descriptor d)
Will pretty print a descriptor- Parameters:
sb
- The string buffer put the pretty print intod
- The descriptor to write
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
writeObject
public void writeObject(java.io.PrintWriter out) throws java.io.IOException
This writes this object to the data output stream in a human-readable format, excellent for writing out data files- Parameters:
out
- The output stream to write this object out to- Throws:
java.io.IOException
- on failure
-
reinitialize
private void reinitialize()
-
readObject
public boolean readObject(java.io.BufferedReader in) throws java.io.IOException
This can be used to read in instances of this object that were previously written out with writeObject. Useful for reading from external data files- Parameters:
in
- The reader to read from- Returns:
- true if a descriptor was read, false otherwise. This is useful if reading a file that might have comments at the end
- Throws:
java.io.IOException
- on failure
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
- Specified by:
writeExternal
in interfacejava.io.Externalizable
- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
- Specified by:
readExternal
in interfacejava.io.Externalizable
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
-