public boolean equals(Object obj) { if (!(obj instanceof NlsString)) { return false; } NlsString that = (NlsString) obj; return Util.equal(value, that.value) && Util.equal(charsetName, that.charsetName) && Util.equal(collation, that.collation); }
/** * Returns the string quoted for SQL, for example <code>_ISO-8859-1'is it a * plane? no it''s superman!'</code>. * * @param prefix if true, prefix the character set name * @param suffix if true, suffix the collation clause * @return the quoted string */ public String asSql(boolean prefix, boolean suffix) { StringBuilder ret = new StringBuilder(); if (prefix && (null != charsetName)) { ret.append("_"); ret.append(charsetName); } ret.append("'"); ret.append(Util.replace(value, "'", "''")); ret.append("'"); // NOTE jvs 3-Feb-2005: see FRG-78 for why this should go away if (false) { if (suffix && (null != collation)) { ret.append(" "); ret.append(collation.toString()); } } return ret.toString(); }
public int hashCode() { int h = value.hashCode(); h = Util.hash(h, charsetName); h = Util.hash(h, collation); return h; }