|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.glassfish.hk2.utilities.DescriptorImpl
public class DescriptorImpl
The implementation of the descriptor itself, with the bonus of being externalizable, and having writeable fields
Constructor Summary | |
---|---|
DescriptorImpl()
For serialization |
|
DescriptorImpl(Descriptor copyMe)
Does a deep copy of the incoming descriptor |
|
DescriptorImpl(Set<String> contracts,
String name,
String scope,
String implementation,
Map<String,List<String>> metadatas,
Set<String> qualifiers,
DescriptorType descriptorType,
HK2Loader loader,
int rank,
Descriptor baseDescriptor,
Long id,
Long locatorId)
This creates this descriptor impl, taking all of the fields as given |
Method Summary | |
---|---|
void |
addAdvertisedContract(String addMe)
Adds an advertised contract to the set of contracts advertised by this descriptor |
void |
addMetadata(String key,
String value)
Adds a value to the list of values associated with this key |
void |
addQualifier(String addMe)
Adds the given string to the list of qualifiers |
boolean |
equals(Object a)
|
Set<String> |
getAdvertisedContracts()
Returns the base class name of the contracts that this service describes. |
Descriptor |
getBaseDescriptor()
If this descriptor is based on another descriptor (for example via the Configuration bind call) then this method will
return the original basis for this descriptor. |
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 factory |
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. |
Long |
getLocatorId()
This returns the id of the ServiceLocator which this descriptor is registered with. |
Map<String,List<String>> |
getMetadata()
Returns all of the metadata associated that this object should be registered with or looked up by |
String |
getName()
The name of this descriptor. |
Set<String> |
getQualifiers()
Returns all of the annotation classes that this object should be registered with or looked up by |
int |
getRanking()
Returns the ranking of this descriptor. |
String |
getScope()
Returns the fully qualified class name of the scope annotation that should be associated with this descriptor. |
Long |
getServiceId()
This returns the unique identifier for this descriptor. |
int |
hashCode()
|
static void |
pretty(StringBuffer sb,
Descriptor d)
Will pretty print a descriptor |
boolean |
readObject(BufferedReader in)
This can be used to read in instances of this object that were previously written out with writeObject. |
boolean |
removeAdvertisedContract(String removeMe)
Removes an advertised contract from the set of contracts advertised by this descriptor |
boolean |
removeAllMetadata(String key)
Removes all the metadata values associated with key |
boolean |
removeMetadata(String key,
String value)
Removes the given value from the given key |
boolean |
removeQualifier(String removeMe)
Removes the given qualifier from the list of qualifiers |
void |
setBaseDescriptor(Descriptor baseDescriptor)
Sets the base descriptor to be associated with this descriptor |
void |
setDescriptorType(DescriptorType descriptorType)
Sets the descriptor type |
void |
setImplementation(String implementation)
Sets the implementation |
void |
setLoader(HK2Loader loader)
Sets the loader to use with this descriptor |
void |
setLocatorId(Long locatorId)
Sets the locator id for this descriptor |
void |
setName(String name)
Sets the name this descriptor should have |
int |
setRanking(int ranking)
Returns the ranking of this descriptor. |
void |
setScope(String scope)
Sets the scope this descriptor should have |
void |
setServiceId(Long id)
Sets the service id for this descriptor |
String |
toString()
|
void |
writeObject(PrintWriter out)
This writes this object to the data output stream in a human-readable format, excellent for writing out data files |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DescriptorImpl()
public DescriptorImpl(Descriptor copyMe)
copyMe
- The descriptor to copypublic DescriptorImpl(Set<String> contracts, String name, String scope, String implementation, Map<String,List<String>> metadatas, Set<String> qualifiers, DescriptorType descriptorType, HK2Loader loader, int rank, Descriptor baseDescriptor, Long id, Long locatorId)
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)loader
- The HK2Loader to associated with this descriptor (may be null)rank
- The rank to initially associate with this descriptorbaseDescriptor
- The base descriptor to associated with this descriptorid
- The ID this descriptor should take (may be null)locatorId
- The locator ID this descriptor should take (may be null)Method Detail |
---|
public Set<String> getAdvertisedContracts()
Descriptor
getAdvertisedContracts
in interface Descriptor
public void addAdvertisedContract(String addMe)
addMe
- The contract to add. May not be nullpublic boolean removeAdvertisedContract(String removeMe)
removeMe
- The contract to remove. May not be null
public String getImplementation()
Descriptor
getImplementation
in interface Descriptor
public void setImplementation(String implementation)
implementation
- The implementation this descriptor should havepublic String getScope()
Descriptor
getScope
in interface Descriptor
public void setScope(String scope)
scope
- The scope of this descriptorpublic String getName()
Descriptor
getName
in interface Descriptor
public void setName(String name)
name
- The name for this descriptorpublic Set<String> getQualifiers()
Descriptor
getQualifiers
in interface Descriptor
public void addQualifier(String addMe)
addMe
- The fully qualified class name of the qualifier to add. May not be nullpublic boolean removeQualifier(String removeMe)
removeMe
- The fully qualifier class name of the qualifier to remove. May not be null
public DescriptorType getDescriptorType()
Descriptor
getDescriptorType
in interface Descriptor
public void setDescriptorType(DescriptorType descriptorType)
descriptorType
- The descriptor type. May not be nullpublic Map<String,List<String>> getMetadata()
Descriptor
getMetadata
in interface Descriptor
public void addMetadata(String key, String value)
key
- The key to which to add the value. May not be nullvalue
- The value to add. May not be nullpublic boolean removeMetadata(String key, String value)
key
- The key of the value to remove. May not be nullvalue
- The value to remove. May not be null
public boolean removeAllMetadata(String key)
key
- The key of the metadata values to remove
public HK2Loader getLoader()
Descriptor
getLoader
in interface Descriptor
public void setLoader(HK2Loader loader)
loader
- The loader to use with this descriptorpublic int getRanking()
Descriptor
getRanking
in interface Descriptor
public int setRanking(int ranking)
Descriptor
The ranking of a service may change at any time during the life of the descriptor
setRanking
in interface Descriptor
ranking
- The new ranking this descriptor should have
public Descriptor getBaseDescriptor()
Descriptor
Configuration
bind call) then this method will
return the original basis for this descriptor.
On bind calls the value of this parameter will be ignored, and will be filled in by the system.
Note that even if the values in the returned descriptor are modified it will not affect the values in the parent descriptor (the fields must have been copied out of the base descriptor, not referenced)
getBaseDescriptor
in interface Descriptor
public void setBaseDescriptor(Descriptor baseDescriptor)
baseDescriptor
- The base descriptor to be associated with this descriptorpublic Long getServiceId()
Descriptor
getServiceId
in interface Descriptor
public void setServiceId(Long id)
id
- the service id for this descriptorpublic Long getLocatorId()
Descriptor
getLocatorId
in interface Descriptor
public void setLocatorId(Long locatorId)
locatorId
- the locator id for this descriptorpublic int hashCode()
hashCode
in class Object
public boolean equals(Object a)
equals
in class Object
public static void pretty(StringBuffer sb, Descriptor d)
sb
- The string buffer put the pretty print intod
- The descriptor to writepublic String toString()
toString
in class Object
public void writeObject(PrintWriter out) throws IOException
out
- The output stream to write this object out to
IOException
- on failurepublic boolean readObject(BufferedReader in) throws IOException
in
- The reader to read from
IOException
- on failure
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |