001 /**
002 * GRANITE DATA SERVICES
003 * Copyright (C) 2006-2013 GRANITE DATA SERVICES S.A.S.
004 *
005 * This file is part of the Granite Data Services Platform.
006 *
007 * Granite Data Services is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * Granite Data Services is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
015 * General Public License for more details.
016 *
017 * You should have received a copy of the GNU Lesser General Public
018 * License along with this library; if not, write to the Free Software
019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
020 * USA, or see <http://www.gnu.org/licenses/>.
021 */
022 /*
023 * www.openamf.org
024 *
025 * Distributable under LGPL license.
026 * See terms of license at gnu.org.
027 */
028
029 package org.granite.messaging.amf;
030
031 import java.io.Serializable;
032
033 /**
034 * AMF Header
035 *
036 * @author Jason Calabrese <jasonc@missionvi.com>
037 * @author Pat Maddox <pergesu@users.sourceforge.net>
038 * @see AMF0Body
039 * @see AMF0Message
040 * @version $Revision: 1.8 $, $Date: 2003/08/16 13:11:16 $
041 */
042 public class AMF0Header implements Serializable {
043
044 private static final long serialVersionUID = 1L;
045
046 protected String key;
047 protected boolean required;
048 protected Object value;
049
050 public AMF0Header(String key, boolean required, Object value) {
051 this.key = key;
052 this.required = required;
053 this.value = value;
054 }
055
056 public String getKey() {
057 return key;
058 }
059
060 public void setKey(String key) {
061 this.key = key;
062 }
063
064 public boolean isRequired() {
065 return required;
066 }
067
068 public void setRequired(boolean required) {
069 this.required = required;
070 }
071
072 public Object getValue() {
073 return value;
074 }
075
076 public void setValue(Object value) {
077 this.value = value;
078 }
079
080 @Override
081 public String toString() {
082 return toString("");
083 }
084
085 public String toString(String indent) {
086 return (new StringBuilder()
087 .append(indent).append(AMF0Header.class.getName()).append(" {")
088 .append('\n').append(indent).append(" key = ").append(key)
089 .append('\n').append(indent).append(" required = ").append(required)
090 .append('\n').append(indent).append(" value = ").append(value)
091 .append('\n').append(indent).append("}")
092 .toString()
093 );
094 }
095
096 }