- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {Connection c =
DataSource dataSource;dataSource.getConnection()
String url;DriverManager.getConnection(url)
IdentityDatabaseUtil.getDBConnection()
- Smart code suggestions by Codota
}
public void setRefresh(String refresh) { int refreshNum = Numbers.toInt(refresh); if (refreshNum > 0) this.refresh = String.valueOf(refreshNum); }
private static short convert(String time) { int index = time.indexOf(':'); Assert.isTrue(index == 2 && time.length() == 5, "illegal time,it should with 00:00 format"); Assert.isTrue((toInt(time.substring(0, index)) < 60 && toInt(time.substring(index + 1, index + 3)) < 60), "illegal time " + time + ",it should within 60:60."); return (short) toInt(time.substring(0, index) + time.substring(index + 1, index + 3)); }
public static HourMinute newHourMinute(String time) { int index = time.indexOf(':'); Assert.isTrue(index == 2 && time.length() == 5, "illegal time,it should with 00:00 format"); Assert.isTrue((toInt(time.substring(0, index)) < 60 && toInt(time.substring(index + 1, index + 3)) < 60), "illegal time " + time + ",it should within 60:60."); return new HourMinute((short) toInt(time.substring(0, index) + time.substring(index + 1, index + 3))); }
private static int valuesOf(String terms) { if (terms.equals("*") || terms.equals("")) return 0; int result = 0; for (String t : Strings.split(terms, ",")) { result |= (1 << Numbers.toInt(t)); } return result; }
public static GenderRatio of(String value) { if (value == null) throw new RuntimeException("value cannot be null"); if (-1 == value.indexOf(':')) throw new RuntimeException("value should contain ':'"); else { String[] pair = Strings.split(value, ':'); if (!(Numbers.isNumber(pair[0]) && Numbers.isNumber(pair[1]))) { throw new RuntimeException("bad format of ratio :" + value); } int res = (Numbers.toInt(pair[0]) << 8) + Numbers.toInt(pair[1]); return new GenderRatio((short) res); } }
public int getIndex() { String index = Strings.substringAfterLast(indexno, "."); if (Strings.isEmpty(index)) index = indexno; int idx = Numbers.toInt(index); if (idx <= 0) idx = 1; return idx; }