class AttributeType extends AbstractNamedSchemaElement {

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

    final AttributeType atd = new AttributeType(m.group(1).trim());

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

    atd.setDescription(m.group(4) != null ? m.group(4).trim() : null);
    atd.setObsolete(m.group(5) != null);
    atd.setSuperiorType(m.group(6) != null ? m.group(6).trim() : null);
    atd.setEqualityMatchingRule(m.group(7) != null ? m.group(7).trim() : null);
    atd.setOrderingMatchingRule(m.group(8) != null ? m.group(8).trim() : null);
    atd.setSubstringMatchingRule(m.group(9) != null ? m.group(9).trim() : null);
    atd.setSyntaxOID(m.group(10) != null ? m.group(10).trim() : null);
    atd.setSingleValued(m.group(11) != null);
    atd.setCollective(m.group(12) != null);
    atd.setNoUserModification(m.group(13) != null);
    if (m.group(14) != null) {
      atd.setUsage(AttributeUsage.parse(m.group(14).trim()));
    }

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

  public  AttributeType(final String s);
  public  AttributeType(
    final String oid,
    final String[] names,
    final String description,
    final boolean obsolete,
    final String superiorType,
    final String equalityMatchingRule,
    final String orderingMatchingRule,
    final String substringMatchingRule,
    final String syntaxOID,
    final boolean singleValued,
    final boolean collective,
    final boolean noUserModification,
    final AttributeUsage usage,
    final Extensions extensions);

}