Exemplo n.º 1
0
 /**
  * Returns a new {@code SimpleDateFormat} with the same pattern and properties as this simple date
  * format.
  */
 @Override
 public Object clone() {
   SimpleDateFormat clone = (SimpleDateFormat) super.clone();
   clone.formatData = (DateFormatSymbols) formatData.clone();
   clone.defaultCenturyStart = new Date(defaultCenturyStart.getTime());
   return clone;
 }
 /**
  * This method returns a copy of the format symbol information used for parsing and formatting
  * dates.
  *
  * @return a copy of the date format symbols.
  */
 public DateFormatSymbols getDateFormatSymbols() {
   return (DateFormatSymbols) formatData.clone();
 }
 /**
  * Returns a copy of this instance of <code>SimpleDateFormat</code>. The copy contains clones of
  * the formatting symbols and the 2-digit year century start date.
  */
 public Object clone() {
   SimpleDateFormat clone = (SimpleDateFormat) super.clone();
   clone.setDateFormatSymbols((DateFormatSymbols) formatData.clone());
   clone.set2DigitYearStart((Date) defaultCenturyStart.clone());
   return clone;
 }
Exemplo n.º 4
0
 /**
  * Constructs a new {@code SimpleDateFormat} using the specified non-localized pattern and {@code
  * DateFormatSymbols} and the {@code Calendar} for the user's default locale. See "<a
  * href="../util/Locale.html#default_locale">Be wary of the default locale</a>".
  *
  * @param template the pattern.
  * @param value the DateFormatSymbols.
  * @throws NullPointerException if the pattern is {@code null}.
  * @throws IllegalArgumentException if the pattern is invalid.
  */
 public SimpleDateFormat(String template, DateFormatSymbols value) {
   this(Locale.getDefault());
   validatePattern(template);
   pattern = template;
   formatData = (DateFormatSymbols) value.clone();
 }
Exemplo n.º 5
0
 /**
  * Sets the {@code DateFormatSymbols} used by this simple date format.
  *
  * @param value the new {@code DateFormatSymbols} object.
  */
 public void setDateFormatSymbols(DateFormatSymbols value) {
   formatData = (DateFormatSymbols) value.clone();
 }