View Javadoc

1   /*
2    * Copyright 2004 Sun Microsystems, Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   */
17  package com.sun.syndication.feed.module;
18  
19  import com.sun.syndication.common.Enum;
20  import com.sun.syndication.common.impl.CopyFromHelper;
21  
22  import java.util.Collections;
23  import java.util.Date;
24  import java.util.HashMap;
25  import java.util.Map;
26  
27  /***
28   * Syndication ModuleImpl, default implementation.
29   * <p>
30   * @see <a href="http://web.resource.org/rss/1.0/modules/syndication/">Syndication module</a>.
31   * @author Alejandro Abdelnur
32   *
33   */
34  public class SyModuleImpl extends ModuleImpl implements SyModule {
35      private SyModule.Period _updatePeriod;
36      private int _updateFrequency;
37      private Date _updateBase;
38  
39      /***
40       * Default constructor. All properties are set to <b>null</b>.
41       * <p>
42       *
43       */
44      public SyModuleImpl() {
45          super(SyModule.class,URI);
46      }
47  
48      /***
49       * Returns the Syndication module update period.
50       * <p>
51       * @return the Syndication module update period, <b>null</b> if none.
52       *
53       */
54      public SyModule.Period getUpdatePeriod() {
55          return _updatePeriod;
56      }
57  
58      /***
59       * Sets the Syndication module update period.
60       * <p>
61       * @param updatePeriod the Syndication module update period to set, <b>null</b> if none.
62       *
63       */
64      public void setUpdatePeriod(SyModule.Period updatePeriod) {
65          _updatePeriod = updatePeriod;
66      }
67  
68      /***
69       * Returns the Syndication module update frequency.
70       * <p>
71       * @return the Syndication module update frequency, <b>null</b> if none.
72       *
73       */
74      public int getUpdateFrequency() {
75          return _updateFrequency;
76      }
77  
78      /***
79       * Sets the Syndication module update frequency.
80       * <p>
81       * @param updateFrequency the Syndication module update frequency to set, <b>null</b> if none.
82       *
83       */
84      public void setUpdateFrequency(int updateFrequency) {
85          _updateFrequency = updateFrequency;
86      }
87  
88      /***
89       * Returns the Syndication module update base date.
90       * <p>
91       * @return the Syndication module update base date, <b>null</b> if none.
92       *
93       */
94      public Date getUpdateBase() {
95          return _updateBase;
96      }
97  
98      /***
99       * Sets the Syndication module update base date.
100      * <p>
101      * @param updateBase the Syndication module update base date to set, <b>null</b> if none.
102      *
103      */
104     public void setUpdateBase(Date updateBase) {
105         _updateBase = updateBase;
106     }
107 
108     public Class getInterface() {
109         return SyModule.class;
110     }
111 
112     public void copyFrom(Object obj) {
113         COPY_FROM_HELPER.copy(this,obj);
114     }
115 
116     private static final CopyFromHelper COPY_FROM_HELPER;
117 
118     static {
119         Map basePropInterfaceMap = new HashMap();
120         basePropInterfaceMap.put("updatePeriod",Integer.TYPE);
121         basePropInterfaceMap.put("updateFrequency",Enum.class);
122         basePropInterfaceMap.put("updateBase",Date.class);
123 
124         Map basePropClassImplMap = Collections.EMPTY_MAP;
125 
126         COPY_FROM_HELPER = new CopyFromHelper(SyModule.class,basePropInterfaceMap,basePropClassImplMap);
127     }
128 
129 }