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.tools.makeldif; 018 019 020 021import org.forgerock.opendj.ldap.schema.AttributeType; 022 023 024 025/** 026 * This class defines a value generated from a template line. 027 */ 028public class TemplateValue 029{ 030 /** The generated template value. */ 031 private StringBuilder templateValue; 032 033 /** The template line used to generate this value. */ 034 private TemplateLine templateLine; 035 036 037 038 /** 039 * Creates a new template value with the provided information. 040 * 041 * @param templateLine The template line used to generate this value. 042 */ 043 public TemplateValue(TemplateLine templateLine) 044 { 045 this.templateLine = templateLine; 046 047 templateValue = new StringBuilder(); 048 } 049 050 051 052 /** 053 * Retrieves the template line used to generate this value. 054 * 055 * @return The template line used to generate this value. 056 */ 057 public TemplateLine getTemplateLine() 058 { 059 return templateLine; 060 } 061 062 063 064 /** 065 * Retrieves the attribute type for this template value. 066 * 067 * @return The attribute type for this template value. 068 */ 069 public AttributeType getAttributeType() 070 { 071 return templateLine.getAttributeType(); 072 } 073 074 075 076 /** 077 * Retrieves the generated value. 078 * 079 * @return The generated value. 080 */ 081 public StringBuilder getValue() 082 { 083 return templateValue; 084 } 085 086 087 088 /** 089 * Appends the provided string to this template value. 090 * 091 * @param s The string to append to the template value. 092 */ 093 public void append(String s) 094 { 095 templateValue.append(s); 096 } 097} 098