Author: mmerz
Date: Wed Sep 15 15:46:23 2004
New Revision: 46136
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/AnnotationModel.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/reflection/WsmReflectionAnnotationProcessor.java
Log:
Fixed param initialization.
Contributor: Daryoush Mehrtash
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/AnnotationModel.java
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/AnnotationModel.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/AnnotationModel.java
Wed Sep 15 15:46:23 2004
@@ -31,7 +31,7 @@
super();
}
- protected boolean hasAnnotationType(Collection<Annotation> annotations,
Class<? extends Annotation> annotationType)
+ static public boolean hasAnnotationType(Collection<Annotation>
annotations, Class<? extends Annotation> annotationType)
{
if ((null != annotations) && (null != annotationType) && (0 <
annotations.size()))
{
@@ -44,6 +44,22 @@
}
}
return false;
+ }
+
+ //TODO: can this method be enhanced?
+ static public Annotation getAnnotationOfType(Collection<Annotation>
annotations, Class<? extends Annotation> annotationType)
+ {
+ if ((null != annotations) && (null != annotationType) && (0 <
annotations.size()))
+ {
+ for ( Annotation a : annotations )
+ {
+ if (a.annotationType() == annotationType)
+ {
+ return a;
+ }
+ }
+ }
+ return null;
}
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java
Wed Sep 15 15:46:23 2004
@@ -39,7 +39,7 @@
import com.sun.mirror.type.AnnotationType;
import org.apache.beehive.wsm.jsr181.model.*;
-
+import org.apache.beehive.wsm.jsr181.model.AnnotationModel;
import java.io.*;
@@ -116,7 +116,7 @@
try {
Collection<Annotation> annotations = getAnnotations(decl);
wstm = new WebServiceTYPEMetadata(
- (javax.jws.WebService)getAnnotationOfType(annotations,
javax.jws.WebService.class),
+
(javax.jws.WebService)AnnotationModel.getAnnotationOfType(annotations,
javax.jws.WebService.class),
decl.getQualifiedName(),
annotations,
webMethods
@@ -148,7 +148,7 @@
try {
Collection<Annotation> annotations = getAnnotations(decl);
wsmm = new WebServiceMETHODMetadata(
- (javax.jws.WebMethod)getAnnotationOfType(annotations,
javax.jws.WebMethod.class),
+
(javax.jws.WebMethod)AnnotationModel.getAnnotationOfType(annotations,
javax.jws.WebMethod.class),
decl.getSimpleName(),
classForName(decl.getReturnType().toString()),
annotations,
@@ -170,7 +170,7 @@
try {
Collection<Annotation> annotations = getAnnotations(decl);
wspm = new WebServicePARAMETERMetadata(
- (javax.jws.WebParam)getAnnotationOfType(annotations,
javax.jws.WebParam.class),
+
(javax.jws.WebParam)AnnotationModel.getAnnotationOfType(annotations,
javax.jws.WebParam.class),
classForName(decl.getType().toString()),
decl.getSimpleName(),
annotations
@@ -183,21 +183,6 @@
return wspm;
}
- //TODO: can this method be enhanced?
- protected Annotation getAnnotationOfType(Collection<Annotation>
annotations, Class<? extends Annotation> annotationType)
- {
- if ((null != annotations) && (null != annotationType) && (0 <
annotations.size()))
- {
- for ( Annotation a : annotations )
- {
- if (a.annotationType() == annotationType)
- {
- return a;
- }
- }
- }
- return null;
- }
private Collection<Annotation> getAnnotations(Declaration decl)
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/reflection/WsmReflectionAnnotationProcessor.java
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/reflection/WsmReflectionAnnotationProcessor.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/reflection/WsmReflectionAnnotationProcessor.java
Wed Sep 15 15:46:23 2004
@@ -14,6 +14,7 @@
import org.apache.beehive.wsm.jsr181.model.WebServiceMETHODMetadata;
import org.apache.beehive.wsm.jsr181.model.WebServicePARAMETERMetadata;
import org.apache.beehive.wsm.jsr181.model.WebServiceTYPEMetadata;
+import org.apache.beehive.wsm.jsr181.model.AnnotationModel;
/*
* Copyright 2004 The Apache Software Foundation
@@ -63,13 +64,14 @@
Class< ? >[] methodParamTypes = method.getParameterTypes();
Annotation[][] allAnnotations = method
.getParameterAnnotations();
- WebParam wpAnnotation = (WebParam) method
- .getAnnotation(WebParam.class);
+// WebParam wpAnnotation = (WebParam) method
+// .getAnnotation(WebParam.class);
for (Class paramType : methodParamTypes) {
- WebParam webParam = null;
+ List<Annotation> allParmAnnotation =
Arrays.asList(allAnnotations[offset]);
+ WebParam wpAnnotation =
(WebParam)AnnotationModel.getAnnotationOfType(allParmAnnotation,
WebParam.class);
WebServicePARAMETERMetadata paramMetaData = new
WebServicePARAMETERMetadata(
wpAnnotation, paramType, "in" +offset, // by
default parameter should be IN
-
Arrays.asList(allAnnotations[offset])); // class
+ allParmAnnotation); // class
// reflection
// doesn't keep the
// name of