@Override public Properties getRemoteAvaticaProperties() { Map<DatabaseProperty, Object> propertyMap = connection.invokeWithRetries( new CallableWithoutException<Map<DatabaseProperty, Object>>() { public Map<DatabaseProperty, Object> call() { return connection.meta.getDatabaseProperties(connection.handle); } }); final Properties properties = new Properties(); for (Entry<DatabaseProperty, Object> entry: propertyMap.entrySet()) { properties.setProperty(entry.getKey().name(), entry.getValue().toString()); } return properties; }
@Override public Properties getRemoteAvaticaProperties() { Map<DatabaseProperty, Object> propertyMap = connection.invokeWithRetries( new CallableWithoutException<Map<DatabaseProperty, Object>>() { public Map<DatabaseProperty, Object> call() { return connection.meta.getDatabaseProperties(connection.handle); } }); final Properties properties = new Properties(); for (Entry<DatabaseProperty, Object> entry: propertyMap.entrySet()) { properties.setProperty(entry.getKey().name(), entry.getValue().toString()); } return properties; }
<T> DatabaseProperty(T defaultValue) { this.defaultValue = defaultValue; final String methodName = AvaticaUtils.toCamelCase(name()); try { this.method = DatabaseMetaData.class.getMethod(methodName); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } this.type = AvaticaUtils.box(method.getReturnType()); assert defaultValue == null || defaultValue.getClass() == type; }
<T> DatabaseProperty(T defaultValue) { this.defaultValue = defaultValue; final String methodName = AvaticaUtils.toCamelCase(name()); Method localMethod = null; try { localMethod = DatabaseMetaData.class.getMethod(methodName); } catch (NoSuchMethodException e) { // Pass, localMethod stays null. } if (null == localMethod) { this.method = null; this.type = null; this.isJdbc = false; } else { this.method = localMethod; this.type = AvaticaUtils.box(method.getReturnType()); this.isJdbc = true; } // It's either: 1) not a JDBC method, 2) has no default value, // 3) the defaultValue is of the expected type assert !isJdbc || defaultValue == null || defaultValue.getClass() == type; }
<T> DatabaseProperty(T defaultValue) { this.defaultValue = defaultValue; final String methodName = AvaticaUtils.toCamelCase(name()); Method localMethod = null; try { localMethod = DatabaseMetaData.class.getMethod(methodName); } catch (NoSuchMethodException e) { // Pass, localMethod stays null. } if (null == localMethod) { this.method = null; this.type = null; this.isJdbc = false; } else { this.method = localMethod; this.type = AvaticaUtils.box(method.getReturnType()); this.isJdbc = true; } // It's either: 1) not a JDBC method, 2) has no default value, // 3) the defaultValue is of the expected type assert !isJdbc || defaultValue == null || defaultValue.getClass() == type; }
public Common.DatabaseProperty toProto() { return Common.DatabaseProperty.newBuilder().setName(name()).build(); } }
public Common.DatabaseProperty toProto() { return Common.DatabaseProperty.newBuilder().setName(name()).build(); } }
public Common.DatabaseProperty toProto() { return Common.DatabaseProperty.newBuilder().setName(name()).build(); } }