public Map<String, ModelProperty> collectProperties(Class cls) {
Map<String, ModelProperty> properties = new LinkedHashMap<String, ModelProperty>();
for (Method method : cls.getMethods()) {
if (method.isAnnotationPresent(Attribute.class)) {
Attribute attribute = method.getAnnotation(Attribute.class);
properties.put(attribute.name(),
new ModelProperty(method.getName(), method.getReturnType(),
map("verbose", attribute.verbose(), "visible", attribute.visible()))
);
}
}
return properties;