1 /* 2 * Copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos 3 * 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are met: 8 * 9 * * Redistributions of source code must retain the above copyright notice, 10 * this list of conditions and the following disclaimer. 11 * 12 * * Redistributions in binary form must reproduce the above copyright notice, 13 * this list of conditions and the following disclaimer in the documentation 14 * and/or other materials provided with the distribution. 15 * 16 * * Neither the name of JSR-310 nor the names of its contributors 17 * may be used to endorse or promote products derived from this software 18 * without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 package org.threeten.bp.format; 33 34 /** 35 * Enumeration of different ways to resolve dates and times. 36 * <p> 37 * Parsing a text string occurs in two phases. 38 * Phase 1 is a basic text parse according to the fields added to the builder. 39 * Phase 2 resolves the parsed field-value pairs into date and/or time objects. 40 * This style is used to control how phase 2, resolving, happens. 41 * 42 * <h3>Specification for implementors</h3> 43 * This is an immutable and thread-safe enum. 44 */ 45 public enum ResolverStyle { 46 47 /** 48 * Style to resolve dates and times strictly. 49 * <p> 50 * Using strict resolution will ensure that all parsed values are within 51 * the outer range of valid values for the field. Individual fields may 52 * be further processed for strictness. 53 * <p> 54 * For example, resolving year-month and day-of-month in the ISO calendar 55 * system using strict mode will ensure that the day-of-month is valid 56 * for the year-month, rejecting invalid values. 57 */ 58 STRICT, 59 /** 60 * Style to resolve dates and times in a smart, or intelligent, manner. 61 * <p> 62 * Using smart resolution will perform the sensible default for each 63 * field, which may be the same as strict, the same as lenient, or a third 64 * behavior. Individual fields will interpret this differently. 65 * <p> 66 * For example, resolving year-month and day-of-month in the ISO calendar 67 * system using smart mode will ensure that the day-of-month is from 68 * 1 to 31, converting any value beyond the last valid day-of-month to be 69 * the last valid day-of-month. 70 */ 71 SMART, 72 /** 73 * Style to resolve dates and times leniently. 74 * <p> 75 * Using lenient resolution will resolve the values in an appropriate 76 * lenient manner. Individual fields will interpret this differently. 77 * <p> 78 * For example, lenient mode allows the month in the ISO calendar system 79 * to be outside the range 1 to 12. 80 * For example, month 15 is treated as being 3 months after month 12. 81 */ 82 LENIENT; 83 84 } 85