Return to Snippet

Revision: 64510
at August 15, 2013 23:43 by ff1959


Updated Code
/**
 * If the entry has the attribute {@code attributeType},
 * converts the attribute value specified by {@code attributeType}
 * to a {@code Date} and returns the date; otherwise returns {@code null}.
 *
 * @param attributeType
 *   The attribute type whose value will be converted 
 *   to a {@code Date}; must not be {@code null}.
 *
 * @return attributeType's value as a {@code Date}. 
 */
    private Date getTime(String attributeType) {
      return entry.hasAttribute(attributeType)
        ? entry.getAttributeValueAsDate(attributeType)
        : null;
    }

Revision: 64509
at August 15, 2013 23:21 by ff1959


Initial Code
/**
   * Retrieves the {@code loadStartTime} attribute value as a {@code Date} if
   * the attribute exists, {@code null} if it does not exist.
   *
   * @param entry
   *   The entry whose {@code loadStartTime} attribute value is
   *   converted to a {@code Date}.x
   *
   * @return The loadStartTime as a {@link Date}.
   *
   * @@throws NullPointerException if {@code entry} was {@code null}.
   */
  private Date getDate(ReadOnlyEntry entry) {
    if(entry == null) {
      throw new NullPointerException("entry was null.");
    }
    return entry.hasAttribute(ATTR_NAME_LOAD_START_TIME)
      ? entry.getAttributeValueAsDate(ATTR_NAME_LOAD_START_TIME)
      : null;
  }
}

Initial URL


Initial Description
Use UnboundID LDAP SDK entry.getAttributeValueAsDate()

Initial Title
Convert LDAP attribute generalizedTimeSyntax to Date

Initial Tags


Initial Language
Java