Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   *  Copyright 2001-2005 Stephen Colebourne
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  *  Unless required by applicable law or agreed to in writing, software
  *  distributed under the License is distributed on an "AS IS" BASIS,
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
 package org.joda.time.field;
 
DecoratedDateTimeField extends BaseDateTimeField, implementing only the minimum required set of methods. These implemented methods delegate to a wrapped field.

This design allows new DateTimeField types to be defined that piggyback on top of another, inheriting all the safe method implementations from BaseDateTimeField. Should any method require pure delegation to the wrapped field, simply override and use the provided getWrappedField method.

DecoratedDateTimeField is thread-safe and immutable, and its subclasses must be as well.

Author(s):
Brian S O'Neill
Since:
1.0
See also:
DelegatedDateTimeField
 
 public abstract class DecoratedDateTimeField extends BaseDateTimeField {

    
Serialization version
 
     private static final long serialVersionUID = 203115783733757597L;

    
The DateTimeField being wrapped
 
     private final DateTimeField iField;

    
Constructor.

Parameters:
field the field being decorated
type allow type to be overridden
 
     protected DecoratedDateTimeField(DateTimeField fieldDateTimeFieldType type) {
         super(type);
         if (field == null) {
             throw new IllegalArgumentException("The field must not be null");
         }
         if (!field.isSupported()) {
             throw new IllegalArgumentException("The field must be supported");
         }
          = field;
     }

    
Gets the wrapped date time field.

Returns:
the wrapped DateTimeField
 
     public final DateTimeField getWrappedField() {
         return ;
     }
 
     public boolean isLenient() {
         return .isLenient();
     }
 
     public int get(long instant) {
         return .get(instant);
     }
 
     public long set(long instantint value) {
         return .set(instantvalue);
     }
 
     public DurationField getDurationField() {
         return .getDurationField();
     }
 
     public DurationField getRangeDurationField() {
         return .getRangeDurationField();
     }
 
     public int getMinimumValue() {
         return .getMinimumValue();
     }
 
     public int getMaximumValue() {
         return .getMaximumValue();
     }
    public long roundFloor(long instant) {
        return .roundFloor(instant);
    }
New to GrepCode? Check out our FAQ X