2 *******************************************************************************
3 * Copyright (C) 2008, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 *******************************************************************************
7 package com.ibm.icu.impl.jdkadapter;
9 import com.ibm.icu.text.CollationKey;
12 * CollationKeyICU is an adapter class which wraps ICU4J CollationKey and
13 * implements java.text.CollationKey APIs.
15 public class CollationKeyICU extends java.text.CollationKey {
17 private CollationKey fIcuCollKey;
19 private CollationKeyICU(CollationKey icuCollKey) {
20 super(icuCollKey.getSourceString());
21 fIcuCollKey = icuCollKey;
24 public static java.text.CollationKey wrap(CollationKey icuCollKey) {
25 return new CollationKeyICU(icuCollKey);
28 public CollationKey unwrap() {
33 public int compareTo(java.text.CollationKey target) {
34 if (target instanceof CollationKeyICU) {
35 return fIcuCollKey.compareTo(((CollationKeyICU)target).fIcuCollKey);
41 public String getSourceString() {
42 return fIcuCollKey.getSourceString();
46 public byte[] toByteArray() {
47 return fIcuCollKey.toByteArray();
51 public boolean equals(Object obj) {
52 if (obj instanceof CollationKeyICU) {
53 return ((CollationKeyICU)obj).fIcuCollKey.equals(fIcuCollKey);
59 public int hashCode() {
60 return fIcuCollKey.hashCode();