001: /*
002: * Portions Copyright 2000-2007 Sun Microsystems, Inc. All Rights
003: * Reserved. Use is subject to license terms.
004: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
005: *
006: * This program is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU General Public License version
008: * 2 only, as published by the Free Software Foundation.
009: *
010: * This program is distributed in the hope that it will be useful, but
011: * WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * General Public License version 2 for more details (a copy is
014: * included at /legal/license.txt).
015: *
016: * You should have received a copy of the GNU General Public License
017: * version 2 along with this work; if not, write to the Free Software
018: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
019: * 02110-1301 USA
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
022: * Clara, CA 95054 or visit www.sun.com if you need additional
023: * information or have any questions.
024: */
025: /*
026: */
027: package gov.nist.javax.sdp.fields;
028:
029: import gov.nist.core.*;
030: import gov.nist.javax.sdp.*;
031:
032: /**
033: * Information field implementation
034: * @version JSR141-PUBLIC-REVIEW (subject to change)
035: *
036: */
037:
038: public class InformationField extends SDPField {
039: /** Additional textual description. */
040: protected String information;
041:
042: /** Default constructor. */
043: public InformationField() {
044: super (INFORMATION_FIELD);
045: }
046:
047: /**
048: * Gets the information field.
049: * @return the information member
050: */
051: public String getInformation() {
052: return information;
053: }
054:
055: /**
056: * Sets the extra descriptive information.
057: * @param info the new descriptive text
058: */
059: public void setInformation(String info) {
060: information = info;
061: }
062:
063: /**
064: * Copies the current instance.
065: * @return the copy of this object
066: */
067: public Object clone() {
068: InformationField retval = new InformationField();
069: retval.information = this .information;
070: return retval;
071: }
072:
073: /**
074: * Gets the string encoded version of this object.
075: * @return the encode string of object contents
076: * @since v1.0
077: */
078: public String encode() {
079: return INFORMATION_FIELD + information + Separators.NEWLINE;
080: }
081:
082: /**
083: * Returns the information value.
084: * @throws SdpParseException if a parsing error occurs
085: * @return the value
086: */
087: public String getValue() throws SdpParseException {
088: return information;
089: }
090:
091: /**
092: * Sets the value.
093: * @param value to set
094: * @throws SdpException if the value is null
095: */
096: public void setValue(String value) throws SdpException {
097: if (value == null)
098: throw new SdpException("The value is null");
099: else {
100: setInformation(value);
101: }
102: }
103:
104: }
|