001    /*
002     * CDDL HEADER START
003     *
004     * The contents of this file are subject to the terms of the
005     * Common Development and Distribution License, Version 1.0 only
006     * (the "License").  You may not use this file except in compliance
007     * with the License.
008     *
009     * You can obtain a copy of the license at
010     * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011     * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Copyright 2006-2008 Sun Microsystems, Inc.
026     */
027    package org.opends.server.tools.makeldif;
028    
029    
030    
031    import org.opends.server.types.AttributeType;
032    
033    
034    
035    /**
036     * This class defines a value generated from a template line.
037     */
038    public class TemplateValue
039    {
040      // The generated template value.
041      private StringBuilder templateValue;
042    
043      // The template line used to generate this value.
044      private TemplateLine templateLine;
045    
046    
047    
048      /**
049       * Creates a new template value with the provided information.
050       *
051       * @param  templateLine  The template line used to generate this value.
052       */
053      public TemplateValue(TemplateLine templateLine)
054      {
055        this.templateLine = templateLine;
056    
057        templateValue = new StringBuilder();
058      }
059    
060    
061    
062      /**
063       * Retrieves the template line used to generate this value.
064       *
065       * @return  The template line used to generate this value.
066       */
067      public TemplateLine getTemplateLine()
068      {
069        return templateLine;
070      }
071    
072    
073    
074      /**
075       * Retrieves the attribute type for this template value.
076       *
077       * @return  The attribute type for this template value.
078       */
079      public AttributeType getAttributeType()
080      {
081        return templateLine.getAttributeType();
082      }
083    
084    
085    
086      /**
087       * Retrieves the generated value.
088       *
089       * @return  The generated value.
090       */
091      public StringBuilder getValue()
092      {
093        return templateValue;
094      }
095    
096    
097    
098      /**
099       * Appends the provided string to this template value.
100       *
101       * @param  s  The string to append to the template value.
102       */
103      public void append(String s)
104      {
105        templateValue.append(s);
106      }
107    }
108