1 /* 2 * dpkg - Debian Package library and the Debian Package Maven plugin 3 * (c) Copyright 2016 Gerrit Hohl 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License 7 * as published by the Free Software Foundation; either version 2 8 * of the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 */ 19 package net.sourceforge.javadpkg.field; 20 21 22 /** 23 * <p> 24 * A field having a name and a value. 25 * </p> 26 * <p> 27 * The name and value of empty fields are <code>null</code>. These fields 28 * represents empty lines in the source / target. 29 * </p> 30 * <p> 31 * The value can contain newlines. 32 * </p> 33 * 34 * @author Gerrit Hohl (gerrit-hohl@users.sourceforge.net) 35 * @version <b>1.0</b>, 03.01.2016 by Gerrit Hohl 36 */ 37 public interface Field { 38 39 40 /** 41 * <p> 42 * Returns the name. 43 * </p> 44 * 45 * @return The name or <code>null</code>, if the field is an empty field or 46 * a nameless field. 47 * @see #isEmpty() 48 * @see #isNameless() 49 */ 50 String getName(); 51 52 53 /** 54 * <p> 55 * Returns the flag if the field has no name. 56 * </p> 57 * <p> 58 * An nameless field has no name, but a value. 59 * </p> 60 * 61 * @return The flag: <code>true</code>, if the field has no name, 62 * <code>false</code> otherwise. 63 * @see #getName() 64 */ 65 boolean isNameless(); 66 67 68 /** 69 * <p> 70 * Returns the value. 71 * </p> 72 * <p> 73 * The value can contain newlines. 74 * </p> 75 * 76 * @return The value or <code>null</code>, if the field is an empty field. 77 * @see #isEmpty() 78 */ 79 String getValue(); 80 81 82 /** 83 * <p> 84 * Returns the value. 85 * </p> 86 * <p> 87 * The value can contain newlines. All "." lines are replaced by 88 * empty lines. 89 * </p> 90 * 91 * @return The value or <code>null</code>, if the field is an empty field. 92 * @see #isEmpty() 93 */ 94 String getFormattedValue(); 95 96 97 /** 98 * <p> 99 * Returns the flag if the field is an empty field. 100 * </p> 101 * <p> 102 * An empty field has no name and no value. 103 * </p> 104 * 105 * @return The flag: <code>true</code>, if the field is an empty field. 106 * @see #getName() 107 * @see #getValue() 108 */ 109 boolean isEmpty(); 110 111 112 }