Skip to content

Commit

Permalink
javadocs/comments/toStrings
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@373 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
nickarls committed Nov 27, 2008
1 parent 4aa0cb8 commit 9980a42
Show file tree
Hide file tree
Showing 9 changed files with 657 additions and 72 deletions.
Expand Up @@ -21,7 +21,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import javax.webbeans.manager.Context;

Expand Down
Expand Up @@ -30,7 +30,7 @@ public interface AnnotatedParameter<T> extends AnnotatedItem<T, Object>
{

/**
* Gets the value of the parameter
* Gets the actual value of the parameter from the manager
*
* @param manager The Web Beans Manager
* @return The value
Expand Down
Expand Up @@ -73,6 +73,24 @@ protected Map<Class<? extends Annotation>, Annotation> delegate()
return delegate;
}

/**
* Gets a string representation of the Map
*
* @return A string representation
*/
@Override
public String toString()
{
StringBuffer buffer = new StringBuffer();
buffer.append("Annotation type -> annotation mappings: " + super.size() + "\n");
int i = 0;
for (Entry<Class<? extends Annotation>, Annotation> entry : delegate.entrySet())
{
buffer.append(++i + " - " + entry.getKey().toString() + ": " + entry.getValue().toString() + "\n");
}
return buffer.toString();
}

}

/**
Expand Down Expand Up @@ -118,6 +136,27 @@ public Set<Annotation> get(Object key)
return annotations;
}

/**
* Gets a string representation of the Map
*
* @return A string representation
*/
@Override
public String toString()
{
StringBuffer buffer = new StringBuffer();
buffer.append("Annotation type -> meta annotation mappings: " + super.size() + "\n");
int i = 0;
for (Entry<Class<? extends Annotation>, Set<Annotation>> entry : delegate.entrySet())
{
for (Annotation annotation : entry.getValue())
{
buffer.append(++i + " - " + entry.getKey().toString() + ": " + annotation.toString() + "\n");
}
}
return buffer.toString();
}

}

// The array of default binding types
Expand All @@ -131,7 +170,8 @@ public Set<Annotation> get(Object key)

// The annotation map (annotation type -> annotation) of the item
private AnnotationMap annotationMap;
// The meta-annotation map (annotation type -> set of annotations containing meta-annotation) of the item
// The meta-annotation map (annotation type -> set of annotations containing
// meta-annotation) of the item
private MetaAnnotationMap metaAnnotationMap;
// The set of all annotations on the item
private Set<Annotation> annotationSet;
Expand Down Expand Up @@ -234,6 +274,8 @@ protected static Object[] getParameterValues(List<AnnotatedParameter<Object>> pa
*
* @param annotationType the annotation type to match
* @return The annotation if found, null if no match was found
*
* @see org.jboss.webbeans.introspector.AnnotatedItem#getAnnotation(Class)
*/
@SuppressWarnings("unchecked")
public <A extends Annotation> A getAnnotation(Class<? extends A> annotationType)
Expand All @@ -247,6 +289,8 @@ public <A extends Annotation> A getAnnotation(Class<? extends A> annotationType)
* @param metaAnnotationType The meta-annotation type to match
* @return The set of annotations containing this meta-annotation. An empty
* set is returned if no match is found.
*
* @see org.jboss.webbeans.introspector.AnnotatedItem#getMetaAnnotations(Class)
*/
public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
{
Expand All @@ -262,6 +306,8 @@ public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnota
* @param metaAnnotationType meta-annotation type to match
* @return The array of annotations to match. An empty array is returned if
* no match is found.
*
* @see org.jboss.webbeans.introspector.AnnotatedItem#getMetaAnnotationsAsArray(Class)
*/
public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation> metaAnnotationType)
{
Expand All @@ -279,6 +325,8 @@ public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation> metaAn
* Populates the annotationSet if it was empty
*
* @return The set of annotations on this item.
*
* @see org.jboss.webbeans.introspector.AnnotatedItem#getAnnotations()
*/
public Set<Annotation> getAnnotations()
{
Expand All @@ -295,6 +343,8 @@ public Set<Annotation> getAnnotations()
*
* @param annotatedType The annotation type to check for
* @return True if present, false otherwise.
*
* @see org.jboss.webbeans.introspector.AnnotatedItem#isAnnotationPresent(Class)
*/
public boolean isAnnotationPresent(Class<? extends Annotation> annotatedType)
{
Expand Down Expand Up @@ -334,6 +384,8 @@ public boolean equals(Object other)
*
* @param that The other annotated item to check against
* @return True if assignable, false otherwise
*
* @see org.jboss.webbeans.introspector.AnnotatedItem#isAssignableFrom(AnnotatedItem)
*/
public boolean isAssignableFrom(AnnotatedItem<?, ?> that)
{
Expand All @@ -345,6 +397,8 @@ public boolean isAssignableFrom(AnnotatedItem<?, ?> that)
*
* @param types The set of types to check against
* @return True if assignable, false otherwise
*
* @see org.jboss.webbeans.introspector.AnnotatedItem#isAssignableFrom(Set)
*/
public boolean isAssignableFrom(Set<Class<?>> types)
{
Expand Down Expand Up @@ -389,22 +443,17 @@ public int hashCode()
@Override
public String toString()
{
String string = getType().toString();
if (getActualTypeArguments().length > 0)
StringBuffer buffer = new StringBuffer();
buffer.append("AbstractAnnotatedItem:\n");
buffer.append("Annotations: " + getAnnotations().size() + "\n");
int i = 0;
for (Annotation annotation : getAnnotations())
{
string += "<";
for (int i = 0; i < getActualTypeArguments().length; i++)
{
string += getActualTypeArguments()[i].toString();
if (i < getActualTypeArguments().length - 1)
{
string += ",";
}
}
string += ">";
buffer.append(++i + " - " + annotation.toString() + "\n");
}
string += getAnnotations();
return string;
buffer.append(annotationMap == null ? "" : (annotationMap.toString() + "\n"));
buffer.append(metaAnnotationMap == null ? "" : (metaAnnotationMap.toString()) + "\n");
return buffer.toString();
}

/**
Expand All @@ -414,6 +463,8 @@ public String toString()
* meta-annotation. Returns default binding (current) if none specified.
*
* @return A set of (binding type) annotations
*
* @see org.jboss.webbeans.introspector.AnnotatedItem#getBindingTypes()
*/
public Set<Annotation> getBindingTypes()
{
Expand All @@ -434,6 +485,8 @@ public Set<Annotation> getBindingTypes()
* meta-annotation. Returns default binding (current) if none specified.
*
* @return An array of (binding type) annotations
*
* @see org.jboss.webbeans.introspector.AnnotatedItem#getBindingTypesAsArray()
*/
public Annotation[] getBindingTypesAsArray()
{
Expand All @@ -451,6 +504,8 @@ public Annotation[] getBindingTypesAsArray()
* Indicates if the type is proxyable to a set of pre-defined rules
*
* @return True if proxyable, false otherwise.
*
* @see org.jboss.webbeans.introspector.AnnotatedItem#isProxyable()
*/
public boolean isProxyable()
{
Expand Down
Expand Up @@ -51,6 +51,8 @@ public AbstractAnnotatedMember(AnnotationMap annotationMap)
* Indicates if the member is static (through the delegate)
*
* @return True if static, false otherwise
*
* @see org.jboss.webbeans.introspector.AnnotatedItem#isStatic()
*/
public boolean isStatic()
{
Expand All @@ -61,6 +63,8 @@ public boolean isStatic()
* Indicates if the member if final (through the delegate)
*
* @return True if final, false otherwise
*
* @see org.jboss.webbeans.introspector.AnnotatedItem#isFinal()
*/
public boolean isFinal()
{
Expand All @@ -82,6 +86,8 @@ public T getValue(ManagerImpl manager)
* Gets the name of the member
*
* @returns The name (or the name of the delegate if none is defined)
*
* @see org.jboss.webbeans.introspector.AnnotatedItem#getName()
*/
public String getName()
{
Expand All @@ -92,4 +98,21 @@ public String getName()
return name;
}

/**
* Gets a string representation of the member
*
* @return A string representation
*/
public String toString()
{
StringBuffer buffer = new StringBuffer();
buffer.append("AbstractAnnotatedMember:\n");
buffer.append(super.toString() + "\n");
buffer.append("Final: " + isFinal() + "\n");
buffer.append("Static: " + isStatic() + "\n");
buffer.append("Name: " + getName() + "\n");
return buffer.toString();
}


}
Expand Up @@ -321,5 +321,17 @@ public AnnotatedType<T> getDeclaringClass()
{
return declaringClass;
}

/**
* Gets a string representation of the constructor
*
* @return A string representation
*/
public String toString()
{
StringBuffer buffer = new StringBuffer();
return buffer.toString();
}


}

0 comments on commit 9980a42

Please sign in to comment.