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.synd;
18  
19  import com.sun.syndication.feed.WireFeed;
20  import com.sun.syndication.feed.synd.SyndFeed;
21  
22  /***
23   * Interface that defines the functionality to convert a SyndFeedImpl
24   * to a real feed (RSS or Atom) and vice versa.
25   * <p>
26   * Each implementation knows how to deal with a specific type (version)
27   * of a real feed.
28   * <p>
29   * Implementations must be thread safe.
30   * <p>
31   * TODO: explain how developers can plugin their own implementations.
32   * <p>
33   * @author Alejandro Abdelnur
34   *
35   */
36  public interface Converter {
37  
38      /***
39       * Returns the type (version) of the real feed this converter handles.
40       * <p>
41       * @see WireFeed for details on the format of this string.
42       * <p>
43       * @return the real feed type.
44       *
45       */
46      public String getType();
47  
48      /***
49       * Makes a deep copy/conversion of the values of a real feed into a SyndFeedImpl.
50       * <p>
51       * It assumes the given SyndFeedImpl has no properties set.
52       * <p>
53       * @param feed real feed to copy/convert.
54       * @param syndFeed the SyndFeedImpl that will contain the copied/converted values of the real feed.
55       *
56       */
57      public void copyInto(WireFeed feed,SyndFeed syndFeed);
58  
59      /***
60       * Creates real feed with a deep copy/conversion of the values of a SyndFeedImpl.
61       * <p>
62       * @param syndFeed SyndFeedImpl to copy/convert value from.
63       * @return a real feed with copied/converted values of the SyndFeedImpl.
64       *
65       */
66      public WireFeed createRealFeed(SyndFeed syndFeed);
67  
68  }