class ObjectClass extends AbstractNamedSchemaElement {

  public static ObjectClass parse(final String definition)
    throws ParseException
  {
    final Matcher m = DEFINITION_PATTERN.matcher(definition);
    if (!m.matches()) {
      throw new ParseException("Invalid object class definition: " + definition, definition.length());
    }

    final ObjectClass ocd = new ObjectClass(m.group(1).trim());

    // CheckStyle:MagicNumber OFF
    // parse names
    if (m.group(2) != null) {
      ocd.setNames(SchemaUtils.parseDescriptors(m.group(2).trim()));
    } else if (m.group(3) != null) {
      ocd.setNames(SchemaUtils.parseDescriptors(m.group(3).trim()));
    }

    ocd.setDescription(m.group(4) != null ? m.group(4).trim() : null);
    ocd.setObsolete(m.group(5) != null);

    // parse superior classes
    if (m.group(6) != null) {
      ocd.setSuperiorClasses(SchemaUtils.parseOIDs(m.group(6).trim()));
    } else if (m.group(7) != null) {
      ocd.setSuperiorClasses(SchemaUtils.parseOIDs(m.group(7).trim()));
    }

    if (m.group(8) != null) {
      ocd.setObjectClassType(ObjectClassType.valueOf(m.group(8).trim()));
    }

    // parse required attributes
    if (m.group(9) != null) {
      ocd.setRequiredAttributes(SchemaUtils.parseOIDs(m.group(9).trim()));
    } else if (m.group(10) != null) {
      ocd.setRequiredAttributes(SchemaUtils.parseOIDs(m.group(10).trim()));
    }

    // parse optional attributes
    if (m.group(11) != null) {
      ocd.setOptionalAttributes(SchemaUtils.parseOIDs(m.group(11).trim()));
    } else if (m.group(12) != null) {
      ocd.setOptionalAttributes(SchemaUtils.parseOIDs(m.group(12).trim()));
    }

    // parse extensions
    if (m.group(13) != null) {
      ocd.setExtensions(Extensions.parse(m.group(13).trim()));
    }
    return ocd;
    // CheckStyle:MagicNumber ON
  }

  public  ObjectClass(final String s);
  public  ObjectClass(
    final String oid,
    final String[] names,
    final String description,
    final boolean obsolete,
    final String[] superiorClasses,
    final ObjectClassType objectClassType,
    final String[] requiredAttributes,
    final String[] optionalAttributes,
    final Extensions extensions);

}