Fixed a bunch of deprecated usages.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1512 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -30,21 +30,21 @@ import com.samskivert.util.StringUtil;
|
||||
*/
|
||||
public abstract class CallMethodSpecialRule extends Rule
|
||||
{
|
||||
public void body (String bodyText)
|
||||
public void body (String namespace, String name, String bodyText)
|
||||
throws Exception
|
||||
{
|
||||
_bodyText = bodyText.trim();
|
||||
}
|
||||
|
||||
public void end ()
|
||||
public void end (String namespace, String name)
|
||||
throws Exception
|
||||
{
|
||||
Object top = digester.peek();
|
||||
|
||||
if (digester.getDebug() >= 1) {
|
||||
digester.log("CallSpecial " + StringUtil.shortClassName(this) +
|
||||
".parseAndSet(" +
|
||||
StringUtil.shortClassName(top) + ")");
|
||||
if (digester.getLogger().isDebugEnabled()) {
|
||||
digester.getLogger().debug(
|
||||
"CallSpecial " + StringUtil.shortClassName(this) +
|
||||
".parseAndSet(" + StringUtil.shortClassName(top) + ")");
|
||||
}
|
||||
|
||||
parseAndSet(_bodyText, top);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class CheckVersionRule extends Rule
|
||||
_parserIdentifier = parserIdentifier;
|
||||
}
|
||||
|
||||
public void body (String bodyText)
|
||||
public void body (String namespace, String name, String bodyText)
|
||||
throws Exception
|
||||
{
|
||||
int version = Integer.parseInt(bodyText.trim());
|
||||
|
||||
@@ -42,19 +42,20 @@ public class SetFieldRule extends Rule
|
||||
_fieldName = fieldName;
|
||||
}
|
||||
|
||||
public void body (String bodyText)
|
||||
public void body (String namespace, String name, String bodyText)
|
||||
throws Exception
|
||||
{
|
||||
_bodyText = bodyText.trim();
|
||||
}
|
||||
|
||||
public void end ()
|
||||
public void end (String namespace, String name)
|
||||
throws Exception
|
||||
{
|
||||
Object top = digester.peek();
|
||||
if (digester.getDebug() >= 1) {
|
||||
digester.log(" Setting '" + _fieldName + "' to '" +
|
||||
_bodyText + "' on '" + top + "'.");
|
||||
Object top = digester.peek();
|
||||
if (digester.getLogger().isDebugEnabled()) {
|
||||
digester.getLogger().debug(
|
||||
" Setting '" + _fieldName + "' to '" +
|
||||
_bodyText + "' on '" + top + "'.");
|
||||
}
|
||||
|
||||
// convert the source string into an object and set the field
|
||||
@@ -64,7 +65,8 @@ public class SetFieldRule extends Rule
|
||||
field.getType(), _bodyText);
|
||||
field.set(top, value);
|
||||
} catch (NoSuchFieldException nsfe) {
|
||||
digester.log("No such field: " + top.getClass() + "." + _fieldName);
|
||||
digester.getLogger().warn(
|
||||
"No such field: " + top.getClass() + "." + _fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class SetNextFieldRule extends Rule
|
||||
_fieldName = fieldName;
|
||||
}
|
||||
|
||||
public void end ()
|
||||
public void end (String namespace, String name)
|
||||
throws Exception
|
||||
{
|
||||
// identify the objects to be used
|
||||
@@ -47,9 +47,9 @@ public class SetNextFieldRule extends Rule
|
||||
Object parent = digester.peek(1);
|
||||
Class pclass = parent.getClass();
|
||||
|
||||
if (digester.getDebug() >= 1) {
|
||||
digester.log("Set " + pclass.getName() + "." + _fieldName +
|
||||
" = " + child);
|
||||
if (digester.getLogger().isDebugEnabled()) {
|
||||
digester.getLogger().debug("Set " + pclass.getName() + "." + _fieldName +
|
||||
" = " + child);
|
||||
}
|
||||
|
||||
// stuff the child object into the field of the parent
|
||||
|
||||
@@ -81,7 +81,7 @@ public class SetPropertyFieldsRule extends Rule
|
||||
_warnNonFields = warnNonFields;
|
||||
}
|
||||
|
||||
public void begin (Attributes attrs)
|
||||
public void begin (String namespace, String name, Attributes attrs)
|
||||
throws Exception
|
||||
{
|
||||
Object top = digester.peek();
|
||||
@@ -90,19 +90,20 @@ public class SetPropertyFieldsRule extends Rule
|
||||
// iterate over the attributes, setting public fields where
|
||||
// applicable
|
||||
for (int i = 0; i < attrs.getLength(); i++) {
|
||||
String name = attrs.getLocalName(i);
|
||||
if (StringUtil.blank(name)) {
|
||||
name = attrs.getQName(i);
|
||||
String lname = attrs.getLocalName(i);
|
||||
if (StringUtil.blank(lname)) {
|
||||
lname = attrs.getQName(i);
|
||||
}
|
||||
|
||||
// look for a public field with this name
|
||||
// look for a public field with this lname
|
||||
Field field = null;
|
||||
try {
|
||||
field = topclass.getField(name);
|
||||
field = topclass.getField(lname);
|
||||
} catch (NoSuchFieldException nsfe) {
|
||||
if (_warnNonFields) {
|
||||
digester.log("Skipping property '" + name +
|
||||
"' for which there is no field.");
|
||||
digester.getLogger().warn(
|
||||
"Skipping property '" + lname +
|
||||
"' for which there is no field.");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -114,7 +115,7 @@ public class SetPropertyFieldsRule extends Rule
|
||||
|
||||
// look for a custom field parser
|
||||
if ((_parsers != null) &&
|
||||
((parser = (FieldParser)_parsers.get(name)) != null)) {
|
||||
((parser = (FieldParser)_parsers.get(lname)) != null)) {
|
||||
value = parser.parse(valstr);
|
||||
} else {
|
||||
// otherwise use the value marshaller to parse the
|
||||
@@ -122,14 +123,14 @@ public class SetPropertyFieldsRule extends Rule
|
||||
value = ValueMarshaller.unmarshal(field.getType(), valstr);
|
||||
}
|
||||
|
||||
if (digester.getDebug() >= 9) {
|
||||
digester.log(" Setting property '" + name + "' to '" +
|
||||
valstr + "'");
|
||||
if (digester.getLogger().isDebugEnabled()) {
|
||||
digester.getLogger().debug(" Setting property '" + lname +
|
||||
"' to '" + valstr + "'");
|
||||
}
|
||||
|
||||
// and finally set the field
|
||||
field.set(top, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected HashMap _parsers;
|
||||
|
||||
@@ -69,12 +69,12 @@ public class ValidatedSetNextRule extends Rule
|
||||
_validator = validator;
|
||||
}
|
||||
|
||||
public void end ()
|
||||
public void end (String namespace, String name)
|
||||
throws Exception
|
||||
{
|
||||
// identify the objects to be used
|
||||
Object child = digester.peek(0);
|
||||
Object parent = digester.peek(1);
|
||||
// identify the objects to be used
|
||||
Object child = digester.peek(0);
|
||||
Object parent = digester.peek(1);
|
||||
|
||||
// make sure the object in question is valid
|
||||
if (!_validator.isValid(child)) {
|
||||
@@ -82,16 +82,16 @@ public class ValidatedSetNextRule extends Rule
|
||||
}
|
||||
|
||||
Class pclass = parent.getClass();
|
||||
if (digester.getDebug() >= 1) {
|
||||
digester.log("Call " + pclass.getName() + "." + _methodName +
|
||||
" (" + child + ")");
|
||||
if (digester.getLogger().isDebugEnabled()) {
|
||||
digester.getLogger().debug("Call " + pclass.getName() + "." +
|
||||
_methodName + " (" + child + ")");
|
||||
}
|
||||
|
||||
// call the specified method
|
||||
Class[] paramTypes = new Class[1];
|
||||
// call the specified method
|
||||
Class[] paramTypes = new Class[1];
|
||||
paramTypes[0] = (_paramType == null) ? child.getClass() : _paramType;
|
||||
Method method = parent.getClass().getMethod(_methodName, paramTypes);
|
||||
method.invoke(parent, new Object[] { child });
|
||||
Method method = parent.getClass().getMethod(_methodName, paramTypes);
|
||||
method.invoke(parent, new Object[] { child });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user