Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   *  Copyright 2001-2013 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.chrono;
 
 
GJDayOfWeekDateTimeField provides time calculations for the day of the week component of time.

Author(s):
Guy Allard
Stephen Colebourne
Brian S O'Neill
Since:
1.0
 
 final class GJDayOfWeekDateTimeField extends PreciseDurationDateTimeField {
    
    
Serialization version
 
     @SuppressWarnings("unused")
     private static final long serialVersionUID = -3857947176719041436L;
 
     private final BasicChronology iChronology;

    
Restricted constructor.
 
     GJDayOfWeekDateTimeField(BasicChronology chronologyDurationField days) {
         super(DateTimeFieldType.dayOfWeek(), days);
          = chronology;
     }

    
Get the value of the specified time instant.

Parameters:
instant the time instant in millis to query
Returns:
the day of the week extracted from the input
 
     public int get(long instant) {
         return .getDayOfWeek(instant);
     }

    
Get the textual value of the specified time instant.

Parameters:
fieldValue the field value to query
locale the locale to use
Returns:
the day of the week, such as 'Monday'
 
     public String getAsText(int fieldValueLocale locale) {
         return GJLocaleSymbols.forLocale(locale).dayOfWeekValueToText(fieldValue);
     }

    
Get the abbreviated textual value of the specified time instant.

Parameters:
fieldValue the field value to query
locale the locale to use
Returns:
the day of the week, such as 'Mon'
 
     public String getAsShortText(int fieldValueLocale locale) {
         return GJLocaleSymbols.forLocale(locale).dayOfWeekValueToShortText(fieldValue);
     }

    
Convert the specified text and locale into a value.

Parameters:
text the text to convert
locale the locale to convert using
Returns:
the value extracted from the text
Throws:
java.lang.IllegalArgumentException if the text is invalid
 
     protected int convertText(String textLocale locale) {
         return GJLocaleSymbols.forLocale(locale).dayOfWeekTextToValue(text);
     }
 
     public DurationField getRangeDurationField() {
         return .weeks();
     }

    
Get the minimum value that this field can have.

Returns:
the field's minimum value
    public int getMinimumValue() {
        return .;
    }

    
Get the maximum value that this field can have.

Returns:
the field's maximum value
    public int getMaximumValue() {
        return .;
    }

    
Get the maximum length of the text returned by this field.

Parameters:
locale the locale to use
Returns:
the maximum textual length
    public int getMaximumTextLength(Locale locale) {
        return GJLocaleSymbols.forLocale(locale).getDayOfWeekMaxTextLength();
    }

    
Get the maximum length of the abbreviated text returned by this field.

Parameters:
locale the locale to use
Returns:
the maximum abbreviated textual length
    public int getMaximumShortTextLength(Locale locale) {
        return GJLocaleSymbols.forLocale(locale).getDayOfWeekMaxShortTextLength();
    }

    
Serialization singleton
    private Object readResolve() {
        return .dayOfWeek();
    }
New to GrepCode? Check out our FAQ X