< prev index next >

src/java.base/share/classes/java/text/DateFormatSymbols.java

Print this page


   1 /*
   2  * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 377 
 378     /**
 379      * Gets era strings. For example: "AD" and "BC".
 380      * @return the era strings.
 381      */
 382     public String[] getEras() {
 383         return Arrays.copyOf(eras, eras.length);
 384     }
 385 
 386     /**
 387      * Sets era strings. For example: "AD" and "BC".
 388      * @param newEras the new era strings.
 389      */
 390     public void setEras(String[] newEras) {
 391         eras = Arrays.copyOf(newEras, newEras.length);
 392         cachedHashCode = 0;
 393     }
 394 
 395     /**
 396      * Gets month strings. For example: "January", "February", etc.



 397      *
 398      * <p>If the language requires different forms for formatting and
 399      * stand-alone usages, this method returns month names in the
 400      * formatting form. For example, the preferred month name for
 401      * January in the Czech language is <em>ledna</em> in the
 402      * formatting form, while it is <em>leden</em> in the stand-alone
 403      * form. This method returns {@code "ledna"} in this case. Refer
 404      * to the <a href="http://unicode.org/reports/tr35/#Calendar_Elements">
 405      * Calendar Elements in the Unicode Locale Data Markup Language
 406      * (LDML) specification</a> for more details.
 407      *


 408      * @return the month strings. Use
 409      * {@link java.util.Calendar#JANUARY Calendar.JANUARY},
 410      * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY},
 411      * etc. to index the result array.
 412      */
 413     public String[] getMonths() {
 414         return Arrays.copyOf(months, months.length);
 415     }
 416 
 417     /**
 418      * Sets month strings. For example: "January", "February", etc.
 419      * @param newMonths the new month strings. The array should
 420      * be indexed by {@link java.util.Calendar#JANUARY Calendar.JANUARY},
 421      * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY}, etc.
 422      */
 423     public void setMonths(String[] newMonths) {
 424         months = Arrays.copyOf(newMonths, newMonths.length);
 425         cachedHashCode = 0;
 426     }
 427 
 428     /**
 429      * Gets short month strings. For example: "Jan", "Feb", etc.



 430      *
 431      * <p>If the language requires different forms for formatting and
 432      * stand-alone usages, this method returns short month names in
 433      * the formatting form. For example, the preferred abbreviation
 434      * for January in the Catalan language is <em>de gen.</em> in the
 435      * formatting form, while it is <em>gen.</em> in the stand-alone
 436      * form. This method returns {@code "de gen."} in this case. Refer
 437      * to the <a href="http://unicode.org/reports/tr35/#Calendar_Elements">
 438      * Calendar Elements in the Unicode Locale Data Markup Language
 439      * (LDML) specification</a> for more details.
 440      *


 441      * @return the short month strings. Use
 442      * {@link java.util.Calendar#JANUARY Calendar.JANUARY},
 443      * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY},
 444      * etc. to index the result array.
 445      */
 446     public String[] getShortMonths() {
 447         return Arrays.copyOf(shortMonths, shortMonths.length);
 448     }
 449 
 450     /**
 451      * Sets short month strings. For example: "Jan", "Feb", etc.
 452      * @param newShortMonths the new short month strings. The array should
 453      * be indexed by {@link java.util.Calendar#JANUARY Calendar.JANUARY},
 454      * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY}, etc.
 455      */
 456     public void setShortMonths(String[] newShortMonths) {
 457         shortMonths = Arrays.copyOf(newShortMonths, newShortMonths.length);
 458         cachedHashCode = 0;
 459     }
 460 


   1 /*
   2  * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 377 
 378     /**
 379      * Gets era strings. For example: "AD" and "BC".
 380      * @return the era strings.
 381      */
 382     public String[] getEras() {
 383         return Arrays.copyOf(eras, eras.length);
 384     }
 385 
 386     /**
 387      * Sets era strings. For example: "AD" and "BC".
 388      * @param newEras the new era strings.
 389      */
 390     public void setEras(String[] newEras) {
 391         eras = Arrays.copyOf(newEras, newEras.length);
 392         cachedHashCode = 0;
 393     }
 394 
 395     /**
 396      * Gets month strings. For example: "January", "February", etc.
 397      * An array with either 12 or 13 elements will be returned depending
 398      * on whether or {@link java.util.Calendar#UNDECIMBER Calendar.UNDECIMBER}
 399      * is supported.
 400      *
 401      * <p>If the language requires different forms for formatting and
 402      * stand-alone usages, this method returns month names in the
 403      * formatting form. For example, the preferred month name for
 404      * January in the Czech language is <em>ledna</em> in the
 405      * formatting form, while it is <em>leden</em> in the stand-alone
 406      * form. This method returns {@code "ledna"} in this case. Refer
 407      * to the <a href="http://unicode.org/reports/tr35/#Calendar_Elements">
 408      * Calendar Elements in the Unicode Locale Data Markup Language
 409      * (LDML) specification</a> for more details.
 410      *
 411      * @implSpec This method returns 13 elements since 
 412      * {@link java.util.Calendar#UNDECIMBER Calendar.UNDECIMBER} is supported.
 413      * @return the month strings. Use
 414      * {@link java.util.Calendar#JANUARY Calendar.JANUARY},
 415      * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY},
 416      * etc. to index the result array.
 417      */
 418     public String[] getMonths() {
 419         return Arrays.copyOf(months, months.length);
 420     }
 421 
 422     /**
 423      * Sets month strings. For example: "January", "February", etc.
 424      * @param newMonths the new month strings. The array should
 425      * be indexed by {@link java.util.Calendar#JANUARY Calendar.JANUARY},
 426      * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY}, etc.
 427      */
 428     public void setMonths(String[] newMonths) {
 429         months = Arrays.copyOf(newMonths, newMonths.length);
 430         cachedHashCode = 0;
 431     }
 432 
 433     /**
 434      * Gets short month strings. For example: "Jan", "Feb", etc.
 435      * An array with either 12 or 13 elements will be returned depending
 436      * on whether or {@link java.util.Calendar#UNDECIMBER Calendar.UNDECIMBER}
 437      * is supported.
 438      * 
 439      * <p>If the language requires different forms for formatting and
 440      * stand-alone usages, this method returns short month names in
 441      * the formatting form. For example, the preferred abbreviation
 442      * for January in the Catalan language is <em>de gen.</em> in the
 443      * formatting form, while it is <em>gen.</em> in the stand-alone
 444      * form. This method returns {@code "de gen."} in this case. Refer
 445      * to the <a href="http://unicode.org/reports/tr35/#Calendar_Elements">
 446      * Calendar Elements in the Unicode Locale Data Markup Language
 447      * (LDML) specification</a> for more details.
 448      *
 449      * @implSpec This method returns 13 elements since 
 450      * {@link java.util.Calendar#UNDECIMBER Calendar.UNDECIMBER} is supported.
 451      * @return the short month strings. Use
 452      * {@link java.util.Calendar#JANUARY Calendar.JANUARY},
 453      * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY},
 454      * etc. to index the result array.
 455      */
 456     public String[] getShortMonths() {
 457         return Arrays.copyOf(shortMonths, shortMonths.length);
 458     }
 459 
 460     /**
 461      * Sets short month strings. For example: "Jan", "Feb", etc.
 462      * @param newShortMonths the new short month strings. The array should
 463      * be indexed by {@link java.util.Calendar#JANUARY Calendar.JANUARY},
 464      * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY}, etc.
 465      */
 466     public void setShortMonths(String[] newShortMonths) {
 467         shortMonths = Arrays.copyOf(newShortMonths, newShortMonths.length);
 468         cachedHashCode = 0;
 469     }
 470 


< prev index next >