org.jvnet.hk2.component
Class DescriptorImpl
java.lang.Object
org.jvnet.hk2.component.DescriptorImpl
- All Implemented Interfaces:
- Descriptor
public class DescriptorImpl
- extends Object
- implements Descriptor
A simple Descriptor. FOR INTERNAL USE ONLY.
- Author:
- Jerome Dochez, Jeff Trent
DescriptorImpl
public DescriptorImpl()
DescriptorImpl
public DescriptorImpl(Class<?> type)
DescriptorImpl
public DescriptorImpl(String name,
String typeName)
DescriptorImpl
public DescriptorImpl(String name,
String typeName,
MultiMap<String,String> metadata,
Scope scope)
DescriptorImpl
public DescriptorImpl(Descriptor other)
DescriptorImpl
public DescriptorImpl(Descriptor other,
boolean readOnly)
toString
public String toString()
- Overrides:
toString in class Object
hashCode
public int hashCode()
- Overrides:
hashCode in class Object
equals
public boolean equals(Object another)
- Overrides:
equals in class Object
setReadOnly
public void setReadOnly()
assertNotReadOnly
protected void assertNotReadOnly()
addName
public DescriptorImpl addName(String name)
addContract
public DescriptorImpl addContract(Class<?> clazz)
addContract
public DescriptorImpl addContract(String contractFQCN)
addQualifierType
public DescriptorImpl addQualifierType(String annotation)
addMetadata
public DescriptorImpl addMetadata(String key,
String value)
getNames
public Collection<String> getNames()
- Specified by:
getNames in interface Descriptor
getScope
public Scope getScope()
- Specified by:
getScope in interface Descriptor
getMetadata
public MultiMap<String,String> getMetadata()
- Specified by:
getMetadata in interface Descriptor
getQualifiers
public Collection<String> getQualifiers()
- Specified by:
getQualifiers in interface Descriptor
getContracts
public Collection<String> getContracts()
- Specified by:
getContracts in interface Descriptor
hasName
public boolean hasName(String name)
- Specified by:
hasName in interface Descriptor
hasQualifier
public boolean hasQualifier(String qualifier)
- Specified by:
hasQualifier in interface Descriptor
hasContract
public boolean hasContract(String contract)
- Specified by:
hasContract in interface Descriptor
getTypeName
public String getTypeName()
- Specified by:
getTypeName in interface Descriptor
matches
public boolean matches(Descriptor another)
- Returns true if this instance "matches" another instance.
Matching considers each attribute of the descriptor one by one.
For non-null attributes, equality checks are made. If the this
instance contains a null value (or empty for the case for collections)
then the result for that field is true as well. For non-null and non-
empty collections, this instance must be a proper subset of the
other.
- Parameters:
another - the other Descriptor to compare against
- Returns:
- true if all fields in this instance matches another
matches
public static boolean matches(Descriptor d1,
Descriptor d2)
isEmpty
public static boolean isEmpty(Descriptor descriptor)
createMerged
public static DescriptorImpl createMerged(Descriptor d1,
Descriptor d2)
Copyright © 2011 Oracle Corporation. All Rights Reserved.