1 17 package com.sun.syndication.feed.atom; 18 19 import com.sun.syndication.feed.impl.ObjectBean; 20 21 import java.io.Serializable ; 22 import java.util.HashSet ; 23 import java.util.Set ; 24 25 31 public class Content implements Cloneable ,Serializable { 32 public static final String XML = "xml"; 33 public static final String BASE64 = "base64"; 34 public static final String ESCAPED = "escaped"; 35 36 private static final Set MODES = new HashSet (); 37 38 static { 39 MODES.add(XML); 40 MODES.add(BASE64); 41 MODES.add(ESCAPED); 42 } 43 44 private ObjectBean _objBean; 45 private String _type; 46 private String _mode; 47 private String _value; 48 49 54 public Content() { 55 _objBean = new ObjectBean(this.getClass(),this); 56 } 57 58 65 public Object clone() throws CloneNotSupportedException { 66 return _objBean.clone(); 67 } 68 69 76 public boolean equals(Object other) { 77 return _objBean.equals(other); 78 } 79 80 88 public int hashCode() { 89 return _objBean.hashCode(); 90 } 91 92 98 public String toString() { 99 return _objBean.toString(); 100 } 101 102 108 public String getType() { 109 return _type; 110 } 111 112 118 public void setType(String type) { 119 _type = type; 120 } 121 122 130 public String getMode() { 131 return _mode; 132 } 133 134 142 public void setMode(String mode) { 143 mode = (mode!=null) ? mode.toLowerCase() : null; 144 if (mode==null || !MODES.contains(mode)) { 145 throw new IllegalArgumentException ("Invalid mode ["+mode+"]"); 146 } 147 _mode = mode; 148 } 149 150 158 public String getValue() { 159 return _value; 160 } 161 162 170 public void setValue(String value) { 171 _value = value; 172 } 173 174 } 175 176 177 | Popular Tags |