public Descriptor buildAttributeDescriptor(
ManagedAttribute ma, String attributeName, boolean is, boolean read, boolean write) {
Descriptor desc = new DescriptorSupport();
desc.setField("name", attributeName);
desc.setField("descriptorType", "attribute");
if (read) {
if (is) {
desc.setField("getMethod", "is" + attributeName);
} else {
desc.setField("getMethod", "get" + attributeName);
}
}
if (write) {
desc.setField("setMethod", "set" + attributeName);
}
if (ma.currencyTimeLimit() >= -1) {
desc.setField("currencyTimeLimit", ma.currencyTimeLimit());
}
if (ma.persistPolicy().length() > 0) {
desc.setField("persistPolicy", ma.persistPolicy());
}
if (ma.persistPeriod() >= -1) {
desc.setField("persistPeriod", ma.persistPeriod());
}
if (ma.defaultValue() != null) {
desc.setField("default", ma.defaultValue());
}
return desc;
}