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