/** * Validates a period type, converting nulls to a default value and * checking the type is suitable for this instance. * * @param type the type to check, may be null * @return the validated type to use, not null * @throws IllegalArgumentException if the period type is invalid */ protected PeriodType checkPeriodType(PeriodType type) { return DateTimeUtils.getPeriodType(type); }
/** * Validates a period type, converting nulls to a default value and * checking the type is suitable for this instance. * * @param type the type to check, may be null * @return the validated type to use, not null * @throws IllegalArgumentException if the period type is invalid */ protected PeriodType checkPeriodType(PeriodType type) { return DateTimeUtils.getPeriodType(type); }
/** * Creates a new Period instance with the same field values but * different PeriodType. * <p> * This period instance is immutable and unaffected by this method call. * * @param type the period type to use, null means standard * @return the new period instance * @throws IllegalArgumentException if the new period won't accept all of the current fields */ public Period withPeriodType(PeriodType type) { type = DateTimeUtils.getPeriodType(type); if (type.equals(getPeriodType())) { return this; } return new Period(this, type); }
/** * Creates a new Period instance with the same field values but * different PeriodType. * <p> * This period instance is immutable and unaffected by this method call. * * @param type the period type to use, null means standard * @return the new period instance * @throws IllegalArgumentException if the new period won't accept all of the current fields */ public Period withPeriodType(PeriodType type) { type = DateTimeUtils.getPeriodType(type); if (type.equals(getPeriodType())) { return this; } return new Period(this, type); }
/** * Validates a period type, converting nulls to a default value and * checking the type is suitable for this instance. * * @param type the type to check, may be null * @return the validated type to use, not null * @throws IllegalArgumentException if the period type is invalid */ protected PeriodType checkPeriodType(PeriodType type) { return DateTimeUtils.getPeriodType(type); }
type = DateTimeUtils.getPeriodType(type); long millis = getMillis(); // no overflow can happen, even with Integer.MAX_VALUEs millis += (((long) getSeconds()) * ((long) DateTimeConstants.MILLIS_PER_SECOND));
type = DateTimeUtils.getPeriodType(type); long millis = getMillis(); // no overflow can happen, even with Integer.MAX_VALUEs millis += (((long) getSeconds()) * ((long) DateTimeConstants.MILLIS_PER_SECOND));
/** * Creates a new Period instance with the same field values but * different PeriodType. * <p> * This period instance is immutable and unaffected by this method call. * * @param type the period type to use, null means standard * @return the new period instance * @throws IllegalArgumentException if the new period won't accept all of the current fields */ public Period withPeriodType(PeriodType type) { type = DateTimeUtils.getPeriodType(type); if (type.equals(getPeriodType())) { return this; } return new Period(this, type); }
/** * Validates a period type, converting nulls to a default value and * checking the type is suitable for this instance. * * @param type the type to check, may be null * @return the validated type to use, not null * @throws IllegalArgumentException if the period type is invalid */ protected PeriodType checkPeriodType(PeriodType type) { return DateTimeUtils.getPeriodType(type); }
/** * Validates a period type, converting nulls to a default value and * checking the type is suitable for this instance. * * @param type the type to check, may be null * @return the validated type to use, not null * @throws IllegalArgumentException if the period type is invalid */ protected PeriodType checkPeriodType(PeriodType type) { return DateTimeUtils.getPeriodType(type); }
/** * Validates a period type, converting nulls to a default value and * checking the type is suitable for this instance. * * @param type the type to check, may be null * @return the validated type to use, not null * @throws IllegalArgumentException if the period type is invalid */ protected PeriodType checkPeriodType(PeriodType type) { return DateTimeUtils.getPeriodType(type); }
/** * Validates a period type, converting nulls to a default value and * checking the type is suitable for this instance. * * @param type the type to check, may be null * @return the validated type to use, not null * @throws IllegalArgumentException if the period type is invalid */ protected PeriodType checkPeriodType(PeriodType type) { return DateTimeUtils.getPeriodType(type); }
/** * Validates a period type, converting nulls to a default value and * checking the type is suitable for this instance. * * @param type the type to check, may be null * @return the validated type to use, not null * @throws IllegalArgumentException if the period type is invalid */ protected PeriodType checkPeriodType(PeriodType type) { return DateTimeUtils.getPeriodType(type); }
/** * Validates a period type, converting nulls to a default value and * checking the type is suitable for this instance. * * @param type the type to check, may be null * @return the validated type to use, not null * @throws IllegalArgumentException if the period type is invalid */ protected PeriodType checkPeriodType(PeriodType type) { return DateTimeUtils.getPeriodType(type); }
/** * Validates a period type, converting nulls to a default value and * checking the type is suitable for this instance. * * @param type the type to check, may be null * @return the validated type to use, not null * @throws IllegalArgumentException if the period type is invalid */ protected PeriodType checkPeriodType(PeriodType type) { return DateTimeUtils.getPeriodType(type); }
/** * Validates a period type, converting nulls to a default value and * checking the type is suitable for this instance. * * @param type the type to check, may be null * @return the validated type to use, not null * @throws IllegalArgumentException if the period type is invalid */ protected PeriodType checkPeriodType(PeriodType type) { return DateTimeUtils.getPeriodType(type); }
millis += (((long) getDays()) * ((long) DateTimeConstants.MILLIS_PER_DAY)); millis += (((long) getWeeks()) * ((long) DateTimeConstants.MILLIS_PER_WEEK)); Period result = new Period(millis, DateTimeUtils.getPeriodType(type), ISOChronology.getInstanceUTC()); int years = getYears(); int months = getMonths();
/** * Creates a new Period instance with the same field values but * different PeriodType. * <p> * This period instance is immutable and unaffected by this method call. * * @param type the period type to use, null means standard * @return the new period instance * @throws IllegalArgumentException if the new period won't accept all of the current fields */ public Period withPeriodType(PeriodType type) { type = DateTimeUtils.getPeriodType(type); if (type.equals(getPeriodType())) { return this; } return new Period(this, type); }
/** * Creates a new Period instance with the same field values but * different PeriodType. * <p> * This period instance is immutable and unaffected by this method call. * * @param type the period type to use, null means standard * @return the new period instance * @throws IllegalArgumentException if the new period won't accept all of the current fields */ public Period withPeriodType(PeriodType type) { type = DateTimeUtils.getPeriodType(type); if (type.equals(getPeriodType())) { return this; } return new Period(this, type); }
/** * Creates a new Period instance with the same field values but * different PeriodType. * <p> * This period instance is immutable and unaffected by this method call. * * @param type the period type to use, null means standard * @return the new period instance * @throws IllegalArgumentException if the new period won't accept all of the current fields */ public Period withPeriodType(PeriodType type) { type = DateTimeUtils.getPeriodType(type); if (type.equals(getPeriodType())) { return this; } return new Period(this, type); }