method2testcases stringlengths 118 6.63k |
|---|
### Question:
FluentIterable implements Iterable<E> { public FluentIterable<E> reverse() { return of(IterableUtils.reversedIterable(iterable)); } FluentIterable(); private FluentIterable(final Iterable<E> iterable); @SuppressWarnings("unchecked") static FluentIterable<T> empty(); static FluentIterable<T> of(final T si... |
### Question:
FluentIterable implements Iterable<E> { public FluentIterable<E> skip(final long elementsToSkip) { return of(IterableUtils.skippingIterable(iterable, elementsToSkip)); } FluentIterable(); private FluentIterable(final Iterable<E> iterable); @SuppressWarnings("unchecked") static FluentIterable<T> empty(); ... |
### Question:
FluentIterable implements Iterable<E> { public <O> FluentIterable<O> transform(final Transformer<? super E, ? extends O> transformer) { return of(IterableUtils.transformedIterable(iterable, transformer)); } FluentIterable(); private FluentIterable(final Iterable<E> iterable); @SuppressWarnings("unchecked... |
### Question:
FluentIterable implements Iterable<E> { public FluentIterable<E> unique() { return of(IterableUtils.uniqueIterable(iterable)); } FluentIterable(); private FluentIterable(final Iterable<E> iterable); @SuppressWarnings("unchecked") static FluentIterable<T> empty(); static FluentIterable<T> of(final T singl... |
### Question:
CacheableUpdateOperator extends UpdateOperator { @Override public Object execute(Object[] values, InvocationStat stat) { InvocationContext context = invocationContextFactory.newInvocationContext(values); Object r = execute(context, stat); if (driver.isUseMultipleKeys()) { Set<String> keys = driver.getCach... |
### Question:
FluentIterable implements Iterable<E> { public FluentIterable<E> unmodifiable() { return of(IterableUtils.unmodifiableIterable(iterable)); } FluentIterable(); private FluentIterable(final Iterable<E> iterable); @SuppressWarnings("unchecked") static FluentIterable<T> empty(); static FluentIterable<T> of(f... |
### Question:
FluentIterable implements Iterable<E> { public FluentIterable<E> zip(final Iterable<? extends E> other) { return of(IterableUtils.zippingIterable(iterable, other)); } FluentIterable(); private FluentIterable(final Iterable<E> iterable); @SuppressWarnings("unchecked") static FluentIterable<T> empty(); sta... |
### Question:
FluentIterable implements Iterable<E> { public Enumeration<E> asEnumeration() { return IteratorUtils.asEnumeration(iterator()); } FluentIterable(); private FluentIterable(final Iterable<E> iterable); @SuppressWarnings("unchecked") static FluentIterable<T> empty(); static FluentIterable<T> of(final T sing... |
### Question:
FluentIterable implements Iterable<E> { public boolean allMatch(final Predicate<? super E> predicate) { return IterableUtils.matchesAll(iterable, predicate); } FluentIterable(); private FluentIterable(final Iterable<E> iterable); @SuppressWarnings("unchecked") static FluentIterable<T> empty(); static Flu... |
### Question:
FluentIterable implements Iterable<E> { public boolean anyMatch(final Predicate<? super E> predicate) { return IterableUtils.matchesAny(iterable, predicate); } FluentIterable(); private FluentIterable(final Iterable<E> iterable); @SuppressWarnings("unchecked") static FluentIterable<T> empty(); static Flu... |
### Question:
FluentIterable implements Iterable<E> { public boolean isEmpty() { return IterableUtils.isEmpty(iterable); } FluentIterable(); private FluentIterable(final Iterable<E> iterable); @SuppressWarnings("unchecked") static FluentIterable<T> empty(); static FluentIterable<T> of(final T singleton); static Fluent... |
### Question:
FluentIterable implements Iterable<E> { public int size() { return IterableUtils.size(iterable); } FluentIterable(); private FluentIterable(final Iterable<E> iterable); @SuppressWarnings("unchecked") static FluentIterable<T> empty(); static FluentIterable<T> of(final T singleton); static FluentIterable<T... |
### Question:
FluentIterable implements Iterable<E> { public FluentIterable<E> eval() { return of(toList()); } FluentIterable(); private FluentIterable(final Iterable<E> iterable); @SuppressWarnings("unchecked") static FluentIterable<T> empty(); static FluentIterable<T> of(final T singleton); static FluentIterable<T> ... |
### Question:
FluentIterable implements Iterable<E> { public boolean contains(final Object object) { return IterableUtils.contains(iterable, object); } FluentIterable(); private FluentIterable(final Iterable<E> iterable); @SuppressWarnings("unchecked") static FluentIterable<T> empty(); static FluentIterable<T> of(fina... |
### Question:
FluentIterable implements Iterable<E> { public void copyInto(final Collection<? super E> collection) { if (collection == null) { throw new NullPointerException("Collection must not be null"); } CollectionUtils.addAll(collection, iterable); } FluentIterable(); private FluentIterable(final Iterable<E> iter... |
### Question:
FluentIterable implements Iterable<E> { @Override public Iterator<E> iterator() { return iterable.iterator(); } FluentIterable(); private FluentIterable(final Iterable<E> iterable); @SuppressWarnings("unchecked") static FluentIterable<T> empty(); static FluentIterable<T> of(final T singleton); static Flu... |
### Question:
FluentIterable implements Iterable<E> { public E get(final int position) { return IterableUtils.get(iterable, position); } FluentIterable(); private FluentIterable(final Iterable<E> iterable); @SuppressWarnings("unchecked") static FluentIterable<T> empty(); static FluentIterable<T> of(final T singleton);... |
### Question:
FluentIterable implements Iterable<E> { public E[] toArray(final Class<E> arrayClass) { return IteratorUtils.toArray(iterator(), arrayClass); } FluentIterable(); private FluentIterable(final Iterable<E> iterable); @SuppressWarnings("unchecked") static FluentIterable<T> empty(); static FluentIterable<T> o... |
### Question:
FluentIterable implements Iterable<E> { @Override public String toString() { return IterableUtils.toString(iterable); } FluentIterable(); private FluentIterable(final Iterable<E> iterable); @SuppressWarnings("unchecked") static FluentIterable<T> empty(); static FluentIterable<T> of(final T singleton); st... |
### Question:
Charsets { public static Charset toCharset(final Charset charset) { return charset == null ? Charset.defaultCharset() : charset; } static Charset toCharset(final Charset charset); static Charset toCharset(final String charset); @Deprecated
static final Charset ISO_8859_1; @Deprecated
static final... |
### Question:
StringEncoderComparator implements Comparator { @Override public int compare(final Object o1, final Object o2) { int compareCode = 0; try { @SuppressWarnings("unchecked") final Comparable<Comparable<?>> s1 = (Comparable<Comparable<?>>) this.stringEncoder.encode(o1); final Comparable<?> s2 = (Comparable<?>... |
### Question:
UnixCrypt { public static String crypt(final byte[] original) { return crypt(original, null); } static String crypt(final byte[] original); static String crypt(final byte[] original, String salt); static String crypt(final String original); static String crypt(final String original, final String salt); ... |
### Question:
B64 { static void b64from24bit(final byte b2, final byte b1, final byte b0, final int outLen, final StringBuilder buffer) { int w = ((b2 << 16) & 0x00ffffff) | ((b1 << 8) & 0x00ffff) | (b0 & 0xff); int n = outLen; while (n-- > 0) { buffer.append(B64T.charAt(w & 0x3f)); w >>= 6; } } }### Answer:
@Test p... |
### Question:
DigestUtils { public static MessageDigest getDigest(final String algorithm) { try { return MessageDigest.getInstance(algorithm); } catch (final NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } } static MessageDigest getDigest(final String algorithm); static MessageDigest getMd2Diges... |
### Question:
DigestUtils { public static byte[] md2(final byte[] data) { return getMd2Digest().digest(data); } static MessageDigest getDigest(final String algorithm); static MessageDigest getMd2Digest(); static MessageDigest getMd5Digest(); static MessageDigest getSha1Digest(); static MessageDigest getSha256Digest();... |
### Question:
DigestUtils { public static byte[] md5(final byte[] data) { return getMd5Digest().digest(data); } static MessageDigest getDigest(final String algorithm); static MessageDigest getMd2Digest(); static MessageDigest getMd5Digest(); static MessageDigest getSha1Digest(); static MessageDigest getSha256Digest();... |
### Question:
DigestUtils { public static String sha1Hex(final byte[] data) { return Hex.encodeHexString(sha1(data)); } static MessageDigest getDigest(final String algorithm); static MessageDigest getMd2Digest(); static MessageDigest getMd5Digest(); static MessageDigest getSha1Digest(); static MessageDigest getSha256D... |
### Question:
DigestUtils { public static byte[] sha256(final byte[] data) { return getSha256Digest().digest(data); } static MessageDigest getDigest(final String algorithm); static MessageDigest getMd2Digest(); static MessageDigest getMd5Digest(); static MessageDigest getSha1Digest(); static MessageDigest getSha256Dig... |
### Question:
DigestUtils { @Deprecated public static String shaHex(final byte[] data) { return sha1Hex(data); } static MessageDigest getDigest(final String algorithm); static MessageDigest getMd2Digest(); static MessageDigest getMd5Digest(); static MessageDigest getSha1Digest(); static MessageDigest getSha256Digest()... |
### Question:
HmacUtils { public static Mac getHmacMd5(final byte[] key) { return getInitializedMac(HmacAlgorithms.HMAC_MD5, key); } static Mac getHmacMd5(final byte[] key); static Mac getHmacSha1(final byte[] key); static Mac getHmacSha256(final byte[] key); static Mac getHmacSha384(final byte[] key); static Mac getH... |
### Question:
HmacUtils { public static Mac getInitializedMac(final HmacAlgorithms algorithm, final byte[] key) { return getInitializedMac(algorithm.toString(), key); } static Mac getHmacMd5(final byte[] key); static Mac getHmacSha1(final byte[] key); static Mac getHmacSha256(final byte[] key); static Mac getHmacSha38... |
### Question:
HmacUtils { public static byte[] hmacMd5(final byte[] key, final byte[] valueToDigest) { try { return getHmacMd5(key).doFinal(valueToDigest); } catch (final IllegalStateException e) { throw new IllegalArgumentException(e); } } static Mac getHmacMd5(final byte[] key); static Mac getHmacSha1(final byte[] k... |
### Question:
HmacUtils { public static byte[] hmacSha1(final byte[] key, final byte[] valueToDigest) { try { return getHmacSha1(key).doFinal(valueToDigest); } catch (final IllegalStateException e) { throw new IllegalArgumentException(e); } } static Mac getHmacMd5(final byte[] key); static Mac getHmacSha1(final byte[]... |
### Question:
HmacUtils { public static byte[] hmacSha256(final byte[] key, final byte[] valueToDigest) { try { return getHmacSha256(key).doFinal(valueToDigest); } catch (final IllegalStateException e) { throw new IllegalArgumentException(e); } } static Mac getHmacMd5(final byte[] key); static Mac getHmacSha1(final by... |
### Question:
HmacUtils { public static byte[] hmacSha384(final byte[] key, final byte[] valueToDigest) { try { return getHmacSha384(key).doFinal(valueToDigest); } catch (final IllegalStateException e) { throw new IllegalArgumentException(e); } } static Mac getHmacMd5(final byte[] key); static Mac getHmacSha1(final by... |
### Question:
HmacUtils { public static byte[] hmacSha512(final byte[] key, final byte[] valueToDigest) { try { return getHmacSha512(key).doFinal(valueToDigest); } catch (final IllegalStateException e) { throw new IllegalArgumentException(e); } } static Mac getHmacMd5(final byte[] key); static Mac getHmacSha1(final by... |
### Question:
MethodNameParser { public static MethodNameInfo parse(String str) { OrderUnit ou = parseOrderUnit(str); if (ou != null) { str = str.substring(0, str.length() - ou.getOrderStrSize()); } List<OpUnit> opUnits = new ArrayList<OpUnit>(); List<String> logics = new ArrayList<String>(); Pattern p = Pattern.compil... |
### Question:
DynamicTokens { public static <E> TypeToken<List<E>> listToken(TypeToken<E> entityToken) { return new TypeToken<List<E>>() {} .where(new TypeParameter<E>() {}, entityToken); } static TypeToken<Collection<E>> collectionToken(TypeToken<E> entityToken); static TypeToken<List<E>> listToken(TypeToken<E> entit... |
### Question:
Crypt { public static String crypt(final byte[] keyBytes) { return crypt(keyBytes, null); } static String crypt(final byte[] keyBytes); static String crypt(final byte[] keyBytes, final String salt); static String crypt(final String key); static String crypt(final String key, final String salt); }### Ans... |
### Question:
Md5Crypt { public static String md5Crypt(final byte[] keyBytes) { return md5Crypt(keyBytes, MD5_PREFIX + B64.getRandomSalt(8)); } static String apr1Crypt(final byte[] keyBytes); static String apr1Crypt(final byte[] keyBytes, String salt); static String apr1Crypt(final String keyBytes); static String apr1... |
### Question:
StringUtils { public static byte[] getBytesIso8859_1(final String string) { return getBytes(string, Charsets.ISO_8859_1); } static boolean equals(final CharSequence cs1, final CharSequence cs2); static byte[] getBytesIso8859_1(final String string); static byte[] getBytesUnchecked(final String string, fin... |
### Question:
StringUtils { public static byte[] getBytesUsAscii(final String string) { return getBytes(string, Charsets.US_ASCII); } static boolean equals(final CharSequence cs1, final CharSequence cs2); static byte[] getBytesIso8859_1(final String string); static byte[] getBytesUnchecked(final String string, final S... |
### Question:
StringUtils { public static byte[] getBytesUtf16(final String string) { return getBytes(string, Charsets.UTF_16); } static boolean equals(final CharSequence cs1, final CharSequence cs2); static byte[] getBytesIso8859_1(final String string); static byte[] getBytesUnchecked(final String string, final Strin... |
### Question:
MethodNameParser { @Nullable static OrderUnit parseOrderUnit(String str) { Pattern p = Pattern.compile(ORDER_BY_REGEX); Matcher m = p.matcher(str); if (m.find()) { String tailStr = Strings.firstLetterToLowerCase(str.substring(m.end() - 1)); int size = ORDER_BY.length() + tailStr.length(); String property;... |
### Question:
StringUtils { public static byte[] getBytesUtf16Be(final String string) { return getBytes(string, Charsets.UTF_16BE); } static boolean equals(final CharSequence cs1, final CharSequence cs2); static byte[] getBytesIso8859_1(final String string); static byte[] getBytesUnchecked(final String string, final S... |
### Question:
StringUtils { public static byte[] getBytesUtf16Le(final String string) { return getBytes(string, Charsets.UTF_16LE); } static boolean equals(final CharSequence cs1, final CharSequence cs2); static byte[] getBytesIso8859_1(final String string); static byte[] getBytesUnchecked(final String string, final S... |
### Question:
StringUtils { public static byte[] getBytesUtf8(final String string) { return getBytes(string, Charsets.UTF_8); } static boolean equals(final CharSequence cs1, final CharSequence cs2); static byte[] getBytesIso8859_1(final String string); static byte[] getBytesUnchecked(final String string, final String ... |
### Question:
StringUtils { public static byte[] getBytesUnchecked(final String string, final String charsetName) { if (string == null) { return null; } try { return string.getBytes(charsetName); } catch (final UnsupportedEncodingException e) { throw StringUtils.newIllegalStateException(charsetName, e); } } static boo... |
### Question:
StringUtils { private static String newString(final byte[] bytes, final Charset charset) { return bytes == null ? null : new String(bytes, charset); } static boolean equals(final CharSequence cs1, final CharSequence cs2); static byte[] getBytesIso8859_1(final String string); static byte[] getBytesUncheck... |
### Question:
StringUtils { public static String newStringIso8859_1(final byte[] bytes) { return new String(bytes, Charsets.ISO_8859_1); } static boolean equals(final CharSequence cs1, final CharSequence cs2); static byte[] getBytesIso8859_1(final String string); static byte[] getBytesUnchecked(final String string, fi... |
### Question:
StringUtils { public static String newStringUsAscii(final byte[] bytes) { return new String(bytes, Charsets.US_ASCII); } static boolean equals(final CharSequence cs1, final CharSequence cs2); static byte[] getBytesIso8859_1(final String string); static byte[] getBytesUnchecked(final String string, final ... |
### Question:
StringUtils { public static String newStringUtf16(final byte[] bytes) { return new String(bytes, Charsets.UTF_16); } static boolean equals(final CharSequence cs1, final CharSequence cs2); static byte[] getBytesIso8859_1(final String string); static byte[] getBytesUnchecked(final String string, final Stri... |
### Question:
LessThanOp extends Param1Op { @Override public String keyword() { return "LessThan"; } @Override String keyword(); @Override String operator(); }### Answer:
@Test public void test() throws Exception { Op op = new LessThanOp(); assertThat(op.keyword(), equalTo("LessThan")); assertThat(op.paramCount(), eq... |
### Question:
StringUtils { public static String newStringUtf16Be(final byte[] bytes) { return new String(bytes, Charsets.UTF_16BE); } static boolean equals(final CharSequence cs1, final CharSequence cs2); static byte[] getBytesIso8859_1(final String string); static byte[] getBytesUnchecked(final String string, final ... |
### Question:
StringUtils { public static String newStringUtf16Le(final byte[] bytes) { return new String(bytes, Charsets.UTF_16LE); } static boolean equals(final CharSequence cs1, final CharSequence cs2); static byte[] getBytesIso8859_1(final String string); static byte[] getBytesUnchecked(final String string, final ... |
### Question:
StringUtils { public static String newStringUtf8(final byte[] bytes) { return newString(bytes, Charsets.UTF_8); } static boolean equals(final CharSequence cs1, final CharSequence cs2); static byte[] getBytesIso8859_1(final String string); static byte[] getBytesUnchecked(final String string, final String ... |
### Question:
BaseNCodec implements BinaryEncoder, BinaryDecoder { protected BaseNCodec(final int unencodedBlockSize, final int encodedBlockSize, final int lineLength, final int chunkSeparatorLength) { this(unencodedBlockSize, encodedBlockSize, lineLength, chunkSeparatorLength, PAD_DEFAULT); } protected BaseNCodec(fin... |
### Question:
BaseNCodec implements BinaryEncoder, BinaryDecoder { protected static boolean isWhiteSpace(final byte byteToCheck) { switch (byteToCheck) { case ' ' : case '\n' : case '\r' : case '\t' : return true; default : return false; } } protected BaseNCodec(final int unencodedBlockSize, final int encodedBlockSize... |
### Question:
BaseNCodec implements BinaryEncoder, BinaryDecoder { protected abstract boolean isInAlphabet(byte value); protected BaseNCodec(final int unencodedBlockSize, final int encodedBlockSize,
final int lineLength, final int chunkSeparatorLength); protected BaseNCodec(final int unencode... |
### Question:
BaseNCodec implements BinaryEncoder, BinaryDecoder { protected boolean containsAlphabetOrPad(final byte[] arrayOctet) { if (arrayOctet == null) { return false; } for (final byte element : arrayOctet) { if (pad == element || isInAlphabet(element)) { return true; } } return false; } protected BaseNCodec(fi... |
### Question:
Base64 extends BaseNCodec { public static boolean isBase64(final byte octet) { return octet == PAD_DEFAULT || (octet >= 0 && octet < DECODE_TABLE.length && DECODE_TABLE[octet] != -1); } Base64(); Base64(final boolean urlSafe); Base64(final int lineLength); Base64(final int lineLength, final byte[] line... |
### Question:
EqualsOp extends Param1Op { @Override public String keyword() { return "Equals"; } @Override String keyword(); @Override String operator(); }### Answer:
@Test public void test() throws Exception { Op op = new EqualsOp(); assertThat(op.keyword(), equalTo("Equals")); assertThat(op.paramCount(), equalTo(1)... |
### Question:
Base64 extends BaseNCodec { public Base64() { this(0); } Base64(); Base64(final boolean urlSafe); Base64(final int lineLength); Base64(final int lineLength, final byte[] lineSeparator); Base64(final int lineLength, final byte[] lineSeparator, final boolean urlSafe); boolean isUrlSafe(); @Deprecated st... |
### Question:
Base64 extends BaseNCodec { public static byte[] encodeInteger(final BigInteger bigInt) { if (bigInt == null) { throw new NullPointerException("encodeInteger called with null parameter"); } return encodeBase64(toIntegerBytes(bigInt), false); } Base64(); Base64(final boolean urlSafe); Base64(final int li... |
### Question:
CustomQueryBuilder extends AbstractCustomBuilder { @Override public String buildSql() { String s1 = Joiner.on(", ").join(columns); return String.format(SQL_TEMPLATE, s1, tailOfSql); } CustomQueryBuilder(List<String> columns, String tailOfSql); @Override String buildSql(); }### Answer:
@Test public void b... |
### Question:
Base64 extends BaseNCodec { @Deprecated public static boolean isArrayByteBase64(final byte[] arrayOctet) { return isBase64(arrayOctet); } Base64(); Base64(final boolean urlSafe); Base64(final int lineLength); Base64(final int lineLength, final byte[] lineSeparator); Base64(final int lineLength, final ... |
### Question:
Base64 extends BaseNCodec { public boolean isUrlSafe() { return this.encodeTable == URL_SAFE_ENCODE_TABLE; } Base64(); Base64(final boolean urlSafe); Base64(final int lineLength); Base64(final int lineLength, final byte[] lineSeparator); Base64(final int lineLength, final byte[] lineSeparator, final b... |
### Question:
Base64 extends BaseNCodec { @Override void decode(final byte[] in, int inPos, final int inAvail, final Context context) { if (context.eof) { return; } if (inAvail < 0) { context.eof = true; } for (int i = 0; i < inAvail; i++) { final byte[] buffer = ensureBufferSize(decodeSize, context); final byte b = in... |
### Question:
CustomCountBuilder extends AbstractCustomBuilder { @Override public String buildSql() { return String.format(SQL_TEMPLATE, tailOfSql); } CustomCountBuilder(String tailOfSql); @Override String buildSql(); }### Answer:
@Test public void buildSql() throws Exception { CustomCountBuilder b = new CustomCountBu... |
### Question:
Base64 extends BaseNCodec { public static String encodeBase64String(final byte[] binaryData) { return StringUtils.newStringUtf8(encodeBase64(binaryData, false)); } Base64(); Base64(final boolean urlSafe); Base64(final int lineLength); Base64(final int lineLength, final byte[] lineSeparator); Base64(fi... |
### Question:
CustomDeleteBuilder extends AbstractCustomBuilder { @Override public String buildSql() { return String.format(SQL_TEMPLATE, tailOfSql); } CustomDeleteBuilder(String tailOfSql); @Override String buildSql(); }### Answer:
@Test public void buildSql() throws Exception { CustomDeleteBuilder b = new CustomDele... |
### Question:
Hex implements BinaryEncoder, BinaryDecoder { @Override public String toString() { return super.toString() + "[charsetName=" + this.charset + "]"; } Hex(); Hex(final Charset charset); Hex(final String charsetName); static byte[] decodeHex(final char[] data); static char[] encodeHex(final byte[] data); s... |
### Question:
Hex implements BinaryEncoder, BinaryDecoder { @Override public byte[] decode(final byte[] array) throws DecoderException { return decodeHex(new String(array, getCharset()).toCharArray()); } Hex(); Hex(final Charset charset); Hex(final String charsetName); static byte[] decodeHex(final char[] data); stat... |
### Question:
CommonGetBuilder extends AbstractCommonBuilder { @Override public String buildSql() { String s1 = Joiner.on(", ").join(columns); return isBatch ? String.format(BATCH_SQL_TEMPLATE, s1, columnId) : String.format(SQL_TEMPLATE, s1, columnId); } CommonGetBuilder(String colId, List<String> cols, boolean isBatch... |
### Question:
Hex implements BinaryEncoder, BinaryDecoder { @Override public byte[] encode(final byte[] array) { return encodeHexString(array).getBytes(this.getCharset()); } Hex(); Hex(final Charset charset); Hex(final String charsetName); static byte[] decodeHex(final char[] data); static char[] encodeHex(final byte... |
### Question:
Hex implements BinaryEncoder, BinaryDecoder { public static char[] encodeHex(final byte[] data) { return encodeHex(data, true); } Hex(); Hex(final Charset charset); Hex(final String charsetName); static byte[] decodeHex(final char[] data); static char[] encodeHex(final byte[] data); static char[] encode... |
### Question:
QuotedPrintableCodec implements BinaryEncoder, BinaryDecoder, StringEncoder, StringDecoder { @Override public byte[] decode(final byte[] bytes) throws DecoderException { return decodeQuotedPrintable(bytes); } QuotedPrintableCodec(); QuotedPrintableCodec(final boolean strict); QuotedPrintableCodec(final ... |
### Question:
CommonDeleteBuilder extends AbstractCommonBuilder { @Override public String buildSql() { return String.format(SQL_TEMPLATE, columnId); } CommonDeleteBuilder(String colId); @Override String buildSql(); }### Answer:
@Test public void build() throws Exception { CommonDeleteBuilder b = new CommonDeleteBuilde... |
### Question:
QuotedPrintableCodec implements BinaryEncoder, BinaryDecoder, StringEncoder, StringDecoder { public static final byte[] decodeQuotedPrintable(final byte[] bytes) throws DecoderException { if (bytes == null) { return null; } final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); for (int i = 0; ... |
### Question:
CommonUpdateBuilder extends AbstractCommonBuilder { @Override public String buildSql() { List<String> exps = new ArrayList<String>(); for (int i = 0; i < properties.size(); i++) { String exp = columns.get(i) + " = :" + properties.get(i); exps.add(exp); } String s1 = Joiner.on(", ").join(exps); String s2 =... |
### Question:
URLCodec implements BinaryEncoder, BinaryDecoder, StringEncoder, StringDecoder { @Override public byte[] decode(final byte[] bytes) throws DecoderException { return decodeUrl(bytes); } URLCodec(); URLCodec(final String charset); static final byte[] encodeUrl(BitSet urlsafe, final byte[] bytes); static fi... |
### Question:
URLCodec implements BinaryEncoder, BinaryDecoder, StringEncoder, StringDecoder { @Override public byte[] encode(final byte[] bytes) { return encodeUrl(WWW_FORM_URL, bytes); } URLCodec(); URLCodec(final String charset); static final byte[] encodeUrl(BitSet urlsafe, final byte[] bytes); static final byte[]... |
### Question:
URLCodec implements BinaryEncoder, BinaryDecoder, StringEncoder, StringDecoder { public static final byte[] decodeUrl(final byte[] bytes) throws DecoderException { if (bytes == null) { return null; } final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); for (int i = 0; i < bytes.length; i++) {... |
### Question:
QCodec extends RFC1522Codec implements StringEncoder, StringDecoder { public String encode(final String str, final Charset charset) throws EncoderException { if (str == null) { return null; } return encodeText(str, charset); } QCodec(); QCodec(final Charset charset); QCodec(final String charsetName); St... |
### Question:
CommonAddBuilder extends AbstractCommonBuilder { @Override public String buildSql() { String s1 = Joiner.on(", ").join(columns); List<String> cps = new ArrayList<String>(); for (String prop : properties) { cps.add(":" + prop); } String s2 = Joiner.on(", ").join(cps); return String.format(SQL_TEMPLATE, s1,... |
### Question:
Reflection { public static <T> T instantiate(Class<T> clazz) throws BeanInstantiationException { if (clazz.isInterface()) { throw new BeanInstantiationException(clazz, "specified class is an interface"); } try { return clazz.newInstance(); } catch (InstantiationException e) { throw new BeanInstantiationEx... |
### Question:
QCodec extends RFC1522Codec implements StringEncoder, StringDecoder { @Override public String decode(final String str) throws DecoderException { if (str == null) { return null; } try { return decodeText(str); } catch (final UnsupportedEncodingException e) { throw new DecoderException(e.getMessage(), e); }... |
### Question:
BCodec extends RFC1522Codec implements StringEncoder, StringDecoder { public String encode(final String value, final Charset charset) throws EncoderException { if (value == null) { return null; } return encodeText(value, charset); } BCodec(); BCodec(final Charset charset); BCodec(final String charsetNam... |
### Question:
BCodec extends RFC1522Codec implements StringEncoder, StringDecoder { @Override public String decode(final String value) throws DecoderException { if (value == null) { return null; } try { return this.decodeText(value); } catch (final UnsupportedEncodingException e) { throw new DecoderException(e.getMessa... |
### Question:
DaitchMokotoffSoundex implements StringEncoder { @Override public Object encode(final Object obj) throws EncoderException { if (!(obj instanceof String)) { throw new EncoderException( "Parameter supplied to DaitchMokotoffSoundex encode is not of type java.lang.String"); } return encode((String) obj); } Da... |
### Question:
CommonGetAllBuilder extends AbstractCommonBuilder { @Override public String buildSql() { String s1 = Joiner.on(", ").join(columns); return String.format(SQL, s1, s1); } CommonGetAllBuilder(List<String> cols); @Override String buildSql(); }### Answer:
@Test public void build() throws Exception { List<Stri... |
### Question:
ColognePhonetic implements StringEncoder { public boolean isEncodeEqual(final String text1, final String text2) { return colognePhonetic(text1).equals(colognePhonetic(text2)); } String colognePhonetic(String text); @Override Object encode(final Object object); @Override String encode(final String text); ... |
### Question:
RefinedSoundex implements StringEncoder { public int difference(final String s1, final String s2) throws EncoderException { return SoundexUtils.difference(this, s1, s2); } RefinedSoundex(); RefinedSoundex(final char[] mapping); RefinedSoundex(final String mapping); int difference(final String s1, final ... |
### Question:
RefinedSoundex implements StringEncoder { @Override public Object encode(final Object obj) throws EncoderException { if (!(obj instanceof String)) { throw new EncoderException("Parameter supplied to RefinedSoundex encode is not of type java.lang.String"); } return soundex((String) obj); } RefinedSoundex()... |
### Question:
RefinedSoundex implements StringEncoder { char getMappingCode(final char c) { if (!Character.isLetter(c)) { return 0; } return this.soundexMapping[Character.toUpperCase(c) - 'A']; } RefinedSoundex(); RefinedSoundex(final char[] mapping); RefinedSoundex(final String mapping); int difference(final String ... |
### Question:
RefinedSoundex implements StringEncoder { public String soundex(String str) { if (str == null) { return null; } str = SoundexUtils.clean(str); if (str.length() == 0) { return str; } final StringBuilder sBuf = new StringBuilder(); sBuf.append(str.charAt(0)); char last, current; last = '*'; for (int i = 0; ... |
### Question:
PhoneticEngine { public String encode(final String input) { final Languages.LanguageSet languageSet = this.lang.guessLanguages(input); return encode(input, languageSet); } PhoneticEngine(final NameType nameType, final RuleType ruleType, final boolean concat); PhoneticEngine(final NameType nameType, final... |
### Question:
BeiderMorseEncoder implements StringEncoder { @Override public Object encode(final Object source) throws EncoderException { if (!(source instanceof String)) { throw new EncoderException("BeiderMorseEncoder encode parameter is not of type String"); } return encode((String) source); } @Override Object enco... |
### Question:
BeiderMorseEncoder implements StringEncoder { public void setConcat(final boolean concat) { this.engine = new PhoneticEngine(this.engine.getNameType(), this.engine.getRuleType(), concat, this.engine.getMaxPhonemes()); } @Override Object encode(final Object source); @Override String encode(final String so... |
### Question:
BeiderMorseEncoder implements StringEncoder { public void setRuleType(final RuleType ruleType) { this.engine = new PhoneticEngine(this.engine.getNameType(), ruleType, this.engine.isConcat(), this.engine.getMaxPhonemes()); } @Override Object encode(final Object source); @Override String encode(final Strin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.