org.apache.webbeans.portable
abstract class: AbstractAnnotated [javadoc |
source]
java.lang.Object
org.apache.webbeans.portable.AbstractAnnotated
All Implemented Interfaces:
javax.enterprise.inject.spi.Annotated
Direct Known Subclasses:
AnnotatedMethodImpl, AnnotatedFieldImpl, AnnotatedParameterImpl, AnnotatedTypeImpl, AbstractAnnotatedCallable, AbstractAnnotatedMember, AnnotatedConstructorImpl
Abstract implementation of the
Annotated contract.
- version:
$
- Rev: 788940 $ $Date: 2009-06-27 11:52:08 +0300 (Sat, 27 Jun 2009) $
Constructor: |
protected AbstractAnnotated(Type baseType) {
this.baseType = baseType;
ClassUtil.setTypeHierarchy(this.typeClosures, this.baseType);
}
Createa a new annotated element. Parameters:
baseType - annotated element type
|
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from org.apache.webbeans.portable.AbstractAnnotated Detail: |
protected void addAnnotation(Annotation annotation) {
this.annotations.add(annotation);
}
Adds new annotation to set. |
public T getAnnotation(Class<T> annotationType) {
for(Annotation ann : this.annotations)
{
if(ann.annotationType().equals(annotationType))
{
return (T)ann;
}
}
return null;
}
|
public Set<Annotation> getAnnotations() {
return this.annotations;
}
|
public Type getBaseType() {
return this.baseType;
}
|
public Set<Type> getTypeClosure() {
return this.typeClosures;
}
|
public boolean isAnnotationPresent(Class<Annotation> annotationType) {
for(Annotation ann : this.annotations)
{
if(ann.annotationType().equals(annotationType))
{
return true;
}
}
return false;
}
|
protected void setAnnotations(Annotation[] annotations) {
this.annotations.clear();
for(Annotation annotation : annotations)
{
this.annotations.add(annotation);
}
}
Adds new annotation to set. |
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Base Type : " + baseType.toString() + ",");
builder.append("Type Closures : " + typeClosures.toString() + ",");
builder.append("Annotations : " + annotations.toString());
return builder.toString();
}
|