Author: shane.bryzak(a)jboss.com
Date: 2010-06-01 08:01:55 -0400 (Tue, 01 Jun 2010)
New Revision: 6368
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/TypedBeanProperty.java
Log:
minor
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java
===================================================================
---
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java 2010-06-01
11:51:42 UTC (rev 6367)
+++
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/AnnotatedBeanProperty.java 2010-06-01
12:01:55 UTC (rev 6368)
@@ -21,7 +21,7 @@
boolean matches(Annotation annotation);
}
- public static class DefaultAnnotationMatcher implements AnnotationMatcher
+ private static class DefaultAnnotationMatcher implements AnnotationMatcher
{
public boolean matches(Annotation annotation)
{
@@ -29,13 +29,13 @@
}
}
- private static class AnnotatedFieldMatcher implements FieldMatcher
+ private static class AnnotatedMatcher implements FieldMatcher, MethodMatcher
{
private Class<? extends Annotation> annotationClass;
private AnnotationMatcher matcher;
private Annotation match;
- public AnnotatedFieldMatcher(Class<? extends Annotation> annotationClass,
+ public AnnotatedMatcher(Class<? extends Annotation> annotationClass,
AnnotationMatcher matcher)
{
this.annotationClass = annotationClass;
@@ -53,25 +53,6 @@
return false;
}
- public Annotation getMatch()
- {
- return match;
- }
- }
-
- private static class AnnotatedMethodMatcher implements MethodMatcher
- {
- private Class<? extends Annotation> annotationClass;
- private AnnotationMatcher matcher;
- private Annotation match;
-
- public AnnotatedMethodMatcher(Class<? extends Annotation> annotationClass,
- AnnotationMatcher matcher)
- {
- this.annotationClass = annotationClass;
- this.matcher = matcher;
- }
-
public boolean matches(Method m)
{
if (m.isAnnotationPresent(annotationClass) &&
@@ -81,7 +62,7 @@
return true;
}
return false;
- }
+ }
public Annotation getMatch()
{
@@ -100,16 +81,16 @@
public AnnotatedBeanProperty(Class<?> cls, Class<T> annotationClass,
AnnotationMatcher annotationMatcher)
{
- super(cls, new AnnotatedFieldMatcher(annotationClass, annotationMatcher != null ?
annotationMatcher : new DefaultAnnotationMatcher()),
- new AnnotatedMethodMatcher(annotationClass, annotationMatcher != null ?
annotationMatcher : new DefaultAnnotationMatcher()));
+ super(cls, new AnnotatedMatcher(annotationClass, annotationMatcher != null ?
annotationMatcher : new DefaultAnnotationMatcher()),
+ new AnnotatedMatcher(annotationClass, annotationMatcher != null ?
annotationMatcher : new DefaultAnnotationMatcher()));
- if (((AnnotatedFieldMatcher) getFieldMatcher()).getMatch() != null)
+ if (((AnnotatedMatcher) getFieldMatcher()).getMatch() != null)
{
- this.annotation = (T) ((AnnotatedFieldMatcher) getFieldMatcher()).getMatch();
+ this.annotation = (T) ((AnnotatedMatcher) getFieldMatcher()).getMatch();
}
- else if (((AnnotatedMethodMatcher) getMethodMatcher()).getMatch() != null)
+ else if (((AnnotatedMatcher) getMethodMatcher()).getMatch() != null)
{
- this.annotation = (T) ((AnnotatedMethodMatcher) getMethodMatcher()).getMatch();
+ this.annotation = (T) ((AnnotatedMatcher) getMethodMatcher()).getMatch();
}
}
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/TypedBeanProperty.java
===================================================================
---
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/TypedBeanProperty.java 2010-06-01
11:51:42 UTC (rev 6367)
+++
extensions/trunk/src/main/java/org/jboss/weld/extensions/util/TypedBeanProperty.java 2010-06-01
12:01:55 UTC (rev 6368)
@@ -11,11 +11,11 @@
*/
public class TypedBeanProperty extends AbstractBeanProperty
{
- private static class TypedFieldMatcher implements FieldMatcher
+ private static class TypedMatcher implements FieldMatcher, MethodMatcher
{
private Class<?> propertyClass;
- public TypedFieldMatcher(Class<?> propertyClass)
+ public TypedMatcher(Class<?> propertyClass)
{
if (propertyClass == null)
{
@@ -29,30 +29,15 @@
{
return propertyClass.equals(f.getType());
}
- }
-
- private static class TypedMethodMatcher implements MethodMatcher
- {
- private Class<?> propertyClass;
- public TypedMethodMatcher(Class<?> propertyClass)
- {
- if (propertyClass == null)
- {
- throw new IllegalArgumentException("propertyClass can not be
null.");
- }
-
- this.propertyClass = propertyClass;
- }
-
public boolean matches(Method m)
{
return propertyClass.equals(m.getReturnType());
- }
+ }
}
public TypedBeanProperty(Class<?> cls, Class<?> propertyClass)
{
- super(cls, new TypedFieldMatcher(propertyClass), new
TypedMethodMatcher(propertyClass));
+ super(cls, new TypedMatcher(propertyClass), new TypedMatcher(propertyClass));
}
}