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 legal-notices/CDDLv1_0.txt 010 * or http://forgerock.org/license/CDDLv1.0.html. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file and include the License file at legal-notices/CDDLv1_0.txt. 016 * If applicable, add the following below this CDDL HEADER, with the 017 * fields enclosed by brackets "[]" replaced with your own identifying 018 * information: 019 * Portions Copyright [yyyy] [name of copyright owner] 020 * 021 * CDDL HEADER END 022 * 023 * 024 * Copyright 2006-2008 Sun Microsystems, Inc. 025 * Portions Copyright 2015 ForgeRock AS. 026 */ 027package org.opends.server.tools.makeldif; 028 029 030 031import org.opends.server.types.AttributeType; 032 033 034 035/** 036 * This class defines a value generated from a template line. 037 */ 038public 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