Author: nickarls
Date: 2008-11-28 02:37:21 -0500 (Fri, 28 Nov 2008)
New Revision: 374
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
Log:
javadocs/comments/toStrings
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-11-27
22:49:18 UTC (rev 373)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-11-28
07:37:21 UTC (rev 374)
@@ -257,6 +257,7 @@
* @param parameters The list of annotated parameter to look up
* @param manager The Web Beans manager
* @return The object array of looked up values
+ *
*/
protected static Object[]
getParameterValues(List<AnnotatedParameter<Object>> parameters, ManagerImpl
manager)
{
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java 2008-11-27
22:49:18 UTC (rev 373)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java 2008-11-28
07:37:21 UTC (rev 374)
@@ -24,7 +24,7 @@
* Represents an abstract annotated type
*
* @author Pete Muir
- *
+ *
* @param <T>
*/
public abstract class AbstractAnnotatedType<T> extends AbstractAnnotatedItem<T,
Class<T>>
@@ -41,40 +41,46 @@
{
super(annotationMap);
}
-
+
/**
* Indicates if the type is static (through the delegate)
*
* @return True if static, false otherwise
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedItem#isStatic()
*/
public boolean isStatic()
{
return Reflections.isStatic(getDelegate());
}
-
+
/**
* Indicates if the type if final (through the delegate)
*
* @return True if final, false otherwise
- */
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedItem#isFinal()
+ */
public boolean isFinal()
{
return Reflections.isFinal(getDelegate());
}
-
+
/**
* Gets the name of the type
*
* @returns The name (through the delegate)
- */
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedItem#getName()
+ */
public String getName()
{
return getDelegate().getName();
}
-
+
/**
* Gets the superclass abstraction of the type
- *
+ *
* @return The superclass abstraction
*/
@SuppressWarnings("unchecked")
@@ -87,5 +93,22 @@
}
return superclass;
}
-
+
+ /**
+ * Gets a string representation of the annotated type
+ *
+ * @return A string representation
+ */
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("AbstractAnnotatedType:\n");
+ buffer.append(super.toString() + "\n");
+ buffer.append("Superclass: " + superclass.toString() + "\n");
+ buffer.append("Name: " + getName() + "\n");
+ buffer.append("Final: " + isFinal() + "\n");
+ buffer.append("Static: " + isStatic() + "\n");
+ return buffer.toString();
+ }
+
}
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java 2008-11-27
22:49:18 UTC (rev 373)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java 2008-11-28
07:37:21 UTC (rev 374)
@@ -28,6 +28,8 @@
import org.jboss.webbeans.introspector.AnnotatedAnnotation;
import org.jboss.webbeans.introspector.AnnotatedMethod;
+import com.google.common.collect.ForwardingMap;
+
/**
* Represents an annotated annotation
*
@@ -37,8 +39,44 @@
*/
public class AnnotatedAnnotationImpl<T extends Annotation> extends
AbstractAnnotatedType<T> implements AnnotatedAnnotation<T>
{
+
+ /**
+ * A (annotation type -> set of method abstractions with annotation) map
+ */
+ private class AnnotatedMembers extends ForwardingMap<Class<? extends
Annotation>, Set<AnnotatedMethod<?>>>
+ {
+ private Map<Class<? extends Annotation>,
Set<AnnotatedMethod<?>>> delegate;
+
+ public AnnotatedMembers()
+ {
+ delegate = new HashMap<Class<? extends Annotation>,
Set<AnnotatedMethod<?>>>();
+ }
+
+ @Override
+ protected Map<Class<? extends Annotation>,
Set<AnnotatedMethod<?>>> delegate()
+ {
+ return delegate;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Annotation type -> member abstraction mappings: " +
super.size() + "\n");
+ int i = 0;
+ for (Entry<Class<? extends Annotation>,
Set<AnnotatedMethod<?>>> entry : delegate.entrySet())
+ {
+ for (AnnotatedMethod<?> parameter : entry.getValue())
+ {
+ buffer.append(++i + " - " + entry.getKey().toString() + ":
" + parameter.toString() + "\n");
+ }
+ }
+ return buffer.toString();
+ }
+ }
+
// The annotated members map (annotation -> member with annotation)
- private Map<Class<? extends Annotation>,
Set<AnnotatedMethod<?>>> annotatedMembers;
+ private AnnotatedMembers annotatedMembers;
// The implementation class of the annotation
private Class<T> clazz;
// The set of abstracted members
@@ -61,6 +99,8 @@
* Gets the actual type arguments
*
* @return The type arguments
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedAnnotation#getActualTypeArguments()
*/
public Type[] getActualTypeArguments()
{
@@ -73,6 +113,8 @@
* Initializes the members first if they are null
*
* @return The set of abstracted members
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedAnnotation#getMembers()
*/
public Set<AnnotatedMethod<?>> getMembers()
{
@@ -87,6 +129,8 @@
* Gets the delegate
*
* @return The delegate
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedAnnotation#getDelegate()
*/
public Class<T> getDelegate()
{
@@ -95,6 +139,8 @@
/**
* Gets the type of the annotation
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedAnnotation#getType()
*/
public Class<T> getType()
{
@@ -124,6 +170,8 @@
* @param annotationType The annotation type to match
* @return The set of abstracted members with the given annotation type
* present. An empty set is returned if no matches are found
+ *
+ * @see
org.jboss.webbeans.introspector.AnnotatedAnnotation#getAnnotatedMembers(Class)
*/
public Set<AnnotatedMethod<?>> getAnnotatedMembers(Class<? extends
Annotation> annotationType)
{
@@ -157,7 +205,7 @@
{
initMembers();
}
- annotatedMembers = new HashMap<Class<? extends Annotation>,
Set<AnnotatedMethod<?>>>();
+ annotatedMembers = new AnnotatedMembers();
for (AnnotatedMethod<?> member : members)
{
for (Annotation annotation : member.getAnnotations())
@@ -171,4 +219,26 @@
}
}
+ /**
+ * Gets a string representation of the constructor
+ *
+ * @return A string representation
+ */
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("AnnotatedConstructorImpl:\n");
+ buffer.append(super.toString() + "\n");
+ buffer.append("Class: " + clazz.toString() + "\n");
+
+ buffer.append("Members: " + getMembers().size() + "\n");
+ int i = 0;
+ for (AnnotatedMethod<?> member : getMembers())
+ {
+ buffer.append(++i + " - " + member.toString());
+ }
+ buffer.append(annotatedMembers == null ? "" :
(annotatedMembers.toString() + "\n"));
+ return buffer.toString();
+ }
+
}
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2008-11-27
22:49:18 UTC (rev 373)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2008-11-28
07:37:21 UTC (rev 374)
@@ -65,6 +65,23 @@
{
return delegate;
}
+
+ @Override
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Annotation type -> field abstraction mappings: " +
super.size() + "\n");
+ int i = 0;
+ for (Entry<Class<? extends Annotation>,
Set<AnnotatedField<Object>>> entry : delegate.entrySet())
+ {
+ for (AnnotatedField<Object> parameter : entry.getValue())
+ {
+ buffer.append(++i + " - " + entry.getKey().toString() + ":
" + parameter.toString() + "\n");
+ }
+ }
+ return buffer.toString();
+ }
+
}
/**
@@ -84,11 +101,27 @@
{
return delegate;
}
+
+ @Override
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Meta-annotation type -> method abstraction mappings:
" + super.size() + "\n");
+ int i = 0;
+ for (Entry<Class<? extends Annotation>,
Set<AnnotatedField<Object>>> entry : delegate.entrySet())
+ {
+ for (AnnotatedField<Object> parameter : entry.getValue())
+ {
+ buffer.append(++i + " - " + entry.getKey().toString() + ":
" + parameter.toString() + "\n");
+ }
+ }
+ return buffer.toString();
+ }
}
/**
* A (annotation type -> set of method abstractions with annotation) map
- */
+ */
private class AnnotatedMethods extends ForwardingMap<Class<? extends
Annotation>, Set<AnnotatedMethod<Object>>>
{
private Map<Class<? extends Annotation>,
Set<AnnotatedMethod<Object>>> delegate;
@@ -103,6 +136,22 @@
{
return delegate;
}
+
+ @Override
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Annotation type -> method abstraction mappings: " +
super.size() + "\n");
+ int i = 0;
+ for (Entry<Class<? extends Annotation>,
Set<AnnotatedMethod<Object>>> entry : delegate.entrySet())
+ {
+ for (AnnotatedMethod<Object> parameter : entry.getValue())
+ {
+ buffer.append(++i + " - " + entry.getKey().toString() + ":
" + parameter.toString() + "\n");
+ }
+ }
+ return buffer.toString();
+ }
}
/**
@@ -122,10 +171,27 @@
{
return delegate;
}
+
+ @Override
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Annotation type -> constructor abstraction mappings:
" + super.size() + "\n");
+ int i = 0;
+ for (Entry<Class<? extends Annotation>,
Set<AnnotatedConstructor<T>>> entry : delegate.entrySet())
+ {
+ for (AnnotatedConstructor<T> parameter : entry.getValue())
+ {
+ buffer.append(++i + " - " + entry.getKey().toString() + ":
" + parameter.toString() + "\n");
+ }
+ }
+ return buffer.toString();
+ }
}
/**
- * A (class list -> set of constructor abstractions with matching parameters) map
+ * A (class list -> set of constructor abstractions with matching parameters)
+ * map
*/
private class ConstructorsByArgument extends
ForwardingMap<List<Class<?>>, AnnotatedConstructor<T>>
{
@@ -141,6 +207,19 @@
{
return delegate;
}
+
+ @Override
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Annotation type -> constructor by arguments mappings:
" + super.size() + "\n");
+ int i = 0;
+ for (Entry<List<Class<?>>, AnnotatedConstructor<T>>
entry : delegate.entrySet())
+ {
+ buffer.append(++i + " - " + entry.getKey().toString() + ":
" + entry.getValue().toString() + "\n");
+ }
+ return buffer.toString();
+ }
}
// The implementing class
@@ -389,6 +468,8 @@
* Gets the actual type arguments
*
* @return The type arguments
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedClass#getActualTypeArguments()
*/
public Type[] getActualTypeArguments()
{
@@ -425,6 +506,8 @@
* @param annotationType The annotation type to match
* @return A set of matching method abstractions. Returns an empty set if no
* matches are found.
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedClass#getAnnotatedMethods(Class)
*/
public Set<AnnotatedMethod<Object>> getAnnotatedMethods(Class<? extends
Annotation> annotationType)
{
@@ -501,6 +584,8 @@
* @return A set of abstracted constructors with given annotation type. If
* the constructors set is empty, initialize it first .Returns an
* empty set if there are no matches.
+ *
+ * @see
org.jboss.webbeans.introspector.AnnotatedClass#getAnnotatedConstructors(Class)
*/
public Set<AnnotatedConstructor<T>> getAnnotatedConstructors(Class<?
extends Annotation> annotationType)
{
@@ -546,9 +631,61 @@
}
}
+ /**
+ * Gets a constructor with given arguments
+ *
+ * @param arguments The arguments to match
+ * @return A constructor which takes given arguments. Null is returned if
+ * there are no matches.
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedClass#getConstructor(List)
+ */
public AnnotatedConstructor<T> getConstructor(List<Class<?>>
arguments)
{
return constructorsByArgumentMap.get(arguments);
}
+ /**
+ * Gets a string representation of the constructor
+ *
+ * @return A string representation
+ */
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("AnnotatedConstructorImpl:\n");
+ buffer.append(super.toString() + "\n");
+ buffer.append("Actual type arguments: " + actualTypeArguments.length +
"\n");
+ int i = 0;
+ for (Type actualTypeArgument : actualTypeArguments)
+ {
+ buffer.append(++i + " - " + actualTypeArgument.toString());
+ }
+ buffer.append("Class: " + clazz.toString() + "\n");
+ buffer.append("Fields: " + getFields().size() + "\n");
+ i = 0;
+ for (AnnotatedField<Object> field : getFields())
+ {
+ buffer.append(++i + " - " + field.toString());
+ }
+ buffer.append("Methods: " + methods.size() + "\n");
+ i = 0;
+ for (AnnotatedMethod<Object> method : methods)
+ {
+ buffer.append(++i + " - " + method.toString());
+ }
+ buffer.append("Constructors: " + methods.size() + "\n");
+ i = 0;
+ for (AnnotatedConstructor<T> constructor : getConstructors())
+ {
+ buffer.append(++i + " - " + constructor.toString());
+ }
+ buffer.append(annotatedConstructors == null ? "" :
(annotatedConstructors.toString() + "\n"));
+ buffer.append(annotatedFields == null ? "" : (annotatedFields.toString()
+ "\n"));
+ buffer.append(annotatedMethods == null ? "" :
(annotatedMethods.toString() + "\n"));
+ buffer.append(constructorsByArgumentMap == null ? "" :
(constructorsByArgumentMap.toString() + "\n"));
+ buffer.append(metaAnnotatedFields == null ? "" :
(metaAnnotatedFields.toString() + "\n"));
+ return buffer.toString();
+ }
+
}
\ No newline at end of file
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2008-11-27
22:49:18 UTC (rev 373)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2008-11-28
07:37:21 UTC (rev 374)
@@ -46,7 +46,7 @@
{
/**
- * An annotation type -> list of annotations map
+ * An annotation type -> list of annotations map
*/
private class AnnotatedParameters extends ForwardingMap<Class<? extends
Annotation>, List<AnnotatedParameter<Object>>>
{
@@ -62,6 +62,22 @@
{
return delegate;
}
+
+ @Override
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Annotation type -> parameter abstraction mappings: "
+ super.size() + "\n");
+ int i = 0;
+ for (Entry<Class<? extends Annotation>,
List<AnnotatedParameter<Object>>> entry : delegate.entrySet())
+ {
+ for (AnnotatedParameter<?> parameter : entry.getValue())
+ {
+ buffer.append(++i + " - " + entry.getKey().toString() + ":
" + parameter.toString() + "\n");
+ }
+ }
+ return buffer.toString();
+ }
}
// The type arguments
@@ -126,6 +142,8 @@
* Gets the actual type arguments
*
* @return The type arguments
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedConstructor#getActualTypeArguments()
*/
public Type[] getActualTypeArguments()
{
@@ -138,6 +156,8 @@
* If the parameters are null, initalize them first
*
* @return A list of annotated parameter abstractions
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedConstructor#getParameters()
*/
public List<AnnotatedParameter<Object>> getParameters()
{
@@ -236,6 +256,8 @@
* @param annotationType The annotation type to match
* @return A list of matching parameter abstractions. An empty list is
* returned if there are no matches.
+ *
+ * @see
org.jboss.webbeans.introspector.AnnotatedConstructor#getAnnotatedParameters(Class)
*/
public List<AnnotatedParameter<Object>> getAnnotatedParameters(Class<?
extends Annotation> annotationType)
{
@@ -255,6 +277,8 @@
*
* @param manager The Web Beans manager
* @return An instance
+ *
+ * @see org.jboss.webbeans.introspector.AnnotatedConstructor#newInstance(ManagerImpl)
*/
public T newInstance(ManagerImpl manager)
{
@@ -321,7 +345,7 @@
{
return declaringClass;
}
-
+
/**
* Gets a string representation of the constructor
*
@@ -330,8 +354,26 @@
public String toString()
{
StringBuffer buffer = new StringBuffer();
+ buffer.append("AnnotatedConstructorImpl:\n");
+ buffer.append(super.toString() + "\n");
+ buffer.append("Actual type arguments: " + actualTypeArguments.length +
"\n");
+ int i = 0;
+ for (Type actualTypeArgument : actualTypeArguments)
+ {
+ buffer.append(++i + " - " + actualTypeArgument.toString());
+ }
+ buffer.append("Declaring class:\n");
+ buffer.append(declaringClass.toString() + "\n");
+ buffer.append("Constructor:\n");
+ buffer.append(constructor.toString() + "\n");
+ buffer.append("Parameters: " + getParameters().size() + "\n");
+ i = 0;
+ for (AnnotatedParameter<?> parameter : getParameters())
+ {
+ buffer.append(++i + " - " + parameter.toString());
+ }
+ buffer.append(annotatedParameters.toString() + "\n");
return buffer.toString();
}
-
}
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2008-11-27
22:49:18 UTC (rev 373)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2008-11-28
07:37:21 UTC (rev 374)
@@ -31,6 +31,7 @@
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.util.Reflections;
+import org.jboss.webbeans.util.Strings;
import com.google.common.collect.ForwardingMap;
@@ -66,7 +67,7 @@
public String toString()
{
StringBuffer buffer = new StringBuffer();
- buffer.append("Annotation -> parameter mappings: " + super.size() +
"\n");
+ buffer.append("Annotation type -> parameter abstraction mappings: "
+ super.size() + "\n");
int i = 0;
for (Entry<Class<? extends Annotation>,
List<AnnotatedParameter<Object>>> entry : delegate.entrySet())
{
@@ -152,7 +153,7 @@
*
* @return The actual type arguments
*
- * @see org.jboss.webbeans.introspector.AnnotatedItem#getActualTypeArguments()
+ * @see org.jboss.webbeans.introspector.AnnotatedMethod#getActualTypeArguments()
*/
public Type[] getActualTypeArguments()
{