_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q157600 | ConnectSupport.completeConnection | train | public Connection<?> completeConnection(OAuth2ConnectionFactory<?> connectionFactory, NativeWebRequest request) {
if (connectionFactory.supportsStateParameter()) {
verifyStateParameter(request);
}
String code = request.getParameter("code");
try {
AccessGrant accessGrant = connectionFactory.getOAuthOper... | java | {
"resource": ""
} |
q157601 | ProviderConfigurationSupport.getConnectionFactoryBeanDefinition | train | protected BeanDefinition getConnectionFactoryBeanDefinition(String appId, String appSecret, Map<String, Object> allAttributes) {
return BeanDefinitionBuilder.genericBeanDefinition(connectionFactoryClass).addConstructorArgValue(appId).addConstructorArgValue(appSecret).getBeanDefinition();
} | java | {
"resource": ""
} |
q157602 | ProviderConfigurationSupport.getApiHelperBeanDefinitionBuilder | train | protected BeanDefinitionBuilder getApiHelperBeanDefinitionBuilder(Map<String, Object> allAttributes)
{
return BeanDefinitionBuilder.genericBeanDefinition(apiHelperClass)
.addConstructorArgReference("usersConnectionRepository")
.addConstructorArgReference("userIdSource");
} | java | {
"resource": ""
} |
q157603 | AbstractConnection.initKey | train | protected void initKey(String providerId, String providerUserId) {
if (providerUserId == null) {
providerUserId = setValues().providerUserId;
}
key = new ConnectionKey(providerId, providerUserId);
} | java | {
"resource": ""
} |
q157604 | ConnectController.addDisconnectInterceptor | train | public void addDisconnectInterceptor(DisconnectInterceptor<?> interceptor) {
Class<?> serviceApiType = GenericTypeResolver.resolveTypeArgument(interceptor.getClass(), DisconnectInterceptor.class);
disconnectInterceptors.add(serviceApiType, interceptor);
} | java | {
"resource": ""
} |
q157605 | ConnectController.connectionStatus | train | @RequestMapping(method=RequestMethod.GET)
public String connectionStatus(NativeWebRequest request, Model model) {
setNoCache(request);
processFlash(request, model);
Map<String, List<Connection<?>>> connections = connectionRepository.findAllConnections();
model.addAttribute("providerIds", connectionFactoryLocat... | java | {
"resource": ""
} |
q157606 | URIBuilder.queryParam | train | public URIBuilder queryParam(String name, String value) {
parameters.add(name, value);
return this;
} | java | {
"resource": ""
} |
q157607 | URIBuilder.build | train | public URI build() {
try {
StringBuilder builder = new StringBuilder();
Set<Entry<String, List<String>>> entrySet = parameters.entrySet();
for (Iterator<Entry<String, List<String>>> entryIt = entrySet.iterator(); entryIt.hasNext();) {
Entry<String, List<String>> entry = entryIt.next();
String name = ... | java | {
"resource": ""
} |
q157608 | ProtectedResourceClientFactory.create | train | public static RestTemplate create(OAuth1Credentials credentials) {
RestTemplate client = new RestTemplate(ClientHttpRequestFactorySelector.getRequestFactory());
OAuth1RequestInterceptor interceptor = new OAuth1RequestInterceptor(credentials);
List<ClientHttpRequestInterceptor> interceptors = new LinkedList<Client... | java | {
"resource": ""
} |
q157609 | SigningSupport.buildAuthorizationHeaderValue | train | public String buildAuthorizationHeaderValue(HttpMethod method, URI targetUrl, Map<String, String> oauthParameters, MultiValueMap<String, String> additionalParameters, String consumerSecret, String tokenSecret) {
StringBuilder header = new StringBuilder();
header.append("OAuth ");
for (Entry<String, String> entry ... | java | {
"resource": ""
} |
q157610 | SigningSupport.buildAuthorizationHeaderValue | train | public String buildAuthorizationHeaderValue(HttpRequest request, byte[] body, OAuth1Credentials oauth1Credentials) {
Map<String, String> oauthParameters = commonOAuthParameters(oauth1Credentials.getConsumerKey());
oauthParameters.put("oauth_token", oauth1Credentials.getAccessToken());
MultiValueMap<String, String... | java | {
"resource": ""
} |
q157611 | SigningSupport.union | train | private MultiValueMap<String, String> union(MultiValueMap<String, String> map1, MultiValueMap<String, String> map2) {
MultiValueMap<String, String> union = new LinkedMultiValueMap<String, String>(map1);
Set<Entry<String, List<String>>> map2Entries = map2.entrySet();
for (Iterator<Entry<String, List<String>>> entr... | java | {
"resource": ""
} |
q157612 | StatisticsQueue.stop | train | public void stop() {
int notProcessed = worker.shutdownNow().size();
if (notProcessed != 0) {
LogFilter.log(LOGGER, LogLevel.INFO, "Worker exiting, {} execution events remaining, time: {}", notProcessed, System.currentTimeMillis());
}
} | java | {
"resource": ""
} |
q157613 | StatisticsQueue.enqueue | train | public Future enqueue(final QueryExecutionEvent event) {
if (!paused) {
return worker.submit(new Runnable() {
@Override public void run() {
QueryStats queryStats = statsByQuery.get(event.getQuery());
if (queryStats == null) {
... | java | {
"resource": ""
} |
q157614 | StatisticsQueue.getReportSortedBy | train | public List<QueryStats> getReportSortedBy(String sortByVal) {
SortBy sortBy;
try {
sortBy = SortBy.valueOf(sortByVal);
} catch (Exception e) {
throw new IllegalArgumentException("allowed values are: " + Arrays.toString(SortBy.values()));
}
List<QueryStats... | java | {
"resource": ""
} |
q157615 | Model.findOrCreateIt | train | public static <T extends Model> T findOrCreateIt(Object... namesAndValues) {
return ModelDelegate.findOrCreateIt(modelClass(), namesAndValues);
} | java | {
"resource": ""
} |
q157616 | Model.findOrInit | train | public static <T extends Model> T findOrInit(Object... namesAndValues) {
return ModelDelegate.findOrInit(modelClass(), namesAndValues);
} | java | {
"resource": ""
} |
q157617 | Model.hydrate | train | protected Set<String> hydrate(Map<String, Object> attributesMap, boolean fireAfterLoad) {
Set<String> changedAttributeNames = new HashSet<>();
Set<String> attributeNames = metaModelLocal.getAttributeNames();
for (Map.Entry<String, Object> entry : attributesMap.entrySet()) {
if (attr... | java | {
"resource": ""
} |
q157618 | Model.willAttributeModifyModel | train | private boolean willAttributeModifyModel(String attributeName, Object newValue) {
Object currentValue = get(attributeName);
return currentValue != null ? !currentValue.equals(newValue) : newValue != null;
} | java | {
"resource": ""
} |
q157619 | Model.set | train | public void set(String[] attributeNames, Object[] values) {
if (attributeNames == null || values == null || attributeNames.length != values.length) {
throw new IllegalArgumentException("must pass non-null arrays of equal length");
}
for (int i = 0; i < attributeNames.length; i++) {
... | java | {
"resource": ""
} |
q157620 | Model.setRaw | train | private <T extends Model> T setRaw(String attributeName, Object value) {
if (manageTime && attributeName.equalsIgnoreCase("created_at")) {
throw new IllegalArgumentException("cannot set 'created_at'");
}
metaModelLocal.checkAttribute(attributeName);
if (willAttributeModifyMo... | java | {
"resource": ""
} |
q157621 | Model.deleteManyToManyLinks | train | private void deleteManyToManyLinks(Many2ManyAssociation association){
String join = association.getJoin();
String sourceFK = association.getSourceFkName();
new DB(metaModelLocal.getDbName()).exec("DELETE FROM " + join + " WHERE " + sourceFK + " = ?", getId());
} | java | {
"resource": ""
} |
q157622 | Model.deleteOne2ManyChildrenShallow | train | private void deleteOne2ManyChildrenShallow(OneToManyAssociation association){
String targetTable = metaModelOf(association.getTargetClass()).getTableName();
new DB(metaModelLocal.getDbName()).exec("DELETE FROM " + targetTable + " WHERE " + association.getFkName() + " = ?", getId());
} | java | {
"resource": ""
} |
q157623 | Model.deletePolymorphicChildrenShallow | train | private void deletePolymorphicChildrenShallow(OneToManyPolymorphicAssociation association){
String targetTable = metaModelOf(association.getTargetClass()).getTableName();
String parentType = association.getTypeLabel();
new DB(metaModelLocal.getDbName()).exec("DELETE FROM " + targetTable + " WHER... | java | {
"resource": ""
} |
q157624 | Model.exists | train | public boolean exists(){
return null != new DB(metaModelLocal.getDbName()).firstCell(metaModelLocal.getDialect().selectExists(metaModelLocal), getId());
} | java | {
"resource": ""
} |
q157625 | Model.update | train | public static int update(String updates, String conditions, Object ... params) {
return ModelDelegate.update(modelClass(), updates, conditions, params);
} | java | {
"resource": ""
} |
q157626 | Model.updateAll | train | public static int updateAll(String updates, Object ... params) {
return ModelDelegate.updateAll(modelClass(), updates, params);
} | java | {
"resource": ""
} |
q157627 | Model.toMap | train | public Map<String, Object> toMap(){
Map<String, Object> retVal = new TreeMap<>();
for (Map.Entry<String, Object> entry : attributes.entrySet()) {
Object v = entry.getValue();
if (v != null) {
if (v instanceof Clob) {
retVal.put(entry.getKey().t... | java | {
"resource": ""
} |
q157628 | Model.beforeClosingTag | train | public void beforeClosingTag(StringBuilder sb, boolean pretty, String indent, String... attributeNames) {
StringWriter writer = new StringWriter();
beforeClosingTag(indent.length(), writer, attributeNames);
sb.append(writer.toString());
} | java | {
"resource": ""
} |
q157629 | Model.toJson | train | public String toJson(boolean pretty, String... attributeNames) {
StringBuilder sb = new StringBuilder();
toJsonP(sb, pretty, "", attributeNames);
return sb.toString();
} | java | {
"resource": ""
} |
q157630 | Model.beforeClosingBrace | train | public void beforeClosingBrace(StringBuilder sb, boolean pretty, String indent, String... attributeNames) {
StringWriter writer = new StringWriter();
beforeClosingBrace(pretty, indent, writer);
sb.append(writer.toString());
} | java | {
"resource": ""
} |
q157631 | Model.refresh | train | public void refresh() {
QueryCache.instance().purgeTableCache(metaModelLocal);
Model fresh = ModelDelegate.findById(this.getClass(), getId());
if (fresh == null) {
throw new StaleModelException("Failed to refresh self because probably record with " +
"this ID does... | java | {
"resource": ""
} |
q157632 | Model.getRaw | train | private Object getRaw(String attributeName) {
if(frozen){
throw new FrozenException(this);
}
if(attributeName == null) {
throw new IllegalArgumentException("attributeName cannot be null");
}
metaModelLocal.checkAttribute(attributeName);
return att... | java | {
"resource": ""
} |
q157633 | Model.get | train | public <C extends Model> LazyList<C> get(Class<C> targetModelClass, String criteria, Object ... params){
OneToManyAssociation oneToManyAssociation = metaModelLocal.getAssociationForTarget(targetModelClass, OneToManyAssociation.class);
MetaModel mm = metaModelLocal;
Many2ManyAssociation manyToM... | java | {
"resource": ""
} |
q157634 | Model.addScope | train | protected static void addScope(String name, String criteria) {
ModelDelegate.addScope(modelClass().getName(), name, criteria);
} | java | {
"resource": ""
} |
q157635 | Model.validateRegexpOf | train | protected static ValidationBuilder validateRegexpOf(String attributeName, String pattern) {
return ModelDelegate.validateRegexpOf(modelClass(), attributeName, pattern);
} | java | {
"resource": ""
} |
q157636 | Model.convertWith | train | @Deprecated
protected static ValidationBuilder convertWith(org.javalite.activejdbc.validation.Converter converter) {
return ModelDelegate.convertWith(modelClass(), converter);
} | java | {
"resource": ""
} |
q157637 | Model.convertWith | train | protected static void convertWith(Converter converter, String... attributeNames) {
ModelDelegate.convertWith(modelClass(), converter, attributeNames);
} | java | {
"resource": ""
} |
q157638 | Model.validate | train | public void validate() {
fireBeforeValidation();
errors = new Errors();
List<Validator> validators = modelRegistryLocal.validators();
if (validators != null) {
for (Validator validator : validators) {
validator.validate(this);
}
}
f... | java | {
"resource": ""
} |
q157639 | Model.addValidator | train | public void addValidator(Validator validator, String errorKey) {
if(!errors.containsKey(errorKey))
errors.addValidator(errorKey, validator);
} | java | {
"resource": ""
} |
q157640 | Model.count | train | public static Long count(String query, Object... params) {
return ModelDelegate.count(modelClass(), query, params);
} | java | {
"resource": ""
} |
q157641 | AppConfig.setProperty | train | public static String setProperty(String name, String value) {
String val = null;
if(props.containsKey(name)){
val = props.get(name).getValue();
}
props.put(name, new Property(name, value, "dynamically added"));
LOGGER.warn("Temporary overriding property: " + name + ".... | java | {
"resource": ""
} |
q157642 | AppConfig.getProperty | train | public static String getProperty(String key) {
if (!isInited()) {
init();
}
Property p = props.get(key);
return p == null ? null : p.getValue();
} | java | {
"resource": ""
} |
q157643 | AppConfig.getKeys | train | public static List<String> getKeys(String prefix) {
List<String> res = new ArrayList<>();
for(String key: props.keySet()){
if(key.startsWith(prefix)){
res.add(key);
}
}
return res;
} | java | {
"resource": ""
} |
q157644 | QueryStats.addQueryTime | train | public void addQueryTime(long time){
if (time < min || min == 0) min = time;
if (time > max || max == 0) max = time;
avg = Math.round((avg + (time - avg) / (double) (++count)));
total += time;
} | java | {
"resource": ""
} |
q157645 | CacheManager.flush | train | public final void flush(CacheEvent event, boolean propagate){
doFlush(event);
if(propagate){
propagate(event);
}
String message = "Cache purged: " + (event.getType() == CacheEvent.CacheEventType.ALL
? "all caches" : "table: " + event.getGroup());
... | java | {
"resource": ""
} |
q157646 | CacheManager.getKey | train | public String getKey(String tableName, String query, Object[] params) {
return tableName + query + (params == null ? null : Arrays.asList(params).toString());
} | java | {
"resource": ""
} |
q157647 | Collections.set | train | public static <T> Set<T> set(T... values) {
return new HashSet<T>(Arrays.asList(values));
} | java | {
"resource": ""
} |
q157648 | Collections.map | train | public static <K, V> Map<K, V> map(Object... keysAndValues) {
if (keysAndValues.length % 2 != 0) { throw new IllegalArgumentException("number of arguments must be even"); }
Map<K, V> map = new HashMap<K, V>(Math.max(keysAndValues.length, 16));
for (int i = 0; i < keysAndValues.length;) {
... | java | {
"resource": ""
} |
q157649 | Collections.list | train | public static <T> List<T> list(T... values) {
return new ArrayList<T>(Arrays.asList(values));
} | java | {
"resource": ""
} |
q157650 | Multipart.field | train | public Multipart field(String name, String value){
formFields.add(new FormField(name, value));
return this;
} | java | {
"resource": ""
} |
q157651 | Multipart.file | train | public Multipart file(String fieldName, String filePath ){
formFields.add(new FileField(fieldName, new File(filePath)));
return this;
} | java | {
"resource": ""
} |
q157652 | Request.header | train | public T header(String name, String value) {
connection.setRequestProperty(name, value);
return (T) this;
} | java | {
"resource": ""
} |
q157653 | Request.getInputStream | train | public InputStream getInputStream() {
try {
return connection.getInputStream();
}catch(SocketTimeoutException e){
throw new HttpException("Failed URL: " + url +
", waited for: " + connection.getConnectTimeout() + " milliseconds", e);
}catch (Exception ... | java | {
"resource": ""
} |
q157654 | Request.responseMessage | train | public String responseMessage() {
try {
connect();
return connection.getResponseMessage();
} catch (Exception e) {
throw new HttpException("Failed URL: " + url, e);
}
} | java | {
"resource": ""
} |
q157655 | Request.bytes | train | public byte[] bytes() {
connect();
ByteArrayOutputStream bout = new ByteArrayOutputStream();
byte[] bytes = new byte[1024];
int count;
try {
InputStream in = connection.getInputStream();
while ((count = in.read(bytes)) != -1) {
bout.wri... | java | {
"resource": ""
} |
q157656 | Request.text | train | public String text() {
try {
connect();
return responseCode() >= 400 ? read(connection.getErrorStream()) : read(connection.getInputStream());
} catch (IOException e) {
throw new HttpException("Failed URL: " + url, e);
}finally {
dispose();
... | java | {
"resource": ""
} |
q157657 | Request.basic | train | public T basic(String user, String password){
connection.setRequestProperty("Authorization", "Basic " + toBase64((user + ":" + password).getBytes()));
return (T) this;
} | java | {
"resource": ""
} |
q157658 | MetaModel.getAttributeNamesSkipId | train | public Set<String> getAttributeNamesSkipId() {
if (attributeNamesNoId == null) {//no one cares about unfortunate multi-threading timing with 2 instances created
//if someone does, use DCL with volatile
Set<String> attributesNames = new CaseInsensitiveSet(getAttributeNames());
... | java | {
"resource": ""
} |
q157659 | MetaModel.getAttributeNamesSkip | train | public Set<String> getAttributeNamesSkip(String ... names) {
Set<String> attributes = new CaseInsensitiveSet(getAttributeNames());
for (String name : names) {
attributes.remove(name);
}
return attributes;
} | java | {
"resource": ""
} |
q157660 | MetaModel.getAttributeNames | train | protected Set<String> getAttributeNames() {
if(columnMetadata == null || columnMetadata.isEmpty()) throw new InitException("Failed to find table: " + getTableName());
return Collections.unmodifiableSet(columnMetadata.keySet());
} | java | {
"resource": ""
} |
q157661 | MetaModel.hasAttribute | train | boolean hasAttribute(String attribute) {
if(columnMetadata != null){
if(columnMetadata.containsKey(attribute)){
return true;
}else if(attribute.startsWith("\"") && attribute.endsWith("\"")){
return columnMetadata.containsKey(attribute.substring(1, attribut... | java | {
"resource": ""
} |
q157662 | MetaModel.checkAttribute | train | protected void checkAttribute(String attribute) {
if (!hasAttribute(attribute)) {
String sb = "Attribute: '" + attribute + "' is not defined in model: '" + getModelClass() + ". "
+ "Available attributes: " +getAttributeNames();
throw new IllegalArgumentException(sb);
... | java | {
"resource": ""
} |
q157663 | MetaModel.getColumnMetadata | train | public Map<String, ColumnMetadata> getColumnMetadata() {
if(columnMetadata == null || columnMetadata.isEmpty()) throw new InitException("Failed to find table: " + getTableName());
return Collections.unmodifiableMap(columnMetadata);
} | java | {
"resource": ""
} |
q157664 | MetaModel.isAssociatedTo | train | public boolean isAssociatedTo(Class<? extends Model> targetModelClass) {
if(targetModelClass == null){
throw new NullPointerException();
}
for (Association association : associations) {
if (association.getTargetClass().getName().equals(targetModelClass.getName())) {
... | java | {
"resource": ""
} |
q157665 | RuntimeUtil.execute | train | public static Response execute(int maxBuffer, String ... command) {
if(command.length == 0){
throw new IllegalArgumentException("Command must be provided.");
}
String[] commandAndArgs = command.length == 1 && command[0].contains(" ") ? Util.split(command[0], " ") : command;
... | java | {
"resource": ""
} |
q157666 | LazyList.toMaps | train | public List<Map<String, Object>> toMaps() {
hydrate();
List<Map<String, Object>> maps = new ArrayList<>(delegate.size());
for (T t : delegate) {
maps.add(t.toMap());
}
return maps;
} | java | {
"resource": ""
} |
q157667 | LazyList.toJson | train | public String toJson(boolean pretty, String ... attrs) {
hydrate();
StringBuilder sb = new StringBuilder();
sb.append('[');
if (pretty) sb.append('\n');
for (int i = 0; i < delegate.size(); i++) {
if (i > 0) {
sb.append(',');
if (prett... | java | {
"resource": ""
} |
q157668 | LazyList.toSql | train | public String toSql(boolean showParameters) {
String sql;
if(forPaginator){
sql = metaModel.getDialect().formSelect(null, null, fullQuery, orderBys, limit, offset);
}else{
sql = fullQuery != null ? fullQuery
: metaModel.getDialect().formSelect(metaMode... | java | {
"resource": ""
} |
q157669 | LazyList.dump | train | public void dump(OutputStream out){
hydrate();
PrintWriter p = new PrintWriter(out);
for(Model m : delegate){
p.write(m.toString());
p.write('\n');
}
p.flush();
} | java | {
"resource": ""
} |
q157670 | ValidatorAdapter.formatMessage | train | @Override
public String formatMessage(Locale locale, Object ... params) {
return Messages.message(message, locale, params);
} | java | {
"resource": ""
} |
q157671 | ConnectionsAccess.attach | train | static void attach(String dbName, Connection connection, String extraInfo) {
if(ConnectionsAccess.getConnectionMap().get(dbName) != null){
throw new InternalException("You are opening a connection " + dbName + " without closing a previous one. Check your logic. Connection still remains on thread: " ... | java | {
"resource": ""
} |
q157672 | Templator.mergeFromPath | train | public static String mergeFromPath(String templatePath, Map<String, ?> values) {
return mergeFromTemplate(readResource(templatePath), values);
} | java | {
"resource": ""
} |
q157673 | Templator.mergeFromTemplate | train | public static String mergeFromTemplate(String template, Map<String, ?> values) {
for (String param : values.keySet()) {
template = template.replace("{{" + param + "}}", values.get(param) == null ? "" : values.get(param).toString());
}
return template.replaceAll("\n|\r| ", "");
} | java | {
"resource": ""
} |
q157674 | DbConfiguration.getConnectionSpecWrappers | train | public static List<ConnectionSpecWrapper> getConnectionSpecWrappers(String env) {
return connectionWrappers.get(env) == null? new ArrayList<>() :connectionWrappers.get(env);
} | java | {
"resource": ""
} |
q157675 | ModelDelegate.addScope | train | public static void addScope(String className, String scope, String criteria) {
if(!scopes.containsKey(className)){
scopes.put(className, new HashMap<>());
}
scopes.get(className).put(scope, criteria);
} | java | {
"resource": ""
} |
q157676 | Http.get | train | public static Get get(String url, int connectTimeout, int readTimeout) {
try {
return new Get(url, connectTimeout, readTimeout);
} catch (Exception e) {
throw new HttpException("Failed URL: " + url, e);
}
} | java | {
"resource": ""
} |
q157677 | Http.multipart | train | public static Multipart multipart(String url, int connectTimeout, int readTimeout) {
return new Multipart(url, connectTimeout, connectTimeout);
} | java | {
"resource": ""
} |
q157678 | Http.delete | train | public static Delete delete(String url, int connectTimeout, int readTimeout) {
try {
return new Delete(url, connectTimeout, readTimeout);
} catch (Exception e) {
throw new HttpException("Failed URL: " + url, e);
}
} | java | {
"resource": ""
} |
q157679 | Base.open | train | public static DB open(String driver, String url, String user, String password) {
return new DB(DB.DEFAULT_NAME).open(driver, url, user, password);
} | java | {
"resource": ""
} |
q157680 | Base.open | train | public static DB open(String driver, String url, Properties props) {
return new DB(DB.DEFAULT_NAME).open(driver, url, props);
} | java | {
"resource": ""
} |
q157681 | Base.count | train | public static Long count(String table, String query, Object... params) {
return new DB(DB.DEFAULT_NAME).count(table, query, params);
} | java | {
"resource": ""
} |
q157682 | Base.findAll | train | public static List<Map> findAll(String query) {
return new DB(DB.DEFAULT_NAME).findAll(query);
} | java | {
"resource": ""
} |
q157683 | Base.exec | train | public static int exec(String query, Object ... params){
return new DB(DB.DEFAULT_NAME).exec(query, params);
} | java | {
"resource": ""
} |
q157684 | Base.execInsert | train | static Object execInsert(String query, String autoIncrementColumnName, Object... params) {
return new DB(DB.DEFAULT_NAME).execInsert(query, autoIncrementColumnName, params);
} | java | {
"resource": ""
} |
q157685 | InstrumentationModelFinder.processFilePath | train | private void processFilePath(File file) {
try {
if (file.getCanonicalPath().toLowerCase().endsWith(".jar")
|| file.getCanonicalPath().toLowerCase().endsWith(".zip")) {
ZipFile zip = new ZipFile(file);
Enumeration<? extends ZipEntry> entries = zip.... | java | {
"resource": ""
} |
q157686 | InstrumentationModelFinder.processDirectory | train | private void processDirectory(File directory) throws IOException, ClassNotFoundException {
findFiles(directory);
File[] files = directory.listFiles();
if (files != null) {
for (File file : files) {
if (file.isDirectory()) {
processDirectory(file);... | java | {
"resource": ""
} |
q157687 | InstrumentationModelFinder.findFiles | train | private void findFiles(File directory) throws IOException, ClassNotFoundException {
File[] files = directory.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".class");
}
});
if (files != null) {
... | java | {
"resource": ""
} |
q157688 | Post.param | train | public Post param(String name, String value){
params.put(name, value);
return this;
} | java | {
"resource": ""
} |
q157689 | ScopeBuilder.where | train | public <T extends Model> LazyList<T> where(String subquery, Object... params) {
StringBuilder query;
if(subquery.equals("*")){
query = new StringBuilder();
}else {
query = new StringBuilder(subquery);
query.append(" AND ");
}
for (int i = 0;... | java | {
"resource": ""
} |
q157690 | Configuration.getEnvironments | train | private Set<String> getEnvironments(Properties props) {
Set<String> environments = new HashSet<>();
for (Object k : props.keySet()) {
String environment = k.toString().split("\\.")[0];
environments.add(environment);
}
return new TreeSet<>(environments);
} | java | {
"resource": ""
} |
q157691 | Configuration.readPropertyFile | train | private Properties readPropertyFile(String file) throws IOException {
String fileName = file.startsWith("/") ? file : "/" + file;
LOGGER.info("Reading properties from: " + fileName + ". Will try classpath, then file system.");
return Util.readProperties(fileName);
} | java | {
"resource": ""
} |
q157692 | DbUtils.driverClass | train | public static String driverClass(String url) {
assert !blank(url);
if (url.contains(POSTGRESQL_FRAGMENT)) {
return "org.postgresql.Driver";
}
if (url.contains(MYSQL_FRAGMENT)) {
return "com.mysql.jdbc.Driver";
}
if (url.contains(HSQL_FRAGMENT)) {
... | java | {
"resource": ""
} |
q157693 | ModelRegistry.convertWith | train | void convertWith(Converter converter, String... attributes) {
for (String attribute : attributes) {
convertWith(converter, attribute);
}
} | java | {
"resource": ""
} |
q157694 | ModelRegistry.convertWith | train | void convertWith(Converter converter, String attribute) {
List<Converter> list = attributeConverters.get(attribute);
if (list == null) {
list = new ArrayList<>();
attributeConverters.put(attribute, list);
}
list.add(converter);
} | java | {
"resource": ""
} |
q157695 | ModelRegistry.converterForClass | train | <S, T> Converter<S, T> converterForClass(String attribute, Class<S> sourceClass, Class<T> destinationClass) {
List<Converter> list = attributeConverters.get(attribute);
if (list != null) {
for (Converter converter : list) {
if (converter.canConvert(sourceClass, destinationCla... | java | {
"resource": ""
} |
q157696 | ModelRegistry.converterForValue | train | <T> Converter<Object, T> converterForValue(String attribute, Object value, Class<T> destinationClass) {
return converterForClass(attribute,
value != null ? (Class<Object>) value.getClass() : Object.class, destinationClass);
} | java | {
"resource": ""
} |
q157697 | MSSQLDialect.overrideDriverTypeConversion | train | @Override
public Object overrideDriverTypeConversion(MetaModel mm, String attributeName, Object value) {
if (value instanceof String && !Util.blank(value)) {
String typeName = mm.getColumnMetadata().get(attributeName).getTypeName();
if ("date".equalsIgnoreCase(typeName)) {
... | java | {
"resource": ""
} |
q157698 | JsonHelper.toMap | train | public static Map toMap(String json) {
try {
return mapper.readValue(json, Map.class);
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | {
"resource": ""
} |
q157699 | JsonHelper.toJsonString | train | public static String toJsonString(Object val, boolean pretty) {
try {
return pretty ? mapper.writerWithDefaultPrettyPrinter().with(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS).writeValueAsString(val) : mapper.writeValueAsString(val);
} catch (Exception e) {
throw new RuntimeEx... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.