Examples of checkValidValue()


Examples of java.time.temporal.ChronoField.checkValidValue()

     */
    @Override
    public Instant with(TemporalField field, long newValue) {
        if (field instanceof ChronoField) {
            ChronoField f = (ChronoField) field;
            f.checkValidValue(newValue);
            switch (f) {
                case MILLI_OF_SECOND: {
                    int nval = (int) newValue * 1000_000;
                    return (nval != nanos ? create(seconds, nval) : this);
                }
View Full Code Here

Examples of java.time.temporal.ChronoField.checkValidValue()

     */
    @Override
    public LocalTime with(TemporalField field, long newValue) {
        if (field instanceof ChronoField) {
            ChronoField f = (ChronoField) field;
            f.checkValidValue(newValue);
            switch (f) {
                case NANO_OF_SECOND: return withNano((int) newValue);
                case NANO_OF_DAY: return LocalTime.ofNanoOfDay(newValue);
                case MICRO_OF_SECOND: return withNano((int) newValue * 1000);
                case MICRO_OF_DAY: return LocalTime.ofNanoOfDay(newValue * 1000);
 
View Full Code Here

Examples of java.time.temporal.ChronoField.checkValidValue()

     */
    @Override
    public YearMonth with(TemporalField field, long newValue) {
        if (field instanceof ChronoField) {
            ChronoField f = (ChronoField) field;
            f.checkValidValue(newValue);
            switch (f) {
                case MONTH_OF_YEAR: return withMonth((int) newValue);
                case PROLEPTIC_MONTH: return plusMonths(newValue - getProlepticMonth());
                case YEAR_OF_ERA: return withYear((int) (year < 1 ? 1 - newValue : newValue));
                case YEAR: return withYear((int) newValue);
View Full Code Here

Examples of java.time.temporal.ChronoField.checkValidValue()

     */
    @Override
    public LocalDate with(TemporalField field, long newValue) {
        if (field instanceof ChronoField) {
            ChronoField f = (ChronoField) field;
            f.checkValidValue(newValue);
            switch (f) {
                case DAY_OF_WEEK: return plusDays(newValue - getDayOfWeek().getValue());
                case ALIGNED_DAY_OF_WEEK_IN_MONTH: return plusDays(newValue - getLong(ALIGNED_DAY_OF_WEEK_IN_MONTH));
                case ALIGNED_DAY_OF_WEEK_IN_YEAR: return plusDays(newValue - getLong(ALIGNED_DAY_OF_WEEK_IN_YEAR));
                case DAY_OF_MONTH: return withDayOfMonth((int) newValue);
View Full Code Here

Examples of java.time.temporal.ChronoField.checkValidValue()

     */
    @Override
    public Year with(TemporalField field, long newValue) {
        if (field instanceof ChronoField) {
            ChronoField f = (ChronoField) field;
            f.checkValidValue(newValue);
            switch (f) {
                case YEAR_OF_ERA: return Year.of((int) (year < 1 ? 1 - newValue : newValue));
                case YEAR: return Year.of((int) newValue);
                case ERA: return (getLong(ERA) == newValue ? this : Year.of(1 - year));
            }
View Full Code Here

Examples of java.time.temporal.ValueRange.checkValidValue()

         * @return the value as a fraction within the range, from 0 to 1, not null
         * @throws DateTimeException if the value cannot be converted to a fraction
         */
        private BigDecimal convertToFraction(long value) {
            ValueRange range = field.range();
            range.checkValidValue(value, field);
            BigDecimal minBD = BigDecimal.valueOf(range.getMinimum());
            BigDecimal rangeBD = BigDecimal.valueOf(range.getMaximum()).subtract(minBD).add(BigDecimal.ONE);
            BigDecimal valueBD = BigDecimal.valueOf(value).subtract(minBD);
            BigDecimal fraction = valueBD.divide(rangeBD, 9, RoundingMode.FLOOR);
            // stripTrailingZeros bug
View Full Code Here

Examples of org.jboss.managed.api.ManagedProperty.checkValidValue()

      compare = maxValue.compareTo(SimpleValueSupport.wrap(50f));
      assertTrue("temperature 50 < max; "+compare, compare > 0);
      compare = maxValue.compareTo(SimpleValueSupport.wrap(150f));
      assertTrue("temperature 150 > max; "+compare, compare < 0);

      String check = temperature.checkValidValue(SimpleValueSupport.wrap(100f));
      assertNull(check, check);
      check = temperature.checkValidValue(SimpleValueSupport.wrap(1f));
      assertNull(check, check);
      check = temperature.checkValidValue(SimpleValueSupport.wrap(-1f));
      assertNotNull(check, check);
View Full Code Here

Examples of org.jboss.managed.api.ManagedProperty.checkValidValue()

      compare = maxValue.compareTo(SimpleValueSupport.wrap(150f));
      assertTrue("temperature 150 > max; "+compare, compare < 0);

      String check = temperature.checkValidValue(SimpleValueSupport.wrap(100f));
      assertNull(check, check);
      check = temperature.checkValidValue(SimpleValueSupport.wrap(1f));
      assertNull(check, check);
      check = temperature.checkValidValue(SimpleValueSupport.wrap(-1f));
      assertNotNull(check, check);
     
   }
View Full Code Here

Examples of org.jboss.managed.api.ManagedProperty.checkValidValue()

      String check = temperature.checkValidValue(SimpleValueSupport.wrap(100f));
      assertNull(check, check);
      check = temperature.checkValidValue(SimpleValueSupport.wrap(1f));
      assertNull(check, check);
      check = temperature.checkValidValue(SimpleValueSupport.wrap(-1f));
      assertNotNull(check, check);
     
   }

   public void testMonth()
View Full Code Here

Examples of org.jboss.managed.api.ManagedProperty.checkValidValue()

      Set<MetaValue> legalValues = month.getLegalValues();
      assertEquals("There are 12 legal values", 12, legalValues.size());
      MetaValue JUN = SimpleValueSupport.wrap("JUN");
      assertTrue("JUN", legalValues.contains(JUN));

      String check = month.checkValidValue(JUN);
      assertNull(check, check);
      check = month.checkValidValue(SimpleValueSupport.wrap("XYZ"));
      assertNotNull("XYZ", check);
   }
  
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.