Fields Summary |
---|
private String | feature |
private String | property |
private String | value |
public static final String | ERROR_BOTH_ATTRIBUTESerror - combined attributes not allowed |
public static final String | FEATUREfeature |
public static final String | PROPERTYproperty |
public static final String | NOT_RECOGNIZEDerror - not recognized |
public static final String | NOT_SUPPORTEDerror - not supported |
public static final String | ERROR_NO_ATTRIBUTESerror - missing attribute |
public static final String | ERROR_NO_VALUEerror - no value |
Methods Summary |
---|
public boolean | eval(){@inheritDoc}.
if (feature != null && property != null) {
throw new BuildException(ERROR_BOTH_ATTRIBUTES);
}
if (feature == null && property == null) {
throw new BuildException(ERROR_NO_ATTRIBUTES);
}
//pick a value that is good for everything
if (feature != null) {
return evalFeature();
}
if (value == null) {
throw new BuildException(ERROR_NO_VALUE);
}
return evalProperty();
|
public boolean | evalFeature()Set a feature
XMLReader reader = getReader();
if (value == null) {
value = "true";
}
boolean v = Project.toBoolean(value);
try {
reader.setFeature(feature, v);
} catch (SAXNotRecognizedException e) {
log(FEATURE + NOT_RECOGNIZED + feature, Project.MSG_VERBOSE);
return false;
} catch (SAXNotSupportedException e) {
log(FEATURE + NOT_SUPPORTED + feature, Project.MSG_VERBOSE);
return false;
}
return true;
|
public boolean | evalProperty()Set a property
XMLReader reader = getReader();
try {
reader.setProperty(property, value);
} catch (SAXNotRecognizedException e) {
log(PROPERTY + NOT_RECOGNIZED + property, Project.MSG_VERBOSE);
return false;
} catch (SAXNotSupportedException e) {
log(PROPERTY + NOT_SUPPORTED + property, Project.MSG_VERBOSE);
return false;
}
return true;
|
private org.xml.sax.XMLReader | getReader()Get our reader
JAXPUtils.getParser();
return JAXPUtils.getXMLReader();
|
public void | setFeature(java.lang.String feature)Feature to probe for.
this.feature = feature;
|
public void | setProperty(java.lang.String property)Property to probe for
this.property = property;
|
public void | setValue(java.lang.String value)Optional value to set.
Converted to a boolean value when setting a property
this.value = value;
|