in jelly-tags/dynabean/src/main/java/org/apache/commons/jelly/tags/dynabean/PropertyTag.java [46:109]
public void doTag (XMLOutput output) throws MissingAttributeException, JellyTagException {
// Check that this tag is used inside the body of
// a DynaClass tag, so that it can access the
// context of that tag
DynaclassTag parentTag = (DynaclassTag) findAncestorWithClass( DynaclassTag.class );
if ( parentTag == null ) {
throw new JellyTagException( "This tag must be enclosed inside a <dynaclass> tag" );
}
// Check property name
if (name == null) {
throw new MissingAttributeException( "name" );
}
// Lookup appropriate property class
Class propClass = propertyClass;
if (propClass == null) {
// Check property type
if (type == null) {
throw new MissingAttributeException( "type" );
}
if (type.equals("String")) {
propClass = String.class;
}
else if (type.equals("Integer")) {
propClass = Integer.TYPE;
}
else if (type.equals("Short")) {
propClass = Short.TYPE;
}
else if (type.equals("Long")) {
propClass = Long.TYPE;
}
else if (type.equals("Float")) {
propClass = Float.TYPE;
}
else if (type.equals("Double")) {
propClass = Double.TYPE;
}
else if (type.equals("Long")) {
propClass = Long.TYPE;
}
if (propClass == null) {
try {
propClass = Class.forName(type);
}
catch (Exception e) {
throw new JellyTagException
("Class " + type +
" not found by Class.forName");
}
}
}
// Create dynaproperty object with given name and type
prop = new DynaProperty (name, propClass);
// Add new property to dynaclass context
parentTag.addDynaProperty(prop);
}