public static void addEnumValues(Class<?> theClass, Builder builder) {
   if (theClass.isEnum()) {
     Object[] enumConstants = theClass.getEnumConstants();
     for (Object object : enumConstants) {
       builder.option(object.toString(), object.toString());
     }
   }
 }
 public static List<AttributeDefinition> buildAttributesList(Class<?> theClass) {
   List<AttributeDefinition> attributes = new ArrayList<AttributeDefinition>();
   try {
     BeanInfo beanInfo = Introspector.getBeanInfo(theClass);
     PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
     for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
       if (propertyDescriptor.getWriteMethod() == null
           || !Modifier.isPublic(propertyDescriptor.getWriteMethod().getModifiers())) {
         continue;
       }
       Builder builder =
           AttributeDefinition.builder(new PassThroughStringLocalizer())
               .id(propertyDescriptor.getName())
               .name(propertyDescriptor.getDisplayName())
               .description(propertyDescriptor.getShortDescription());
       addEnumValues(propertyDescriptor.getPropertyType(), builder);
       AttributeDefinition a = builder.build();
       attributes.add(a);
     }
   } catch (IntrospectionException ex) {
     LOGGER.error("building attribute list failed", ex);
   }
   return attributes;
 }