001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2006-2008 Sun Microsystems, Inc.
015 * Portions Copyright 2015-2016 ForgeRock AS.
016 */
017package org.opends.server.api;
018
019/**
020 * This interface defines a set of methods that must be implemented by
021 * any class that forms the basis for a protocol element (e.g., an
022 * ASN.1 element, an LDAP message, etc.).
023 */
024@org.opends.server.types.PublicAPI(
025     stability=org.opends.server.types.StabilityLevel.VOLATILE,
026     mayExtend=true,
027     mayInvoke=true)
028public interface ProtocolElement
029{
030  /**
031   * Retrieves the name of the protocol associated with this protocol element.
032   *
033   * @return  The name of the protocol associated with this protocol element.
034   */
035  String getProtocolElementName();
036
037  /**
038   * Appends a string representation of this protocol element to the
039   * provided buffer.
040   *
041   * @param  buffer  The buffer into which the string representation
042   *                 should be written.
043   */
044  void toString(StringBuilder buffer);
045
046  /**
047   * Appends a string representation of this protocol element to the
048   * provided buffer.
049   *
050   * @param  buffer  The buffer into which the string representation
051   *                 should be written.
052   * @param  indent  The number of spaces that should be used to
053   *                 indent the resulting string representation.
054   */
055  void toString(StringBuilder buffer, int indent);
056}