1 17 package com.sun.syndication.feed.module; 18 19 import com.sun.syndication.feed.impl.CopyFromHelper; 20 21 import java.util.*; 22 23 30 public class SyModuleImpl extends ModuleImpl implements SyModule { 31 private static final Set PERIODS = new HashSet(); 32 33 static { 34 PERIODS.add(HOURLY ); 35 PERIODS.add(DAILY ); 36 PERIODS.add(WEEKLY ); 37 PERIODS.add(MONTHLY); 38 PERIODS.add(YEARLY ); 39 } 40 41 42 private String _updatePeriod; 43 private int _updateFrequency; 44 private Date _updateBase; 45 46 51 public SyModuleImpl() { 52 super(SyModule.class,URI); 53 } 54 55 61 public String getUpdatePeriod() { 62 return _updatePeriod; 63 } 64 65 71 public void setUpdatePeriod(String updatePeriod) { 72 if (!PERIODS.contains(updatePeriod)) { 73 throw new IllegalArgumentException ("Invalid period ["+updatePeriod+"]"); 74 } 75 _updatePeriod = updatePeriod; 76 } 77 78 84 public int getUpdateFrequency() { 85 return _updateFrequency; 86 } 87 88 94 public void setUpdateFrequency(int updateFrequency) { 95 _updateFrequency = updateFrequency; 96 } 97 98 104 public Date getUpdateBase() { 105 return _updateBase; 106 } 107 108 114 public void setUpdateBase(Date updateBase) { 115 _updateBase = updateBase; 116 } 117 118 public Class getInterface() { 119 return SyModule.class; 120 } 121 122 public void copyFrom(Object obj) { 123 COPY_FROM_HELPER.copy(this,obj); 124 } 125 126 private static final CopyFromHelper COPY_FROM_HELPER; 127 128 static { 129 Map basePropInterfaceMap = new HashMap(); 130 basePropInterfaceMap.put("updatePeriod",String .class); 131 basePropInterfaceMap.put("updateFrequency",Integer.TYPE); 132 basePropInterfaceMap.put("updateBase",Date.class); 133 134 Map basePropClassImplMap = Collections.EMPTY_MAP; 135 136 COPY_FROM_HELPER = new CopyFromHelper(SyModule.class,basePropInterfaceMap,basePropClassImplMap); 137 } 138 139 } 140 | Popular Tags |