Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   *  Copyright 2001-2009 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;
 
 
DelegatedDurationField delegates each method call to the duration field it wraps.

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

Author(s):
Brian S O'Neill
Since:
1.0
See also:
DecoratedDurationField
 
 public class DelegatedDurationField extends DurationField implements Serializable {

    
Serialization lock.
 
     private static final long serialVersionUID = -5576443481242007829L;

    
The DurationField being wrapped
 
     private final DurationField iField;
    
The field type
 
     private final DurationFieldType iType;

    
Constructor.

Parameters:
field the base field
 
     protected DelegatedDurationField(DurationField field) {
         this(fieldnull);
     }

    
Constructor.

Parameters:
field the base field
type the field type to use
 
     protected DelegatedDurationField(DurationField fieldDurationFieldType type) {
         super();
         if (field == null) {
             throw new IllegalArgumentException("The field must not be null");
         }
          = field;
          = (type == null ? field.getType() : type);
     }
 
     //-----------------------------------------------------------------------
     
Gets the wrapped duration field.

Returns:
the wrapped DurationField
 
     public final DurationField getWrappedField() {
         return ;
     }
 
     public DurationFieldType getType() {
         return ;
     }
 
     public String getName() {
         return .getName();
     }

    
Returns true if this field is supported.
 
     public boolean isSupported() {
         return .isSupported();
     }
 
     public boolean isPrecise() {
         return .isPrecise();
     }
     
     public int getValue(long duration) {
         return .getValue(duration);
     }
    public long getValueAsLong(long duration) {
        return .getValueAsLong(duration);
    }
    public int getValue(long durationlong instant) {
        return .getValue(durationinstant);
    }
    public long getValueAsLong(long durationlong instant) {
        return .getValueAsLong(durationinstant);
    }
    public long getMillis(int value) {
        return .getMillis(value);
    }
    public long getMillis(long value) {
        return .getMillis(value);
    }
    public long getMillis(int valuelong instant) {
        return .getMillis(valueinstant);
    }
    public long getMillis(long valuelong instant) {
        return .getMillis(valueinstant);
    }
    public long add(long instantint value) {
        return .add(instantvalue);
    }
    public long add(long instantlong value) {
        return .add(instantvalue);
    }
    public int getDifference(long minuendInstantlong subtrahendInstant) {
        return .getDifference(minuendInstantsubtrahendInstant);
    }
    public long getDifferenceAsLong(long minuendInstantlong subtrahendInstant) {
        return .getDifferenceAsLong(minuendInstantsubtrahendInstant);
    }
    public long getUnitMillis() {
        return .getUnitMillis();
    }
    public int compareTo(DurationField durationField) {
        return .compareTo(durationField);
    }
    public boolean equals(Object obj) {
        if (obj instanceof DelegatedDurationField) {
            return .equals(((DelegatedDurationFieldobj).);
        }
        return false;
    }
    public int hashCode() {
        return .hashCode() ^ .hashCode();
    }
    public String toString() {
        return ( == null) ? .toString() :
            ("DurationField[" +  + ']');
    }
New to GrepCode? Check out our FAQ X