|
JavaTM 2 Platform Std. Ed. v1. 4.0 |
||||||||||
| ÀüÀÇ Å¬·¡½º ´ÙÀ½ÀÇ Å¬·¡½º | ÇÁ·¹ÀÓ ÀÖ¾î ÇÁ·¹ÀÓ ¾øÀ½ | ||||||||||
| °³¿ä: »óÀÚ | Çʵå | constructor | ¸Þ¼Òµå | »ó¼¼: Çʵå | constructor | ¸Þ¼Òµå | ||||||||||
java.lang.Object
|
+--java.text.Format
|
+--java.text.MessageFormat
MessageFormat ´Â ¿¬°áµÈ ¸Þ¼¼Áö¸¦, ¾ð¾î¿¡ ÀÇÁ¸ÇÏÁö ¾Ê´Â ¹æ¹ýÀ¸·Î ±¸ÃàÇϱâ À§ÇÑÀÇ °ÍÀÔ´Ï´Ù. ÃÖÁ¾ »ç¿ëÀÚ¿ëÀ¸·Î Ç¥½ÃÇÏ´Â ¸Þ¼¼Áö´Â ÀÌ ¹æ¹ýÀ¸·Î ±¸ÃàÇØ ÁÖ¼¼¿ä.
MessageFormat ´Â 1 Á¶ÀÇ ¿ÀºêÁ§Æ®¸¦ Æ÷¸Ë ÇØ, Æ÷¸Ë ÇÑ Ä³¸¯ÅÍ ¶óÀÎÀ» ÆÐÅÏÀÇ ÀûÀýÇÑ Àå¼Ò¿¡ »ðÀÔÇÕ´Ï´Ù.
ÁÖ:
MessageFormat °¡ ´Ù¸¥ Format Ŭ·¡½º¿Í ´Ù¸¥ Á¡Àº MessageFormat ¿ÀºêÁ§Æ®¸¦ (getInstance ½ºÅ¸ÀÏÀÇ ÆÑÅ丮 ¸Þ¼Òµå´Â ¾Æ´Ï°í) ±× constructor ÀÇ 1 °³·Î ÀÛ¼ºÇÑ´Ù°í ÇÏ´Â °ÍÀÔ´Ï´Ù. MessageFormat ¿¡¼´Â ·ÎÄÉÀÏ °íÀ¯ÀÇ µ¿ÀÛÀº ±¸ÇöµÇ¾î ÀÖÁö ¾Ê±â ¶§¹®¿¡, ÆÑÅ丮 ¸Þ¼Òµå´Â ÇÊ¿ä ¾ø½À´Ï´Ù. ·ÎÄÉÀÏ °íÀ¯ÀÇ µ¿ÀÛÀº Á¦°øÇÏ´Â ÆÐÅÏ ¹× »ðÀÔµÈ Àμö¿¡ »ç¿ëÇÏ´Â ¼ºê Æ÷¸Ë¿¡ ÀÇÇØ Á¤Àǵ˴ϴÙ.
MessageFormat ´Â ´ÙÀ½ÀÇ ÆÐÅÏÀ» »ç¿ëÇÕ´Ï´Ù.
MessageFormatPattern:
String
MessageFormatPattern FormatElement String
FormatElement:
{ ArgumentIndex }
{ ArgumentIndex , FormatType }
{ ArgumentIndex , FormatType , FormatStyle }
FormatType: one of
number date time choice
FormatStyle:
short
medium
long
full
integer
currency
percent
SubformatPattern
String:
StringPartopt
String StringPart
StringPart:
''
' QuotedString '
UnquotedString
SubformatPattern:
SubformatPatternPartopt
SubformatPattern SubformatPatternPart
SubFormatPatternPart:
' QuotedPattern '
UnquotedPattern
String ³»¿¡¼´Â "''" ´Â ´ÜÀÏ ÀοëºÎÈ£¸¦ ³ªÅ¸³À´Ï´Ù. QuotedString ´Â ´ÜÀÏ ÀοëºÎÈ£¸¦ Á¦¿ÜÇÑ ÀÓÀÇÀÇ Ä³¸¯Å͸¦ Æ÷ÇÔÇÕ´Ï´Ù. µÑ·¯½Î°í ÀÖ´Â ´ÜÀÏ ÀοëºÎÈ£´Â »èÁ¦µË´Ï´Ù. UnquotedString ´Â ´ÜÀÏ ÀοëºÎÈ£¿Í ¿ÞÂÊ´ë°ýÈ£¸¦ Á¦¿ÜÇÑ ÀÓÀÇÀÇ Ä³¸¯Å͸¦ Æ÷ÇÔÇÕ´Ï´Ù. µû¶ó¼, Æ÷¸Ë µÈ ¸Þ¼¼Áö·Î "'{0}'" °¡ µÇ´Â ij¸¯ÅÍ ¶óÀÎÀº "'''{'0}''" ¶Ç´Â "'''{0}'''" ¿Í ±â¼úÇÕ´Ï´Ù.
SubformatPattern ³»¿¡¼´Â ´Ù¸¥ ·êÀÌ Àû¿ëµË´Ï´Ù. QuotedPattern ´Â ´ÜÀÏ ÀοëºÎÈ£ ÀÌ¿ÜÀÇ ÀÓÀÇÀÇ Ä³¸¯Å͸¦ Æ÷ÇÔÇÕ´Ï´Ù¸¸, µÑ·¯½Î°í ÀÖ´Â ´ÜÀÏ ÀοëºÎÈ£´Â »èÁ¦µÇÁö ¾Ê½À´Ï´Ù. ÀÌ ¶§¹®¿¡ ´ÜÀÏ ÀοëºÎÈ£´Â ¼ºê Æ÷¸Ë¿¡ ÀÇÇØ ÇØ¼®µË´Ï´Ù. ¿¹¸¦ µé¾î,"{1, number,$'#',##}" ¶ó°í ÁöÁ¤Çϸé(ÀÚ), ÇØ½Ã ±âÈ£ (#)°¡ ºÙÀº ¼öÄ¡ Æ÷¸ËÀÌ »ý¼ºµË´Ï´Ù. °á°ú´Â ¡¸$#31, 45¡¹¿Í °°ÀÌ µË´Ï´Ù. UnquotedPattern ´Â ´ÜÀÏ ÀοëºÎÈ£ ÀÌ¿ÜÀÇ ÀÓÀÇÀÇ Ä³¸¯Å͸¦ Æ÷ÇÔÇÕ´Ï´Ù¸¸, ±× Á߾ȰýÈ£´Â Æä¾î°¡ µÇ¾î ÀÖÀ» Çʿ䰡 ÀÖ½À´Ï´Ù. ¿¹¸¦ µé¾î,"ab {0} de" ¿Í "ab '}' de" ´Â À¯È¿ÇÑ ¼ºê Æ÷¸Ë ÆÐÅÏÀÔ´Ï´Ù¸¸,"ab {0'}' de" ¿Í "ab } de" ´Â ¹«È¿ÀÔ´Ï´Ù.
ArgumentIndex Ä¡´Â ¼ýÀÚ 0 ~ 9 ¸¦ »ç¿ëÇØ ±â¼úÇÑ 0 ÀÌ»óÀÇ Á¤¼öÀÔ´Ï´Ù. format ¸Þ¼Òµå¿¡°Ô °Ç³×Áø arguments ¹è¿ ¶Ç´Â parse ¸Þ¼Òµå¿¡ ÀÇÇØ µ¹·ÁÁÖ¾îÁø °á°úÀÇ ¹è¿ÀÇ À妽º¸¦ ³ªÅ¸³À´Ï´Ù.
FormatType ¹× FormatStyle Ä¡´Â Æ÷¸Ë ¿ä¼ÒÀÇ Format ÀνºÅϽºÀÇ »ý¼º¿¡ »ç¿ëÇÕ´Ï´Ù. ´ÙÀ½ÀÇ °Ñ(Ç¥)¿¡, Format ÀνºÅϽº¿¡ÀÇ °ªÀÇ MAP¿¡ ´ëÇØ °¡¸®Åµ´Ï´Ù. °Ñ(Ç¥)¿¡ ¾ø´Â Æí¼ºÀº »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù. SubformatPattern ´Â »ç¿ëÇÏ´Â Format ¼ºê Ŭ·¡½º¿¡ ´ëÇØ¼ À¯È¿ÇÑ ÆÐÅÏ Ä³¸¯ÅÍ ¶óÀÎÀÌ ¾Æ´Ï¸é ¾ÈµË´Ï´Ù.
| Æ÷¸Ë ŸÀÔ | Æ÷¸Ë ½ºÅ¸ÀÏ | »ý¼ºµÇ´Â ¼ºê Æ÷¸Ë | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| (¾øÀ½) | null
| ||||||||||||||||
number
| (¾øÀ½) | NumberFormat.getInstance(getLocale())
| |||||||||||||||
integer
| NumberFormat.getIntegerInstance(getLocale())
| ||||||||||||||||
currency
| NumberFormat.getCurrencyInstance(getLocale())
| ||||||||||||||||
percent
| NumberFormat.getPercentInstance(getLocale())
| ||||||||||||||||
| SubformatPattern | new DecimalFormat(subformatPattern, new DecimalFormatSymbols(getLocale()))
| ||||||||||||||||
date
| (¾øÀ½) | DateFormat.getDateInstance(DateFormat.DEFAULT, getLocale())
| |||||||||||||||
short
| DateFormat.getDateInstance(DateFormat.SHORT, getLocale())
| ||||||||||||||||
medium
| DateFormat.getDateInstance(DateFormat.DEFAULT, getLocale())
| ||||||||||||||||
long
| DateFormat.getDateInstance(DateFormat.LONG, getLocale())
| ||||||||||||||||
full
| DateFormat.getDateInstance(DateFormat.FULL, getLocale())
| ||||||||||||||||
| SubformatPattern | new SimpleDateFormat(subformatPattern, getLocale())
| ||||||||||||||||
ÀÌ »ç¿ë¿¹¸¦ ´ÙÀ½¿¡ ³ªÅ¸³À´Ï´Ù.
Object[] arguments = {
new Integer(7),
new Date(System.currentTimeMillis()),
"a disturbance in the Force"
};
String result = MessageFormat.format(
"At {1, time} on {1, date}, there was {2} on planet {0, number, integer}. ",
arguments);
output: At 12:30 PM on Jul 3, 2053, there was a disturbance
in the Force on planet 7.
ÀϹÝÀûÀ¸·Î, ¸Þ¼¼Áö Æ÷¸ËÀº ¸®¼Ò½º·ÎºÎÅÍ ÁÖ¾îÁ® Àμö´Â ½ÇÇà½Ã¿¡ µ¿ÀûÀ¸·Î ¼³Á¤µË´Ï´Ù.
·Ê 2:
Object[] testArgs = {new Long(3), "MyDisk"};
MessageFormat form = new MessageFormat(
"The disk \"{1}\" contains {0} file(s). ");
System.out.println(form.format(testArgs));
// output, with different testArgs
output: The disk "MyDisk" contains 0 file(s).
output: The disk "MyDisk" contains 1 file(s).
output: The disk "MyDisk" contains 1,273 file(s).
ÇÑÃþ ´õ º¹ÀâÇÑ ÆÐÅÏÀÇ °æ¿ì,ChoiceFormat ¸¦ »ç¿ëÇØ ´ÙÀ½°ú °°ÀÌ Ãâ·ÂÀ» ¾òÀ» ¼öµµ ÀÖ½À´Ï´Ù.
MessageFormat form = new MessageFormat("The disk \"{1}\" contains {0}. ");
double[] filelimits = {0,1,2};
String[] filepart = {"no files","one file","{0, number} files"};
ChoiceFormat fileform = new ChoiceFormat(filelimits, filepart);
form.setFormatByArgumentIndex(0, fileform);
Object[] testArgs = {new Long(12373), "MyDisk"};
System.out.println(form.format(testArgs));
// output, with different testArgs
output: The disk "MyDisk" contains no files.
output: The disk "MyDisk" contains one file.
output: The disk "MyDisk" contains 1,273 files.
À̰ÍÀº À§ÀÇ ¿¹ÀÇ °°°Ô ÇÁ·Î±×·¥ÀûÀ¸·Î ½Ç½ÃÇÏ´ÂÁö ´ÙÀ½°ú °°ÀÌ ÆÐÅÏ (ÀÚ¼¼ÇÑ °ÍÀº ChoiceFormat ¸¦ ÂüÁ¶)À» »ç¿ëÇØ ½Ç½ÃÇÒ ¼ö°¡ ÀÖ½À´Ï´Ù.
form.applyPattern(
"There {0, choice, 0#are no files|1#is one file|1<are {0, number, integer} files}. ");
ÁÖ: Àü¼ú°ú °°ÀÌ,MessageFormat ÀÇ ChoiceFormat ·Î »ý¼ºµÇ´Â ij¸¯ÅÍ ¶óÀÎÀº Ưº°È÷ 󸮵˴ϴÙ. º¹¼öÀÇ °Í { À» »ç¿ëÇØ ¼ºê Æ÷¸ËÀ» ³ªÅ¸³», ¹Ýº¹À» ½Ç½ÃÇÕ´Ï´Ù. MessageFormat ¿Í ChoiceFormat ¸¦ ¾çÂÊ ¸ðµÎ (ij¸¯ÅÍ ¶óÀÎ ÆÐÅÏÀº ¾Æ´Ï°í) ÇÁ·Î±×·¥ÀûÀ¸·Î ÀÛ¼ºÇÏ´Â °æ¿ì¿¡´Â Àç±ÍÀûÀ¸·Î ¹Ýº¹ÇÏ´Â Æ÷¸ËÀ» ÀÛ¼ºÇÏÁö ¾Ê°Ô ÁÖÀÇÇØ ÁÖ¼¼¿ä. ¿µ±¸ ·çÇÁ°¡ µË´Ï´Ù.
1 °³ÀÇ Àμö°¡ ij¸¯ÅÍ ¶óÀγ»¿¡¼ ¿©·¯ Â÷·Ê ÇØ¼®µÇ¸é(ÀÚ), ¸¶Áö¸·¿¡ ÀÏÄ¡ÇÏ´Â °ÍÀÌ ÇØ¼®ÀÇ ÃÖÁ¾ °á°ú°¡ µË´Ï´Ù. ´ÙÀ½¿¡ ¿¹¸¦ ³ªÅ¸³À´Ï´Ù.
MessageFormat mf = new MessageFormat("{0, number,#. ##}, {0, number,#. #}");
Object[] objs = {new Double(3.1415)};
String result = mf.format( objs );
// result now equals "3.14, 3.1"
objs = null;
objs = mf.parse(result, new ParsePosition(0));
// objs now equals {new Double(3.1)}
°°ÀÌ °°Àº Àμö°¡ ¿©·¯ Â÷·Ê ³ª¿À´Â ÆÐÅÏÀ» »ç¿ëÇØ MessageFormat ¿ÀºêÁ§Æ®¸¦ ÇØ¼®Çϸé(ÀÚ), ¸¶Áö¸·¿¡ ÀÏÄ¡ÇÏ´Â °ÍÀÌ µ¹·ÁÁÖ¾îÁý´Ï´Ù. ´ÙÀ½¿¡ ¿¹¸¦ ³ªÅ¸³À´Ï´Ù.
MessageFormat mf = new MessageFormat("{0}, {0}, {0}");
String forParsing = "x, y, z";
Object[] objs = mf.parse(forParsing, new ParsePosition(0));
// result now equals {new String("z")}
¸Þ¼¼Áö Æ÷¸ËÀº µ¿±âÈ µÇÁö ¾Ê½À´Ï´Ù. thread ¸¶´Ù ´Ù¸¥ Æ÷¸Ë ÀνºÅϽº¸¦ ÀÛ¼ºÇÏ´Â °ÍÀ» ÃßõÇÕ´Ï´Ù. º¹¼öÀÇ thread°¡ Æ÷¸Ë¿¡ µ¿½Ã¿¡ ¾×¼¼½º ÇÏ´Â °æ¿ì´Â ¿ÜºÎÀûÀ¸·Î µ¿±âÈÇÒ Çʿ䰡 ÀÖ½À´Ï´Ù.
Locale ,
Format ,
NumberFormat ,
DecimalFormat ,
ChoiceFormat ,
Á÷·ÄÈ µÈ Çü½Ä | ÁßøµÈ Ŭ·¡½ºÀÇ °³¿ä | |
static class |
MessageFormat.Field
MessageFormat.formatToCharacterIterator ·ÎºÎÅÍ µ¹·ÁÁÖ¾îÁø AttributedCharacterIterator ³»ÀÇ ¼Ó¼º Ű·Î¼ »ç¿ëÇÏ´Â Á¤¼ö¸¦ Á¤ÀÇÇÕ´Ï´Ù. |
| Ŭ·¡½º java.text. Format À» »ó¼Ó¹ÞÀº ÁßøµÈ Ŭ·¡½º |
|
| »ý¼ºÀÚÀÇ °³¿ä | |
MessageFormat (String pattern)
µðÆúÆ® ·ÎÄÉÀϰú ÁöÁ¤µÈ ÆÐÅÏÀ» À§ÇÑ MessageFormat ¸¦ ±¸ÃàÇÕ´Ï´Ù. |
|
MessageFormat (String pattern,
Locale locale)
ÁöÁ¤µÈ ·ÎÄÉÀϰú ÆÐÅÏÀ» À§ÇÑ MessageFormat ¸¦ ±¸ÃàÇÕ´Ï´Ù. |
|
| ¸Þ¼ÒµåÀÇ °³¿ä | |
void |
applyPattern (String pattern)
ÀÌ ¸Þ¼¼Áö Æ÷¸Ë¿¡ ÀÇÇØ »ç¿ëµÇ´Â ÆÐÅÏÀ» ¼³Á¤ÇÕ´Ï´Ù. |
Object |
clone ()
ÀÌ ¿ÀºêÁ§Æ®ÀÇ Ä«ÇǸ¦ ÀÛ¼ºÇØ, µ¹·ÁÁÝ´Ï´Ù. |
boolean |
equals (Object obj)
2 °³ÀÇ ¸Þ¼¼Áö Æ÷¸Ë ¿ÀºêÁ§Æ®ÀÇ »çÀÌÀÇ µîÈ£ ºñ±³ÀÔ´Ï´Ù. |
StringBuffer |
format (Object [] arguments,
StringBuffer result,
FieldPosition pos)
¿ÀºêÁ§Æ®ÀÇ ¹è¿À» Æ÷¸Ë ÇØ, Á¦°øµÈ StringBuffer ¿¡, Æ÷¸Ë ¿ä¼Ò¸¦ Æ÷¸Ë µÈ ¿ÀºêÁ§Æ®¿¡ ÀÇÇØ ¿Å°Ü³õ¾Æ MessageFormat ÀÇ ÆÐÅÏÀ» Ãß°¡ÇÕ´Ï´Ù.
|
StringBuffer |
format (Object arguments,
StringBuffer result,
FieldPosition pos)
¿ÀºêÁ§Æ®ÀÇ ¹è¿À» Æ÷¸Ë ÇØ, Á¦°øµÈ StringBuffer ¿¡, Æ÷¸Ë ¿ä¼Ò¸¦ Æ÷¸Ë µÈ ¿ÀºêÁ§Æ®·Î ¿Å°Ü³õ¾Æ,MessageFormat ÀÇ ÆÐÅÏÀ» Ãß°¡ÇÕ´Ï´Ù. |
static String |
format (String pattern,
Object [] arguments)
ÁöÁ¤µÈ ÆÐÅÏÀ» »ç¿ëÇØ MessageFormat ¸¦ ÀÛ¼ºÇØ, ±×°ÍÀ» »ç¿ëÇØ ÁöÁ¤µÈ Àμö¸¦ Æ÷¸Ë ÇÕ´Ï´Ù. |
AttributedCharacterIterator |
formatToCharacterIterator (Object arguments)
¿ÀºêÁ§Æ®ÀÇ ¹è¿À» Æ÷¸Ë ÇØ, ±×°ÍÀ» MessageFormat ÀÇ ÆÐÅÏ¿¡ »ðÀÔÇØ,AttributedCharacterIterator ¸¦ »ý¼ºÇÕ´Ï´Ù. |
Format [] |
getFormats ()
¹Ì¸® ¼³Á¤µÈ ÆÐÅÏ Ä³¸¯ÅÍ ¶óÀγ»ÀÇ Æ÷¸Ë ¿ä¼Ò¿¡ »ç¿ëµÇ´Â Æ÷¸ËÀ» ÃëµæÇÕ´Ï´Ù. |
Format [] |
getFormatsByArgumentIndex ()
format ¸Þ¼Òµå¿¡°Ô °Ç³×Áö´Â °ª ¶Ç´Â parse ¸Þ¼Òµå·ÎºÎÅÍ µ¹·ÁÁÖ¾îÁø °ª¿¡ »ç¿ëµÇ´Â Æ÷¸ËÀ» ÃëµæÇÕ´Ï´Ù. |
Locale |
getLocale ()
¼ºê Æ÷¸ËÀ» ÀÛ¼º ¶Ç´Â ºñ±³ÇÏ´Â °æ¿ì¿¡ »ç¿ëµÇ´Â ·ÎÄÉÀÏÀ» ÃëµæÇÕ´Ï´Ù. |
int |
hashCode ()
¸Þ¼¼Áö Æ÷¸Ë ¿ÀºêÁ§Æ®ÀÇ ÇØ½Ã Äڵ带 »ý¼ºÇÕ´Ï´Ù. |
Object [] |
parse (String source)
ÁöÁ¤µÈ ij¸¯ÅÍ ¶óÀÎÀÇ ¼±µÎ·ÎºÎÅÍ ÅØ½ºÆ®¸¦ ÇØ¼®ÇØ ¿ÀºêÁ§Æ® ¹è¿À» »ý¼ºÇÕ´Ï´Ù. |
Object [] |
parse (String source,
ParsePosition pos)
ij¸¯ÅÍ ¶óÀÎÀ» ÇØ¼®ÇÕ´Ï´Ù. |
Object |
parseObject (String source,
ParsePosition pos)
ij¸¯ÅÍ ¶óÀÎÀ¸·ÎºÎÅÍ ÅØ½ºÆ®¸¦ ÇØ¼®ÇØ ¿ÀºêÁ§Æ® ¹è¿À» »ý¼ºÇÕ´Ï´Ù. |
void |
setFormat (int formatElementIndex,
Format newFormat)
¹Ì¸® ¼³Á¤µÈ ÆÐÅÏ Ä³¸¯ÅÍ ¶óÀγ»ÀÇ ÁöÁ¤µÈ Æ÷¸Ë ¿ä¼Ò À妽º·Î, Æ÷¸Ë ¿ä¼Ò¿¡ »ç¿ëÇÏ´Â Æ÷¸ËÀ» ¼³Á¤ÇÕ´Ï´Ù. |
void |
setFormatByArgumentIndex (int argumentIndex,
Format newFormat)
ÁöÁ¤µÈ Àμö À妽º¸¦ »ç¿ëÇÑ´Ù, ¹Ì¸® ¼³Á¤µÈ ÆÐÅÏ Ä³¸¯ÅÍ ¶óÀγ»ÀÇ Æ÷¸Ë ¿ä¼Ò¿¡ »ç¿ëÇÏ´Â Æ÷¸ËÀ» ¼³Á¤ÇÕ´Ï´Ù. |
void |
setFormats (Format [] newFormats)
¹Ì¸® ¼³Á¤µÈ ÆÐÅÏ Ä³¸¯ÅÍ ¶óÀγ»ÀÇ Æ÷¸Ë ¿ä¼Ò¿¡ »ç¿ëÇÏ´Â Æ÷¸ËÀ» ¼³Á¤ÇÕ´Ï´Ù. |
void |
setFormatsByArgumentIndex (Format [] newFormats)
format ¸Þ¼Òµå¿¡°Ô °Ç³×Áö´Â °ª ¶Ç´Â parse ¸Þ¼Òµå·ÎºÎÅÍ µ¹·ÁÁÖ¾îÁø °ª¿¡ »ç¿ëÇÏ´Â Æ÷¸ËÀ» ¼³Á¤ÇÕ´Ï´Ù. |
void |
setLocale (Locale locale)
¼ºê Æ÷¸ËÀ» ÀÛ¼º ¶Ç´Â ºñ±³ÇÏ´Â °æ¿ì¿¡ »ç¿ëÇÏ´Â ·ÎÄÉÀÏÀ» ¼³Á¤ÇÕ´Ï´Ù. |
String |
toPattern ()
¸Þ¼¼Áö Æ÷¸ËÀÇ ÇöÀç »óŸ¦ ³ªÅ¸³»´Â ÆÐÅÏÀ» µ¹·ÁÁÝ´Ï´Ù. |
| Ŭ·¡½º java.text. Format ¿¡¼ »ó¼Ó¹ÞÀº ¸Þ¼Òµå |
format , parseObject |
| Ŭ·¡½º java.lang. Object ¿¡¼ »ó¼Ó¹ÞÀº ¸Þ¼Òµå |
finalize , getClass , notify , notifyAll , toString , wait , wait , wait |
| »ý¼ºÀÚÀÇ »ó¼¼ |
public MessageFormat(String pattern)
pattern - ÀÌ ¸Þ¼¼Áö Æ÷¸ËÀ» À§ÇÑ ÆÐÅÏ
IllegalArgumentException - ÆÐÅÏÀÌ ¹«È¿ÀÎ °æ¿ì
public MessageFormat(String pattern,
Locale locale)
pattern - ÀÌ ¸Þ¼¼Áö Æ÷¸ËÀ» À§ÇÑ ÆÐÅÏlocale - ÀÌ ¸Þ¼¼Áö Æ÷¸ËÀ» À§ÇÑ ·ÎÄÉÀÏ
IllegalArgumentException - ÆÐÅÏÀÌ ¹«È¿ÀÎ °æ¿ì| ¸Þ¼ÒµåÀÇ »ó¼¼ |
public void setLocale(Locale locale)
applyPattern ¹× toPattern ¸Þ¼Òµå¿Í format ¹× formatToCharacterIterator ¸Þ¼Òµå¿¡ÀÇ È£Ãâ¿¡ ¿µÇâÀ» ÁÝ´Ï´Ù.
locale - ¼ºê Æ÷¸ËÀ» ÀÛ¼º ¶Ç´Â ºñ±³ÇÏ´Â °æ¿ì¿¡ »ç¿ëÇÏ´Â ·ÎÄÉÀÏpublic Locale getLocale()
public void applyPattern(String pattern)
pattern - ÀÌ ¸Þ¼¼Áö Æ÷¸ËÀ» À§ÇÑ ÆÐÅÏ
IllegalArgumentException - ÆÐÅÏÀÌ ¹«È¿ÀÎ °æ¿ìpublic String toPattern()
public void setFormatsByArgumentIndex(Format [] newFormats)
format ¸Þ¼Òµå¿¡°Ô °Ç³×Áö´Â °ª ¶Ç´Â parse ¸Þ¼Òµå·ÎºÎÅÍ µ¹·ÁÁÖ¾îÁø °ª¿¡ »ç¿ëÇÏ´Â Æ÷¸ËÀ» ¼³Á¤ÇÕ´Ï´Ù. newFormats ³»ÀÇ ¿ä¼ÒÀÇ À妽º´Â ¹Ì¸® ¼³Á¤µÈ ÆÐÅÏ Ä³¸¯ÅÍ ¶óÀÎÀ¸·Î »ç¿ëµÇ´Â Àμö À妽º¿¡ ´ëÀÀÇÕ´Ï´Ù. µû¶ó¼,newFormats ³»ÀÇ Æ÷¸ËÀÇ ¼ø¼´Â format ¸Þ¼Òµå¿¡°Ô °Ç³×Áø arguments ¹è¿ ¶Ç´Â parse ¸Þ¼Òµå¿¡ ÀÇÇØ µ¹·ÁÁÖ¾îÁø °á°úÀÇ ¹è¿³»ÀÇ ¿ä¼ÒÀÇ ¼ø¼¿¡ ´ëÀÀÇÕ´Ï´Ù.
Àμö À妽º°¡ ÆÐÅÏ Ä³¸¯ÅÍ ¶óÀγ»¿¡¼ º¹¼öÀÇ Æ÷¸Ë ¿ä¼Ò¿¡ »ç¿ëµÇ´Â °æ¿ì, ´ëÀÀÇÏ´Â »õ·Î¿î Æ÷¸ËÀÌ ±× ¸ðµç Æ÷¸Ë ¿ä¼Ò¿¡ »ç¿ëµË´Ï´Ù. Àμö À妽º°¡ ij¸¯ÅÍ ¶óÀγ»¿¡¼ ¾î´À Æ÷¸Ë ¿ä¼Ò¿¡µµ »ç¿ëµÇÁö ¾Ê´Â °æ¿ì´Â ´ëÀÀÇÏ´Â »õ·Î¿î Æ÷¸ËÀº ¹«½ÃµË´Ï´Ù. Á¦°øµÈ Æ÷¸ËÀÌ ÇÊ¿ä¼ö¿¡ ¸ø ¹ÌÄ£ °æ¿ì,newFormats.length º¸´Ù ÀûÀº Àμö À妽º¿¡ ´ëÇÑ Æ÷¸Ë¸¸ÀÌ ¿Å°Ü³õÀ» ¼ö ÀÖ½À´Ï´Ù.
newFormats - »ç¿ëÇÏ´Â »õ·Î¿î Æ÷¸Ë
NullPointerException - newFormats °¡ null ÀÇ °æ¿ìpublic void setFormats(Format [] newFormats)
newFormats ³»ÀÇ Æ÷¸ËÀÇ ¼ø¼´Â ÆÐÅÏ Ä³¸¯ÅÍ ¶óÀγ»ÀÇ Æ÷¸Ë ¿ä¼ÒÀÇ ¼ø¼¿¡ ´ëÀÀÇÕ´Ï´Ù.
ÆÐÅÏ Ä³¸¯ÅÍ ¶óÀÎÀ¸·Î ÇÊ¿ä·Î ÇÏ´Â °Íº¸´Ùµµ ¸¹Àº Æ÷¸ËÀÌ Á¦°øµÇ¾úÀ» °æ¿ì, ³²Àº Æ÷¸ËÀº ¹«½ÃµË´Ï´Ù. ÇÊ¿ä¼ö¿¡ ¸ø ¹ÌÄ£ °æ¿ì´Â ÃÖÃÊÀÇ newFormats.length ¸¸ÀÌ ¿Å°Ü³õÀ» ¼ö ÀÖ½À´Ï´Ù.
ÆÐÅÏ Ä³¸¯ÅÍ ¶óÀγ»ÀÇ Æ÷¸Ë ¿ä¼ÒÀÇ ¼ø¼´Â Áö¿ª ´ëÀÀÈÀÇ Ã³¸® °úÁ¤¿¡¼ º¯°æµÇ´Â °ÍÀÌ ¸¹±â ¶§¹®¿¡, Åë»óÀº setFormatsByArgumentIndex ¸Þ¼Òµå¸¦ »ç¿ëÇÏ´Â (ºÐ)ÆíÀÌ È¿À²ÀûÀÔ´Ï´Ù. ÀÌ ¸Þ¼Òµå´Â Æ÷¸ËÀÇ ¼ø¼¸¦ format ¸Þ¼Òµå¿¡°Ô °Ç³×Áø arguments ¹è¿ ¶Ç´Â parse ¸Þ¼Òµå¿¡ ÀÇÇØ µ¹·ÁÁÖ¾îÁø °á°úÀÇ ¹è¿³»ÀÇ ¿ä¼ÒÀÇ ¼ø¼¿¡ ´ëÀÀÇÏ´Â °ÍÀ̶ó°í º¾´Ï´Ù.
newFormats - »ç¿ëÇÏ´Â »õ·Î¿î Æ÷¸Ë
NullPointerException - newFormats °¡ null ÀÇ °æ¿ì
public void setFormatByArgumentIndex(int argumentIndex,
Format newFormat)
¸Þ¼Òµå¿¡°Ô °Ç³×Áø arguments ¹è¿ ¶Ç´Â parse ¸Þ¼Òµå¿¡ ÀÇÇØ µ¹·ÁÁÖ¾îÁø °á°úÀÇ ¹è¿ÀÇ À妽º¸¦ ³ªÅ¸³À´Ï´Ù.
Àμö À妽º°¡ ÆÐÅÏ Ä³¸¯ÅÍ ¶óÀγ»¿¡¼ º¹¼öÀÇ Æ÷¸Ë ¿ä¼Ò¿¡ »ç¿ëµÇ´Â °æ¿ì, »õ·Î¿î Æ÷¸ËÀÌ ±× ¸ðµç Æ÷¸Ë ¿ä¼Ò¿¡ »ç¿ëµË´Ï´Ù. Àμö À妽º°¡ ij¸¯ÅÍ ¶óÀγ»¿¡¼ ¾î´À Æ÷¸Ë ¿ä¼Ò¿¡µµ »ç¿ëµÇÁö ¾Ê´Â °æ¿ì´Â »õ·Î¿î Æ÷¸ËÀº ¹«½ÃµË´Ï´Ù.
- ÆÄ¶ó¹ÌÅÍ:
argumentIndex - »õ·Î¿î Æ÷¸Ë¿¡ »ç¿ëÇϱâ À§ÇÑ Àμö À妽ºnewFormat - »ç¿ëÇÏ´Â »õ·Î¿î Æ÷¸Ë- µµÀÔµÈ ¹öÁ¯:
- 1.4
public void setFormat(int formatElementIndex,
Format newFormat)
ÆÐÅÏ Ä³¸¯ÅÍ ¶óÀγ»ÀÇ Æ÷¸Ë ¿ä¼ÒÀÇ ¼ø¼´Â Áö¿ª ´ëÀÀÈÀÇ Ã³¸® °úÁ¤¿¡¼ º¯°æµÇ´Â °ÍÀÌ ¸¹±â ¶§¹®¿¡, Åë»óÀº setFormatByArgumentIndex ¸Þ¼Òµå¸¦ »ç¿ëÇÏ´Â (ºÐ)ÆíÀÌ È¿À²ÀûÀÔ´Ï´Ù. ÀÌ ¸Þ¼Òµå´Â Æ÷¸Ë ¿ä¼Ò°¡ ÁöÁ¤ÇÏ´Â Àμö À妽º¸¦ ±âº»À¸·Î, Æ÷¸Ë ¿ä¼Ò¿¡ ¾×¼¼½º ÇÕ´Ï´Ù.
formatElementIndex - ÆÐÅϳ»ÀÇ Æ÷¸Ë ¿ä¼ÒÀÇ À妽ºnewFormat - ÁöÁ¤µÈ Æ÷¸Ë ¿ä¼Ò¿¡ »ç¿ëÇÏ´Â Æ÷¸Ë
ArrayIndexOutOfBoundsException - formatElementIndex °¡, ÆÐÅÏ Ä³¸¯ÅÍ ¶óÀγ»ÀÇ Æ÷¸Ë ¿ä¼ÒÀÇ ¼öÀÌ»óÀÇ °æ¿ìpublic Format [] getFormatsByArgumentIndex()
format ¸Þ¼Òµå¿¡°Ô °Ç³×Áö´Â °ª ¶Ç´Â parse ¸Þ¼Òµå·ÎºÎÅÍ µ¹·ÁÁÖ¾îÁø °ª¿¡ »ç¿ëµÇ´Â Æ÷¸ËÀ» ÃëµæÇÕ´Ï´Ù. µ¹·ÁÁÖ¾îÁø ¹è¿³»ÀÇ ¿ä¼ÒÀÇ À妽º´Â ¹Ì¸® ¼³Á¤µÈ ÆÐÅÏ Ä³¸¯ÅÍ ¶óÀÎÀ¸·Î »ç¿ëµÇ´Â Àμö À妽º¿¡ ´ëÀÀÇÕ´Ï´Ù. µû¶ó¼, µ¹·ÁÁÖ¾îÁø ¹è¿³»ÀÇ Æ÷¸ËÀÇ ¼ø¼´Â format ¸Þ¼Òµå¿¡°Ô °Ç³×Áø arguments ¹è¿ ¶Ç´Â parse ¸Þ¼Òµå¿¡ ÀÇÇØ µ¹·ÁÁÖ¾îÁø °á°úÀÇ ¹è¿³»ÀÇ ¿ä¼ÒÀÇ ¼ø¼¿¡ ´ëÀÀÇÕ´Ï´Ù.
Àμö À妽º°¡ ÆÐÅÏ Ä³¸¯ÅÍ ¶óÀγ»¿¡¼ º¹¼öÀÇ Æ÷¸Ë ¿ä¼Ò¿¡ »ç¿ëµÇ´Â °æ¿ì, ±× ¸¶Áö¸· Æ÷¸Ë ¿ä¼Ò·Î »ç¿ëµÇ´Â Æ÷¸ËÀÌ ¹è¿¿¡ µ¹·ÁÁÖ¾îÁý´Ï´Ù. Àμö À妽º°¡ ij¸¯ÅÍ ¶óÀγ»¿¡¼ ¾î´À Æ÷¸Ë ¿ä¼Ò¿¡µµ »ç¿ëµÇÁö ¾Ê´Â °æ¿ì´Â null °¡ ¹è¿¿¡ µ¹·ÁÁÖ¾îÁý´Ï´Ù.
public Format [] getFormats()
ÆÐÅÏ Ä³¸¯ÅÍ ¶óÀγ»ÀÇ Æ÷¸Ë ¿ä¼ÒÀÇ ¼ø¼´Â Áö¿ª ´ëÀÀÈÀÇ Ã³¸® °úÁ¤¿¡¼ º¯°æµÇ´Â °ÍÀÌ ¸¹±â ¶§¹®¿¡, Åë»óÀº getFormatsByArgumentIndex ¸Þ¼Òµå¸¦ »ç¿ëÇÏ´Â (ºÐ)ÆíÀÌ È¿À²ÀûÀÔ´Ï´Ù. ÀÌ ¸Þ¼Òµå´Â Æ÷¸ËÀÇ ¼ø¼¸¦ format ¸Þ¼Òµå¿¡°Ô °Ç³×Áø arguments ¹è¿ ¶Ç´Â parse ¸Þ¼Òµå¿¡ ÀÇÇØ µ¹·ÁÁÖ¾îÁø °á°úÀÇ ¹è¿³»ÀÇ ¿ä¼ÒÀÇ ¼ø¼¿¡ ´ëÀÀÇÏ´Â °ÍÀ̶ó°í º¾´Ï´Ù.
public final StringBuffer format(Object [] arguments,
StringBuffer result,
FieldPosition pos)
StringBuffer ¿¡, Æ÷¸Ë ¿ä¼Ò¸¦ Æ÷¸Ë µÈ ¿ÀºêÁ§Æ®¿¡ ÀÇÇØ ¿Å°Ü³õ¾Æ MessageFormat ÀÇ ÆÐÅÏÀ» Ãß°¡ÇÕ´Ï´Ù.
°³°³ÀÇ Æ÷¸Ë ¿ä¼Ò¿¡ ġȯµÈ ÅØ½ºÆ®´Â ´ÙÀ½ÀÇ °Ñ(Ç¥)ÀÇ ÃÖÃÊ·Î ÀÏÄ¡ÇÏ´Â ÇàÀ¸·Î ³ªÅ¸³ªµµ·Ï(µíÀÌ), Æ÷¸Ë ¿ä¼ÒÀÇ ÇöÀçÀÇ ¼ºê Æ÷¸Ë°ú Æ÷¸Ë ¿ä¼ÒÀÇ Àμö À妽º¿¡ ÀÖ´Â arguments ¿ä¼Ò·ÎºÎÅÍ ¾òÀ» ¼ö ÀÖ½À´Ï´Ù. Àμö´Â arguments °¡ nullÀÎÁö ¶Ç´Â ¿ä¼ÒÀÇ ¼ö°¡ argumentIndex+1 °³º¸´Ù ÀûÀº °æ¿ì,»ç¿ë ºÒ°¡ÀÔ´Ï´Ù.
| ¼ºê Æ÷¸Ë | Àμö | Æ÷¸Ë µÈ ÅØ½ºÆ® |
|---|---|---|
| ÀÓÀÇ | »ç¿ë ºÒ°¡ | "{" + argumentIndex + "}"
|
| ÀÓÀÇ | null
| "null"
|
instanceof ChoiceFormat
| ÀÓÀÇ | subformat.format(argument). indexOf('{') >= 0 ?
|
! = null
| ÀÓÀÇ | subformat.format(argument)
|
null
| instanceof Number
| NumberFormat.getInstance(getLocale()). format(argument)
|
null
| instanceof Date
| DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, getLocale()). format(argument)
|
null
| instanceof String
| argument
|
null
| ÀÓÀÇ | argument.toString()
|
pos °¡ null °¡ ¾Æ´Ï°í, ÇÑÆí Field.ARGUMENT ¸¦ ÂüÁ¶Çϰí ÀÖ´Â °æ¿ì, ÃÖÃÊÀÇ Æ÷¸Ë µÈ ij¸¯ÅÍ ¶óÀÎÀÇ À§Ä¡°¡ µ¹·ÁÁÖ¾îÁý´Ï´Ù.
arguments - Æ÷¸Ë Çϵ簡 ¶Ç´Â ¿Å°Ü³õ´Â ´ë»óÀÇ ¿ÀºêÁ§Æ®·ÎºÎÅÍ µÇ´Â ¹è¿result - ÅØ½ºÆ®°¡ Ãß°¡µÇ´Â À§Ä¡pos - ÀÔ·ÂÀÇ °æ¿ì´Â À§Ä¡ ¸ÂÃã Çʵå (ÇÊ¿äÇÑ °æ¿ì). Ãâ·ÂÀÇ °æ¿ì´Â À§Ä¡ ¸ÂÃã ÇʵåÀÇ ¿ÀÇÁ¼Â(offset)
IllegalArgumentException - arguments ¹è¿³»ÀÇ Àμö°¡, ±×°ÍÀ» »ç¿ëÇÏ´Â Æ÷¸Ë ¿ä¼Ò¿¡ ÀÇÇØ ¿¹ÃøµÈ ŸÀÔÀÌ ¾Æ´Ñ °æ¿ì
public static String format(String pattern,
Object [] arguments)
(new MessageFormat (pattern)). format (arguments, new StringBuffer(), null). toString()
IllegalArgumentException - ÆÐÅÏÀÌ ¹«È¿ÀÇ °æ¿ì, ¶Ç´Â arguments ¹è¿³»ÀÇ Àμö°¡, ±×°ÍÀ» »ç¿ëÇÏ´Â Æ÷¸Ë ¿ä¼Ò¿¡ ÀÇÇØ ¿¹ÃøµÈ ŸÀÔÀÌ ¾Æ´Ñ °æ¿ì
public final StringBuffer format(Object arguments,
StringBuffer result,
FieldPosition pos)
StringBuffer ¿¡, Æ÷¸Ë ¿ä¼Ò¸¦ Æ÷¸Ë µÈ ¿ÀºêÁ§Æ®·Î ¿Å°Ü³õ¾Æ,MessageFormat ÀÇ ÆÐÅÏÀ» Ãß°¡ÇÕ´Ï´Ù. À̰ÍÀº ÀÌÇÏÀÇ ±â¼ú°ú µ¿µîÇÕ´Ï´Ù.
format ((Object[]) arguments, result, pos)
Format ³»ÀÇ format arguments - Æ÷¸Ë Çϵ簡 ¶Ç´Â ¿Å°Ü³õ´Â ¿ÀºêÁ§Æ®·ÎºÎÅÍ µÇ´Â ¹è¿result - ÅØ½ºÆ®°¡ Ãß°¡µÇ´Â À§Ä¡pos - ÀÔ·ÂÀÇ °æ¿ì´Â À§Ä¡ ¸ÂÃã Çʵå (ÇÊ¿äÇÑ °æ¿ì). Ãâ·ÂÀÇ °æ¿ì´Â À§Ä¡ ¸ÂÃã ÇʵåÀÇ ¿ÀÇÁ¼Â(offset)
toAppendTo ·Î¼ °Ç³×¹Þ´Â ij¸¯ÅÍ ¶óÀÎ ¹öÆÛ. Æ÷¸Ë µÈ ÅØ½ºÆ®°¡ Ãß°¡µÈ´Ù
IllegalArgumentException - arguments ¹è¿³»ÀÇ Àμö°¡, ±×°ÍÀ» »ç¿ëÇÏ´Â Æ÷¸Ë ¿ä¼Ò¿¡ ÀÇÇØ ¿¹ÃøµÈ ŸÀÔÀÌ ¾Æ´Ñ °æ¿ìpublic AttributedCharacterIterator formatToCharacterIterator(Object arguments)
MessageFormat ÀÇ ÆÐÅÏ¿¡ »ðÀÔÇØ,AttributedCharacterIterator ¸¦ »ý¼ºÇÕ´Ï´Ù. µ¹·ÁÁÖ¾îÁø AttributedCharacterIterator ¸¦ »ç¿ëÇϸé(ÀÚ), °á°úÀÇ String ¸¦ ±¸ÃàÇÒ ¼ö ÀÖÀ½°ú µ¿½Ã¿¡, °á°úÀÇ String ¿¡ ´ëÇÑ Á¤º¸¸¦ ÆÇÁ¤ÇÒ ¼ö ÀÖ½À´Ï´Ù.
µ¹·ÁÁÖ¾îÁø AttributedCharacterIterator ÀÇ ÅØ½ºÆ®´Â ÀÌÇÏÀÇ ±â¼ú¿¡ ÀÇÇØ µ¹·ÁÁÖ¾îÁö´Â ÅØ½ºÆ®¿Í µ¿ÀÏÇÕ´Ï´Ù.
format (arguments, new StringBuffer(), null). toString()
°Ô´Ù°¡AttributedCharacterIterator ´Â Àû¾îµµ arguments ¹è¿³»ÀÇ Àμö·ÎºÎÅÍ ÅØ½ºÆ®°¡ »ý¼ºµÈ À§Ä¡¸¦ ³ªÅ¸³»´Â ¼Ó¼ºÀ» Æ÷ÇÔÇÕ´Ï´Ù. ÀÌ·¯ÇÑ ¼Ó¼ºÀÇ Å°´Â MessageFormat.Field ÇüÀÔ´Ï´Ù. ¼Ó¼ºÀÇ °ªÀº ÅØ½ºÆ®°¡ »ý¼ºµÈ ÀμöÀÇ arguments ¹è¿³»ÀÇ À妽º¸¦ ³ªÅ¸³»´Â Integer ¿ÀºêÁ§Æ®ÀÔ´Ï´Ù.
MessageFormat °¡ »ç¿ëÇÏ´Â ±âº»ÀÇ Format ÀνºÅϽº·ÎºÎÅÍÀÇ ¼Ó¼º/Ä¡µµ, °á°úÀÇ AttributedCharacterIterator ¿¡ ¹èÄ¡µË´Ï´Ù. À̰Ϳ¡ ÀÇÇØ, °á°úÀÇ String ³»ÀÇ ÀμöÀÇ À§Ä¡¸¦ ¾Ë ¼ö ÀÖÀ» »Ó¸¸ ¾Æ´Ï¶ó, ±× Àμö°¡ ¾î´À Çʵ忡 Æ÷ÇԵǾî ÀÖÀ»Áöµµ ¾Ð´Ï´Ù.
Format ³»ÀÇ formatToCharacterIterator arguments - Æ÷¸Ë Çϵ簡 ¶Ç´Â ¿Å°Ü³õ´Â ¿ÀºêÁ§Æ®·ÎºÎÅÍ µÇ´Â ¹è¿
NullPointerException - arguments °¡ null ÀÇ °æ¿ì
IllegalArgumentException - arguments ¹è¿³»ÀÇ Àμö°¡, ±×°ÍÀ» »ç¿ëÇÏ´Â Æ÷¸Ë ¿ä¼Ò¿¡ ÀÇÇØ ¿¹ÃøµÈ ŸÀÔÀÌ ¾Æ´Ñ °æ¿ì
public Object [] parse(String source,
ParsePosition pos)
ÁÖÀÇ: ÇØ¼®Àº ´Ù¾çÇÑ ¿øÀÎÀ» À§Çؼ(¶§¹®¿¡), Àß µ¿ÀÛÇÏÁö ¾Ê´Â °ÍÀÌ ÀÖ½À´Ï´Ù. ¿¹¸¦ µé¾î, ´ÙÀ½°ú °°Àº °æ¿ìÀÔ´Ï´Ù.
public Object [] parse(String source)
throws ParseException
¸Þ¼¼ÁöÀÇ ÇØ¼®¿¡ ´ëÇÑ ÀÚ¼¼ÇÑ °ÍÀº parse(String, ParsePosition) ¸¦ ÂüÁ¶ÇØ ÁÖ¼¼¿ä.
source - ¼±µÎ°¡ ÇØ¼®µÇ´Â String
Object ¹è¿
ParseException - ÁöÁ¤µÈ ij¸¯ÅÍ ¶óÀÎÀÇ ¼±µÎ¸¦ ÇØ¼®ÇÒ ¼ö ¾ø´Â °æ¿ì
public Object parseObject(String source,
ParsePosition pos)
¸Þ¼Òµå´Â pos ¿¡ ÀÇÇØ ÁöÁ¤µÈ À妽º¸¦ °³½Ã À§Ä¡·Î¼ ÅØ½ºÆ®ÀÇ ÇØ¼®À» ½ÃµµÇÕ´Ï´Ù. ÇØ¼®ÀÌ ¿Ï·áÇϸé(ÀÚ),pos ÀÇ À妽º´Â »ç¿ëµÈ ¸¶Áö¸· ij¸¯ÅÍ (ÇØ¼®¿¡¼´Â ij¸¯ÅÍ ¶óÀÎÀÇ ³¡±îÁöÀÇ ¸ðµç ij¸¯ÅͰ¡ »ç¿ëµÈ´Ù°í´Â ÇÒ ¼ö ¾ø´Ù)ÀÇ µÚÀÇ À妽º¿¡ °»½ÅµÇ¾î ÇØ¼®µÈ ¿ÀºêÁ§Æ® ¹è¿ÀÌ µ¹·ÁÁÖ¾îÁý´Ï´Ù. °»½ÅµÈ pos ´Â ÀÌ ¸Þ¼ÒµåÀÇ ´ÙÀ½ÀÇ È£ÃâÀÇ °³½ÃÁ¡À» ³ªÅ¸³»±â À§Çؼ(¶§¹®¿¡) »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. ¿¡·¯°¡ ¹ß»ýÇßÀ» °æ¿ì´Â pos ÀÇ À妽º´Â º¯°æµÇÁö ¾Ê°í ¿¡·¯°¡ ¹ß»ýÇÑ Ä³¸¯ÅÍÀÇ À妽º¿¡ pos ÀÇ ¿¡·¯ À妽º°¡ ¼³Á¤µÇ¾î null °¡ µ¹·ÁÁÖ¾îÁý´Ï´Ù.
¸Þ¼¼ÁöÀÇ ÇØ¼®¿¡ ´ëÇÑ ÀÚ¼¼ÇÑ °ÍÀº parse(String, ParsePosition) ¸¦ ÂüÁ¶ÇØ ÁÖ¼¼¿ä.
Format ³»ÀÇ parseObject source - ºÎºÐÀûÀ¸·Î ÇØ¼®µÇ´Â Stringpos - »ó±âÀÇ À妽º ¹× ¿¡·¯ À妽º Á¤º¸¸¦ °¡Áö´Â ParsePosition ¿ÀºêÁ§Æ®
Object ¹è¿. ¿¡·¯ÀÇ °æ¿ì´Â null ¸¦ µ¹·ÁÁØ´Ù
NullPointerException - pos °¡ null ÀÇ °æ¿ìpublic Object clone()
Format ³»ÀÇ clone public boolean equals(Object obj)
Object ³»ÀÇ equals obj - ºñ±³ ´ë»óÀÇ ÂüÁ¶ ¿ÀºêÁ§Æ®
true, ±×·¸Áö ¾ÊÀº °æ¿ì´Â falseObject.hashCode() ,
Hashtable public int hashCode()
Object ³»ÀÇ hashCode Object.equals(java.lang.Object) ,
Hashtable
|
JavaTM 2 Platform Std. Ed. v1. 4.0 |
||||||||||
| ÀüÀÇ Å¬·¡½º ´ÙÀ½ÀÇ Å¬·¡½º | ÇÁ·¹ÀÓ ÀÖ¾î ÇÁ·¹ÀÓ ¾øÀ½ | ||||||||||
| °³¿ä: »óÀÚ | Çʵå | constructor | ¸Þ¼Òµå | »ó¼¼: Çʵå | constructor | ¸Þ¼Òµå | ||||||||||
Java, Java 2 D, ¹× JDBC ´Â ¹Ì±¹ ¹× ±× ¿ÜÀÇ ³ª¶ó¿¡ ÀÖ¾î¼ÀÇ ¹Ì±¹ Sun Microsystems, Inc. ÀÇ »óÇ¥ ȤÀº µî·Ï»óÇ¥ÀÔ´Ï´Ù.
Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.