Index: src/documentation/content/xdocs/rules.xml
===================================================================
--- src/documentation/content/xdocs/rules.xml (revision 378354)
+++ src/documentation/content/xdocs/rules.xml (working copy)
@@ -300,11 +300,14 @@
value
string
yes
- The value to set the proeprty to. The is interpreted as with the
- smart translator, meaning that
- conversion to normal Java types (boolean, int, etc.) will work as
- expected.
+ The value to set the proeprty to. This value is interpreted based on the value of translator attribute.
+
+ translator
+ string
+ no
+ The name of the translator to use to interpret the value. The default is the smart translator
+
Index: framework/src/java/org/apache/hivemind/ant/RegistrySerializer.java
===================================================================
--- framework/src/java/org/apache/hivemind/ant/RegistrySerializer.java (revision 378354)
+++ framework/src/java/org/apache/hivemind/ant/RegistrySerializer.java (working copy)
@@ -623,6 +623,7 @@
rule.setAttribute("property", spr.getPropertyName());
rule.setAttribute("value", spr.getValue());
+ rule.setAttribute("translator",spr.getTranslator());
}
else if (r instanceof ConversionDescriptor)
{
Index: framework/src/java/org/apache/hivemind/parse/DescriptorParser.properties
===================================================================
--- framework/src/java/org/apache/hivemind/parse/DescriptorParser.properties (revision 378354)
+++ framework/src/java/org/apache/hivemind/parse/DescriptorParser.properties (working copy)
@@ -84,6 +84,7 @@
required.set-property.property=true
required.set-property.value=true
+required.set-property.translator=false
required.push-attribute.attribute=true
Index: framework/src/java/org/apache/hivemind/parse/DescriptorParser.java
===================================================================
--- framework/src/java/org/apache/hivemind/parse/DescriptorParser.java (revision 378354)
+++ framework/src/java/org/apache/hivemind/parse/DescriptorParser.java (working copy)
@@ -1125,7 +1125,8 @@
rule.setPropertyName(getAttribute("property"));
rule.setValue(getAttribute("value"));
-
+ rule.setTranslator(getAttribute("translator"));
+
elementModel.addRule(rule);
}
Index: framework/src/java/org/apache/hivemind/schema/rules/SetPropertyRule.java
===================================================================
--- framework/src/java/org/apache/hivemind/schema/rules/SetPropertyRule.java (revision 378354)
+++ framework/src/java/org/apache/hivemind/schema/rules/SetPropertyRule.java (working copy)
@@ -33,8 +33,9 @@
private String _propertyName;
private String _value;
- private Translator _smartTranslator;
-
+ private Translator _translator;
+ private String _translatorName = "smart";
+
public void begin(SchemaProcessor processor, Element element)
{
String value = RuleUtils.processText(processor, element, _value);
@@ -43,13 +44,13 @@
try
{
- if (_smartTranslator == null)
- _smartTranslator = RuleUtils.getTranslator(processor, "smart");
+ if (_translator == null)
+ _translator = RuleUtils.getTranslator(processor, _translatorName);
Class propertyType = PropertyUtils.getPropertyType(target, _propertyName);
Object finalValue =
- _smartTranslator.translate(
+ _translator.translate(
processor.getContributingModule(),
propertyType,
value,
@@ -88,4 +89,14 @@
return _value;
}
+ public void setTranslator(String string)
+ {
+ _translatorName = string;
+ }
+
+ public String getTranslator()
+ {
+ return _translatorName;
+ }
+
}