code: @Override
      public AttributeDefinition[] getAttributeDefinitions(int filter) {
          List<AttributeDefinition> adList;
          if (filter == ObjectClassDefinition.ALL) {
              adList = new ArrayList<AttributeDefinition>(requiredAttributeDefinitions.size() + optionalAttributeDefinitions.size());
              adList.addAll(requiredAttributeDefinitions);
              adList.addAll(optionalAttributeDefinitions);
          } else if (filter == ObjectClassDefinition.OPTIONAL) {
              adList = optionalAttributeDefinitions;
          } else if (filter == ObjectClassDefinition.REQUIRED) {
              adList = requiredAttributeDefinitions;
          } else {
              throw new IllegalArgumentException("Unexpected filter value: " + filter);
          }
          AttributeDefinition[] ads = new AttributeDefinition[adList.size()];
          return adList.toArray(ads);
      }
docs: /*
  (non-Javadoc)
  
  @see org.osgi.service.metatype.ObjectClassDefinition#getAttributeDefinitions(int)