|
Oracle® Globalization Development Kit Java API Reference 10g Release 2 (10.2) Part No. B14224-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.i18n.text.OraCollator
The OraCollator
class performs locale-sensitive string comparisons, including linguistic collation and binary sorting.
Field Summary | |
static int |
CANONICAL_COMPOSITION The OraCollator class composition level value. |
static int |
EQUAL The result of the comparison that the OraCollator object returns if the two strings are equal. |
static int |
GREATER The result of the comparison that the OraCollator object returns if the first string is greater than the second string. |
static int |
LESS The result of the comparison that the OraCollator object returns if the first string is less than the second string. |
static int |
NO_COMPOSITION The OraCollator class composition level value. |
static int |
PRIMARY The OraCollator class strength value. |
static int |
SECONDARY The OraCollator class strength value. |
static int |
TERTIARY The OraCollator class strength value. |
Constructor Summary | |
protected |
OraCollator() The constructor is here only for completeness. |
Method Summary | |
Object |
clone() Makes an independent duplicate of the OraCollator object. |
int |
compare(Object source, Object target) Compares two objects using the current collation rule. |
int |
compare(String source, String target) Compares two strings using the current collation rule. |
boolean |
equals(Object obj) Returns true if this OraCollator object is equal to another. |
String |
getCharSet() Gets the charSet name of this OraCollator object. |
oracle.i18n.text.OraCollationKey |
getCollationKey(String source) Gets the OraCollationKey object for a given source string. |
int |
getComposition() Gets the composition level used for comparison. |
static oracle.i18n.text.OraCollator |
getInstance() Constructs an Oracle collation object from the default Java locale. |
static oracle.i18n.text.OraCollator |
getInstance(Locale locale) Constructs an Oracle collation object from the Java locale. |
static oracle.i18n.text.OraCollator |
getInstance(Locale locale, String sortRule, String charSet) Constructs an OraCollator instance from the specified sortRule value and locale. |
static oracle.i18n.text.OraCollator |
getInstance(oracle.i18n.util.OraLocaleInfo oraLocale) Constructs an Oracle collation object from an OraLocaleInfo object. |
static oracle.i18n.text.OraCollator |
getInstance(String sortRule) Constructs an OraCollator instance from the specified sortRule value. |
static oracle.i18n.text.OraCollator |
getInstance(String sortRule, String charSet) Constructs an OraCollator instance from the specified sortRule value. |
String |
getName() Gets the sorting rule name of this OraCollator object. |
int |
getStrength() Gets the strength used in comparisons. |
int |
hashCode() Creates a hash code for this OraCollator object based on sort rule, strength, and decomposition level. |
void |
setComposition(int compositionMode) Sets the composition level used for comparison. |
void |
setStrength(int newStrength) Sets the strength used in comparisons. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int PRIMARY
OraCollator
class strength value. When set, only primary differences are considered significant during comparison. The assignment of strengths to language features is locale dependant. For example, different base letters ("a" vs. "b") are considered a primary difference. For monolingual and binary sort, a primary setting means accent insensitive.
setStrength(int)
, getStrength()
, Constant Field Valuespublic static final int SECONDARY
OraCollator
class strength value. When set, only secondary and higher-order differences are considered significant during comparison. The assignment of strengths to language features is locale dependant. For example, different accented forms of the same base letter ("a" vs. "â") are considered a secondary difference. For monolingual and binary sort, a secondary setting means case insensitive .
setStrength(int)
, getStrength()
, Constant Field Valuespublic static final int TERTIARY
OraCollator
class strength value. When set, only tertiary and higher-order differences are considered significant during comparison. The assignment of strengths to language features is locale dependant. For example, case differences ("a" vs. "A") are considered a tertiary difference.
setStrength(int)
, getStrength()
, Constant Field Valuespublic static final int NO_COMPOSITION
OraCollator
class composition level value. When the composition level set to NO_COMPOSITION
, canonical equivalence is not considered.
setComposition(int)
, getComposition()
, Constant Field Valuespublic static final int CANONICAL_COMPOSITION
OraCollator
class composition level value. When the composition level set to CANONICAL_COMPOSITION
, canonical equivalence is considered as the same.
setComposition(int)
, getComposition()
, Constant Field Valuespublic static final int EQUAL
OraCollator
object returns if the two strings are equal.
public static final int LESS
OraCollator
object returns if the first string is less than the second string.
public static final int GREATER
OraCollator
object returns if the first string is greater than the second string.
Constructor Detail |
protected OraCollator()
getInstance
method should be used instead to create new OraCollator
objects.Method Detail |
public static oracle.i18n.text.OraCollator getInstance()
OraLocaleInfo
object using the default sorting rule.OraCollator
instancepublic static oracle.i18n.text.OraCollator getInstance(Locale locale)
OraCollator
object.locale
- Java Locale
objectOraCollator
instancepublic static oracle.i18n.text.OraCollator getInstance(oracle.i18n.util.OraLocaleInfo oraLocale)
OraLocaleInfo
object. Retrieves the default collator associated with the OraLocaleInfo
object.oraLocale
- OraLocaleInfo
objectOraCollator
instancepublic static oracle.i18n.text.OraCollator getInstance(String sortRule)
OraCollator
instance from the specified sortRule
value. The sortRule
values are the same as NLSRTL's NLS_SORT names; for example, xgerman
, GENERIC_M
, unicode_binary
, binary
, etc. ai
or ci
can be attached to sort rules to specify the comparison level.sortRule
- Oracle sort rule nameOraCollator
instanceIllegalArgumentException
- if an invalid sort rule name is specifiedpublic static oracle.i18n.text.OraCollator getInstance(String sortRule, String charSet)
OraCollator
instance from the specified sortRule
value. This method will take both Oracle sorting rule and "binary" as sortRule
value. If using Oracle sorting rule, the charSet
values will be ignored. If using binary sorting rule, the charSet
value could be specified by a valid character set on the database server. ai
or ci
can be attached to "binary" for specifying the comparison level.sortRule
- Oracle sort rule namecharSet
- Oracle database character set, could be null
. The default is UTF16OraCollator
instanceIllegalArgumentException
- if an invalid sort rule name is specifiedpublic static oracle.i18n.text.OraCollator getInstance(Locale locale, String sortRule, String charSet)
OraCollator
instance from the specified sortRule
value and locale. This method will take both Oracle sorting rule and "binary" as sortRule
value. If using Oracle sorting rule, the charSet
values will be ignored. If using binary sorting rule, the charSet
value could be specified by a valid character set on the database server. ai
or ci
can be attached to "binary" for specifying the comparison level. It also records the locale information in the instance.locale
- Java Locale
objectsortRule
- Oracle sort rule namecharSet
- Oracle database character set, could be null
. The default is UTF16OraCollator
instancepublic String getName()
OraCollator
object.public String getCharSet()
charSet
name of this OraCollator
object.public void setStrength(int newStrength)
PRIMARY
, SECONDARY
, or TERTIARY
.newStrength
- the new strength to be set, options are PRIMARY
, SECONDARY
or TERTIARY
IllegalArgumentException
- if an invalid strength is specifiedPRIMARY
, SECONDARY
, TERTIARY
public int getStrength()
PRIMARY
, SECONDARY
, or TERTIARY
.PRIMARY
, SECONDARY
, TERTIARY
public void setComposition(int compositionMode)
CANONICAL_COMPOSITION
or NO_COMPOSITION
.compositionMode
- the composition level to be set, options are either CANONICAL_COMPOSITION
or NO_COMPOSITION
IllegalArgumentException
- if an invalid composition mode is specifiedNO_COMPOSITION
, CANONICAL_COMPOSITION
public int getComposition()
CANONICAL_COMPOSITION
or NO_COMPOSITION
.NO_COMPOSITION
, CANONICAL_COMPOSITION
public Object clone()
OraCollator
object.clone
in class Object
OraCollator
objectpublic int hashCode()
OraCollator
object based on sort rule, strength, and decomposition level.hashCode
in class Object
public boolean equals(Object obj)
true
if this OraCollator
object is equal to another.equals
in interface Comparator
equals
in class Object
obj
- a target object with which to be comparedtrue
if equal or false
if notpublic int compare(Object source, Object target)
This implementation merely returns compare((String)o1, (String)o2)
.
compare
in interface Comparator
source
- first Object
to be comparedtarget
- second Object
to be comparedOraCollator.GREATER
, OraCollator.EQUAL
, or OraCollator.LESS
public int compare(String source, String target)
source
- first String
to be comparedtarget
- second String
to be comparedOraCollator.GREATER
, OraCollator.EQUAL
, or OraCollator.LESS
public oracle.i18n.text.OraCollationKey getCollationKey(String source)
OraCollationKey
object for a given source string.source
- source string to get Oracle collation keyOraCollationKey
object
|
Oracle® Globalization Development Kit Java API Reference 10g Release 2 (10.2) Part No. B14224-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |