View Javadoc

1   /*
2    * Copyright 2008 the original author or authors.
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  package net.sf.jdigg.arguments;
17  
18  /**
19   * Abstract base class for arguments with 'sort', 'count', 'offset', 'minDate' and 'maxDate'.
20   * <p>Please read this before you use the API:
21   * <a href="http://apidoc.digg.com/BasicConcepts#BePolitePlease">Be Polite, Please!</a></p>
22   * @author Philip May
23   * @since 1.0 M1
24   */
25  public abstract class AbstractSortCountOffsetMinMaxDateArguments extends AbstractSortCountOffsetArguments {
26  
27      private static final String MIN_DATE_NAME = "min_date";
28  
29      private static final String MAX_DATE_NAME = "max_date";
30  
31      public AbstractSortCountOffsetMinMaxDateArguments(String appkey) {
32          super(appkey);
33      }
34  
35      /**
36       * Get results within a time period.
37       * @param minDate Unix epoch integer
38       * @see net.sf.jdigg.util.DateUtil
39       */
40      public final void setMinDate(long minDate) {
41          addArgument(MIN_DATE_NAME, String.valueOf(minDate));
42      }
43  
44      /**
45       * Get results within a time period.
46       * @param maxDate Unix epoch integer
47       * @see net.sf.jdigg.util.DateUtil
48       */
49      public final void setMaxDate(long maxDate) {
50          addArgument(MAX_DATE_NAME, String.valueOf(maxDate));
51      }
52  
53  }