View Javadoc
1 /* 2 * Copyright (C) The Apache Software Foundation. All rights reserved. 3 * 4 * This software is published under the terms of the Apache Software License 5 * version 1.1, a copy of which has been included with this distribution in 6 * the LICENSE file. 7 */ 8 package org.apache.james.util; 9 10 import java.text.ParseException; 11 import java.util.Date; 12 import java.util.Locale; 13 import java.util.TimeZone; 14 15 /*** 16 * <p>This interface is designed to provide a simplified subset of the 17 * methods provided by the <code>java.text.DateFormat</code> class.</p> 18 * 19 * <p>This interface is necessary because of the difficulty in writing 20 * thread safe classes that inherit from <code>java.text.DateFormat</code>. 21 * This difficulty leads us to approach the problem using composition 22 * rather than inheritance. In general classes that implement this 23 * interface will delegate these calls to an internal DateFormat object.</p> 24 * 25 * @author Peter M. Goldstein <farsight@alum.mit.edu> 26 */ 27 public interface SimplifiedDateFormat { 28 29 /*** 30 * Formats a Date into a date/time string. 31 * @param date the time value to be formatted into a time string. 32 * @return the formatted time string. 33 */ 34 public String format(Date d); 35 36 /*** 37 * Parses text from the beginning of the given string to produce a date. 38 * The method may not use the entire text of the given string. 39 * 40 * @param source A <code>String</code> whose beginning should be parsed. 41 * @return A <code>Date</code> parsed from the string. 42 * @throws ParseException if the beginning of the specified string 43 * cannot be parsed. 44 */ 45 public Date parse(String source) throws ParseException; 46 47 /*** 48 * Sets the time zone of this SimplifiedDateFormat object. 49 * @param zone the given new time zone. 50 */ 51 public void setTimeZone(TimeZone zone); 52 53 /*** 54 * Gets the time zone. 55 * @return the time zone associated with this SimplifiedDateFormat. 56 */ 57 public TimeZone getTimeZone(); 58 59 /*** 60 * Specify whether or not date/time parsing is to be lenient. With 61 * lenient parsing, the parser may use heuristics to interpret inputs that 62 * do not precisely match this object's format. With strict parsing, 63 * inputs must match this object's format. 64 * @param lenient when true, parsing is lenient 65 * @see java.util.Calendar#setLenient 66 */ 67 public void setLenient(boolean lenient); 68 69 /*** 70 * Tell whether date/time parsing is to be lenient. 71 * @return whether this SimplifiedDateFormat is lenient. 72 */ 73 public boolean isLenient(); 74 } 75

This page was automatically generated by Maven