Widening.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2251 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -30,8 +30,8 @@ import com.samskivert.util.StringUtil;
|
|||||||
import com.samskivert.util.ValueMarshaller;
|
import com.samskivert.util.ValueMarshaller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the fields in the object on the top of the stack from the
|
* Sets the fields in the object on the top of the stack from the attributes available in the
|
||||||
* attributes available in the matched element.
|
* matched element.
|
||||||
*/
|
*/
|
||||||
public class SetPropertyFieldsRule extends Rule
|
public class SetPropertyFieldsRule extends Rule
|
||||||
{
|
{
|
||||||
@@ -73,8 +73,8 @@ public class SetPropertyFieldsRule extends Rule
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures this rule to warn or not when it skips properties for
|
* Configures this rule to warn or not when it skips properties for which there are no
|
||||||
* which there are no associated object fields.
|
* associated object fields.
|
||||||
*/
|
*/
|
||||||
public void setWarnNonFields (boolean warnNonFields)
|
public void setWarnNonFields (boolean warnNonFields)
|
||||||
{
|
{
|
||||||
@@ -87,8 +87,7 @@ public class SetPropertyFieldsRule extends Rule
|
|||||||
Object top = digester.peek();
|
Object top = digester.peek();
|
||||||
Class topclass = top.getClass();
|
Class topclass = top.getClass();
|
||||||
|
|
||||||
// iterate over the attributes, setting public fields where
|
// iterate over the attributes, setting public fields where applicable
|
||||||
// applicable
|
|
||||||
for (int i = 0; i < attrs.getLength(); i++) {
|
for (int i = 0; i < attrs.getLength(); i++) {
|
||||||
String lname = attrs.getLocalName(i);
|
String lname = attrs.getLocalName(i);
|
||||||
if (StringUtil.isBlank(lname)) {
|
if (StringUtil.isBlank(lname)) {
|
||||||
@@ -102,8 +101,7 @@ public class SetPropertyFieldsRule extends Rule
|
|||||||
} catch (NoSuchFieldException nsfe) {
|
} catch (NoSuchFieldException nsfe) {
|
||||||
if (_warnNonFields) {
|
if (_warnNonFields) {
|
||||||
digester.getLogger().warn(
|
digester.getLogger().warn(
|
||||||
"Skipping property '" + lname +
|
"Skipping property '" + lname + "' for which there is no field.");
|
||||||
"' for which there is no field.");
|
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -118,14 +116,14 @@ public class SetPropertyFieldsRule extends Rule
|
|||||||
((parser = _parsers.get(lname)) != null)) {
|
((parser = _parsers.get(lname)) != null)) {
|
||||||
value = parser.parse(valstr);
|
value = parser.parse(valstr);
|
||||||
} else {
|
} else {
|
||||||
// otherwise use the value marshaller to parse the
|
// otherwise use the value marshaller to parse the property based on the type of
|
||||||
// property based on the type of the target object field
|
// the target object field
|
||||||
value = ValueMarshaller.unmarshal(field.getType(), valstr);
|
value = ValueMarshaller.unmarshal(field.getType(), valstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (digester.getLogger().isDebugEnabled()) {
|
if (digester.getLogger().isDebugEnabled()) {
|
||||||
digester.getLogger().debug(" Setting property '" + lname +
|
digester.getLogger().debug(
|
||||||
"' to '" + valstr + "'");
|
" Setting property '" + lname + "' to '" + valstr + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
// and finally set the field
|
// and finally set the field
|
||||||
|
|||||||
Reference in New Issue
Block a user