in maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/TrinidadComponentGenerator.java [95:187]
public void writePropertyConstants(
PrettyWriter out,
String superclassName,
ComponentBean component) throws IOException
{
out.println("static public final FacesBean.Type TYPE = new FacesBean.Type(");
out.indent();
out.println(superclassName + ".TYPE);");
out.unindent();
// component property keys
Iterator<PropertyBean> properties = component.properties();
properties = new FilteredIterator<PropertyBean>(properties, new NonVirtualFilter());
properties = new FilteredIterator<PropertyBean>(properties, new NonOverriddenFilter());
while (properties.hasNext())
{
PropertyBean property = properties.next();
String propName = property.getPropertyName();
String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
String propAlias = property.getAliasOf();
if (property.getDeprecated() != null)
{
out.println("@Deprecated");
}
out.println("static public final PropertyKey " + propKey + " =");
out.indent();
if (propAlias != null)
{
String aliasKey = Util.getConstantNameFromProperty(propAlias, "_KEY");
out.print("TYPE.registerAlias(" + aliasKey + ", \"" + propName + "\");");
}
else
{
out.print("TYPE.registerKey(\"" + propName + "\"");
// property class
String propFullClass = property.getPropertyClass();
String propClass = Util.getClassFromFullClass(propFullClass);
if (propClass == null)
{
propClass = "String";
}
String propDefault = property.getDefaultValue();
String propMutable = _getPropertyMutable(property);
if (!"Object".equals(propClass) || propDefault != null)
{
// TODO: do not use boxed class here
String boxedClass = Util.getBoxedClass(propClass);
out.print(", " + boxedClass + ".class");
}
else if (propMutable != null)
{
out.print(", Object.class");
}
if (propDefault != null)
{
if (property.isEnum())
out.print(", Enum.valueOf(" + propClass + ".class," +
convertStringToBoxedLiteral("String", propDefault) +
")");
else
out.print(", " + convertStringToBoxedLiteral(propClass, propDefault));
}
else if (propMutable != null)
{
out.print(", null");
}
// property capabilities
String propCaps = _getPropertyCapabilities(property);
if (propCaps != null)
out.print(", " + propCaps);
if (propMutable != null)
{
if (propCaps == null )
out.print(", 0");
out.print(", " + propMutable);
}
out.println(");");
}
out.unindent();
}
}