[jboss-svn-commits] JBL Code SVN: r37530 - in labs/jbosstm/trunk: common/classes/com/arjuna/common/internal/util/propertyservice and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Oct 11 11:05:18 EDT 2011
Author: jhalliday
Date: 2011-10-11 11:05:18 -0400 (Tue, 11 Oct 2011)
New Revision: 37530
Modified:
labs/jbosstm/trunk/
labs/jbosstm/trunk/common/classes/com/arjuna/common/internal/util/propertyservice/BeanPopulator.java
Log:
remove PropertyPrefix requirement for EnvironmentBean classes. JBTM-920
Property changes on: labs/jbosstm/trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /labs/jbosstm/branches/JBOSSTS_4_15_0_Final:37308,37480,37484,37492
+ /labs/jbosstm/branches/JBOSSTS_4_15_0_Final:37308,37480,37484,37492,37529
Modified: labs/jbosstm/trunk/common/classes/com/arjuna/common/internal/util/propertyservice/BeanPopulator.java
===================================================================
--- labs/jbosstm/trunk/common/classes/com/arjuna/common/internal/util/propertyservice/BeanPopulator.java 2011-10-11 14:34:18 UTC (rev 37529)
+++ labs/jbosstm/trunk/common/classes/com/arjuna/common/internal/util/propertyservice/BeanPopulator.java 2011-10-11 15:05:18 UTC (rev 37530)
@@ -122,10 +122,6 @@
*/
public static void configureFromProperties(Object bean, String instanceName, Properties properties) throws Exception {
- if(!bean.getClass().isAnnotationPresent(PropertyPrefix.class)) {
- throw new Exception("no PropertyPrefix found on "+bean.getClass().getName());
- }
-
for(Field field : bean.getClass().getDeclaredFields()) {
Class type = field.getType();
@@ -163,7 +159,7 @@
StringBuffer buffer = new StringBuffer();
printBean(bean, buffer);
return buffer.toString();
- }
+ }
/**
* Render the state of the known bean instances as text.
@@ -255,8 +251,11 @@
private static void handleSimpleProperty(Object bean, String instanceName, Properties properties, Field field, Method setter, Method getter)
throws Exception
{
- PropertyPrefix prefixAnnotation = bean.getClass().getAnnotation(PropertyPrefix.class);
- String prefix = prefixAnnotation.prefix();
+ String prefix = null;
+ if(bean.getClass().isAnnotationPresent(PropertyPrefix.class)) {
+ PropertyPrefix prefixAnnotation = bean.getClass().getAnnotation(PropertyPrefix.class);
+ prefix = prefixAnnotation.prefix();
+ }
String valueFromProperties = getValueFromProperties(bean, instanceName, properties, field, prefix);
@@ -336,13 +335,16 @@
valueFromProperties = properties.getProperty(propertyFileKey);
}
}
-
+
if (valueFromProperties == null) {
- propertyFileKey = prefix+field.getName();
if(field.isAnnotationPresent(FullPropertyName.class)) {
FullPropertyName fullPropertyName = field.getAnnotation(FullPropertyName.class);
propertyFileKey = fullPropertyName.name();
+ } else if(prefix != null) {
+ propertyFileKey = prefix+field.getName();
+ } else {
+ propertyFileKey = field.getName();
}
valueFromProperties = properties.getProperty(propertyFileKey);
More information about the jboss-svn-commits
mailing list