org.jboss.weld.annotated.slim.backed.BackedAnnotatedMember Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of weld-servlet-shaded Show documentation
Show all versions of weld-servlet-shaded Show documentation
This jar bundles all the bits of Weld and CDI required for running in a Servlet container.
package org.jboss.weld.annotated.slim.backed;
import java.io.Serializable;
import java.lang.reflect.Member;
import java.lang.reflect.Type;
import javax.enterprise.inject.spi.AnnotatedMember;
import org.jboss.weld.logging.BeanLogger;
import org.jboss.weld.resources.ReflectionCache;
import org.jboss.weld.resources.SharedObjectCache;
import org.jboss.weld.serialization.AbstractSerializableHolder;
import org.jboss.weld.util.reflection.Reflections;
public abstract class BackedAnnotatedMember extends BackedAnnotated implements AnnotatedMember {
private BackedAnnotatedType declaringType;
public BackedAnnotatedMember(Type baseType, BackedAnnotatedType declaringType, SharedObjectCache sharedObjectCache) {
super(baseType, sharedObjectCache);
this.declaringType = declaringType;
}
public boolean isStatic() {
return Reflections.isStatic(getJavaMember());
}
public BackedAnnotatedType getDeclaringType() {
return declaringType;
}
@Override
protected ReflectionCache getReflectionCache() {
return getDeclaringType().getReflectionCache();
}
protected abstract static class BackedAnnotatedMemberSerializationProxy> implements Serializable {
private static final long serialVersionUID = 450947485748828056L;
protected final BackedAnnotatedType type;
private final AbstractSerializableHolder extends Member> memberHolder;
public BackedAnnotatedMemberSerializationProxy(BackedAnnotatedType type, AbstractSerializableHolder extends Member> memberHolder) {
this.type = type;
this.memberHolder = memberHolder;
}
protected A resolve() {
for (A annotatedMember : getCandidates()) {
if (annotatedMember.getJavaMember().equals(memberHolder.get())) {
return annotatedMember;
}
}
throw BeanLogger.LOG.unableToLoadMember(memberHolder.get());
}
protected abstract Iterable getCandidates();
}
}