View Javadoc

1   /*
2    *  Copyright 2001-2007 Stephen Colebourne
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 org.joda.time.base;
17  
18  /**
19   * BaseLocal is an abstract implementation of ReadablePartial that
20   * use a local milliseconds internal representation.
21   * <p>
22   * This class should generally not be used directly by API users.
23   * The {@link org.joda.time.ReadablePartial} interface should be used when different 
24   * kinds of partial objects are to be referenced.
25   * <p>
26   * BasePartial subclasses may be mutable and not thread-safe.
27   *
28   * @author Stephen Colebourne
29   * @since 1.5
30   */
31  public abstract class BaseLocal
32          extends AbstractPartial {
33  
34      /** Serialization version */
35      private static final long serialVersionUID = 276453175381783L;
36  
37      //-----------------------------------------------------------------------
38      /**
39       * Constructs a partial with the current time, using ISOChronology in
40       * the default zone to extract the fields.
41       * <p>
42       * The constructor uses the default time zone, resulting in the local time
43       * being initialised. Once the constructor is complete, all further calculations
44       * are performed without reference to a timezone (by switching to UTC).
45       */
46      protected BaseLocal() {
47          super();
48      }
49  
50      //-----------------------------------------------------------------------
51      /**
52       * Gets the local milliseconds from the Java epoch
53       * of 1970-01-01T00:00:00 (not fixed to any specific time zone).
54       * <p>
55       * This method is useful in certain circustances for high performance
56       * access to the datetime fields.
57       * 
58       * @return the number of milliseconds since 1970-01-01T00:00:00
59       */
60      protected abstract long getLocalMillis();
61  
62  }