1 17 package com.sun.syndication.feed.synd; 18 19 import com.sun.syndication.feed.impl.ObjectBean; 20 import com.sun.syndication.feed.module.DCSubjectImpl; 21 import com.sun.syndication.feed.module.DCSubject; 22 23 import java.util.AbstractList ; 24 import java.util.List ; 25 import java.util.ArrayList ; 26 import java.io.Serializable ; 27 28 34 public class SyndCategoryImpl implements Serializable ,SyndCategory { 35 private ObjectBean _objBean; 36 private DCSubject _subject; 37 38 44 SyndCategoryImpl(DCSubject subject) { 45 _objBean = new ObjectBean(SyndCategory.class,this); 46 _subject = subject; 47 } 48 49 56 public Object clone() throws CloneNotSupportedException { 57 return _objBean.clone(); 58 } 59 60 67 public boolean equals(Object other) { 68 return _objBean.equals(other); 69 } 70 71 79 public int hashCode() { 80 return _objBean.hashCode(); 81 } 82 83 89 public String toString() { 90 return _objBean.toString(); 91 } 92 93 99 DCSubject getSubject() { 100 return _subject; 101 } 102 103 108 public SyndCategoryImpl() { 109 this(new DCSubjectImpl()); 110 } 111 112 118 public String getName() { 119 return _subject.getValue(); 120 } 121 122 128 public void setName(String name) { 129 _subject.setValue(name); 130 } 131 132 138 public String getTaxonomyUri() { 139 return _subject.getTaxonomyUri(); 140 } 141 142 148 public void setTaxonomyUri(String taxonomyUri) { 149 _subject.setTaxonomyUri(taxonomyUri); 150 } 151 152 } 153 154 155 171 class SyndCategoryListFacade extends AbstractList { 172 private List _subjects; 173 174 177 public SyndCategoryListFacade() { 178 this(new ArrayList ()); 179 } 180 181 187 public SyndCategoryListFacade(List subjects) { 188 _subjects = subjects; 189 } 190 191 198 public Object get(int index) { 199 return new SyndCategoryImpl((DCSubject) _subjects.get(index)); 200 } 201 202 208 public int size() { 209 return _subjects.size(); 210 } 211 212 220 public Object set(int index,Object obj) { 221 SyndCategoryImpl sCat = (SyndCategoryImpl) obj; 222 DCSubject subject = (sCat!=null) ? sCat.getSubject() : null; 223 subject = (DCSubject) _subjects.set(index,subject); 224 return (subject!=null) ? new SyndCategoryImpl(subject) : null; 225 } 226 227 234 public void add(int index,Object obj) { 235 SyndCategoryImpl sCat = (SyndCategoryImpl) obj; 236 DCSubject subject = (sCat!=null) ? sCat.getSubject() : null; 237 _subjects.add(index,subject); 238 } 239 240 247 public Object remove(int index) { 248 DCSubject subject = (DCSubject) _subjects.remove(index); 249 return (subject!=null) ? new SyndCategoryImpl(subject) : null; 250 } 251 252 260 public static List convertElementsSyndCategoryToSubject(List cList) { 261 List sList = null; 262 if (cList!=null) { 263 sList = new ArrayList (); 264 for (int i=0;i<cList.size();i++) { 265 SyndCategoryImpl sCat = (SyndCategoryImpl) cList.get(i); 266 DCSubject subject = null; 267 if (sCat!=null) { 268 subject = sCat.getSubject(); 269 } 270 sList.add(subject); 271 } 272 } 273 return sList; 274 } 275 276 } 277 | Popular Tags |