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 ForgeRock AS.
016 */
017package org.opends.server.api;
018
019
020
021/**
022 * This interface defines a set of methods that must be implemented by
023 * any class that forms the basis for a protocol element (e.g., an
024 * ASN.1 element, an LDAP message, etc.).
025 */
026@org.opends.server.types.PublicAPI(
027     stability=org.opends.server.types.StabilityLevel.VOLATILE,
028     mayInstantiate=false,
029     mayExtend=true,
030     mayInvoke=true)
031public interface ProtocolElement
032{
033  /**
034   * Retrieves the name of the protocol associated with this protocol
035   * element.
036   *
037   * @return  The name of the protocol associated with this protocol
038   *          element.
039   */
040  String getProtocolElementName();
041
042
043
044  /**
045   * Retrieves a string representation of this protocol element.
046   *
047   * @return  A string representation of this protocol element.
048   */
049  String toString();
050
051
052
053  /**
054   * Appends a string representation of this protocol element to the
055   * provided buffer.
056   *
057   * @param  buffer  The buffer into which the string representation
058   *                 should be written.
059   */
060  void toString(StringBuilder buffer);
061
062
063
064  /**
065   * Appends a string representation of this protocol element to the
066   * provided buffer.
067   *
068   * @param  buffer  The buffer into which the string representation
069   *                 should be written.
070   * @param  indent  The number of spaces that should be used to
071   *                 indent the resulting string representation.
072   */
073  void toString(StringBuilder buffer, int indent);
074}
075