mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

matthew_swift
04.33.2009 0cc40b0c847f78964d74a675b829a29c6d3f3a87
Add some missing constructors.
1 files modified
79 ■■■■■ changed files
sdk/src/org/opends/sdk/RDN.java 79 ●●●●● patch | view | raw | blame | history
sdk/src/org/opends/sdk/RDN.java
@@ -62,8 +62,6 @@
 *
 * The last is an example of a multi-valued RDN; that is, an RDN
 * composed of multiple AVAs.
 * <p>
 * TODO: need more constructors.
 *
 * @see <a href="http://tools.ietf.org/html/rfc4512#section-2.3">RFC
 *      4512 - Lightweight Directory Access Protocol (LDAP): Directory
@@ -108,6 +106,37 @@
    /**
     * Creates a new attribute value assertion (AVA) using the provided
     * attribute type and value decoded using the default schema.
     * <p>
     * If {@code attributeValue} is not an instance of {@code
     * ByteString} then it will be converted using the
     * {@link ByteString#valueOf(Object)} method.
     *
     * @param attributeType
     *          The attribute type.
     * @param attributeValue
     *          The attribute value.
     * @throws UnknownSchemaElementException
     *           If {@code attributeType} was not found in the default
     *           schema.
     * @throws NullPointerException
     *           If {@code attributeType} or {@code attributeValue} was
     *           {@code null}.
     */
    public AVA(String attributeType, Object attributeValue)
        throws UnknownSchemaElementException, NullPointerException
    {
      Validator.ensureNotNull(attributeType, attributeValue);
      this.attributeType = Schema.getDefaultSchema().getAttributeType(
          attributeType);
      this.attributeValue = ByteString.valueOf(attributeValue);
    }
    /**
     * {@inheritDoc}
     */
    public int compareTo(AVA ava)
@@ -675,6 +704,52 @@
  /**
   * Creates a new RDN using the provided attribute type and value.
   *
   * @param attributeType
   *          The attribute type.
   * @param attributeValue
   *          The attribute value.
   * @throws NullPointerException
   *           If {@code attributeType} or {@code attributeValue} was
   *           {@code null}.
   */
  public RDN(AttributeType attributeType, ByteString attributeValue)
      throws NullPointerException
  {
    this.avas = new AVA[] { new AVA(attributeType, attributeValue) };
  }
  /**
   * Creates a new RDN using the provided attribute type and value
   * decoded using the default schema.
   * <p>
   * If {@code attributeValue} is not an instance of {@code ByteString}
   * then it will be converted using the
   * {@link ByteString#valueOf(Object)} method.
   *
   * @param attributeType
   *          The attribute type.
   * @param attributeValue
   *          The attribute value.
   * @throws UnknownSchemaElementException
   *           If {@code attributeType} was not found in the default
   *           schema.
   * @throws NullPointerException
   *           If {@code attributeType} or {@code attributeValue} was
   *           {@code null}.
   */
  public RDN(String attributeType, Object attributeValue)
      throws UnknownSchemaElementException, NullPointerException
  {
    this.avas = new AVA[] { new AVA(attributeType, attributeValue) };
  }
  private RDN(AVA[] avas, String stringValue)
  {
    this.avas = avas;