Java Code Examples for org.joda.time.DateTimeField#getType()

The following examples show how to use org.joda.time.DateTimeField#getType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GJChronology.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param julianField field from the chronology used before the cutover instant
 * @param gregorianField field from the chronology used at and after the cutover
 * @param rangeField  the range field
 * @param cutoverMillis  the millis of the cutover
 * @param convertByWeekyear
 */
CutoverField(DateTimeField julianField, DateTimeField gregorianField,
             DurationField rangeField, long cutoverMillis, boolean convertByWeekyear) {
    super(gregorianField.getType());
    iJulianField = julianField;
    iGregorianField = gregorianField;
    iCutover = cutoverMillis;
    iConvertByWeekyear = convertByWeekyear;
    // Although average length of Julian and Gregorian years differ,
    // use the Gregorian duration field because it is more accurate.
    iDurationField = gregorianField.getDurationField();
    if (rangeField == null) {
        rangeField = gregorianField.getRangeDurationField();
        if (rangeField == null) {
            rangeField = julianField.getRangeDurationField();
        }
    }
    iRangeDurationField = rangeField;
}
 
Example 2
Source File: ZonedChronology.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
ZonedDateTimeField(DateTimeField field,
                   DateTimeZone zone,
                   DurationField durationField,
                   DurationField rangeDurationField,
                   DurationField leapDurationField) {
    super(field.getType());
    if (!field.isSupported()) {
        throw new IllegalArgumentException();
    }
    iField = field;
    iZone = zone;
    iDurationField = durationField;
    iTimeField = useTimeArithmetic(durationField);
    iRangeDurationField = rangeDurationField;
    iLeapDurationField = leapDurationField;
}
 
Example 3
Source File: Time_18_GJChronology_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * @param julianField field from the chronology used before the cutover instant
 * @param gregorianField field from the chronology used at and after the cutover
 * @param cutoverMillis  the millis of the cutover
 * @param convertByWeekyear
 */
CutoverField(DateTimeField julianField, DateTimeField gregorianField,
             long cutoverMillis, boolean convertByWeekyear) {
    super(gregorianField.getType());
    iJulianField = julianField;
    iGregorianField = gregorianField;
    iCutover = cutoverMillis;
    iConvertByWeekyear = convertByWeekyear;
    // Although average length of Julian and Gregorian years differ,
    // use the Gregorian duration field because it is more accurate.
    iDurationField = gregorianField.getDurationField();

    DurationField rangeField = gregorianField.getRangeDurationField();
    if (rangeField == null) {
        rangeField = julianField.getRangeDurationField();
    }
    iRangeDurationField = rangeField;
}
 
Example 4
Source File: Time_18_GJChronology_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * @param julianField field from the chronology used before the cutover instant
 * @param gregorianField field from the chronology used at and after the cutover
 * @param cutoverMillis  the millis of the cutover
 * @param convertByWeekyear
 */
CutoverField(DateTimeField julianField, DateTimeField gregorianField,
             long cutoverMillis, boolean convertByWeekyear) {
    super(gregorianField.getType());
    iJulianField = julianField;
    iGregorianField = gregorianField;
    iCutover = cutoverMillis;
    iConvertByWeekyear = convertByWeekyear;
    // Although average length of Julian and Gregorian years differ,
    // use the Gregorian duration field because it is more accurate.
    iDurationField = gregorianField.getDurationField();

    DurationField rangeField = gregorianField.getRangeDurationField();
    if (rangeField == null) {
        rangeField = julianField.getRangeDurationField();
    }
    iRangeDurationField = rangeField;
}
 
Example 5
Source File: ZonedChronology.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
ZonedDateTimeField(DateTimeField field,
                   DateTimeZone zone,
                   DurationField durationField,
                   DurationField rangeDurationField,
                   DurationField leapDurationField) {
    super(field.getType());
    if (!field.isSupported()) {
        throw new IllegalArgumentException();
    }
    iField = field;
    iZone = zone;
    iDurationField = durationField;
    iTimeField = useTimeArithmetic(durationField);
    iRangeDurationField = rangeDurationField;
    iLeapDurationField = leapDurationField;
}
 
Example 6
Source File: GJChronology.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param julianField field from the chronology used before the cutover instant
 * @param gregorianField field from the chronology used at and after the cutover
 * @param cutoverMillis  the millis of the cutover
 * @param convertByWeekyear
 */
CutoverField(DateTimeField julianField, DateTimeField gregorianField,
             long cutoverMillis, boolean convertByWeekyear) {
    super(gregorianField.getType());
    iJulianField = julianField;
    iGregorianField = gregorianField;
    iCutover = cutoverMillis;
    iConvertByWeekyear = convertByWeekyear;
    // Although average length of Julian and Gregorian years differ,
    // use the Gregorian duration field because it is more accurate.
    iDurationField = gregorianField.getDurationField();

    DurationField rangeField = gregorianField.getRangeDurationField();
    if (rangeField == null) {
        rangeField = julianField.getRangeDurationField();
    }
    iRangeDurationField = rangeField;
}
 
Example 7
Source File: Time_6_GJChronology_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * @param julianField field from the chronology used before the cutover instant
 * @param gregorianField field from the chronology used at and after the cutover
 * @param cutoverMillis  the millis of the cutover
 * @param convertByWeekyear
 */
CutoverField(DateTimeField julianField, DateTimeField gregorianField,
             long cutoverMillis, boolean convertByWeekyear) {
    super(gregorianField.getType());
    iJulianField = julianField;
    iGregorianField = gregorianField;
    iCutover = cutoverMillis;
    iConvertByWeekyear = convertByWeekyear;
    // Although average length of Julian and Gregorian years differ,
    // use the Gregorian duration field because it is more accurate.
    iDurationField = gregorianField.getDurationField();

    DurationField rangeField = gregorianField.getRangeDurationField();
    if (rangeField == null) {
        rangeField = julianField.getRangeDurationField();
    }
    iRangeDurationField = rangeField;
}
 
Example 8
Source File: DelegatedDateTimeField.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the field being decorated
 * @param type  the field type override
 */
public DelegatedDateTimeField(DateTimeField field, DateTimeFieldType type) {
    super();
    if (field == null) {
        throw new IllegalArgumentException("The field must not be null");
    }
    iField = field;
    iType = (type == null ? field.getType() : type);
}
 
Example 9
Source File: LimitChronology.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
LimitDateTimeField(DateTimeField field,
                   DurationField durationField,
                   DurationField rangeDurationField,
                   DurationField leapDurationField) {
    super(field, field.getType());
    iDurationField = durationField;
    iRangeDurationField = rangeDurationField;
    iLeapDurationField = leapDurationField;
}
 
Example 10
Source File: FieldUtils.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verify that input values are within specified bounds.
 * 
 * @param value  the value to check
 * @param lowerBound  the lower bound allowed for value
 * @param upperBound  the upper bound allowed for value
 * @throws IllegalFieldValueException if value is not in the specified bounds
 */
public static void verifyValueBounds(DateTimeField field, 
                                     int value, int lowerBound, int upperBound) {
    if ((value < lowerBound) || (value > upperBound)) {
        throw new IllegalFieldValueException
            (field.getType(), Integer.valueOf(value),
             Integer.valueOf(lowerBound), Integer.valueOf(upperBound));
    }
}
 
Example 11
Source File: DelegatedDateTimeField.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the field being decorated
 * @param rangeField  the range field, null to derive
 * @param type  the field type override
 */
public DelegatedDateTimeField(DateTimeField field, DurationField rangeField, DateTimeFieldType type) {
    super();
    if (field == null) {
        throw new IllegalArgumentException("The field must not be null");
    }
    iField = field;
    iRangeDurationField = rangeField;
    iType = (type == null ? field.getType() : type);
}
 
Example 12
Source File: LimitChronology.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
LimitDateTimeField(DateTimeField field,
                   DurationField durationField,
                   DurationField rangeDurationField,
                   DurationField leapDurationField) {
    super(field, field.getType());
    iDurationField = durationField;
    iRangeDurationField = rangeDurationField;
    iLeapDurationField = leapDurationField;
}
 
Example 13
Source File: Time_15_FieldUtils_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Verify that input values are within specified bounds.
 * 
 * @param value  the value to check
 * @param lowerBound  the lower bound allowed for value
 * @param upperBound  the upper bound allowed for value
 * @throws IllegalFieldValueException if value is not in the specified bounds
 */
public static void verifyValueBounds(DateTimeField field, 
                                     int value, int lowerBound, int upperBound) {
    if ((value < lowerBound) || (value > upperBound)) {
        throw new IllegalFieldValueException
            (field.getType(), Integer.valueOf(value),
             Integer.valueOf(lowerBound), Integer.valueOf(upperBound));
    }
}
 
Example 14
Source File: Time_15_FieldUtils_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Verify that input values are within specified bounds.
 * 
 * @param value  the value to check
 * @param lowerBound  the lower bound allowed for value
 * @param upperBound  the upper bound allowed for value
 * @throws IllegalFieldValueException if value is not in the specified bounds
 */
public static void verifyValueBounds(DateTimeField field, 
                                     int value, int lowerBound, int upperBound) {
    if ((value < lowerBound) || (value > upperBound)) {
        throw new IllegalFieldValueException
            (field.getType(), Integer.valueOf(value),
             Integer.valueOf(lowerBound), Integer.valueOf(upperBound));
    }
}
 
Example 15
Source File: elixir3_three_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Verify that input values are within specified bounds.
 * 
 * @param value  the value to check
 * @param lowerBound  the lower bound allowed for value
 * @param upperBound  the upper bound allowed for value
 * @throws IllegalFieldValueException if value is not in the specified bounds
 */
public static void verifyValueBounds(DateTimeField field, 
                                     int value, int lowerBound, int upperBound) {
    if ((value < lowerBound) || (value > upperBound)) {
        throw new IllegalFieldValueException
            (field.getType(), Integer.valueOf(value),
             Integer.valueOf(lowerBound), Integer.valueOf(upperBound));
    }
}
 
Example 16
Source File: FieldUtils.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verify that input values are within specified bounds.
 * 
 * @param value  the value to check
 * @param lowerBound  the lower bound allowed for value
 * @param upperBound  the upper bound allowed for value
 * @throws IllegalFieldValueException if value is not in the specified bounds
 */
public static void verifyValueBounds(DateTimeField field, 
                                     int value, int lowerBound, int upperBound) {
    if ((value < lowerBound) || (value > upperBound)) {
        throw new IllegalFieldValueException
            (field.getType(), Integer.valueOf(value),
             Integer.valueOf(lowerBound), Integer.valueOf(upperBound));
    }
}
 
Example 17
Source File: Elixir_0039_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Verify that input values are within specified bounds.
 * 
 * @param value  the value to check
 * @param lowerBound  the lower bound allowed for value
 * @param upperBound  the upper bound allowed for value
 * @throws IllegalFieldValueException if value is not in the specified bounds
 */
public static void verifyValueBounds(DateTimeField field, 
                                     int value, int lowerBound, int upperBound) {
    if ((value < lowerBound) || (value > upperBound)) {
        throw new IllegalFieldValueException
            (field.getType(), Integer.valueOf(value),
             Integer.valueOf(lowerBound), Integer.valueOf(upperBound));
    }
}
 
Example 18
Source File: Arja_0050_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Verify that input values are within specified bounds.
 * 
 * @param value  the value to check
 * @param lowerBound  the lower bound allowed for value
 * @param upperBound  the upper bound allowed for value
 * @throws IllegalFieldValueException if value is not in the specified bounds
 */
public static void verifyValueBounds(DateTimeField field, 
                                     int value, int lowerBound, int upperBound) {
    if ((value < lowerBound) || (value > upperBound)) {
        throw new IllegalFieldValueException
            (field.getType(), Integer.valueOf(value),
             Integer.valueOf(lowerBound), Integer.valueOf(upperBound));
    }
}
 
Example 19
Source File: OffsetDateTimeField.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the field to wrap, like "year()".
 * @param offset  offset to add to field values
 * @throws IllegalArgumentException if offset is zero
 */
public OffsetDateTimeField(DateTimeField field, int offset) {
    this(field, (field == null ? null : field.getType()), offset, Integer.MIN_VALUE, Integer.MAX_VALUE);
}
 
Example 20
Source File: OffsetDateTimeField.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the field to wrap, like "year()".
 * @param offset  offset to add to field values
 * @throws IllegalArgumentException if offset is zero
 */
public OffsetDateTimeField(DateTimeField field, int offset) {
    this(field, (field == null ? null : field.getType()), offset, Integer.MIN_VALUE, Integer.MAX_VALUE);
}