Skip to content

Commit

Permalink
rename methods to reflect JDK
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@2005 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
pmuir committed Mar 15, 2009
1 parent df52117 commit 3ef0eb2
Show file tree
Hide file tree
Showing 29 changed files with 168 additions and 70 deletions.
6 changes: 3 additions & 3 deletions impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
Expand Up @@ -260,10 +260,10 @@ protected boolean checkInjectionPointsAreSerializable()
// TODO CACHE THIS and rebuild on addBean
// TODO: a bit crude, don't check *all* injectionpoints, only those listed
// in the spec for passivation checks
for (AnnotatedItem<?, ?> injectionPoint : getInjectionPoints())
for (AnnotatedInjectionPoint<?, ?> injectionPoint : getInjectionPoints())
{
Annotation[] bindings = injectionPoint.getMetaAnnotationsAsArray(BindingType.class);
Bean<?> resolvedBean = manager.resolveByType(injectionPoint.getType(), bindings).iterator().next();
Bean<?> resolvedBean = manager.resolveByType(injectionPoint.getRawType(), bindings).iterator().next();
if (MetaDataCache.instance().getScopeModel(this.getScopeType()).isPassivating())
{
if (Dependent.class.equals(resolvedBean.getScopeType()) && !resolvedBean.isSerializable() && (((injectionPoint instanceof AnnotatedField) && !((AnnotatedField<?>) injectionPoint).isTransient()) || (injectionPoint instanceof AnnotatedParameter)) )
Expand Down Expand Up @@ -314,7 +314,7 @@ protected void checkDeploymentType()
{
throw new DefinitionException("type: " + getType() + " must specify a deployment type");
}
else if (deploymentType.equals(Standard.class) && !STANDARD_WEB_BEAN_CLASSES.contains(getAnnotatedItem().getType()))
else if (deploymentType.equals(Standard.class) && !STANDARD_WEB_BEAN_CLASSES.contains(getAnnotatedItem().getRawType()))
{
throw new DefinitionException(getAnnotatedItem().getName() + " cannot have deployment type @Standard");
}
Expand Down
Expand Up @@ -121,7 +121,7 @@ protected void callInitializers(T instance, CreationalContext<T> creationalConte
protected void initType()
{
log.trace("Bean type specified in Java");
this.type = getAnnotatedItem().getType();
this.type = getAnnotatedItem().getRawType();
}

/**
Expand Down Expand Up @@ -270,7 +270,7 @@ protected void checkBeanImplementation()
protected void preSpecialize()
{
super.preSpecialize();
if (getAnnotatedItem().getSuperclass() == null || getAnnotatedItem().getSuperclass().getType().equals(Object.class))
if (getAnnotatedItem().getSuperclass() == null || getAnnotatedItem().getSuperclass().getRawType().equals(Object.class))
{
throw new DefinitionException("Specializing bean must extend another bean " + toString());
}
Expand Down
Expand Up @@ -62,7 +62,7 @@ public AbstractFacadeBean(AnnotatedItem<T, S> field, ManagerImpl manager)
@SuppressWarnings("unchecked")
protected Class<P> getTypeParameter()
{
return (Class<P>) annotatedItem.getType().getTypeParameters()[0].getClass();
return (Class<P>) annotatedItem.getActualTypeArguments()[0].getClass();
}

/**
Expand Down Expand Up @@ -121,7 +121,7 @@ protected void initType()
{
if (getAnnotatedItem() != null)
{
this.type = getAnnotatedItem().getType();
this.type = getAnnotatedItem().getRawType();
}
}
catch (ClassCastException e)
Expand Down
Expand Up @@ -120,11 +120,11 @@ protected void initType()
{
try
{
this.type = getAnnotatedItem().getType();
this.type = getAnnotatedItem().getRawType();
}
catch (ClassCastException e)
{
throw new RuntimeException(" Cannot cast producer type " + getAnnotatedItem().getType() + " to bean type " + (getDeclaredBeanType() == null ? " unknown " : getDeclaredBeanType()), e);
throw new RuntimeException(" Cannot cast producer type " + getAnnotatedItem().getRawType() + " to bean type " + (getDeclaredBeanType() == null ? " unknown " : getDeclaredBeanType()), e);
}
}

Expand Down
Expand Up @@ -189,7 +189,7 @@ protected void checkScopeAllowed()
protected void preSpecialize()
{
super.preSpecialize();
if (!manager.getEjbDescriptorCache().containsKey(getAnnotatedItem().getSuperclass().getType()))
if (!manager.getEjbDescriptorCache().containsKey(getAnnotatedItem().getSuperclass().getRawType()))
{
throw new DefinitionException("Annotation defined specializing EJB must have EJB superclass");
}
Expand Down
2 changes: 1 addition & 1 deletion impl/src/main/java/org/jboss/webbeans/bean/EventBean.java
Expand Up @@ -88,7 +88,7 @@ protected void init()
*/
private void validateInjectionPoint()
{
if (!this.getAnnotatedItem().getType().equals(Event.class))
if (!this.getAnnotatedItem().getRawType().equals(Event.class))
{
throw new DefinitionException("Event field/parameter is not of type Event<T>: " + this.getAnnotatedItem());
}
Expand Down
4 changes: 2 additions & 2 deletions impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
Expand Up @@ -365,7 +365,7 @@ protected void checkBeanImplementation()
protected void preSpecialize()
{
super.preSpecialize();
if (manager.getEjbDescriptorCache().containsKey(getAnnotatedItem().getSuperclass().getType()))
if (manager.getEjbDescriptorCache().containsKey(getAnnotatedItem().getSuperclass().getRawType()))
{
throw new DefinitionException("Simple bean must specialize a simple bean");
}
Expand Down Expand Up @@ -458,7 +458,7 @@ else if (preDestroyMethods.size() == 1)
protected void initType()
{
log.trace("Bean type specified in Java");
this.type = getAnnotatedItem().getType();
this.type = getAnnotatedItem().getRawType();
}

/**
Expand Down
Expand Up @@ -84,7 +84,7 @@ public void deploy()
{
for (AnnotatedClass<?> clazz : deferredClasses)
{
if (manager.getEjbDescriptorCache().containsKey(clazz.getType()))
if (manager.getEjbDescriptorCache().containsKey(clazz.getRawType()))
{
createEnterpriseBean(clazz);
}
Expand Down
5 changes: 2 additions & 3 deletions impl/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
Expand Up @@ -40,7 +40,6 @@
import org.jboss.webbeans.injection.MethodInjectionPoint;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.util.Reflections;

/**
* <p>
Expand Down Expand Up @@ -79,7 +78,7 @@ protected ObserverImpl(final AnnotatedMethod<?> observer, final Bean<?> observer
checkObserverMethod();

@SuppressWarnings("unchecked")
Class<T> c = (Class<T>) observerMethod.getAnnotatedParameters(Observes.class).get(0).getType();
Class<T> c = (Class<T>) observerMethod.getAnnotatedParameters(Observes.class).get(0).getRawType();
this.eventType = c;

this.bindings = observerMethod.getAnnotatedParameters(Observes.class).get(0).getBindingsAsArray();
Expand Down Expand Up @@ -114,7 +113,7 @@ private void checkObserverMethod()
if (eventObjects.size() > 0)
{
AnnotatedParameter<?> eventParam = eventObjects.iterator().next();
if (Reflections.isParameterizedType(eventParam.getType()))
if (eventParam.isParameterizedType())
{
throw new DefinitionException(this + " cannot observe parameterized event types");
}
Expand Down
Expand Up @@ -21,6 +21,7 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Type;
import java.util.AbstractList;
import java.util.Iterator;
import java.util.List;
Expand Down Expand Up @@ -173,5 +174,10 @@ protected Object[] getParameterValues(List<ParameterInjectionPoint<?>> parameter
}
return parameterValues;
}

public Type getType()
{
return getRawType();
}

}
Expand Up @@ -93,10 +93,16 @@ public String getName()
throw new UnsupportedOperationException();
}

public Class<T> getType()
public Class<T> getRawType()
{
return rawType;
}

@Override
public Type getType()
{
return getRawType();
}

public boolean isFinal()
{
Expand Down
Expand Up @@ -129,9 +129,9 @@ public interface AnnotatedItem<T, S>
*
* @return The type of the element
*/
public Class<T> getType();
public Class<T> getRawType();

public Type getUnderlyingType();
public Type getType();

/**
* Extends Java Class assignability such that actual type parameters are also
Expand Down Expand Up @@ -199,5 +199,7 @@ public interface AnnotatedItem<T, S>
public String getName();

public AnnotationStore getAnnotationStore();

public boolean isParameterizedType();

}
Expand Up @@ -114,14 +114,14 @@ public String getName()
/**
* @see org.jboss.webbeans.introspector.AnnotatedItem
*/
public Class<T> getType()
public Class<T> getRawType()
{
return delegate().getType();
return delegate().getRawType();
}

public Type getUnderlyingType()
public Type getType()
{
return delegate().getUnderlyingType();
return delegate().getType();
}

/**
Expand Down Expand Up @@ -223,5 +223,10 @@ public Set<? extends Type> getFlattenedTypeHierarchy()
{
return delegate().getFlattenedTypeHierarchy();
}

public boolean isParameterizedType()
{
return delegate().isParameterizedType();
}

}
Expand Up @@ -53,17 +53,18 @@ interface WrappableAnnotatedItem<T, S> extends AnnotatedItem<T, S>

}

public Type getUnderlyingType()
public Type getType()
{
return getType();
return getRawType();
}

// Cached string representation
private String toString;
private final AnnotationStore annotationStore;
private final Class<T> type;
private final Class<T> rawType;
private final Set<? extends Type> flattenedTypes;
private final boolean proxyable;
private final boolean _parameterizedType;

/**
* Constructor
Expand All @@ -74,18 +75,20 @@ public Type getUnderlyingType()
* @param annotationMap A map of annotation to register
*
*/
public AbstractAnnotatedItem(AnnotationStore annotatedItemHelper, Class<T> type)
public AbstractAnnotatedItem(AnnotationStore annotatedItemHelper, Class<T> rawType)
{
this.annotationStore = annotatedItemHelper;
this.type = type;
this.flattenedTypes = new Reflections.HierarchyDiscovery<Type>(type).getFlattenedTypes();
this.rawType = rawType;
this._parameterizedType = Reflections.isParameterizedType(rawType);
this.flattenedTypes = new Reflections.HierarchyDiscovery<Type>(rawType).getFlattenedTypes();
this.proxyable = Proxies.isTypesProxyable(flattenedTypes);
}

public AbstractAnnotatedItem(AnnotationStore annotatedItemHelper)
{
this.annotationStore = annotatedItemHelper;
this.type = null;
this.rawType = null;
this._parameterizedType = false;
this.flattenedTypes = null;
this.proxyable = false;
}
Expand Down Expand Up @@ -145,7 +148,7 @@ public boolean equals(Object other)
if (other instanceof AnnotatedItem)
{
AnnotatedItem<?, ?> that = (AnnotatedItem<?, ?>) other;
return this.getAnnotationsAsSet().equals(that.getAnnotationsAsSet()) && this.getType().equals(that.getType());
return this.getAnnotationsAsSet().equals(that.getAnnotationsAsSet()) && this.getRawType().equals(that.getRawType());
}
return false;
}
Expand All @@ -161,7 +164,7 @@ public boolean equals(Object other)
*/
public boolean isAssignableFrom(AnnotatedItem<?, ?> that)
{
return isAssignableFrom(that.getType(), that.getActualTypeArguments());
return isAssignableFrom(that.getRawType(), that.getActualTypeArguments());
}

/**
Expand Down Expand Up @@ -208,7 +211,7 @@ else if (type instanceof ParameterizedType)
*/
private boolean isAssignableFrom(Class<?> type, Type[] actualTypeArguments)
{
return Types.boxedType(getType()).isAssignableFrom(Types.boxedType(type)) && Arrays.equals(getActualTypeArguments(), actualTypeArguments);
return Types.boxedType(getRawType()).isAssignableFrom(Types.boxedType(type)) && Arrays.equals(getActualTypeArguments(), actualTypeArguments);
}

/**
Expand All @@ -219,7 +222,7 @@ private boolean isAssignableFrom(Class<?> type, Type[] actualTypeArguments)
@Override
public int hashCode()
{
return getType().hashCode();
return getRawType().hashCode();
}

/**
Expand Down Expand Up @@ -272,9 +275,9 @@ public boolean isProxyable()
return proxyable;
}

public Class<T> getType()
public Class<T> getRawType()
{
return type;
return rawType;
}

public Set<? extends Type> getFlattenedTypeHierarchy()
Expand All @@ -288,5 +291,10 @@ public boolean isDeclaredAnnotationPresent(Class<? extends Annotation> annotatio
{
return getAnnotationStore().isDeclaredAnnotationPresent(annotationType);
}

public boolean isParameterizedType()
{
return _parameterizedType;
}

}
Expand Up @@ -159,7 +159,7 @@ public boolean isPublic()
*/
public T getValue(Manager manager)
{
return manager.getInstanceByType(getType(), getMetaAnnotationsAsArray(BindingType.class));
return manager.getInstanceByType(getRawType(), getMetaAnnotationsAsArray(BindingType.class));
}

/**
Expand Down
Expand Up @@ -255,7 +255,6 @@ public String toString()
private String toString;

private final boolean _nonStaticMemberClass;
private final boolean _parameterizedType;
private final boolean _abstract;


Expand Down Expand Up @@ -284,7 +283,6 @@ private AnnotatedClassImpl(Class<T> rawType, Type type, Annotation[] annotations
this.declaredAnnotatedFields = new AnnotatedFieldMap();
this.declaredMetaAnnotatedFields = new AnnotatedFieldMap();
this._nonStaticMemberClass = Reflections.isNonMemberInnerClass(rawType);
this._parameterizedType = Reflections.isParameterizedType(rawType);
this._abstract = Reflections.isAbstract(rawType);
for (Class<?> c = clazz; c != Object.class && c != null; c = c.getSuperclass())
{
Expand Down Expand Up @@ -481,11 +479,6 @@ public boolean isNonStaticMemberClass()
return _nonStaticMemberClass;
}

public boolean isParameterizedType()
{
return _parameterizedType;
}

public boolean isAbstract()
{
return _abstract;
Expand Down Expand Up @@ -613,9 +606,4 @@ public String toString()
return toString;
}

public AnnotatedClass<T> wrap(Set<Annotation> annotations)
{
throw new UnsupportedOperationException();
}

}

0 comments on commit 3ef0eb2

Please sign in to comment.