Author: richard.opalka(a)jboss.com
Date: 2011-07-27 08:49:06 -0400 (Wed, 27 Jul 2011)
New Revision: 14755
Modified:
container/jboss60/branches/jbossws-jboss600/src/main/java/org/jboss/webservices/integration/injection/InjectionMetaDataDeploymentAspect.java
container/jboss60/branches/jbossws-jboss600/src/main/java/org/jboss/webservices/integration/injection/ServiceRefResourceProvider.java
Log:
[JBWS-3334] fixing injection method lookup algorithm
Modified:
container/jboss60/branches/jbossws-jboss600/src/main/java/org/jboss/webservices/integration/injection/InjectionMetaDataDeploymentAspect.java
===================================================================
---
container/jboss60/branches/jbossws-jboss600/src/main/java/org/jboss/webservices/integration/injection/InjectionMetaDataDeploymentAspect.java 2011-07-27
12:44:16 UTC (rev 14754)
+++
container/jboss60/branches/jbossws-jboss600/src/main/java/org/jboss/webservices/integration/injection/InjectionMetaDataDeploymentAspect.java 2011-07-27
12:49:06 UTC (rev 14755)
@@ -243,7 +243,7 @@
{
// prepare injection target meta data
targetClass = resourceInjectionTargetMD.getInjectionTargetClass();
- targetName = resourceInjectionTargetMD.getInjectionTargetName();
+ targetName = getTargetName(resourceInjectionTargetMD);
// build injection meta data for injection target
final InjectionMetaData injectionMD = new InjectionMetaData(targetClass,
targetName, envEntryValueClass,
@@ -256,4 +256,15 @@
return retVal;
}
+
+ private String getTargetName(final ResourceInjectionTargetMetaData
resourceInjectionTargetMD)
+ {
+ final String targetName = resourceInjectionTargetMD.getInjectionTargetName();
+ if (targetName.startsWith("set"))
+ {
+ final String propertyName = targetName.substring(3);
+ return propertyName.substring(0, 1).toLowerCase() + propertyName.substring(1);
+ }
+ return targetName;
+ }
}
Modified:
container/jboss60/branches/jbossws-jboss600/src/main/java/org/jboss/webservices/integration/injection/ServiceRefResourceProvider.java
===================================================================
---
container/jboss60/branches/jbossws-jboss600/src/main/java/org/jboss/webservices/integration/injection/ServiceRefResourceProvider.java 2011-07-27
12:44:16 UTC (rev 14754)
+++
container/jboss60/branches/jbossws-jboss600/src/main/java/org/jboss/webservices/integration/injection/ServiceRefResourceProvider.java 2011-07-27
12:49:06 UTC (rev 14755)
@@ -688,13 +688,28 @@
return field;
}
+ final String targetName = getMethodName(target);
for (Method method : clazz.getDeclaredMethods())
{
- if (method.getName().equals(target.getTargetName()))
+ if (method.getName().equals(targetName))
return method;
}
throw new RuntimeException(BundleUtils.getMessage(bundle,
"INJECTION_TARGET_NOT_FOUND", target.getTargetClass()+ "."
+target.getTargetName()));
+ }
+
+ private String getMethodName(final InjectionTarget target)
+ {
+ if (target.getTargetName() == null)
+ {
+ return null;
+ }
+ if (target.getTargetName().startsWith("set"))
+ {
+ return target.getTargetName();
+ }
+
+ return "set" + target.getTargetName().substring(0, 1).toUpperCase() +
target.getTargetName().substring(1);
+ }
- }
}