108 * 109 * <p>Note: Always use the {@link DatatypeFactory} to 110 * construct an instance of {@code Duration}. 111 * The constructor on this class cannot be guaranteed to 112 * produce an object with a consistent state and may be 113 * removed in the future. 114 */ 115 public Duration() { 116 } 117 118 /** 119 * Return the name of the XML Schema date/time type that this instance 120 * maps to. Type is computed based on fields that are set, 121 * i.e. {@link #isSet(DatatypeConstants.Field field)} == {@code true}. 122 * 123 * <table class="striped"> 124 * <caption>Required fields for XML Schema 1.0 Date/Time Datatypes.<br> 125 * <i>(timezone is optional for all date/time datatypes)</i></caption> 126 * <thead> 127 * <tr> 128 * <th>Datatype</th> 129 * <th>year</th> 130 * <th>month</th> 131 * <th>day</th> 132 * <th>hour</th> 133 * <th>minute</th> 134 * <th>second</th> 135 * </tr> 136 * </thead> 137 * <tbody> 138 * <tr> 139 * <td>{@link DatatypeConstants#DURATION}</td> 140 * <td>X</td> 141 * <td>X</td> 142 * <td>X</td> 143 * <td>X</td> 144 * <td>X</td> 145 * <td>X</td> 146 * </tr> 147 * <tr> 148 * <td>{@link DatatypeConstants#DURATION_DAYTIME}</td> 149 * <td></td> 150 * <td></td> 151 * <td>X</td> 152 * <td>X</td> 153 * <td>X</td> 154 * <td>X</td> 155 * </tr> 156 * <tr> 157 * <td>{@link DatatypeConstants#DURATION_YEARMONTH}</td> 158 * <td>X</td> 159 * <td>X</td> 160 * <td></td> 161 * <td></td> 162 * <td></td> 163 * <td></td> 164 * </tr> 165 * </tbody> 166 * </table> 167 * 168 * @return one of the following constants: 169 * {@link DatatypeConstants#DURATION}, 170 * {@link DatatypeConstants#DURATION_DAYTIME} or 171 * {@link DatatypeConstants#DURATION_YEARMONTH}. 172 * 173 * @throws IllegalStateException If the combination of set fields does not match one of the XML Schema date/time datatypes. 174 */ 175 public QName getXMLSchemaType() { 176 177 boolean yearSet = isSet(DatatypeConstants.YEARS); | 108 * 109 * <p>Note: Always use the {@link DatatypeFactory} to 110 * construct an instance of {@code Duration}. 111 * The constructor on this class cannot be guaranteed to 112 * produce an object with a consistent state and may be 113 * removed in the future. 114 */ 115 public Duration() { 116 } 117 118 /** 119 * Return the name of the XML Schema date/time type that this instance 120 * maps to. Type is computed based on fields that are set, 121 * i.e. {@link #isSet(DatatypeConstants.Field field)} == {@code true}. 122 * 123 * <table class="striped"> 124 * <caption>Required fields for XML Schema 1.0 Date/Time Datatypes.<br> 125 * <i>(timezone is optional for all date/time datatypes)</i></caption> 126 * <thead> 127 * <tr> 128 * <th scope="col">Datatype</th> 129 * <th scope="col">year</th> 130 * <th scope="col">month</th> 131 * <th scope="col">day</th> 132 * <th scope="col">hour</th> 133 * <th scope="col">minute</th> 134 * <th scope="col">second</th> 135 * </tr> 136 * </thead> 137 * <tbody> 138 * <tr> 139 * <th scope="row">{@link DatatypeConstants#DURATION}</th> 140 * <td>X</td> 141 * <td>X</td> 142 * <td>X</td> 143 * <td>X</td> 144 * <td>X</td> 145 * <td>X</td> 146 * </tr> 147 * <tr> 148 * <th scope="row">{@link DatatypeConstants#DURATION_DAYTIME}</th> 149 * <td></td> 150 * <td></td> 151 * <td>X</td> 152 * <td>X</td> 153 * <td>X</td> 154 * <td>X</td> 155 * </tr> 156 * <tr> 157 * <th scope="row">{@link DatatypeConstants#DURATION_YEARMONTH}</th> 158 * <td>X</td> 159 * <td>X</td> 160 * <td></td> 161 * <td></td> 162 * <td></td> 163 * <td></td> 164 * </tr> 165 * </tbody> 166 * </table> 167 * 168 * @return one of the following constants: 169 * {@link DatatypeConstants#DURATION}, 170 * {@link DatatypeConstants#DURATION_DAYTIME} or 171 * {@link DatatypeConstants#DURATION_YEARMONTH}. 172 * 173 * @throws IllegalStateException If the combination of set fields does not match one of the XML Schema date/time datatypes. 174 */ 175 public QName getXMLSchemaType() { 176 177 boolean yearSet = isSet(DatatypeConstants.YEARS); |