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()); 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())); } if (m.group(15) != null) { atd.setExtensions(Extensions.parse(m.group(15).trim())); } return atd; } AttributeType(final String s);  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); String getOID(); String getSuperiorType(); void setSuperiorType(final String s); String getEqualityMatchingRule(); void setEqualityMatchingRule(final String s); String getOrderingMatchingRule(); void setOrderingMatchingRule(final String s); String getSubstringMatchingRule(); void setSubstringMatchingRule(final String s); String getSyntaxOID(); String getSyntaxOID(final boolean withBoundCount); int getSyntaxOIDBoundCount(); void setSyntaxOID(final String s); boolean isSingleValued(); void setSingleValued(final boolean b); boolean isCollective(); void setCollective(final boolean b); boolean isNoUserModification(); void setNoUserModification(final boolean b); AttributeUsage getUsage(); void setUsage(final AttributeUsage u); static AttributeType parse(final String definition); @Override String format(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }
@Test(groups = "schema", dataProvider = "definitions") public void parse(final AttributeType type, final String definition) throws Exception { final AttributeType parsed = AttributeType.parse(definition); Assert.assertEquals(type, parsed); Assert.assertEquals(definition, parsed.format()); Assert.assertEquals(type.format(), parsed.format()); }