method2testcases stringlengths 118 6.63k |
|---|
### Question:
StreamPartitionAssignor implements PartitionAssignor, Configurable { @Override public void onAssignment(Assignment assignment) { List<TopicPartition> partitions = new ArrayList<>(assignment.partitions()); Collections.sort(partitions, PARTITION_COMPARATOR); AssignmentInfo info = AssignmentInfo.decode(assig... |
### Question:
StreamPartitionAssignor implements PartitionAssignor, Configurable { Cluster clusterMetadata() { if (metadataWithInternalTopics == null) { return Cluster.empty(); } return metadataWithInternalTopics; } @Override void configure(Map<String, ?> configs); @Override String name(); @Override Subscription subsc... |
### Question:
ConnectorsResource { @DELETE @Path("/{connector}") public void destroyConnector(final @PathParam("connector") String connector, final @QueryParam("forward") Boolean forward) throws Throwable { FutureCallback<Herder.Created<ConnectorInfo>> cb = new FutureCallback<>(); herder.deleteConnectorConfig(connector... |
### Question:
RecordQueue { public int addRawRecords(Iterable<ConsumerRecord<byte[], byte[]>> rawRecords) { for (ConsumerRecord<byte[], byte[]> rawRecord : rawRecords) { ConsumerRecord<Object, Object> record = recordDeserializer.deserialize(rawRecord); long timestamp = timestampExtractor.extract(record, timeTracker.get... |
### Question:
ProcessorNode { public void init(ProcessorContext context) { this.context = context; try { nodeMetrics = new NodeMetrics(context.metrics(), name, "task." + context.taskId()); nodeMetrics.metrics.measureLatencyNs(time, initDelegate, nodeMetrics.nodeCreationSensor); } catch (Exception e) { throw new Streams... |
### Question:
ProcessorNode { public void close() { try { nodeMetrics.metrics.measureLatencyNs(time, closeDelegate, nodeMetrics.nodeDestructionSensor); nodeMetrics.removeAllSensors(); } catch (Exception e) { throw new StreamsException(String.format("failed to close processor %s", name), e); } } ProcessorNode(String nam... |
### Question:
SourceNode extends ProcessorNode<K, V> { K deserializeKey(String topic, Headers headers, byte[] data) { return keyDeserializer.deserialize(topic, headers, data); } SourceNode(String name, List<String> topics, TimestampExtractor timestampExtractor, Deserializer<K> keyDeserializer, Deserializer<V> valDeseri... |
### Question:
SourceNode extends ProcessorNode<K, V> { V deserializeValue(String topic, Headers headers, byte[] data) { return valDeserializer.deserialize(topic, headers, data); } SourceNode(String name, List<String> topics, TimestampExtractor timestampExtractor, Deserializer<K> keyDeserializer, Deserializer<V> valDese... |
### Question:
ProcessorStateManager implements StateManager { @Override public StateStore getStore(final String name) { return stores.get(name); } ProcessorStateManager(final TaskId taskId,
final Collection<TopicPartition> sources,
final boolean isStandb... |
### Question:
ProcessorStateManager implements StateManager { @Override public void close(final Map<TopicPartition, Long> ackedOffsets) throws ProcessorStateException { RuntimeException firstException = null; try { if (!stores.isEmpty()) { log.debug("{} Closing its state manager and all the registered state stores", lo... |
### Question:
ProcessorStateManager implements StateManager { @Override public void register(final StateStore store, final boolean loggingEnabled, final StateRestoreCallback stateRestoreCallback) { log.debug("{} Registering state store {} to its state manager", logPrefix, store.name()); if (store.name().equals(CHECKPOI... |
### Question:
MinTimestampTracker implements TimestampTracker<E> { public long get() { Stamped<E> stamped = ascendingSubsequence.peekFirst(); if (stamped == null) return lastKnownTime; else return stamped.timestamp; } void addElement(final Stamped<E> elem); void removeElement(final Stamped<E> elem); int size(); long g... |
### Question:
MinTimestampTracker implements TimestampTracker<E> { public void removeElement(final Stamped<E> elem) { if (elem == null) { return; } if (ascendingSubsequence.peekFirst() == elem) { ascendingSubsequence.removeFirst(); } if (ascendingSubsequence.isEmpty()) { lastKnownTime = elem.timestamp; } } void addEle... |
### Question:
MinTimestampTracker implements TimestampTracker<E> { public void addElement(final Stamped<E> elem) { if (elem == null) throw new NullPointerException(); Stamped<E> maxElem = ascendingSubsequence.peekLast(); while (maxElem != null && maxElem.timestamp >= elem.timestamp) { ascendingSubsequence.removeLast();... |
### Question:
SourceNodeRecordDeserializer implements RecordDeserializer { @Override public ConsumerRecord<Object, Object> deserialize(final ConsumerRecord<byte[], byte[]> rawRecord) { final Object key; try { key = sourceNode.deserializeKey(rawRecord.topic(), rawRecord.headers(), rawRecord.key()); } catch (Exception e)... |
### Question:
AssignmentInfo { public static AssignmentInfo decode(ByteBuffer data) { data.rewind(); DataInputStream in = new DataInputStream(new ByteBufferInputStream(data)); try { int version = in.readInt(); if (version < 0 || version > CURRENT_VERSION) { TaskAssignmentException ex = new TaskAssignmentException("Unkn... |
### Question:
ConnectorsResource { @GET @Path("/{connector}") public ConnectorInfo getConnector(final @PathParam("connector") String connector, final @QueryParam("forward") Boolean forward) throws Throwable { FutureCallback<ConnectorInfo> cb = new FutureCallback<>(); herder.connectorInfo(connector, cb); return complete... |
### Question:
CarManufacturer { public Car manufactureCar(Specification spec) { Car car = carFactory.createCar(spec); entityManager.merge(car); return car; } Car manufactureCar(Specification spec); }### Answer:
@Test public void test() { Specification spec = new Specification(); Car car = new Car(spec); when(entityMa... |
### Question:
Types { public static boolean isAssignable(Class<?> lhsType, Class<?> rhsType) { if (lhsType.isAssignableFrom(rhsType)) { return true; } return lhsType.isPrimitive() ? lhsType.equals(Primitives.unwrap(rhsType)) : lhsType.isAssignableFrom(Primitives.wrap(rhsType)); } private Types(); static boolean isAssi... |
### Question:
Parser implements ParserTreeConstants, ParserConstants { final public void IntegerLiteral() throws ParseException { ASTIntegerLiteral jjtn000 = new ASTIntegerLiteral(JJTINTEGERLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1));Token t; try { t = jj_consu... |
### Question:
Soundex implements StringEncoder { public int difference(final String s1, final String s2) throws EncoderException { return SoundexUtils.difference(this, s1, s2); } Soundex(); Soundex(final char[] mapping); Soundex(final String mapping); int difference(final String s1, final String s2); @Override Object... |
### Question:
Parser implements ParserTreeConstants, ParserConstants { final public void Replace() throws ParseException { ASTReplace jjtn000 = new ASTReplace(JJTREPLACE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1));Token t; try { t = jj_consume_token(REPLACE); jjtree.cl... |
### Question:
Soundex implements StringEncoder { public Soundex() { this.soundexMapping = US_ENGLISH_MAPPING; } Soundex(); Soundex(final char[] mapping); Soundex(final String mapping); int difference(final String s1, final String s2); @Override Object encode(final Object obj); @Override String encode(final String str... |
### Question:
Parser implements ParserTreeConstants, ParserConstants { final public void Merge() throws ParseException { ASTMerge jjtn000 = new ASTMerge(JJTMERGE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1));Token t; try { t = jj_consume_token(MERGE); jjtree.closeNodeSco... |
### Question:
TransactionManager { public TransactionManager() { } TransactionManager(); TransactionManager(ConnectionSource connectionSource); void initialize(); T callInTransaction(final Callable<T> callable); T callInTransaction(String tableName, final Callable<T> callable); static T callInTransaction(final Connect... |
### Question:
TransactionManager { public void initialize() { if (connectionSource == null) { throw new IllegalStateException("dataSource was not set on " + getClass().getSimpleName()); } } TransactionManager(); TransactionManager(ConnectionSource connectionSource); void initialize(); T callInTransaction(final Callabl... |
### Question:
TransactionManager { private static void rollBack(DatabaseConnection connection, Savepoint savePoint) throws SQLException { String name = (savePoint == null ? null : savePoint.getSavepointName()); connection.rollback(savePoint); if (name == null) { logger.debug("rolled back savePoint transaction"); } else... |
### Question:
TransactionManager { public <T> T callInTransaction(final Callable<T> callable) throws SQLException { return callInTransaction(connectionSource, callable); } TransactionManager(); TransactionManager(ConnectionSource connectionSource); void initialize(); T callInTransaction(final Callable<T> callable); T ... |
### Question:
SqlExceptionUtil { public static SQLException create(String message, Throwable cause) { SQLException sqlException; if (cause instanceof SQLException) { sqlException = new SQLException(message, ((SQLException) cause).getSQLState()); } else { sqlException = new SQLException(message); } sqlException.initCaus... |
### Question:
BaseDaoEnabled { public int create() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.create(t); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); void se... |
### Question:
Parser implements ParserTreeConstants, ParserConstants { final public void StringLiteral() throws ParseException { ASTStringLiteral jjtn000 = new ASTStringLiteral(JJTSTRINGLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1));Token t; try { t = jj_consume_t... |
### Question:
BaseDaoEnabled { public int update() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.update(t); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); void se... |
### Question:
BaseDaoEnabled { public int updateId(ID newId) throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.updateId(t, newId); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqua... |
### Question:
BaseDaoEnabled { public int delete() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.delete(t); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); void se... |
### Question:
BaseDaoEnabled { public String objectToString() { try { checkForDao(); } catch (SQLException e) { throw new IllegalArgumentException(e); } @SuppressWarnings("unchecked") T t = (T) this; return dao.objectToString(t); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String... |
### Question:
BaseDaoEnabled { public ID extractId() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.extractId(t); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); vo... |
### Question:
LocalLog implements Log { @Override public boolean isLevelEnabled(Level level) { return this.level.isEnabled(level); } LocalLog(String className); static void openLogFile(String logPath); @Override boolean isLevelEnabled(Level level); @Override void log(Level level, String msg); @Override void log(Level l... |
### Question:
LocalLog implements Log { public static void openLogFile(String logPath) { if (logPath == null) { printStream = System.out; } else { try { printStream = new PrintStream(new File(logPath)); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Log file " + logPath + " was not found", e); ... |
### Question:
LocalLog implements Log { static List<PatternLevel> readLevelResourceFile(InputStream stream) { List<PatternLevel> levels = null; if (stream != null) { try { levels = configureClassLevels(stream); } catch (IOException e) { System.err.println( "IO exception reading the log properties file '" + LOCAL_LOG_PR... |
### Question:
LoggerFactory { public static Logger getLogger(Class<?> clazz) { return getLogger(clazz.getName()); } private LoggerFactory(); static Logger getLogger(Class<?> clazz); static Logger getLogger(String className); static String getSimpleClassName(String className); static final String LOG_TYPE_SYSTEM_PROPER... |
### Question:
LoggerFactory { public static String getSimpleClassName(String className) { String[] parts = className.split("\\."); if (parts.length <= 1) { return className; } else { return parts[parts.length - 1]; } } private LoggerFactory(); static Logger getLogger(Class<?> clazz); static Logger getLogger(String cla... |
### Question:
TableInfo { public TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass) throws SQLException { this(connectionSource.getDatabaseType(), baseDaoImpl, DatabaseTableConfig.fromClass(connectionSource, dataClass)); } TableInfo(ConnectionSource connectionSource, BaseDa... |
### Question:
TableInfo { public String objectToString(T object) { StringBuilder sb = new StringBuilder(64); sb.append(object.getClass().getSimpleName()); for (FieldType fieldType : fieldTypes) { sb.append(' ').append(fieldType.getColumnName()).append('='); try { sb.append(fieldType.extractJavaFieldValue(object)); } ca... |
### Question:
TableInfo { public String getTableName() { return tableName; } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); Class<T> getDataClass(); String getTab... |
### Question:
TableInfo { public T createObject() throws SQLException { try { T instance; ObjectFactory<T> factory = null; if (baseDaoImpl != null) { factory = baseDaoImpl.getObjectFactory(); } if (factory == null) { instance = constructor.newInstance(); } else { instance = factory.createObject(constructor, baseDaoImpl... |
### Question:
TableInfo { public FieldType getFieldTypeByColumnName(String columnName) { if (fieldNameMap == null) { Map<String, FieldType> map = new HashMap<String, FieldType>(); for (FieldType fieldType : fieldTypes) { map.put(fieldType.getColumnName().toLowerCase(), fieldType); } fieldNameMap = map; } FieldType fiel... |
### Question:
TableInfo { public boolean hasColumnName(String columnName) { for (FieldType fieldType : fieldTypes) { if (fieldType.getColumnName().equals(columnName)) { return true; } } return false; } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseT... |
### Question:
DatabaseTableConfigLoader { public static <T> void write(BufferedWriter writer, DatabaseTableConfig<T> config) throws SQLException { try { writeConfig(writer, config); } catch (IOException e) { throw SqlExceptionUtil.create("Could not write config to writer", e); } } static List<DatabaseTableConfig<?>> l... |
### Question:
DatabaseTableConfigLoader { public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(... |
### Question:
DatabaseTableConfig { public DatabaseTableConfig() { } DatabaseTableConfig(); DatabaseTableConfig(Class<T> dataClass, List<DatabaseFieldConfig> fieldConfigs); DatabaseTableConfig(Class<T> dataClass, String tableName, List<DatabaseFieldConfig> fieldConfigs); private DatabaseTableConfig(Class<T> dataClas... |
### Question:
DatabaseTableConfig { public void setFieldConfigs(List<DatabaseFieldConfig> fieldConfigs) { this.fieldConfigs = fieldConfigs; } DatabaseTableConfig(); DatabaseTableConfig(Class<T> dataClass, List<DatabaseFieldConfig> fieldConfigs); DatabaseTableConfig(Class<T> dataClass, String tableName, List<DatabaseF... |
### Question:
DatabaseTableConfig { public void initialize() { if (dataClass == null) { throw new IllegalStateException("dataClass was never set on " + getClass().getSimpleName()); } if (tableName == null) { tableName = extractTableName(dataClass); } } DatabaseTableConfig(); DatabaseTableConfig(Class<T> dataClass, Lis... |
### Question:
ConsoleLogger extends AbstractInternalLogger { @Override public void trace(String msg) { println(msg); } protected ConsoleLogger(String name); @Override boolean isTraceEnabled(); @Override void trace(String msg); @Override void trace(String format, Object arg); @Override void trace(String format, Object ... |
### Question:
DatabaseTableConfig { public FieldType[] getFieldTypes(DatabaseType databaseType) throws SQLException { if (fieldTypes == null) { throw new SQLException("Field types have not been extracted in table config"); } return fieldTypes; } DatabaseTableConfig(); DatabaseTableConfig(Class<T> dataClass, List<Datab... |
### Question:
TableUtils { public static <T, ID> List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); if (dao instanceof BaseDaoImpl<?, ?>) { return addCreateTableStatements(connectionSource... |
### Question:
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); static int createTable(Conne... |
### Question:
TableUtils { public static <T> int clearTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { String tableName = DatabaseTableConfig.extractTableName(dataClass); DatabaseType databaseType = connectionSource.getDatabaseType(); if (databaseType.isEntityNamesMustBeUpCase()) { tab... |
### Question:
TableUtils { public static <T> int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, true); } private TableUtils(); static int createTable(ConnectionSource connec... |
### Question:
BaseDatabaseType implements DatabaseType { @Override public void loadDriver() throws SQLException { String className = getDriverClassName(); if (className != null) { try { Class.forName(className); } catch (ClassNotFoundException e) { throw SqlExceptionUtil.create("Driver class was not found for " + getDa... |
### Question:
BaseDatabaseType implements DatabaseType { protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs, List<String> queriesAfter) { throw new IllegalStateException( "GeneratedId is no... |
### Question:
BaseSqliteDatabaseType extends BaseDatabaseType { @Override protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs, List<String> queriesAfter) { if (fieldType.getSqlType() != SqlT... |
### Question:
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public boolean isVarcharFieldWidthSupported() { return false; } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldCo... |
### Question:
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public boolean isCreateTableReturnsZero() { return false; } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConver... |
### Question:
BaseSqliteDatabaseType extends BaseDatabaseType { @Override protected boolean generatedIdSqlAtEnd() { return false; } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConverte... |
### Question:
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public boolean isCreateIfNotExistsSupported() { return true; } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldCon... |
### Question:
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType) { switch (dataPersister.getSqlType()) { case BOOLEAN : return booleanConverter; case BIG_DECIMAL : return BigDecimalStringType.getSingleton(); default : ret... |
### Question:
FieldType { @Override public boolean equals(Object arg) { if (arg == null || arg.getClass() != this.getClass()) { return false; } FieldType other = (FieldType) arg; return field.equals(other.field) && (parentClass == null ? other.parentClass == null : parentClass.equals(other.parentClass)); } FieldType(Co... |
### Question:
DatabaseFieldConfigLoader { public static DatabaseFieldConfig fromReader(BufferedReader reader) throws SQLException { DatabaseFieldConfig config = new DatabaseFieldConfig(); boolean anything = false; while (true) { String line; try { line = reader.readLine(); } catch (IOException e) { throw SqlExceptionUt... |
### Question:
DateLongType extends BaseDateType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { try { return Long.parseLong(defaultStr); } catch (NumberFormatException e) { throw SqlExceptionUtil.create("Problems with field " + fieldType + " parsing default dat... |
### Question:
SerializableType extends BaseDataType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { throw new SQLException("Default values for serializable types are not supported"); } private SerializableType(); protected SerializableType(SqlType sqlType, Cl... |
### Question:
DateTimeType extends BaseDataType { @Override public Object javaToSqlArg(FieldType fieldType, Object javaObject) throws SQLException { return extractMillis(javaObject); } private DateTimeType(); protected DateTimeType(SqlType sqlType, Class<?>[] classes); static DateTimeType getSingleton(); @Override St... |
### Question:
DateTimeType extends BaseDataType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { try { return Long.parseLong(defaultStr); } catch (NumberFormatException e) { throw SqlExceptionUtil.create("Problems with field " + fieldType + " parsing default Dat... |
### Question:
DateTimeType extends BaseDataType { @Override public Object resultToSqlArg(FieldType fieldType, DatabaseResults results, int columnPos) throws SQLException { return results.getLong(columnPos); } private DateTimeType(); protected DateTimeType(SqlType sqlType, Class<?>[] classes); static DateTimeType getS... |
### Question:
DateType extends BaseDateType { @Override public Object parseDefaultString(FieldType fieldType, String defaultStr) throws SQLException { DateStringFormatConfig dateFormatConfig = convertDateStringConfig(fieldType, getDefaultDateFormatConfig()); try { return new Timestamp(parseDateString(dateFormatConfig, ... |
### Question:
BindingParameter { public String getFullName() { return Strings.getFullName(parameterName, propertyPath); } BindingParameter(String parameterName, String propertyPath, JdbcType jdbcType); static BindingParameter create(String parameterName, String propertyPath, JdbcType jdbcType); BindingParameter rightSh... |
### Question:
BindingParameter { @Override public boolean equals(Object obj) { if (obj == null) return false; if (getClass() != obj.getClass()) return false; final BindingParameter other = (BindingParameter) obj; return Objects.equal(this.getParameterName(), other.getParameterName()) && Objects.equal(this.getPropertyPa... |
### Question:
FunctionalBindingParameterInvoker implements BindingParameterInvoker { public static FunctionalBindingParameterInvoker create( Type originalType, BindingParameter bindingParameter) { try { FunctionalBindingParameterInvoker invokerGroup = new FunctionalBindingParameterInvoker(originalType, bindingParameter... |
### Question:
BeanUtil { public static List<PropertyMeta> fetchPropertyMetas(Class<?> clazz) { return cache.get(clazz); } static List<PropertyMeta> fetchPropertyMetas(Class<?> clazz); }### Answer:
@Test public void fetchPropertyMetas() throws Exception { Set<PropertyMeta> pms = Sets.newHashSet(BeanUtil.fetchPropertyM... |
### Question:
InvocationContextFactory { public InvocationContext newInvocationContext(Object[] values) { InvocationContext context = DefaultInvocationContext.create(); for (int i = 0; i < values.length; i++) { String parameterName = parameterContext.getParameterNameByPosition(i); context.addParameter(parameterName, va... |
### Question:
LruObjectCache implements ObjectCache { @Override public <T> int size(Class<T> clazz) { Map<Object, Object> objectMap = getMapForClass(clazz); if (objectMap == null) { return 0; } else { return objectMap.size(); } } LruObjectCache(int capacity); @Override synchronized void registerClass(Class<T> clazz); @... |
### Question:
LruObjectCache implements ObjectCache { @Override public <T> void clear(Class<T> clazz) { Map<Object, Object> objectMap = getMapForClass(clazz); if (objectMap != null) { objectMap.clear(); } } LruObjectCache(int capacity); @Override synchronized void registerClass(Class<T> clazz); @Override T get(Class<T>... |
### Question:
EagerForeignCollection extends BaseForeignCollection<T, ID> implements CloseableWrappedIterable<T>,
Serializable { @Override public boolean contains(Object o) { return results.contains(o); } EagerForeignCollection(Dao<T, ID> dao, Object parent, Object parentId, FieldType foreignFieldType,
String orde... |
### Question:
DaoManager { public synchronized static <D extends Dao<T, ?>, T> D createDao(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConne... |
### Question:
DaoManager { public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource, Class<T> clazz) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } ClassConnectionSource key = new ClassConnectionSource(connecti... |
### Question:
DaoManager { public static synchronized void registerDao(ConnectionSource connectionSource, Dao<?, ?> dao) { if (connectionSource == null) { throw new IllegalArgumentException("connectionSource argument cannot be null"); } addDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()), d... |
### Question:
DefaultInvocationContext implements InvocationContext { @Override @Nullable public Object getNullableBindingValue(BindingParameterInvoker invoker) { String key = getCacheKey(invoker); if (cache.containsKey(key)) { return cache.get(key); } String parameterName = invoker.getBindingParameter().getParameterNa... |
### Question:
DefaultInvocationContext implements InvocationContext { @Override public Object getBindingValue(BindingParameterInvoker invoker) { Object value = getNullableBindingValue(invoker); if (value == null) { throw new BindingException("Parameter '" + invoker.getBindingParameter() + "' need a non-null value"); } ... |
### Question:
DefaultInvocationContext implements InvocationContext { @Override public void setBindingValue(BindingParameterInvoker invoker, Object value) { String key = getCacheKey(invoker); cache.put(key, value); } private DefaultInvocationContext(); static DefaultInvocationContext create(); @Override void addParame... |
### Question:
DefaultParameterContext implements ParameterContext { @Override public String getParameterNameByPosition(int position) { String name = positionToNameMap.get(position); if (name == null) { throw new IllegalStateException("parameter name can not be found by position [" + position + "]"); } return name; } pr... |
### Question:
DefaultParameterContext implements ParameterContext { @Override public BindingParameterInvoker getBindingParameterInvoker(BindingParameter bindingParameter) { String parameterName = bindingParameter.getParameterName(); Type type = nameToTypeMap.get(parameterName); if (type == null) { throw new BindingExce... |
### Question:
DefaultParameterContext implements ParameterContext { @Override public List<ParameterDescriptor> getParameterDescriptors() { return parameterDescriptors; } private DefaultParameterContext(List<ParameterDescriptor> parameterDescriptors); static DefaultParameterContext create(List<ParameterDescriptor> para... |
### Question:
BaseConnectionSource implements ConnectionSource { @Override public DatabaseConnection getSpecialConnection(String tableName) { NestedConnection currentSaved = specialConnection.get(); if (currentSaved == null) { return null; } else { return currentSaved.connection; } } @Override DatabaseConnection getSp... |
### Question:
DatabaseConnectionProxy implements DatabaseConnection { @Override public boolean isAutoCommitSupported() throws SQLException { if (proxy == null) { return false; } else { return proxy.isAutoCommitSupported(); } } DatabaseConnectionProxy(DatabaseConnection proxy); @Override boolean isAutoCommitSupported();... |
### Question:
DefaultParameterContext implements ParameterContext { @Override @Nullable public BindingParameter tryExpandBindingParameter(BindingParameter bindingParameter) { if (!nameToTypeMap.containsKey(bindingParameter.getParameterName())) { BindingParameter newBindingParameter = bindingParameter.rightShift(); List... |
### Question:
DatabaseConnectionProxy implements DatabaseConnection { @Override public boolean isAutoCommit() throws SQLException { if (proxy == null) { return false; } else { return proxy.isAutoCommit(); } } DatabaseConnectionProxy(DatabaseConnection proxy); @Override boolean isAutoCommitSupported(); @Override boolean... |
### Question:
DatabaseConnectionProxy implements DatabaseConnection { @Override public void setAutoCommit(boolean autoCommit) throws SQLException { if (proxy != null) { proxy.setAutoCommit(autoCommit); } } DatabaseConnectionProxy(DatabaseConnection proxy); @Override boolean isAutoCommitSupported(); @Override boolean is... |
### Question:
DatabaseConnectionProxy implements DatabaseConnection { @Override public Savepoint setSavePoint(String name) throws SQLException { if (proxy == null) { return null; } else { return proxy.setSavePoint(name); } } DatabaseConnectionProxy(DatabaseConnection proxy); @Override boolean isAutoCommitSupported(); @... |
### Question:
DatabaseConnectionProxy implements DatabaseConnection { @Override public void commit(Savepoint savePoint) throws SQLException { if (proxy != null) { proxy.commit(savePoint); } } DatabaseConnectionProxy(DatabaseConnection proxy); @Override boolean isAutoCommitSupported(); @Override boolean isAutoCommit(); ... |
### Question:
DatabaseConnectionProxy implements DatabaseConnection { @Override public void rollback(Savepoint savePoint) throws SQLException { if (proxy != null) { proxy.rollback(savePoint); } } DatabaseConnectionProxy(DatabaseConnection proxy); @Override boolean isAutoCommitSupported(); @Override boolean isAutoCommit... |
### Question:
DatabaseConnectionProxy implements DatabaseConnection { @Override public int insert(String statement, Object[] args, FieldType[] argfieldTypes, GeneratedKeyHolder keyHolder) throws SQLException { if (proxy == null) { return 0; } else { return proxy.insert(statement, args, argfieldTypes, keyHolder); } } Da... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.