use of cern.gp.beans.PropertyInfo in project ACS by ACS-Community.
the class BeanNode method computeProperties.
/**
* Computes a descriptor for properties from a bean info.
* @param bean bean to create properties for
* @param info about the bean
* @param ignoreHiddenProperties true if hidden property should be ignored completely
* @param propertyInfo extra information of some properties (possibly null)
* @return three property lists
*/
private static Descriptor computeProperties(Object bean, BeanInfo info, boolean ignoreHiddenProperties, Boolean nodePropertiesCacheable, PropertyInfo[] propertyInfo) {
java.util.List property = null;
java.util.List expert = null;
java.util.List hidden = null;
PropertyDescriptor[] propertyDescriptor = info.getPropertyDescriptors();
int k = propertyDescriptor.length;
for (int i = 0; i < k; i++) {
if (propertyDescriptor[i].getPropertyType() == null)
continue;
String propName = propertyDescriptor[i].getName();
// we first update the PropertyDescriptor with the PropertyInfo
// that update may make non hidden a property that was hidden
PropertyInfo propInfo = findPropertyInfoByName(propertyInfo, propName);
if (propInfo != null)
propInfo.updatePropertyDescriptor(propertyDescriptor[i]);
// after the update we can test whether the property is hidden or not
if (ignoreHiddenProperties && propertyDescriptor[i].isHidden()) {
continue;
}
CachingStrategy strategy = createCachingStrategy(nodePropertiesCacheable, BeanTagger.isCacheable(propertyDescriptor[i]));
Node.Property prop;
if (propertyDescriptor[i] instanceof IndexedPropertyDescriptor) {
prop = createIndexedNodeProperty(bean, (IndexedPropertyDescriptor) propertyDescriptor[i], strategy);
} else {
prop = createNodeProperty(bean, propertyDescriptor[i], strategy);
}
if (prop == null)
continue;
if (propertyDescriptor[i].isHidden()) {
if (hidden == null)
hidden = new java.util.ArrayList();
hidden.add(prop);
} else if (propertyDescriptor[i].isExpert()) {
if (expert == null)
expert = new java.util.ArrayList();
expert.add(prop);
} else {
if (property == null)
property = new java.util.ArrayList();
property.add(prop);
}
}
// for
return new Descriptor(property, expert, hidden);
}
Aggregations