A property key-value pair. This class is used to read configuration files.
Method from org.apache.struts.tiles.xmlDefinition.XmlAttribute Detail: |
protected Object computeRealValue() {
Object realValue = value;
// Is there a type set ?
// First check direct attribute, and translate it to a valueType.
// Then, evaluate valueType, and create requested typed attribute.
if (direct != null) {
this.valueType =
Boolean.valueOf(direct).booleanValue() ? "string" : "path";
}
if (value != null && valueType != null) {
String strValue = value.toString();
if (valueType.equalsIgnoreCase("string")) {
realValue = new DirectStringAttribute(strValue);
} else if (valueType.equalsIgnoreCase("page")) {
realValue = new PathAttribute(strValue);
} else if (valueType.equalsIgnoreCase("template")) {
realValue = new PathAttribute(strValue);
} else if (valueType.equalsIgnoreCase("instance")) {
realValue = new DefinitionNameAttribute(strValue);
}
// Set realValue's role value if needed
if (role != null) {
((UntypedAttribute) realValue).setRole(role);
}
}
// Create attribute wrapper to hold role if role is set and no type specified
if (role != null && value != null && valueType == null) {
realValue = new UntypedAttribute(value.toString(), role);
}
return realValue;
}
Compute real value from attributes setting. |
public String getAttribute() {
return name;
}
Another access method for the name property. |
public String getName() {
return name;
}
Access method for the name property. |
public String getRole() {
return role;
}
Access method for the name property. |
public Object getValue() {
// Compatibility with JSP Template
if (this.realValue == null) {
this.realValue = this.computeRealValue();
}
return this.realValue;
}
Access method for the value property. Return the value or a
QualifiedAttribute containing the value if 'direct' is set. |
public void setAttribute(String aName) {
name = aName;
}
Sets the value of the name property. |
public void setBody(String body) {
if (body.length() == 0) {
return;
}
setValue(body);
}
Sets the value of the value property. |
public void setContent(Object aValue) {
setValue(aValue);
}
Sets the value of the value property. |
public void setDirect(String value) {
this.direct = value;
}
Sets the value of the value property. |
public void setName(String aName) {
name = aName;
}
Sets the value of the name property. |
public void setRole(String role) {
this.role = role;
}
Sets the value of the name property. |
public void setType(String value) {
this.valueType = value;
}
Sets the value of the value property. |
public void setValue(Object aValue) {
realValue = null;
value = aValue;
}
Sets the value of the value property. |