id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
115,100
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/statistics/QueryStats.java
QueryStats.addQueryTime
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
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; }
[ "public", "void", "addQueryTime", "(", "long", "time", ")", "{", "if", "(", "time", "<", "min", "||", "min", "==", "0", ")", "min", "=", "time", ";", "if", "(", "time", ">", "max", "||", "max", "==", "0", ")", "max", "=", "time", ";", "avg", ...
Whenever this query was executed, add execution time with this method. This class will then recalculate all statistics. @param time time in milliseconds it took to execute the query
[ "Whenever", "this", "query", "was", "executed", "add", "execution", "time", "with", "this", "method", ".", "This", "class", "will", "then", "recalculate", "all", "statistics", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/statistics/QueryStats.java#L39-L47
115,101
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/cache/CacheManager.java
CacheManager.flush
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
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()); ...
[ "public", "final", "void", "flush", "(", "CacheEvent", "event", ",", "boolean", "propagate", ")", "{", "doFlush", "(", "event", ")", ";", "if", "(", "propagate", ")", "{", "propagate", "(", "event", ")", ";", "}", "String", "message", "=", "\"Cache purge...
Flashes cache. @param propagate true to propagate event to listeners, false to not propagate @param event type of caches to flush.
[ "Flashes", "cache", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/cache/CacheManager.java#L67-L76
115,102
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/cache/CacheManager.java
CacheManager.getKey
public String getKey(String tableName, String query, Object[] params) { return tableName + query + (params == null ? null : Arrays.asList(params).toString()); }
java
public String getKey(String tableName, String query, Object[] params) { return tableName + query + (params == null ? null : Arrays.asList(params).toString()); }
[ "public", "String", "getKey", "(", "String", "tableName", ",", "String", "query", ",", "Object", "[", "]", "params", ")", "{", "return", "tableName", "+", "query", "+", "(", "params", "==", "null", "?", "null", ":", "Arrays", ".", "asList", "(", "param...
Generates a cache key. Subclasses may override this implementation. @param tableName name of a table @param query query @param params query parameters. @return generated key for tied to these parameters.
[ "Generates", "a", "cache", "key", ".", "Subclasses", "may", "override", "this", "implementation", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/cache/CacheManager.java#L138-L140
115,103
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Collections.java
Collections.set
public static <T> Set<T> set(T... values) { return new HashSet<T>(Arrays.asList(values)); }
java
public static <T> Set<T> set(T... values) { return new HashSet<T>(Arrays.asList(values)); }
[ "public", "static", "<", "T", ">", "Set", "<", "T", ">", "set", "(", "T", "...", "values", ")", "{", "return", "new", "HashSet", "<", "T", ">", "(", "Arrays", ".", "asList", "(", "values", ")", ")", ";", "}" ]
Creates a set from values. @param values values for a set. @return set filled with values.
[ "Creates", "a", "set", "from", "values", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Collections.java#L53-L55
115,104
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Collections.java
Collections.map
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
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;) { ...
[ "public", "static", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "map", "(", "Object", "...", "keysAndValues", ")", "{", "if", "(", "keysAndValues", ".", "length", "%", "2", "!=", "0", ")", "{", "throw", "new", "IllegalArgumentException",...
Create a map from keys and values. @param keysAndValues list of key value pairs. The number of items must be even. The argument at index 0 is a key of the value at index 1, argument at index 2 is key of value at index 3, and so on. @return Map filled with keys and values.
[ "Create", "a", "map", "from", "keys", "and", "values", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Collections.java#L64-L72
115,105
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Collections.java
Collections.list
public static <T> List<T> list(T... values) { return new ArrayList<T>(Arrays.asList(values)); }
java
public static <T> List<T> list(T... values) { return new ArrayList<T>(Arrays.asList(values)); }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "list", "(", "T", "...", "values", ")", "{", "return", "new", "ArrayList", "<", "T", ">", "(", "Arrays", ".", "asList", "(", "values", ")", ")", ";", "}" ]
Create a list from values. @param values values to create a list from. @return list with values.
[ "Create", "a", "list", "from", "values", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Collections.java#L90-L92
115,106
javalite/activejdbc
javalite-common/src/main/java/org/javalite/http/Multipart.java
Multipart.field
public Multipart field(String name, String value){ formFields.add(new FormField(name, value)); return this; }
java
public Multipart field(String name, String value){ formFields.add(new FormField(name, value)); return this; }
[ "public", "Multipart", "field", "(", "String", "name", ",", "String", "value", ")", "{", "formFields", ".", "add", "(", "new", "FormField", "(", "name", ",", "value", ")", ")", ";", "return", "this", ";", "}" ]
Convenience method to add a form field to the request. @param name name of field @param value value of field @return self
[ "Convenience", "method", "to", "add", "a", "form", "field", "to", "the", "request", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/http/Multipart.java#L128-L131
115,107
javalite/activejdbc
javalite-common/src/main/java/org/javalite/http/Multipart.java
Multipart.file
public Multipart file(String fieldName, String filePath ){ formFields.add(new FileField(fieldName, new File(filePath))); return this; }
java
public Multipart file(String fieldName, String filePath ){ formFields.add(new FileField(fieldName, new File(filePath))); return this; }
[ "public", "Multipart", "file", "(", "String", "fieldName", ",", "String", "filePath", ")", "{", "formFields", ".", "add", "(", "new", "FileField", "(", "fieldName", ",", "new", "File", "(", "filePath", ")", ")", ")", ";", "return", "this", ";", "}" ]
Convenience method to add a file fields to the request. @param fieldName name of field @param filePath fully qualified path to a file. @return self.
[ "Convenience", "method", "to", "add", "a", "file", "fields", "to", "the", "request", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/http/Multipart.java#L164-L167
115,108
javalite/activejdbc
javalite-common/src/main/java/org/javalite/http/Request.java
Request.header
public T header(String name, String value) { connection.setRequestProperty(name, value); return (T) this; }
java
public T header(String name, String value) { connection.setRequestProperty(name, value); return (T) this; }
[ "public", "T", "header", "(", "String", "name", ",", "String", "value", ")", "{", "connection", ".", "setRequestProperty", "(", "name", ",", "value", ")", ";", "return", "(", "T", ")", "this", ";", "}" ]
Sets an HTTP header - call before making a request. @param name header name @param value header value. @return self.
[ "Sets", "an", "HTTP", "header", "-", "call", "before", "making", "a", "request", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/http/Request.java#L60-L63
115,109
javalite/activejdbc
javalite-common/src/main/java/org/javalite/http/Request.java
Request.getInputStream
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
public InputStream getInputStream() { try { return connection.getInputStream(); }catch(SocketTimeoutException e){ throw new HttpException("Failed URL: " + url + ", waited for: " + connection.getConnectTimeout() + " milliseconds", e); }catch (Exception ...
[ "public", "InputStream", "getInputStream", "(", ")", "{", "try", "{", "return", "connection", ".", "getInputStream", "(", ")", ";", "}", "catch", "(", "SocketTimeoutException", "e", ")", "{", "throw", "new", "HttpException", "(", "\"Failed URL: \"", "+", "url"...
Returns input stream to read server response from. @return input stream to read server response from.
[ "Returns", "input", "stream", "to", "read", "server", "response", "from", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/http/Request.java#L82-L91
115,110
javalite/activejdbc
javalite-common/src/main/java/org/javalite/http/Request.java
Request.responseMessage
public String responseMessage() { try { connect(); return connection.getResponseMessage(); } catch (Exception e) { throw new HttpException("Failed URL: " + url, e); } }
java
public String responseMessage() { try { connect(); return connection.getResponseMessage(); } catch (Exception e) { throw new HttpException("Failed URL: " + url, e); } }
[ "public", "String", "responseMessage", "(", ")", "{", "try", "{", "connect", "(", ")", ";", "return", "connection", ".", "getResponseMessage", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "HttpException", "(", "\"Failed URL...
Returns response message from server, such as "OK", or "Created", etc. @return response message from server, such as "OK", or "Created", etc.
[ "Returns", "response", "message", "from", "server", "such", "as", "OK", "or", "Created", "etc", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/http/Request.java#L122-L129
115,111
javalite/activejdbc
javalite-common/src/main/java/org/javalite/http/Request.java
Request.bytes
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
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...
[ "public", "byte", "[", "]", "bytes", "(", ")", "{", "connect", "(", ")", ";", "ByteArrayOutputStream", "bout", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "1024", "]", ";", "int", "count", "...
Fetches response content from server as bytes. @return response content from server as bytes.
[ "Fetches", "response", "content", "from", "server", "as", "bytes", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/http/Request.java#L136-L156
115,112
javalite/activejdbc
javalite-common/src/main/java/org/javalite/http/Request.java
Request.text
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
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(); ...
[ "public", "String", "text", "(", ")", "{", "try", "{", "connect", "(", ")", ";", "return", "responseCode", "(", ")", ">=", "400", "?", "read", "(", "connection", ".", "getErrorStream", "(", ")", ")", ":", "read", "(", "connection", ".", "getInputStream...
Fetches response content from server as String. @return response content from server as String.
[ "Fetches", "response", "content", "from", "server", "as", "String", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/http/Request.java#L163-L172
115,113
javalite/activejdbc
javalite-common/src/main/java/org/javalite/http/Request.java
Request.basic
public T basic(String user, String password){ connection.setRequestProperty("Authorization", "Basic " + toBase64((user + ":" + password).getBytes())); return (T) this; }
java
public T basic(String user, String password){ connection.setRequestProperty("Authorization", "Basic " + toBase64((user + ":" + password).getBytes())); return (T) this; }
[ "public", "T", "basic", "(", "String", "user", ",", "String", "password", ")", "{", "connection", ".", "setRequestProperty", "(", "\"Authorization\"", ",", "\"Basic \"", "+", "toBase64", "(", "(", "user", "+", "\":\"", "+", "password", ")", ".", "getBytes", ...
Sets a user and password for basic authentication. @param user user. @param password password. @return self.
[ "Sets", "a", "user", "and", "password", "for", "basic", "authentication", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/http/Request.java#L247-L250
115,114
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java
MetaModel.getAttributeNamesSkipId
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
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()); ...
[ "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", "<", ...
Finds all attribute names except for id. @return all attribute names except for id.
[ "Finds", "all", "attribute", "names", "except", "for", "id", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java#L198-L206
115,115
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java
MetaModel.getAttributeNamesSkip
public Set<String> getAttributeNamesSkip(String ... names) { Set<String> attributes = new CaseInsensitiveSet(getAttributeNames()); for (String name : names) { attributes.remove(name); } return attributes; }
java
public Set<String> getAttributeNamesSkip(String ... names) { Set<String> attributes = new CaseInsensitiveSet(getAttributeNames()); for (String name : names) { attributes.remove(name); } return attributes; }
[ "public", "Set", "<", "String", ">", "getAttributeNamesSkip", "(", "String", "...", "names", ")", "{", "Set", "<", "String", ">", "attributes", "=", "new", "CaseInsensitiveSet", "(", "getAttributeNames", "(", ")", ")", ";", "for", "(", "String", "name", ":...
Finds all attribute names except those provided as arguments. @return list of all attributes except those provided as arguments.
[ "Finds", "all", "attribute", "names", "except", "those", "provided", "as", "arguments", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java#L244-L250
115,116
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java
MetaModel.getAttributeNames
protected Set<String> getAttributeNames() { if(columnMetadata == null || columnMetadata.isEmpty()) throw new InitException("Failed to find table: " + getTableName()); return Collections.unmodifiableSet(columnMetadata.keySet()); }
java
protected Set<String> getAttributeNames() { if(columnMetadata == null || columnMetadata.isEmpty()) throw new InitException("Failed to find table: " + getTableName()); return Collections.unmodifiableSet(columnMetadata.keySet()); }
[ "protected", "Set", "<", "String", ">", "getAttributeNames", "(", ")", "{", "if", "(", "columnMetadata", "==", "null", "||", "columnMetadata", ".", "isEmpty", "(", ")", ")", "throw", "new", "InitException", "(", "\"Failed to find table: \"", "+", "getTableName",...
Retrieves all attribute names. @return all attribute names.
[ "Retrieves", "all", "attribute", "names", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java#L266-L269
115,117
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java
MetaModel.hasAttribute
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
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...
[ "boolean", "hasAttribute", "(", "String", "attribute", ")", "{", "if", "(", "columnMetadata", "!=", "null", ")", "{", "if", "(", "columnMetadata", ".", "containsKey", "(", "attribute", ")", ")", "{", "return", "true", ";", "}", "else", "if", "(", "attrib...
returns true if this attribute is present in this meta model. This method i case insensitive. @param attribute attribute name, case insensitive. @return true if this attribute is present in this meta model, false of not.
[ "returns", "true", "if", "this", "attribute", "is", "present", "in", "this", "meta", "model", ".", "This", "method", "i", "case", "insensitive", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java#L353-L362
115,118
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java
MetaModel.checkAttribute
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
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); ...
[ "protected", "void", "checkAttribute", "(", "String", "attribute", ")", "{", "if", "(", "!", "hasAttribute", "(", "attribute", ")", ")", "{", "String", "sb", "=", "\"Attribute: '\"", "+", "attribute", "+", "\"' is not defined in model: '\"", "+", "getModelClass", ...
Checks if this model has a named attribute that has the same name as argument. Throws <code>IllegalArgumentException</code> in case it does not find it. @param attribute name of attribute or association target.
[ "Checks", "if", "this", "model", "has", "a", "named", "attribute", "that", "has", "the", "same", "name", "as", "argument", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java#L446-L452
115,119
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java
MetaModel.getColumnMetadata
public Map<String, ColumnMetadata> getColumnMetadata() { if(columnMetadata == null || columnMetadata.isEmpty()) throw new InitException("Failed to find table: " + getTableName()); return Collections.unmodifiableMap(columnMetadata); }
java
public Map<String, ColumnMetadata> getColumnMetadata() { if(columnMetadata == null || columnMetadata.isEmpty()) throw new InitException("Failed to find table: " + getTableName()); return Collections.unmodifiableMap(columnMetadata); }
[ "public", "Map", "<", "String", ",", "ColumnMetadata", ">", "getColumnMetadata", "(", ")", "{", "if", "(", "columnMetadata", "==", "null", "||", "columnMetadata", ".", "isEmpty", "(", ")", ")", "throw", "new", "InitException", "(", "\"Failed to find table: \"", ...
Provides column metadata map, keyed by attribute names. Table columns correspond to ActiveJDBC model attributes. @return Provides column metadata map, keyed by attribute names.
[ "Provides", "column", "metadata", "map", "keyed", "by", "attribute", "names", ".", "Table", "columns", "correspond", "to", "ActiveJDBC", "model", "attributes", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java#L465-L468
115,120
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java
MetaModel.isAssociatedTo
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
public boolean isAssociatedTo(Class<? extends Model> targetModelClass) { if(targetModelClass == null){ throw new NullPointerException(); } for (Association association : associations) { if (association.getTargetClass().getName().equals(targetModelClass.getName())) { ...
[ "public", "boolean", "isAssociatedTo", "(", "Class", "<", "?", "extends", "Model", ">", "targetModelClass", ")", "{", "if", "(", "targetModelClass", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "for", "(", "Association"...
Checks if there is association to the target model class., @param targetModelClass class of a model that will be checked for association from current model. @return true if any association exists such that the current model is a source and targetModelClass is a target.
[ "Checks", "if", "there", "is", "association", "to", "the", "target", "model", "class", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/MetaModel.java#L477-L489
115,121
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/RuntimeUtil.java
RuntimeUtil.execute
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
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; ...
[ "public", "static", "Response", "execute", "(", "int", "maxBuffer", ",", "String", "...", "command", ")", "{", "if", "(", "command", ".", "length", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Command must be provided.\"", ")", ";",...
Executes an external command and provides results of execution. Will accumulate limited output from the external process. @param command array containing the command to call and its arguments. @param maxBuffer max size of buffers <code>out, err</code>. An external process may produce a lot of output, be careful settin...
[ "Executes", "an", "external", "command", "and", "provides", "results", "of", "execution", ".", "Will", "accumulate", "limited", "output", "from", "the", "external", "process", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/RuntimeUtil.java#L31-L63
115,122
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/LazyList.java
LazyList.toMaps
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
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; }
[ "public", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "toMaps", "(", ")", "{", "hydrate", "(", ")", ";", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "maps", "=", "new", "ArrayList", "<>", "(", "delegate", ".", "siz...
Converts the resultset to list of maps, where each map represents a row in the resultset keyed off column names. @return list of maps, where each map represents a row in the resultset keyed off column names.
[ "Converts", "the", "resultset", "to", "list", "of", "maps", "where", "each", "map", "represents", "a", "row", "in", "the", "resultset", "keyed", "off", "column", "names", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/LazyList.java#L186-L193
115,123
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/LazyList.java
LazyList.toJson
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
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...
[ "public", "String", "toJson", "(", "boolean", "pretty", ",", "String", "...", "attrs", ")", "{", "hydrate", "(", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "'", "'", ")", ";", "if", "(", "...
Generates JSON from content of this list @param pretty true if you want pretty format, false if not @param attrs attributes to include, not providing any will include all. @return generated JSON
[ "Generates", "JSON", "from", "content", "of", "this", "list" ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/LazyList.java#L245-L261
115,124
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/LazyList.java
LazyList.toSql
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
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...
[ "public", "String", "toSql", "(", "boolean", "showParameters", ")", "{", "String", "sql", ";", "if", "(", "forPaginator", ")", "{", "sql", "=", "metaModel", ".", "getDialect", "(", ")", ".", "formSelect", "(", "null", ",", "null", ",", "fullQuery", ",", ...
Use to see what SQL will be sent to the database. @param showParameters true to see parameter values, false not to. @return SQL in a dialect for current connection which will be used if you start querying this list.
[ "Use", "to", "see", "what", "SQL", "will", "be", "sent", "to", "the", "database", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/LazyList.java#L297-L311
115,125
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/LazyList.java
LazyList.dump
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
public void dump(OutputStream out){ hydrate(); PrintWriter p = new PrintWriter(out); for(Model m : delegate){ p.write(m.toString()); p.write('\n'); } p.flush(); }
[ "public", "void", "dump", "(", "OutputStream", "out", ")", "{", "hydrate", "(", ")", ";", "PrintWriter", "p", "=", "new", "PrintWriter", "(", "out", ")", ";", "for", "(", "Model", "m", ":", "delegate", ")", "{", "p", ".", "write", "(", "m", ".", ...
Dumps content of list to a stream. Use for debugging. @param out
[ "Dumps", "content", "of", "list", "to", "a", "stream", ".", "Use", "for", "debugging", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/LazyList.java#L579-L587
115,126
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/validation/ValidatorAdapter.java
ValidatorAdapter.formatMessage
@Override public String formatMessage(Locale locale, Object ... params) { return Messages.message(message, locale, params); }
java
@Override public String formatMessage(Locale locale, Object ... params) { return Messages.message(message, locale, params); }
[ "@", "Override", "public", "String", "formatMessage", "(", "Locale", "locale", ",", "Object", "...", "params", ")", "{", "return", "Messages", ".", "message", "(", "message", ",", "locale", ",", "params", ")", ";", "}" ]
Provides default implementation, will look for a property in resource bundle, using set message as key. If property in resource bundle not found, treats message verbatim. @param locale locale to use, or null for default locale. @param params parameters in case a message is parametrized. @return formatted message.
[ "Provides", "default", "implementation", "will", "look", "for", "a", "property", "in", "resource", "bundle", "using", "set", "message", "as", "key", ".", "If", "property", "in", "resource", "bundle", "not", "found", "treats", "message", "verbatim", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/validation/ValidatorAdapter.java#L28-L31
115,127
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/ConnectionsAccess.java
ConnectionsAccess.attach
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
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: " ...
[ "static", "void", "attach", "(", "String", "dbName", ",", "Connection", "connection", ",", "String", "extraInfo", ")", "{", "if", "(", "ConnectionsAccess", ".", "getConnectionMap", "(", ")", ".", "get", "(", "dbName", ")", "!=", "null", ")", "{", "throw", ...
Attaches a connection to a ThreadLocal and binds it to a name. @param dbName @param connection
[ "Attaches", "a", "connection", "to", "a", "ThreadLocal", "and", "binds", "it", "to", "a", "name", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/ConnectionsAccess.java#L63-L69
115,128
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Templator.java
Templator.mergeFromPath
public static String mergeFromPath(String templatePath, Map<String, ?> values) { return mergeFromTemplate(readResource(templatePath), values); }
java
public static String mergeFromPath(String templatePath, Map<String, ?> values) { return mergeFromTemplate(readResource(templatePath), values); }
[ "public", "static", "String", "mergeFromPath", "(", "String", "templatePath", ",", "Map", "<", "String", ",", "?", ">", "values", ")", "{", "return", "mergeFromTemplate", "(", "readResource", "(", "templatePath", ")", ",", "values", ")", ";", "}" ]
This method is used in one-off operations, where it is OK to load a template every time. Example: <code> String result = Templator.mergeFromPath(readResource("/message_template.txt", valuesMap)); </code> @param templatePath template to merge @param values values to merge into a template @return result of merging
[ "This", "method", "is", "used", "in", "one", "-", "off", "operations", "where", "it", "is", "OK", "to", "load", "a", "template", "every", "time", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Templator.java#L81-L83
115,129
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Templator.java
Templator.mergeFromTemplate
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
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| ", ""); }
[ "public", "static", "String", "mergeFromTemplate", "(", "String", "template", ",", "Map", "<", "String", ",", "?", ">", "values", ")", "{", "for", "(", "String", "param", ":", "values", ".", "keySet", "(", ")", ")", "{", "template", "=", "template", "....
Merges from string as template. @param template template content, with placeholders like: {{name}} @param values map with values to merge
[ "Merges", "from", "string", "as", "template", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Templator.java#L91-L96
115,130
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/connection_config/DbConfiguration.java
DbConfiguration.getConnectionSpecWrappers
public static List<ConnectionSpecWrapper> getConnectionSpecWrappers(String env) { return connectionWrappers.get(env) == null? new ArrayList<>() :connectionWrappers.get(env); }
java
public static List<ConnectionSpecWrapper> getConnectionSpecWrappers(String env) { return connectionWrappers.get(env) == null? new ArrayList<>() :connectionWrappers.get(env); }
[ "public", "static", "List", "<", "ConnectionSpecWrapper", ">", "getConnectionSpecWrappers", "(", "String", "env", ")", "{", "return", "connectionWrappers", ".", "get", "(", "env", ")", "==", "null", "?", "new", "ArrayList", "<>", "(", ")", ":", "connectionWrap...
Provides a list of all connection wrappers corresponding to a given environment. @param env name of environment, such as "development", "production", etc. @return a list of all connection wrappers corresponding to a given environment.
[ "Provides", "a", "list", "of", "all", "connection", "wrappers", "corresponding", "to", "a", "given", "environment", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/connection_config/DbConfiguration.java#L63-L65
115,131
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/ModelDelegate.java
ModelDelegate.addScope
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
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); }
[ "public", "static", "void", "addScope", "(", "String", "className", ",", "String", "scope", ",", "String", "criteria", ")", "{", "if", "(", "!", "scopes", ".", "containsKey", "(", "className", ")", ")", "{", "scopes", ".", "put", "(", "className", ",", ...
has to be public because it is called from models.
[ "has", "to", "be", "public", "because", "it", "is", "called", "from", "models", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/ModelDelegate.java#L479-L485
115,132
javalite/activejdbc
javalite-common/src/main/java/org/javalite/http/Http.java
Http.get
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
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); } }
[ "public", "static", "Get", "get", "(", "String", "url", ",", "int", "connectTimeout", ",", "int", "readTimeout", ")", "{", "try", "{", "return", "new", "Get", "(", "url", ",", "connectTimeout", ",", "readTimeout", ")", ";", "}", "catch", "(", "Exception"...
Executes a GET request @param url url of resource. @param connectTimeout connection timeout in milliseconds. @param readTimeout read timeout in milliseconds. @return {@link Get} object.
[ "Executes", "a", "GET", "request" ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/http/Http.java#L141-L148
115,133
javalite/activejdbc
javalite-common/src/main/java/org/javalite/http/Http.java
Http.multipart
public static Multipart multipart(String url, int connectTimeout, int readTimeout) { return new Multipart(url, connectTimeout, connectTimeout); }
java
public static Multipart multipart(String url, int connectTimeout, int readTimeout) { return new Multipart(url, connectTimeout, connectTimeout); }
[ "public", "static", "Multipart", "multipart", "(", "String", "url", ",", "int", "connectTimeout", ",", "int", "readTimeout", ")", "{", "return", "new", "Multipart", "(", "url", ",", "connectTimeout", ",", "connectTimeout", ")", ";", "}" ]
Create multipart request @param url URL to send to @param connectTimeout connect timeout @param readTimeout read timeout @return new Multipart request
[ "Create", "multipart", "request" ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/http/Http.java#L208-L210
115,134
javalite/activejdbc
javalite-common/src/main/java/org/javalite/http/Http.java
Http.delete
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
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); } }
[ "public", "static", "Delete", "delete", "(", "String", "url", ",", "int", "connectTimeout", ",", "int", "readTimeout", ")", "{", "try", "{", "return", "new", "Delete", "(", "url", ",", "connectTimeout", ",", "readTimeout", ")", ";", "}", "catch", "(", "E...
Executes a DELETE request. @param url url of resource to delete @param connectTimeout connection timeout in milliseconds. @param readTimeout read timeout in milliseconds. @return {@link Delete}
[ "Executes", "a", "DELETE", "request", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/http/Http.java#L230-L236
115,135
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/Base.java
Base.open
public static DB open(String driver, String url, String user, String password) { return new DB(DB.DEFAULT_NAME).open(driver, url, user, password); }
java
public static DB open(String driver, String url, String user, String password) { return new DB(DB.DEFAULT_NAME).open(driver, url, user, password); }
[ "public", "static", "DB", "open", "(", "String", "driver", ",", "String", "url", ",", "String", "user", ",", "String", "password", ")", "{", "return", "new", "DB", "(", "DB", ".", "DEFAULT_NAME", ")", ".", "open", "(", "driver", ",", "url", ",", "use...
Opens a new connection based on JDBC properties and attaches it to a current thread. @param driver class name of driver @param url URL connection to DB @param user user name. @param password password.
[ "Opens", "a", "new", "connection", "based", "on", "JDBC", "properties", "and", "attaches", "it", "to", "a", "current", "thread", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Base.java#L62-L64
115,136
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/Base.java
Base.open
public static DB open(String driver, String url, Properties props) { return new DB(DB.DEFAULT_NAME).open(driver, url, props); }
java
public static DB open(String driver, String url, Properties props) { return new DB(DB.DEFAULT_NAME).open(driver, url, props); }
[ "public", "static", "DB", "open", "(", "String", "driver", ",", "String", "url", ",", "Properties", "props", ")", "{", "return", "new", "DB", "(", "DB", ".", "DEFAULT_NAME", ")", ".", "open", "(", "driver", ",", "url", ",", "props", ")", ";", "}" ]
Opens a new connection in case additional driver-specific parameters need to be passed in. @param driver driver class name @param url JDBC URL @param props connection properties
[ "Opens", "a", "new", "connection", "in", "case", "additional", "driver", "-", "specific", "parameters", "need", "to", "be", "passed", "in", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Base.java#L74-L76
115,137
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/Base.java
Base.count
public static Long count(String table, String query, Object... params) { return new DB(DB.DEFAULT_NAME).count(table, query, params); }
java
public static Long count(String table, String query, Object... params) { return new DB(DB.DEFAULT_NAME).count(table, query, params); }
[ "public", "static", "Long", "count", "(", "String", "table", ",", "String", "query", ",", "Object", "...", "params", ")", "{", "return", "new", "DB", "(", "DB", ".", "DEFAULT_NAME", ")", ".", "count", "(", "table", ",", "query", ",", "params", ")", "...
Runs a count query, returns a number of matching records. @param table table in which to count rows. @param query this is a filtering query for the count. If '*' provided, all records will be counted. Example: <code>"age > 65 AND department = 'accounting'"</code> @param params parameters for placeholder substitution. ...
[ "Runs", "a", "count", "query", "returns", "a", "number", "of", "matching", "records", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Base.java#L165-L167
115,138
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/Base.java
Base.findAll
public static List<Map> findAll(String query) { return new DB(DB.DEFAULT_NAME).findAll(query); }
java
public static List<Map> findAll(String query) { return new DB(DB.DEFAULT_NAME).findAll(query); }
[ "public", "static", "List", "<", "Map", ">", "findAll", "(", "String", "query", ")", "{", "return", "new", "DB", "(", "DB", ".", "DEFAULT_NAME", ")", ".", "findAll", "(", "query", ")", ";", "}" ]
This method returns entire resultset as one list. Do not use it for large result sets. @param query raw SQL query. This query is not parametrized. @return entire result set corresponding to the query.
[ "This", "method", "returns", "entire", "resultset", "as", "one", "list", ".", "Do", "not", "use", "it", "for", "large", "result", "sets", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Base.java#L225-L227
115,139
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/Base.java
Base.exec
public static int exec(String query, Object ... params){ return new DB(DB.DEFAULT_NAME).exec(query, params); }
java
public static int exec(String query, Object ... params){ return new DB(DB.DEFAULT_NAME).exec(query, params); }
[ "public", "static", "int", "exec", "(", "String", "query", ",", "Object", "...", "params", ")", "{", "return", "new", "DB", "(", "DB", ".", "DEFAULT_NAME", ")", ".", "exec", "(", "query", ",", "params", ")", ";", "}" ]
Executes parametrized DML - will contain question marks as placeholders. @param query query to execute - will contain question marks as placeholders. @param params query parameters. @return number of records affected.
[ "Executes", "parametrized", "DML", "-", "will", "contain", "question", "marks", "as", "placeholders", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Base.java#L279-L281
115,140
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/Base.java
Base.execInsert
static Object execInsert(String query, String autoIncrementColumnName, Object... params) { return new DB(DB.DEFAULT_NAME).execInsert(query, autoIncrementColumnName, params); }
java
static Object execInsert(String query, String autoIncrementColumnName, Object... params) { return new DB(DB.DEFAULT_NAME).execInsert(query, autoIncrementColumnName, params); }
[ "static", "Object", "execInsert", "(", "String", "query", ",", "String", "autoIncrementColumnName", ",", "Object", "...", "params", ")", "{", "return", "new", "DB", "(", "DB", ".", "DEFAULT_NAME", ")", ".", "execInsert", "(", "query", ",", "autoIncrementColumn...
This method is specific for inserts. @param query SQL for inserts. @param autoIncrementColumnName name of a column that is auto-incremented. @param params list of parameter values. @return new value of auto-incremented column that is uniquely identifying a new record inserted. May return -1 if this functionality is no...
[ "This", "method", "is", "specific", "for", "inserts", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Base.java#L293-L295
115,141
javalite/activejdbc
activejdbc-instrumentation/src/main/java/org/javalite/instrumentation/InstrumentationModelFinder.java
InstrumentationModelFinder.processFilePath
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
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....
[ "private", "void", "processFilePath", "(", "File", "file", ")", "{", "try", "{", "if", "(", "file", ".", "getCanonicalPath", "(", ")", ".", "toLowerCase", "(", ")", ".", "endsWith", "(", "\".jar\"", ")", "||", "file", ".", "getCanonicalPath", "(", ")", ...
Finds and processes property files inside zip or jar files. @param file zip or jar file.
[ "Finds", "and", "processes", "property", "files", "inside", "zip", "or", "jar", "files", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc-instrumentation/src/main/java/org/javalite/instrumentation/InstrumentationModelFinder.java#L72-L93
115,142
javalite/activejdbc
activejdbc-instrumentation/src/main/java/org/javalite/instrumentation/InstrumentationModelFinder.java
InstrumentationModelFinder.processDirectory
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
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);...
[ "private", "void", "processDirectory", "(", "File", "directory", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "findFiles", "(", "directory", ")", ";", "File", "[", "]", "files", "=", "directory", ".", "listFiles", "(", ")", ";", "if", "(...
Recursively processes this directory. @param directory - start directory for processing.
[ "Recursively", "processes", "this", "directory", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc-instrumentation/src/main/java/org/javalite/instrumentation/InstrumentationModelFinder.java#L105-L116
115,143
javalite/activejdbc
activejdbc-instrumentation/src/main/java/org/javalite/instrumentation/InstrumentationModelFinder.java
InstrumentationModelFinder.findFiles
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
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) { ...
[ "private", "void", "findFiles", "(", "File", "directory", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "File", "[", "]", "files", "=", "directory", ".", "listFiles", "(", "new", "FilenameFilter", "(", ")", "{", "public", "boolean", "accept...
This will scan directory for class files, non-recursive. @param directory directory to scan. @throws IOException, NotFoundException
[ "This", "will", "scan", "directory", "for", "class", "files", "non", "-", "recursive", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc-instrumentation/src/main/java/org/javalite/instrumentation/InstrumentationModelFinder.java#L124-L140
115,144
javalite/activejdbc
javalite-common/src/main/java/org/javalite/http/Post.java
Post.param
public Post param(String name, String value){ params.put(name, value); return this; }
java
public Post param(String name, String value){ params.put(name, value); return this; }
[ "public", "Post", "param", "(", "String", "name", ",", "String", "value", ")", "{", "params", ".", "put", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a parameter to the request as in a HTML form. @param name name of parameter @param value value of parameter @return self
[ "Adds", "a", "parameter", "to", "the", "request", "as", "in", "a", "HTML", "form", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/http/Post.java#L112-L115
115,145
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/ScopeBuilder.java
ScopeBuilder.where
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
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;...
[ "public", "<", "T", "extends", "Model", ">", "LazyList", "<", "T", ">", "where", "(", "String", "subquery", ",", "Object", "...", "params", ")", "{", "StringBuilder", "query", ";", "if", "(", "subquery", ".", "equals", "(", "\"*\"", ")", ")", "{", "q...
Applies additional criteria to scopes defined in the model. @param subquery additional criteria. @param params dynamic parameters for the subquery. Similar to {@link Model#where(String, Object...)}. @return a list of records filtered by all supplied scopes as well as additional criteria.
[ "Applies", "additional", "criteria", "to", "scopes", "defined", "in", "the", "model", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/ScopeBuilder.java#L28-L51
115,146
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/Configuration.java
Configuration.getEnvironments
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
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); }
[ "private", "Set", "<", "String", ">", "getEnvironments", "(", "Properties", "props", ")", "{", "Set", "<", "String", ">", "environments", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "Object", "k", ":", "props", ".", "keySet", "(", ")", ")...
get environments defined in properties
[ "get", "environments", "defined", "in", "properties" ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Configuration.java#L207-L214
115,147
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/Configuration.java
Configuration.readPropertyFile
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
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); }
[ "private", "Properties", "readPropertyFile", "(", "String", "file", ")", "throws", "IOException", "{", "String", "fileName", "=", "file", ".", "startsWith", "(", "\"/\"", ")", "?", "file", ":", "\"/\"", "+", "file", ";", "LOGGER", ".", "info", "(", "\"Read...
read from classpath, if not found, read from file system. If not found there, throw exception
[ "read", "from", "classpath", "if", "not", "found", "read", "from", "file", "system", ".", "If", "not", "found", "there", "throw", "exception" ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Configuration.java#L217-L221
115,148
javalite/activejdbc
db-migrator/src/main/java/org/javalite/db_migrator/DbUtils.java
DbUtils.driverClass
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
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)) { ...
[ "public", "static", "String", "driverClass", "(", "String", "url", ")", "{", "assert", "!", "blank", "(", "url", ")", ";", "if", "(", "url", ".", "contains", "(", "POSTGRESQL_FRAGMENT", ")", ")", "{", "return", "\"org.postgresql.Driver\"", ";", "}", "if", ...
Given a jdbc url, this tries to determine the target database and returns the driver class name as a string. @param url jdbc url @return jdbc driver class name
[ "Given", "a", "jdbc", "url", "this", "tries", "to", "determine", "the", "target", "database", "and", "returns", "the", "driver", "class", "name", "as", "a", "string", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/db-migrator/src/main/java/org/javalite/db_migrator/DbUtils.java#L38-L70
115,149
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/ModelRegistry.java
ModelRegistry.convertWith
void convertWith(Converter converter, String... attributes) { for (String attribute : attributes) { convertWith(converter, attribute); } }
java
void convertWith(Converter converter, String... attributes) { for (String attribute : attributes) { convertWith(converter, attribute); } }
[ "void", "convertWith", "(", "Converter", "converter", ",", "String", "...", "attributes", ")", "{", "for", "(", "String", "attribute", ":", "attributes", ")", "{", "convertWith", "(", "converter", ",", "attribute", ")", ";", "}", "}" ]
Registers converter for specified model attributes.
[ "Registers", "converter", "for", "specified", "model", "attributes", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/ModelRegistry.java#L88-L92
115,150
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/ModelRegistry.java
ModelRegistry.convertWith
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
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); }
[ "void", "convertWith", "(", "Converter", "converter", ",", "String", "attribute", ")", "{", "List", "<", "Converter", ">", "list", "=", "attributeConverters", ".", "get", "(", "attribute", ")", ";", "if", "(", "list", "==", "null", ")", "{", "list", "=",...
Registers converter for specified model attribute.
[ "Registers", "converter", "for", "specified", "model", "attribute", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/ModelRegistry.java#L97-L104
115,151
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/ModelRegistry.java
ModelRegistry.converterForClass
<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
<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...
[ "<", "S", ",", "T", ">", "Converter", "<", "S", ",", "T", ">", "converterForClass", "(", "String", "attribute", ",", "Class", "<", "S", ">", "sourceClass", ",", "Class", "<", "T", ">", "destinationClass", ")", "{", "List", "<", "Converter", ">", "lis...
Returns converter for specified model attribute, able to convert from sourceClass to destinationClass. Returns null if no suitable converter was found.
[ "Returns", "converter", "for", "specified", "model", "attribute", "able", "to", "convert", "from", "sourceClass", "to", "destinationClass", ".", "Returns", "null", "if", "no", "suitable", "converter", "was", "found", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/ModelRegistry.java#L110-L120
115,152
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/ModelRegistry.java
ModelRegistry.converterForValue
<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
<T> Converter<Object, T> converterForValue(String attribute, Object value, Class<T> destinationClass) { return converterForClass(attribute, value != null ? (Class<Object>) value.getClass() : Object.class, destinationClass); }
[ "<", "T", ">", "Converter", "<", "Object", ",", "T", ">", "converterForValue", "(", "String", "attribute", ",", "Object", "value", ",", "Class", "<", "T", ">", "destinationClass", ")", "{", "return", "converterForClass", "(", "attribute", ",", "value", "!=...
Returns converter for specified model attribute, able to convert value to an instance of destinationClass. Returns null if no suitable converter was found.
[ "Returns", "converter", "for", "specified", "model", "attribute", "able", "to", "convert", "value", "to", "an", "instance", "of", "destinationClass", ".", "Returns", "null", "if", "no", "suitable", "converter", "was", "found", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/ModelRegistry.java#L126-L129
115,153
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/dialects/MSSQLDialect.java
MSSQLDialect.overrideDriverTypeConversion
@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
@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)) { ...
[ "@", "Override", "public", "Object", "overrideDriverTypeConversion", "(", "MetaModel", "mm", ",", "String", "attributeName", ",", "Object", "value", ")", "{", "if", "(", "value", "instanceof", "String", "&&", "!", "Util", ".", "blank", "(", "value", ")", ")"...
TDS converts a number of important data types to String. This isn't what we want, nor helpful. Here, we change them back.
[ "TDS", "converts", "a", "number", "of", "important", "data", "types", "to", "String", ".", "This", "isn", "t", "what", "we", "want", "nor", "helpful", ".", "Here", "we", "change", "them", "back", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/dialects/MSSQLDialect.java#L102-L113
115,154
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/JsonHelper.java
JsonHelper.toMap
public static Map toMap(String json) { try { return mapper.readValue(json, Map.class); } catch (IOException e) { throw new RuntimeException(e); } }
java
public static Map toMap(String json) { try { return mapper.readValue(json, Map.class); } catch (IOException e) { throw new RuntimeException(e); } }
[ "public", "static", "Map", "toMap", "(", "String", "json", ")", "{", "try", "{", "return", "mapper", ".", "readValue", "(", "json", ",", "Map", ".", "class", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException",...
Convert a JSON map to a Java Map @param json JSON map @return Java Map.
[ "Convert", "a", "JSON", "map", "to", "a", "Java", "Map" ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/JsonHelper.java#L49-L55
115,155
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/JsonHelper.java
JsonHelper.toJsonString
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
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...
[ "public", "static", "String", "toJsonString", "(", "Object", "val", ",", "boolean", "pretty", ")", "{", "try", "{", "return", "pretty", "?", "mapper", ".", "writerWithDefaultPrettyPrinter", "(", ")", ".", "with", "(", "SerializationFeature", ".", "ORDER_MAP_ENTR...
Convert Java object to a JSON string. @param val Java object @param pretty enable/disable pretty print @return JSON string.
[ "Convert", "Java", "object", "to", "a", "JSON", "string", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/JsonHelper.java#L88-L94
115,156
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/JsonHelper.java
JsonHelper.toJsonObject
public static String toJsonObject(Object... namesAndValues) { if (namesAndValues.length % 2 != 0) { throw new IllegalArgumentException("number or arguments must be even"); } StringBuilder sb = new StringBuilder("{"); int count = 0; while (true) { Object...
java
public static String toJsonObject(Object... namesAndValues) { if (namesAndValues.length % 2 != 0) { throw new IllegalArgumentException("number or arguments must be even"); } StringBuilder sb = new StringBuilder("{"); int count = 0; while (true) { Object...
[ "public", "static", "String", "toJsonObject", "(", "Object", "...", "namesAndValues", ")", "{", "if", "(", "namesAndValues", ".", "length", "%", "2", "!=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"number or arguments must be even\"", ")",...
Converts input into a JSON object. @param namesAndValues - expected sequence of corresponding name and value pairs (number of parameters must be even ). @return new string {name:value,name1:value1, etc.}
[ "Converts", "input", "into", "a", "JSON", "object", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/JsonHelper.java#L102-L133
115,157
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/JsonHelper.java
JsonHelper.toList
public static List toList(String json) { try { return mapper.readValue(json, List.class); } catch (IOException e) { throw new RuntimeException(e); } }
java
public static List toList(String json) { try { return mapper.readValue(json, List.class); } catch (IOException e) { throw new RuntimeException(e); } }
[ "public", "static", "List", "toList", "(", "String", "json", ")", "{", "try", "{", "return", "mapper", ".", "readValue", "(", "json", ",", "List", ".", "class", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeExceptio...
Convert JSON array tp Java List @param json JSON array string. @return Java List instance.
[ "Convert", "JSON", "array", "tp", "Java", "List" ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/JsonHelper.java#L142-L148
115,158
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/JsonHelper.java
JsonHelper.sanitize
public static String sanitize(String value, boolean clean, Character... toEscape) { StringBuilder builder = new StringBuilder(); Map<Character, String> replacements = clean ? CLEAN_CHARS : REPLACEMENT_CHARS; for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); ...
java
public static String sanitize(String value, boolean clean, Character... toEscape) { StringBuilder builder = new StringBuilder(); Map<Character, String> replacements = clean ? CLEAN_CHARS : REPLACEMENT_CHARS; for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); ...
[ "public", "static", "String", "sanitize", "(", "String", "value", ",", "boolean", "clean", ",", "Character", "...", "toEscape", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "Map", "<", "Character", ",", "String", ">", "...
Escapes control characters in a string when you need to generate JSON. @param value input string @param clean if true will remove characters that match, if false will escape @param toEscape array of characters to escape. If not provided, it will escape or clean <code>'"','\\', '\t', '\b', '\n', '\r' '\f'</code>....
[ "Escapes", "control", "characters", "in", "a", "string", "when", "you", "need", "to", "generate", "JSON", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/JsonHelper.java#L196-L219
115,159
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Convert.java
Convert.toBoolean
public static Boolean toBoolean(Object value) { if (value == null) { return false; } else if (value instanceof Boolean) { return (Boolean) value; } else if (value instanceof BigDecimal) { return value.equals(BigDecimal.ONE); } else if (value instanceof...
java
public static Boolean toBoolean(Object value) { if (value == null) { return false; } else if (value instanceof Boolean) { return (Boolean) value; } else if (value instanceof BigDecimal) { return value.equals(BigDecimal.ONE); } else if (value instanceof...
[ "public", "static", "Boolean", "toBoolean", "(", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "false", ";", "}", "else", "if", "(", "value", "instanceof", "Boolean", ")", "{", "return", "(", "Boolean", ")", "value"...
Returns true if the value is any numeric type and has a value of 1, or if string type has a value of '1', 't', 'y', 'true' or 'yes'. Otherwise, return false. @param value value to convert @return true if the value is any numeric type and has a value of 1, or if string type has a value of '1', 't', 'y', 'true' or 'yes'...
[ "Returns", "true", "if", "the", "value", "is", "any", "numeric", "type", "and", "has", "a", "value", "of", "1", "or", "if", "string", "type", "has", "a", "value", "of", "1", "t", "y", "true", "or", "yes", ".", "Otherwise", "return", "false", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Convert.java#L110-L128
115,160
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Convert.java
Convert.toFloat
public static Float toFloat(Object value) { if (value == null) { return null; } else if (value instanceof Float) { return (Float) value; } else if (value instanceof Number) { return ((Number) value).floatValue(); } else { return Float.value...
java
public static Float toFloat(Object value) { if (value == null) { return null; } else if (value instanceof Float) { return (Float) value; } else if (value instanceof Number) { return ((Number) value).floatValue(); } else { return Float.value...
[ "public", "static", "Float", "toFloat", "(", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "value", "instanceof", "Float", ")", "{", "return", "(", "Float", ")", "value", ";", ...
Converts value to Float if it can. If value is a Float, it is returned, if it is a Number, it is promoted to Float and then returned, in all other cases, it converts the value to String, then tries to parse Float from it. @param value value to be converted to Float. @return value converted to Float.
[ "Converts", "value", "to", "Float", "if", "it", "can", ".", "If", "value", "is", "a", "Float", "it", "is", "returned", "if", "it", "is", "a", "Number", "it", "is", "promoted", "to", "Float", "and", "then", "returned", "in", "all", "other", "cases", "...
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Convert.java#L326-L336
115,161
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Convert.java
Convert.toInteger
public static Integer toInteger(Object value) { if (value == null) { return null; } else if (value instanceof Integer) { return (Integer) value; } else if (value instanceof Number) { return ((Number) value).intValue(); } else { try { ...
java
public static Integer toInteger(Object value) { if (value == null) { return null; } else if (value instanceof Integer) { return (Integer) value; } else if (value instanceof Number) { return ((Number) value).intValue(); } else { try { ...
[ "public", "static", "Integer", "toInteger", "(", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "value", "instanceof", "Integer", ")", "{", "return", "(", "Integer", ")", "value",...
Converts value to Integer if it can. If value is a Integer, it is returned, if it is a Number, it is promoted to Integer and then returned, in all other cases, it converts the value to String, then tries to parse Integer from it. @param value value to be converted to Integer. @return value converted to Integer.
[ "Converts", "value", "to", "Integer", "if", "it", "can", ".", "If", "value", "is", "a", "Integer", "it", "is", "returned", "if", "it", "is", "a", "Number", "it", "is", "promoted", "to", "Integer", "and", "then", "returned", "in", "all", "other", "cases...
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Convert.java#L373-L387
115,162
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Convert.java
Convert.toBigDecimal
public static BigDecimal toBigDecimal(Object value) { if (value == null) { return null; } else if (value instanceof BigDecimal) { return (BigDecimal) value; } else { try { return new BigDecimal(value.toString().trim()); } catch (Num...
java
public static BigDecimal toBigDecimal(Object value) { if (value == null) { return null; } else if (value instanceof BigDecimal) { return (BigDecimal) value; } else { try { return new BigDecimal(value.toString().trim()); } catch (Num...
[ "public", "static", "BigDecimal", "toBigDecimal", "(", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "value", "instanceof", "BigDecimal", ")", "{", "return", "(", "BigDecimal", ")"...
Converts value to BigDecimal if it can. If value is a BigDecimal, it is returned, if it is a BigDecimal, it is promoted to BigDecimal and then returned, in all other cases, it converts the value to String, then tries to parse BigDecimal from it. @param value value to be converted to Integer. @return value converted to...
[ "Converts", "value", "to", "BigDecimal", "if", "it", "can", ".", "If", "value", "is", "a", "BigDecimal", "it", "is", "returned", "if", "it", "is", "a", "BigDecimal", "it", "is", "promoted", "to", "BigDecimal", "and", "then", "returned", "in", "all", "oth...
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Convert.java#L397-L409
115,163
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/XmlEntities.java
XmlEntities.doUnescape
private void doUnescape(StringBuilder sb, String str, int firstAmp) { sb.append(str, 0, firstAmp); int len = str.length(); for (int i = firstAmp; i < len; i++) { char c = str.charAt(i); if (c == '&') { int nextIdx = i + 1; int semiColonIdx ...
java
private void doUnescape(StringBuilder sb, String str, int firstAmp) { sb.append(str, 0, firstAmp); int len = str.length(); for (int i = firstAmp; i < len; i++) { char c = str.charAt(i); if (c == '&') { int nextIdx = i + 1; int semiColonIdx ...
[ "private", "void", "doUnescape", "(", "StringBuilder", "sb", ",", "String", "str", ",", "int", "firstAmp", ")", "{", "sb", ".", "append", "(", "str", ",", "0", ",", "firstAmp", ")", ";", "int", "len", "=", "str", ".", "length", "(", ")", ";", "for"...
Underlying unescape method that allows the optimisation of not starting from the 0 index again. @param sb The <code>StringBuilder</code> to write the results to; assumed to be non-null. @param str The source <code>String</code> to unescape; assumed to be non-null. @param firstAmp The <code>int</code> index of the firs...
[ "Underlying", "unescape", "method", "that", "allows", "the", "optimisation", "of", "not", "starting", "from", "the", "0", "index", "again", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/XmlEntities.java#L612-L673
115,164
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Util.java
Util.readResourceBytes
public static byte[] readResourceBytes(String resourceName) { InputStream is = Util.class.getResourceAsStream(resourceName); try { return bytes(is); } catch (IOException e) { throw new RuntimeException(e); } finally { closeQuietly(is); } }
java
public static byte[] readResourceBytes(String resourceName) { InputStream is = Util.class.getResourceAsStream(resourceName); try { return bytes(is); } catch (IOException e) { throw new RuntimeException(e); } finally { closeQuietly(is); } }
[ "public", "static", "byte", "[", "]", "readResourceBytes", "(", "String", "resourceName", ")", "{", "InputStream", "is", "=", "Util", ".", "class", ".", "getResourceAsStream", "(", "resourceName", ")", ";", "try", "{", "return", "bytes", "(", "is", ")", ";...
Reads contents of resource fully into a byte array. @param resourceName resource name. @return entire contents of resource as byte array.
[ "Reads", "contents", "of", "resource", "fully", "into", "a", "byte", "array", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Util.java#L39-L48
115,165
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Util.java
Util.readResource
public static String readResource(String resourceName, String charset) { InputStream is = Util.class.getResourceAsStream(resourceName); try { return read(is, charset); } catch (IOException e) { throw new RuntimeException(e); } finally { closeQuietly(is...
java
public static String readResource(String resourceName, String charset) { InputStream is = Util.class.getResourceAsStream(resourceName); try { return read(is, charset); } catch (IOException e) { throw new RuntimeException(e); } finally { closeQuietly(is...
[ "public", "static", "String", "readResource", "(", "String", "resourceName", ",", "String", "charset", ")", "{", "InputStream", "is", "=", "Util", ".", "class", ".", "getResourceAsStream", "(", "resourceName", ")", ";", "try", "{", "return", "read", "(", "is...
Reads contents of resource fully into a string. @param resourceName resource name. @param charset name of supported charset @return entire contents of resource as string.
[ "Reads", "contents", "of", "resource", "fully", "into", "a", "string", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Util.java#L67-L76
115,166
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Util.java
Util.readFile
public static String readFile(String fileName, String charset) { FileInputStream in = null; try { in = new FileInputStream(fileName); return read(in, charset); } catch (IOException e) { throw new RuntimeException(e); } finally { closeQuietl...
java
public static String readFile(String fileName, String charset) { FileInputStream in = null; try { in = new FileInputStream(fileName); return read(in, charset); } catch (IOException e) { throw new RuntimeException(e); } finally { closeQuietl...
[ "public", "static", "String", "readFile", "(", "String", "fileName", ",", "String", "charset", ")", "{", "FileInputStream", "in", "=", "null", ";", "try", "{", "in", "=", "new", "FileInputStream", "(", "fileName", ")", ";", "return", "read", "(", "in", "...
Reads contents of file fully and returns as string. @param fileName file name. @param charset name of supported charset. @return contents of entire file.
[ "Reads", "contents", "of", "file", "fully", "and", "returns", "as", "string", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Util.java#L95-L105
115,167
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Util.java
Util.read
public static String read(InputStream in, String charset) throws IOException { if (in == null) { throw new IllegalArgumentException("input stream cannot be null"); } InputStreamReader reader = null; try { reader = new InputStreamReader(in, charset); ch...
java
public static String read(InputStream in, String charset) throws IOException { if (in == null) { throw new IllegalArgumentException("input stream cannot be null"); } InputStreamReader reader = null; try { reader = new InputStreamReader(in, charset); ch...
[ "public", "static", "String", "read", "(", "InputStream", "in", ",", "String", "charset", ")", "throws", "IOException", "{", "if", "(", "in", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"input stream cannot be null\"", ")", ";", ...
Reads contents of the input stream fully and returns it as String. @param in InputStream to read from. @param charset name of supported charset to use @return contents of the input stream fully as String. @throws IOException in case of IO error
[ "Reads", "contents", "of", "the", "input", "stream", "fully", "and", "returns", "it", "as", "String", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Util.java#L156-L173
115,168
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Util.java
Util.read
public static byte[] read(File file) throws IOException { FileInputStream is = new FileInputStream(file); try { return bytes(is); } finally { closeQuietly(is); } }
java
public static byte[] read(File file) throws IOException { FileInputStream is = new FileInputStream(file); try { return bytes(is); } finally { closeQuietly(is); } }
[ "public", "static", "byte", "[", "]", "read", "(", "File", "file", ")", "throws", "IOException", "{", "FileInputStream", "is", "=", "new", "FileInputStream", "(", "file", ")", ";", "try", "{", "return", "bytes", "(", "is", ")", ";", "}", "finally", "{"...
Reads file into a byte array. @param file file to read. @return content of file. @throws java.io.IOException
[ "Reads", "file", "into", "a", "byte", "array", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Util.java#L208-L215
115,169
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Util.java
Util.getResourceLines
public static List<String> getResourceLines(String resourceName) throws IOException { InputStreamReader isreader = null; BufferedReader reader = null; try { isreader = new InputStreamReader(Util.class.getResourceAsStream(resourceName)); reader = new BufferedReader(isreade...
java
public static List<String> getResourceLines(String resourceName) throws IOException { InputStreamReader isreader = null; BufferedReader reader = null; try { isreader = new InputStreamReader(Util.class.getResourceAsStream(resourceName)); reader = new BufferedReader(isreade...
[ "public", "static", "List", "<", "String", ">", "getResourceLines", "(", "String", "resourceName", ")", "throws", "IOException", "{", "InputStreamReader", "isreader", "=", "null", ";", "BufferedReader", "reader", "=", "null", ";", "try", "{", "isreader", "=", ...
Returns lines of text of a resource as list. @param resourceName name of resource @return list of text lines @throws java.io.IOException in case of IO error
[ "Returns", "lines", "of", "text", "of", "a", "resource", "as", "list", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Util.java#L224-L240
115,170
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Util.java
Util.join
public static String join(String[] array, String delimiter) { if (empty(array)) { return ""; } StringBuilder sb = new StringBuilder(); join(sb, array, delimiter); return sb.toString(); }
java
public static String join(String[] array, String delimiter) { if (empty(array)) { return ""; } StringBuilder sb = new StringBuilder(); join(sb, array, delimiter); return sb.toString(); }
[ "public", "static", "String", "join", "(", "String", "[", "]", "array", ",", "String", "delimiter", ")", "{", "if", "(", "empty", "(", "array", ")", ")", "{", "return", "\"\"", ";", "}", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", "...
Joins the items in array with a delimiter. @param array array of items to join. @param delimiter delimiter to insert between elements of array. @return string with array elements separated by delimiter. There is no trailing delimiter in the string.
[ "Joins", "the", "items", "in", "array", "with", "a", "delimiter", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Util.java#L279-L284
115,171
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Util.java
Util.join
public static void join(StringBuilder sb, Collection<?> collection, String delimiter) { if (collection.isEmpty()) { return; } Iterator<?> it = collection.iterator(); sb.append(it.next()); while (it.hasNext()) { sb.append(delimiter); sb.append(it.next()); }...
java
public static void join(StringBuilder sb, Collection<?> collection, String delimiter) { if (collection.isEmpty()) { return; } Iterator<?> it = collection.iterator(); sb.append(it.next()); while (it.hasNext()) { sb.append(delimiter); sb.append(it.next()); }...
[ "public", "static", "void", "join", "(", "StringBuilder", "sb", ",", "Collection", "<", "?", ">", "collection", ",", "String", "delimiter", ")", "{", "if", "(", "collection", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "Iterator", "<", "?",...
Joins the items in collection with a delimiter, and appends the result to StringBuilder. @param sb StringBuilder to append result to @param collection collection of items to join. @param delimiter delimiter to insert between elements of collection.
[ "Joins", "the", "items", "in", "collection", "with", "a", "delimiter", "and", "appends", "the", "result", "to", "StringBuilder", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Util.java#L338-L346
115,172
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Util.java
Util.join
public static void join(StringBuilder sb, Object[] array, String delimiter) { if (empty(array)) { return; } sb.append(array[0]); for (int i = 1; i < array.length; i++) { sb.append(delimiter); sb.append(array[i]); } }
java
public static void join(StringBuilder sb, Object[] array, String delimiter) { if (empty(array)) { return; } sb.append(array[0]); for (int i = 1; i < array.length; i++) { sb.append(delimiter); sb.append(array[i]); } }
[ "public", "static", "void", "join", "(", "StringBuilder", "sb", ",", "Object", "[", "]", "array", ",", "String", "delimiter", ")", "{", "if", "(", "empty", "(", "array", ")", ")", "{", "return", ";", "}", "sb", ".", "append", "(", "array", "[", "0"...
Joins the items in array with a delimiter, and appends the result to StringBuilder. @param sb StringBuilder to append result to @param array array of items to join. @param delimiter delimiter to insert between elements of array.
[ "Joins", "the", "items", "in", "array", "with", "a", "delimiter", "and", "appends", "the", "result", "to", "StringBuilder", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Util.java#L355-L362
115,173
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Util.java
Util.repeat
public static void repeat(StringBuilder sb, String str, int count) { for (int i = 0; i < count; i++) { sb.append(str); } }
java
public static void repeat(StringBuilder sb, String str, int count) { for (int i = 0; i < count; i++) { sb.append(str); } }
[ "public", "static", "void", "repeat", "(", "StringBuilder", "sb", ",", "String", "str", ",", "int", "count", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "sb", ".", "append", "(", "str", ")", ";"...
Repeats string of characters a defined number of times, and appends result to StringBuilder. @param sb StringBuilder to append result to @param str string of characters to be repeated. @param count number of times to repeat, zero or a negative number produces no result
[ "Repeats", "string", "of", "characters", "a", "defined", "number", "of", "times", "and", "appends", "result", "to", "StringBuilder", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Util.java#L371-L375
115,174
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Util.java
Util.joinAndRepeat
public static void joinAndRepeat(StringBuilder sb, String str, String delimiter, int count) { if (count > 0) { sb.append(str); for (int i = 1; i < count; i++) { sb.append(delimiter); sb.append(str); } } }
java
public static void joinAndRepeat(StringBuilder sb, String str, String delimiter, int count) { if (count > 0) { sb.append(str); for (int i = 1; i < count; i++) { sb.append(delimiter); sb.append(str); } } }
[ "public", "static", "void", "joinAndRepeat", "(", "StringBuilder", "sb", ",", "String", "str", ",", "String", "delimiter", ",", "int", "count", ")", "{", "if", "(", "count", ">", "0", ")", "{", "sb", ".", "append", "(", "str", ")", ";", "for", "(", ...
Repeats string of characters a defined number of times with a delimiter, and appends result to StringBuilder. <p>For example, <tt>joinAndRepeat(sb, "?", ",", 3)</tt> will append <tt>"?,?,?"</tt> to <tt>sb</tt>. @param sb StringBuilder to append result to @param str string of characters to be repeated. @param delimite...
[ "Repeats", "string", "of", "characters", "a", "defined", "number", "of", "times", "with", "a", "delimiter", "and", "appends", "result", "to", "StringBuilder", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Util.java#L387-L395
115,175
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Util.java
Util.getStackTraceString
public static String getStackTraceString(Throwable throwable) { StringWriter sw = null; PrintWriter pw = null; try { sw = new StringWriter(); pw = new PrintWriter(sw); pw.println(throwable.toString()); throwable.printStackTrace(pw); pw....
java
public static String getStackTraceString(Throwable throwable) { StringWriter sw = null; PrintWriter pw = null; try { sw = new StringWriter(); pw = new PrintWriter(sw); pw.println(throwable.toString()); throwable.printStackTrace(pw); pw....
[ "public", "static", "String", "getStackTraceString", "(", "Throwable", "throwable", ")", "{", "StringWriter", "sw", "=", "null", ";", "PrintWriter", "pw", "=", "null", ";", "try", "{", "sw", "=", "new", "StringWriter", "(", ")", ";", "pw", "=", "new", "P...
Converts stack trace to string. @param throwable - throwable to convert. @return message and stack trace converted to string.
[ "Converts", "stack", "trace", "to", "string", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Util.java#L434-L448
115,176
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Util.java
Util.saveTo
public static void saveTo(String path, byte[] content) { InputStream is = null; try { is = new ByteArrayInputStream(content); saveTo(path, is); } finally { closeQuietly(is); } }
java
public static void saveTo(String path, byte[] content) { InputStream is = null; try { is = new ByteArrayInputStream(content); saveTo(path, is); } finally { closeQuietly(is); } }
[ "public", "static", "void", "saveTo", "(", "String", "path", ",", "byte", "[", "]", "content", ")", "{", "InputStream", "is", "=", "null", ";", "try", "{", "is", "=", "new", "ByteArrayInputStream", "(", "content", ")", ";", "saveTo", "(", "path", ",", ...
Saves content of byte array to file. @param path path to file - can be absolute or relative to current. @param content bytes to save.
[ "Saves", "content", "of", "byte", "array", "to", "file", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Util.java#L456-L464
115,177
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Util.java
Util.recursiveDelete
public static void recursiveDelete(Path directory) throws IOException { try { Files.walkFileTree(directory, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws java.io.IOException { ...
java
public static void recursiveDelete(Path directory) throws IOException { try { Files.walkFileTree(directory, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws java.io.IOException { ...
[ "public", "static", "void", "recursiveDelete", "(", "Path", "directory", ")", "throws", "IOException", "{", "try", "{", "Files", ".", "walkFileTree", "(", "directory", ",", "new", "SimpleFileVisitor", "<", "Path", ">", "(", ")", "{", "@", "Override", "public...
Deletes a directory recursively with all its contents. Will ignore files and directories if they are disappear during the oprtation. @param directory directory to delete.
[ "Deletes", "a", "directory", "recursively", "with", "all", "its", "contents", ".", "Will", "ignore", "files", "and", "directories", "if", "they", "are", "disappear", "during", "the", "oprtation", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Util.java#L547-L569
115,178
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/MetaModels.java
MetaModels.getEdges
protected List<String> getEdges(String join) { List<String> results = new ArrayList<>(); for (Many2ManyAssociation a : many2ManyAssociations) { if (a.getJoin().equalsIgnoreCase(join)) { results.add(getMetaModel(a.getSourceClass()).getTableName()); results.add(...
java
protected List<String> getEdges(String join) { List<String> results = new ArrayList<>(); for (Many2ManyAssociation a : many2ManyAssociations) { if (a.getJoin().equalsIgnoreCase(join)) { results.add(getMetaModel(a.getSourceClass()).getTableName()); results.add(...
[ "protected", "List", "<", "String", ">", "getEdges", "(", "String", "join", ")", "{", "List", "<", "String", ">", "results", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Many2ManyAssociation", "a", ":", "many2ManyAssociations", ")", "{", "i...
An edge is a table in a many to many relationship that is not a join. @param join join table @return edges for a join.
[ "An", "edge", "is", "a", "table", "in", "a", "many", "to", "many", "relationship", "that", "is", "not", "a", "join", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/MetaModels.java#L109-L118
115,179
javalite/activejdbc
db-migrator/src/main/java/org/javalite/db_migrator/MigrationManager.java
MigrationManager.getPendingMigrations
public List<Migration> getPendingMigrations() { List<String> appliedMigrations = getAppliedMigrationVersions(); List<Migration> allMigrations = migrationResolver.resolve(); List<Migration> pendingMigrations = new ArrayList<Migration>(); for (Migration migration : allMigrations) { ...
java
public List<Migration> getPendingMigrations() { List<String> appliedMigrations = getAppliedMigrationVersions(); List<Migration> allMigrations = migrationResolver.resolve(); List<Migration> pendingMigrations = new ArrayList<Migration>(); for (Migration migration : allMigrations) { ...
[ "public", "List", "<", "Migration", ">", "getPendingMigrations", "(", ")", "{", "List", "<", "String", ">", "appliedMigrations", "=", "getAppliedMigrationVersions", "(", ")", ";", "List", "<", "Migration", ">", "allMigrations", "=", "migrationResolver", ".", "re...
Returns pending migrations. @return a sorted set of pending migrations
[ "Returns", "pending", "migrations", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/db-migrator/src/main/java/org/javalite/db_migrator/MigrationManager.java#L39-L50
115,180
javalite/activejdbc
db-migrator/src/main/java/org/javalite/db_migrator/MigrationManager.java
MigrationManager.migrate
public void migrate(Log log, String encoding) { createSchemaVersionTable(); final Collection<Migration> pendingMigrations = getPendingMigrations(); if (pendingMigrations.isEmpty()) { log.info("No new migrations are found"); return; } log.info("Migrating...
java
public void migrate(Log log, String encoding) { createSchemaVersionTable(); final Collection<Migration> pendingMigrations = getPendingMigrations(); if (pendingMigrations.isEmpty()) { log.info("No new migrations are found"); return; } log.info("Migrating...
[ "public", "void", "migrate", "(", "Log", "log", ",", "String", "encoding", ")", "{", "createSchemaVersionTable", "(", ")", ";", "final", "Collection", "<", "Migration", ">", "pendingMigrations", "=", "getPendingMigrations", "(", ")", ";", "if", "(", "pendingMi...
Migrates the database to the latest version, enabling migrations if necessary.
[ "Migrates", "the", "database", "to", "the", "latest", "version", "enabling", "migrations", "if", "necessary", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/db-migrator/src/main/java/org/javalite/db_migrator/MigrationManager.java#L55-L85
115,181
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Escape.java
Escape.html
public static void html(StringBuilder sb, String html) { for (int i = 0; i < html.length(); i++) { char c = html.charAt(i); switch (c) { case '&': sb.append("&amp;"); break; case '"': sb.append("&quot;"); ...
java
public static void html(StringBuilder sb, String html) { for (int i = 0; i < html.length(); i++) { char c = html.charAt(i); switch (c) { case '&': sb.append("&amp;"); break; case '"': sb.append("&quot;"); ...
[ "public", "static", "void", "html", "(", "StringBuilder", "sb", ",", "String", "html", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "html", ".", "length", "(", ")", ";", "i", "++", ")", "{", "char", "c", "=", "html", ".", "charAt"...
Escapes HTML appending to StringBuilder. @param sb StringBuilder to append to @param html input
[ "Escapes", "HTML", "appending", "to", "StringBuilder", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Escape.java#L22-L45
115,182
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Escape.java
Escape.html
public static String html(String html) { StringBuilder sb = createStringBuilder(html.length()); html(sb, html); return sb.toString(); }
java
public static String html(String html) { StringBuilder sb = createStringBuilder(html.length()); html(sb, html); return sb.toString(); }
[ "public", "static", "String", "html", "(", "String", "html", ")", "{", "StringBuilder", "sb", "=", "createStringBuilder", "(", "html", ".", "length", "(", ")", ")", ";", "html", "(", "sb", ",", "html", ")", ";", "return", "sb", ".", "toString", "(", ...
Escapes HTML. @param html input @return escaped HTML
[ "Escapes", "HTML", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Escape.java#L53-L57
115,183
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Inflector.java
Inflector.gsub
public static String gsub(String word, String rule, String replacement) { Pattern pattern = Pattern.compile(rule, Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(word); return matcher.find() ? matcher.replaceFirst(replacement) : null; }
java
public static String gsub(String word, String rule, String replacement) { Pattern pattern = Pattern.compile(rule, Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(word); return matcher.find() ? matcher.replaceFirst(replacement) : null; }
[ "public", "static", "String", "gsub", "(", "String", "word", ",", "String", "rule", ",", "String", "replacement", ")", "{", "Pattern", "pattern", "=", "Pattern", ".", "compile", "(", "rule", ",", "Pattern", ".", "CASE_INSENSITIVE", ")", ";", "Matcher", "ma...
Replaces a found pattern in a word and returns a transformed word. @param word @param rule @param replacement @return Replaces a found pattern in a word and returns a transformed word. Null is pattern does not match.
[ "Replaces", "a", "found", "pattern", "in", "a", "word", "and", "returns", "a", "transformed", "word", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Inflector.java#L119-L123
115,184
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/Paginator.java
Paginator.setCurrentPageIndex
public void setCurrentPageIndex(int currentPageIndex, boolean skipCheck){ if( currentPageIndex < 1){ throw new IndexOutOfBoundsException("currentPageIndex cannot be < 1"); } if(!skipCheck){ if(currentPageIndex > pageCount()){ throw new IndexOutOfBoundsEx...
java
public void setCurrentPageIndex(int currentPageIndex, boolean skipCheck){ if( currentPageIndex < 1){ throw new IndexOutOfBoundsException("currentPageIndex cannot be < 1"); } if(!skipCheck){ if(currentPageIndex > pageCount()){ throw new IndexOutOfBoundsEx...
[ "public", "void", "setCurrentPageIndex", "(", "int", "currentPageIndex", ",", "boolean", "skipCheck", ")", "{", "if", "(", "currentPageIndex", "<", "1", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"currentPageIndex cannot be < 1\"", ")", ";", "}", ...
Sets an index of a current page. This method will make a quick count query to check that the index you are setting is within the boundaries. @param currentPageIndex index of a current page. @param skipCheck <code>true</code> to skip the upper boundary check (will not make a call to DB).
[ "Sets", "an", "index", "of", "a", "current", "page", ".", "This", "method", "will", "make", "a", "quick", "count", "query", "to", "check", "that", "the", "index", "you", "are", "setting", "is", "within", "the", "boundaries", "." ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Paginator.java#L398-L409
115,185
javalite/activejdbc
activejdbc-instrumentation/src/main/java/org/javalite/instrumentation/ActiveJdbcInstrumentationPlugin.java
ActiveJdbcInstrumentationPlugin.addCP
private void addCP() throws DependencyResolutionRequiredException, MalformedURLException, InvocationTargetException, NoSuchMethodException, IllegalAccessException { List runtimeClasspathElements = project.getRuntimeClasspathElements(); for (Object runtimeClasspathElement : runtimeClasspathElements) { ...
java
private void addCP() throws DependencyResolutionRequiredException, MalformedURLException, InvocationTargetException, NoSuchMethodException, IllegalAccessException { List runtimeClasspathElements = project.getRuntimeClasspathElements(); for (Object runtimeClasspathElement : runtimeClasspathElements) { ...
[ "private", "void", "addCP", "(", ")", "throws", "DependencyResolutionRequiredException", ",", "MalformedURLException", ",", "InvocationTargetException", ",", "NoSuchMethodException", ",", "IllegalAccessException", "{", "List", "runtimeClasspathElements", "=", "project", ".", ...
man, what a hack!
[ "man", "what", "a", "hack!" ]
ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc-instrumentation/src/main/java/org/javalite/instrumentation/ActiveJdbcInstrumentationPlugin.java#L128-L135
115,186
SeunMatt/mysql-backup4j
src/main/java/com/smattme/MysqlImportService.java
MysqlImportService.assertValidParams
private boolean assertValidParams() { return username != null && !this.username.isEmpty() && password != null && !this.password.isEmpty() && sqlString != null && !this.sqlString.isEmpty() && ( (database != null && !this.database.isEmpty()) || (jdbcConnString != null &...
java
private boolean assertValidParams() { return username != null && !this.username.isEmpty() && password != null && !this.password.isEmpty() && sqlString != null && !this.sqlString.isEmpty() && ( (database != null && !this.database.isEmpty()) || (jdbcConnString != null &...
[ "private", "boolean", "assertValidParams", "(", ")", "{", "return", "username", "!=", "null", "&&", "!", "this", ".", "username", ".", "isEmpty", "(", ")", "&&", "password", "!=", "null", "&&", "!", "this", ".", "password", ".", "isEmpty", "(", ")", "&...
This function will check that required parameters are set @return bool
[ "This", "function", "will", "check", "that", "required", "parameters", "are", "set" ]
7e31aac33fe63948d4ad64a053394759457da636
https://github.com/SeunMatt/mysql-backup4j/blob/7e31aac33fe63948d4ad64a053394759457da636/src/main/java/com/smattme/MysqlImportService.java#L145-L150
115,187
SeunMatt/mysql-backup4j
src/main/java/com/smattme/MysqlBaseService.java
MysqlBaseService.connectWithURL
static Connection connectWithURL(String username, String password, String jdbcURL, String driverName) throws ClassNotFoundException, SQLException { String driver = (Objects.isNull(driverName) || driverName.isEmpty()) ? "com.mysql.cj.jdbc.Driver" : driverName; return doConnect(driver, jdbcURL, username...
java
static Connection connectWithURL(String username, String password, String jdbcURL, String driverName) throws ClassNotFoundException, SQLException { String driver = (Objects.isNull(driverName) || driverName.isEmpty()) ? "com.mysql.cj.jdbc.Driver" : driverName; return doConnect(driver, jdbcURL, username...
[ "static", "Connection", "connectWithURL", "(", "String", "username", ",", "String", "password", ",", "String", "jdbcURL", ",", "String", "driverName", ")", "throws", "ClassNotFoundException", ",", "SQLException", "{", "String", "driver", "=", "(", "Objects", ".", ...
This is a utility function that allows connecting to a database instance identified by the provided jdbcURL The connector driver name can be empty @param username database username @param password database password @param jdbcURL the user supplied JDBC URL. It's used as is. So ensure you supply the right parameters @pa...
[ "This", "is", "a", "utility", "function", "that", "allows", "connecting", "to", "a", "database", "instance", "identified", "by", "the", "provided", "jdbcURL", "The", "connector", "driver", "name", "can", "be", "empty" ]
7e31aac33fe63948d4ad64a053394759457da636
https://github.com/SeunMatt/mysql-backup4j/blob/7e31aac33fe63948d4ad64a053394759457da636/src/main/java/com/smattme/MysqlBaseService.java#L53-L56
115,188
SeunMatt/mysql-backup4j
src/main/java/com/smattme/MysqlBaseService.java
MysqlBaseService.doConnect
private static Connection doConnect(String driver, String url, String username, String password) throws SQLException, ClassNotFoundException { Class.forName(driver); Connection connection = DriverManager.getConnection(url, username, password); logger.debug("DB Connected Successfully"); ...
java
private static Connection doConnect(String driver, String url, String username, String password) throws SQLException, ClassNotFoundException { Class.forName(driver); Connection connection = DriverManager.getConnection(url, username, password); logger.debug("DB Connected Successfully"); ...
[ "private", "static", "Connection", "doConnect", "(", "String", "driver", ",", "String", "url", ",", "String", "username", ",", "String", "password", ")", "throws", "SQLException", ",", "ClassNotFoundException", "{", "Class", ".", "forName", "(", "driver", ")", ...
This will attempt to connect to a database using the provided parameters. On success it'll return the java.sql.Connection object @param driver the class name for the mysql driver to use @param url the url of the database @param username database username @param password database password @return Connection @throws SQLE...
[ "This", "will", "attempt", "to", "connect", "to", "a", "database", "using", "the", "provided", "parameters", ".", "On", "success", "it", "ll", "return", "the", "java", ".", "sql", ".", "Connection", "object" ]
7e31aac33fe63948d4ad64a053394759457da636
https://github.com/SeunMatt/mysql-backup4j/blob/7e31aac33fe63948d4ad64a053394759457da636/src/main/java/com/smattme/MysqlBaseService.java#L70-L75
115,189
SeunMatt/mysql-backup4j
src/main/java/com/smattme/MysqlBaseService.java
MysqlBaseService.getAllTables
static List<String> getAllTables(String database, Statement stmt) throws SQLException { List<String> table = new ArrayList<>(); ResultSet rs; rs = stmt.executeQuery("SHOW TABLE STATUS FROM `" + database + "`;"); while ( rs.next() ) { table.add(rs.getString("Name")); ...
java
static List<String> getAllTables(String database, Statement stmt) throws SQLException { List<String> table = new ArrayList<>(); ResultSet rs; rs = stmt.executeQuery("SHOW TABLE STATUS FROM `" + database + "`;"); while ( rs.next() ) { table.add(rs.getString("Name")); ...
[ "static", "List", "<", "String", ">", "getAllTables", "(", "String", "database", ",", "Statement", "stmt", ")", "throws", "SQLException", "{", "List", "<", "String", ">", "table", "=", "new", "ArrayList", "<>", "(", ")", ";", "ResultSet", "rs", ";", "rs"...
This is a utility function to get the names of all the tables that're in the database supplied @param database the database name @param stmt Statement object @return List\<String\> @throws SQLException exception
[ "This", "is", "a", "utility", "function", "to", "get", "the", "names", "of", "all", "the", "tables", "that", "re", "in", "the", "database", "supplied" ]
7e31aac33fe63948d4ad64a053394759457da636
https://github.com/SeunMatt/mysql-backup4j/blob/7e31aac33fe63948d4ad64a053394759457da636/src/main/java/com/smattme/MysqlBaseService.java#L86-L94
115,190
SeunMatt/mysql-backup4j
src/main/java/com/smattme/MysqlBaseService.java
MysqlBaseService.getEmptyTableSQL
static String getEmptyTableSQL(String database, String table) { String safeDeleteSQL = "SELECT IF( \n" + "(SELECT COUNT(1) as table_exists FROM information_schema.tables \n" + "WHERE table_schema='" + database + "' AND table_name='" + table + "') > 1, \n" + ...
java
static String getEmptyTableSQL(String database, String table) { String safeDeleteSQL = "SELECT IF( \n" + "(SELECT COUNT(1) as table_exists FROM information_schema.tables \n" + "WHERE table_schema='" + database + "' AND table_name='" + table + "') > 1, \n" + ...
[ "static", "String", "getEmptyTableSQL", "(", "String", "database", ",", "String", "table", ")", "{", "String", "safeDeleteSQL", "=", "\"SELECT IF( \\n\"", "+", "\"(SELECT COUNT(1) as table_exists FROM information_schema.tables \\n\"", "+", "\"WHERE table_schema='\"", "+", "da...
This function is an helper function that'll generate a DELETE FROM database.table SQL to clear existing table @param database database @param table table @return String sql to delete the all records from the table
[ "This", "function", "is", "an", "helper", "function", "that", "ll", "generate", "a", "DELETE", "FROM", "database", ".", "table", "SQL", "to", "clear", "existing", "table" ]
7e31aac33fe63948d4ad64a053394759457da636
https://github.com/SeunMatt/mysql-backup4j/blob/7e31aac33fe63948d4ad64a053394759457da636/src/main/java/com/smattme/MysqlBaseService.java#L104-L116
115,191
SeunMatt/mysql-backup4j
src/main/java/com/smattme/MysqlExportService.java
MysqlExportService.isValidateProperties
private boolean isValidateProperties() { return properties != null && properties.containsKey(DB_USERNAME) && properties.containsKey(DB_PASSWORD) && (properties.containsKey(DB_NAME) || properties.containsKey(JDBC_CONNECTION_STRING)); }
java
private boolean isValidateProperties() { return properties != null && properties.containsKey(DB_USERNAME) && properties.containsKey(DB_PASSWORD) && (properties.containsKey(DB_NAME) || properties.containsKey(JDBC_CONNECTION_STRING)); }
[ "private", "boolean", "isValidateProperties", "(", ")", "{", "return", "properties", "!=", "null", "&&", "properties", ".", "containsKey", "(", "DB_USERNAME", ")", "&&", "properties", ".", "containsKey", "(", "DB_PASSWORD", ")", "&&", "(", "properties", ".", "...
This function will check if the required minimum properties are set for database connection and exporting @return bool
[ "This", "function", "will", "check", "if", "the", "required", "minimum", "properties", "are", "set", "for", "database", "connection", "and", "exporting" ]
7e31aac33fe63948d4ad64a053394759457da636
https://github.com/SeunMatt/mysql-backup4j/blob/7e31aac33fe63948d4ad64a053394759457da636/src/main/java/com/smattme/MysqlExportService.java#L80-L85
115,192
SeunMatt/mysql-backup4j
src/main/java/com/smattme/MysqlExportService.java
MysqlExportService.isEmailPropertiesSet
private boolean isEmailPropertiesSet() { return properties != null && properties.containsKey(EMAIL_HOST) && properties.containsKey(EMAIL_PORT) && properties.containsKey(EMAIL_USERNAME) && properties.containsKey(EMAIL_PASSWORD) && ...
java
private boolean isEmailPropertiesSet() { return properties != null && properties.containsKey(EMAIL_HOST) && properties.containsKey(EMAIL_PORT) && properties.containsKey(EMAIL_USERNAME) && properties.containsKey(EMAIL_PASSWORD) && ...
[ "private", "boolean", "isEmailPropertiesSet", "(", ")", "{", "return", "properties", "!=", "null", "&&", "properties", ".", "containsKey", "(", "EMAIL_HOST", ")", "&&", "properties", ".", "containsKey", "(", "EMAIL_PORT", ")", "&&", "properties", ".", "containsK...
This function will check if all the minimum required email properties are set, that can facilitate sending of exported sql to email @return bool
[ "This", "function", "will", "check", "if", "all", "the", "minimum", "required", "email", "properties", "are", "set", "that", "can", "facilitate", "sending", "of", "exported", "sql", "to", "email" ]
7e31aac33fe63948d4ad64a053394759457da636
https://github.com/SeunMatt/mysql-backup4j/blob/7e31aac33fe63948d4ad64a053394759457da636/src/main/java/com/smattme/MysqlExportService.java#L94-L102
115,193
SeunMatt/mysql-backup4j
src/main/java/com/smattme/MysqlExportService.java
MysqlExportService.getTableInsertStatement
private String getTableInsertStatement(String table) throws SQLException { StringBuilder sql = new StringBuilder(); ResultSet rs; boolean addIfNotExists = Boolean.parseBoolean(properties.containsKey(ADD_IF_NOT_EXISTS) ? properties.getProperty(ADD_IF_NOT_EXISTS, "true") : "true"); ...
java
private String getTableInsertStatement(String table) throws SQLException { StringBuilder sql = new StringBuilder(); ResultSet rs; boolean addIfNotExists = Boolean.parseBoolean(properties.containsKey(ADD_IF_NOT_EXISTS) ? properties.getProperty(ADD_IF_NOT_EXISTS, "true") : "true"); ...
[ "private", "String", "getTableInsertStatement", "(", "String", "table", ")", "throws", "SQLException", "{", "StringBuilder", "sql", "=", "new", "StringBuilder", "(", ")", ";", "ResultSet", "rs", ";", "boolean", "addIfNotExists", "=", "Boolean", ".", "parseBoolean"...
This will generate the SQL statement for creating the table supplied in the method signature @param table the table concerned @return String @throws SQLException exception
[ "This", "will", "generate", "the", "SQL", "statement", "for", "creating", "the", "table", "supplied", "in", "the", "method", "signature" ]
7e31aac33fe63948d4ad64a053394759457da636
https://github.com/SeunMatt/mysql-backup4j/blob/7e31aac33fe63948d4ad64a053394759457da636/src/main/java/com/smattme/MysqlExportService.java#L124-L153
115,194
SeunMatt/mysql-backup4j
src/main/java/com/smattme/MysqlExportService.java
MysqlExportService.clearTempFiles
public void clearTempFiles(boolean preserveZipFile) { //delete the temp sql file File sqlFile = new File(dirName + "/sql/" + sqlFileName); if(sqlFile.exists()) { boolean res = sqlFile.delete(); logger.debug(LOG_PREFIX + ": " + sqlFile.getAbsolutePath() + " deleted ...
java
public void clearTempFiles(boolean preserveZipFile) { //delete the temp sql file File sqlFile = new File(dirName + "/sql/" + sqlFileName); if(sqlFile.exists()) { boolean res = sqlFile.delete(); logger.debug(LOG_PREFIX + ": " + sqlFile.getAbsolutePath() + " deleted ...
[ "public", "void", "clearTempFiles", "(", "boolean", "preserveZipFile", ")", "{", "//delete the temp sql file\r", "File", "sqlFile", "=", "new", "File", "(", "dirName", "+", "\"/sql/\"", "+", "sqlFileName", ")", ";", "if", "(", "sqlFile", ".", "exists", "(", ")...
This function will delete all the temp files generated ny the library unless it's otherwise instructed not to do so by the preserveZipFile variable @param preserveZipFile bool
[ "This", "function", "will", "delete", "all", "the", "temp", "files", "generated", "ny", "the", "library", "unless", "it", "s", "otherwise", "instructed", "not", "to", "do", "so", "by", "the", "preserveZipFile", "variable" ]
7e31aac33fe63948d4ad64a053394759457da636
https://github.com/SeunMatt/mysql-backup4j/blob/7e31aac33fe63948d4ad64a053394759457da636/src/main/java/com/smattme/MysqlExportService.java#L414-L459
115,195
SeunMatt/mysql-backup4j
src/main/java/com/smattme/MysqlExportService.java
MysqlExportService.getSqlFilename
public String getSqlFilename(){ return isSqlFileNamePropertySet() ? properties.getProperty(SQL_FILE_NAME) + ".sql" : new SimpleDateFormat("d_M_Y_H_mm_ss").format(new Date()) + "_" + database + "_database_dump.sql"; }
java
public String getSqlFilename(){ return isSqlFileNamePropertySet() ? properties.getProperty(SQL_FILE_NAME) + ".sql" : new SimpleDateFormat("d_M_Y_H_mm_ss").format(new Date()) + "_" + database + "_database_dump.sql"; }
[ "public", "String", "getSqlFilename", "(", ")", "{", "return", "isSqlFileNamePropertySet", "(", ")", "?", "properties", ".", "getProperty", "(", "SQL_FILE_NAME", ")", "+", "\".sql\"", ":", "new", "SimpleDateFormat", "(", "\"d_M_Y_H_mm_ss\"", ")", ".", "format", ...
This will get the final output sql file name. @return String
[ "This", "will", "get", "the", "final", "output", "sql", "file", "name", "." ]
7e31aac33fe63948d4ad64a053394759457da636
https://github.com/SeunMatt/mysql-backup4j/blob/7e31aac33fe63948d4ad64a053394759457da636/src/main/java/com/smattme/MysqlExportService.java#L466-L469
115,196
SeunMatt/mysql-backup4j
src/main/java/com/smattme/EmailService.java
EmailService.isPropertiesSet
private boolean isPropertiesSet() { return !this.host.isEmpty() && this.port > 0 && !this.username.isEmpty() && !this.password.isEmpty() && !this.toAdd.isEmpty() && !this.fromAdd.isEmpty() && !this.subject.isE...
java
private boolean isPropertiesSet() { return !this.host.isEmpty() && this.port > 0 && !this.username.isEmpty() && !this.password.isEmpty() && !this.toAdd.isEmpty() && !this.fromAdd.isEmpty() && !this.subject.isE...
[ "private", "boolean", "isPropertiesSet", "(", ")", "{", "return", "!", "this", ".", "host", ".", "isEmpty", "(", ")", "&&", "this", ".", "port", ">", "0", "&&", "!", "this", ".", "username", ".", "isEmpty", "(", ")", "&&", "!", "this", ".", "passwo...
This will check if the necessary properties are set for sending an email successfully @return boolean
[ "This", "will", "check", "if", "the", "necessary", "properties", "are", "set", "for", "sending", "an", "email", "successfully" ]
7e31aac33fe63948d4ad64a053394759457da636
https://github.com/SeunMatt/mysql-backup4j/blob/7e31aac33fe63948d4ad64a053394759457da636/src/main/java/com/smattme/EmailService.java#L94-L104
115,197
SeunMatt/mysql-backup4j
src/main/java/com/smattme/EmailService.java
EmailService.sendMail
boolean sendMail() { if(!this.isPropertiesSet()) { logger.debug(LOG_PREFIX + ": Required Mail Properties are not set. Attachments will not be sent"); return false; } Properties prop = new Properties(); prop.put("mail.smtp.auth", true); prop.put(...
java
boolean sendMail() { if(!this.isPropertiesSet()) { logger.debug(LOG_PREFIX + ": Required Mail Properties are not set. Attachments will not be sent"); return false; } Properties prop = new Properties(); prop.put("mail.smtp.auth", true); prop.put(...
[ "boolean", "sendMail", "(", ")", "{", "if", "(", "!", "this", ".", "isPropertiesSet", "(", ")", ")", "{", "logger", ".", "debug", "(", "LOG_PREFIX", "+", "\": Required Mail Properties are not set. Attachments will not be sent\"", ")", ";", "return", "false", ";", ...
This function will send an email and add the generated sql file as an attachment @return boolean
[ "This", "function", "will", "send", "an", "email", "and", "add", "the", "generated", "sql", "file", "as", "an", "attachment" ]
7e31aac33fe63948d4ad64a053394759457da636
https://github.com/SeunMatt/mysql-backup4j/blob/7e31aac33fe63948d4ad64a053394759457da636/src/main/java/com/smattme/EmailService.java#L112-L176
115,198
ical4j/ical4j
src/main/java/net/fortuna/ical4j/model/property/DateProperty.java
DateProperty.setDate
public final void setDate(final Date date) { this.date = date; if (date instanceof DateTime) { if (Value.DATE.equals(getParameter(Parameter.VALUE))) { getParameters().replace(Value.DATE_TIME); } updateTimeZone(((DateTime) date).getTimeZone()); ...
java
public final void setDate(final Date date) { this.date = date; if (date instanceof DateTime) { if (Value.DATE.equals(getParameter(Parameter.VALUE))) { getParameters().replace(Value.DATE_TIME); } updateTimeZone(((DateTime) date).getTimeZone()); ...
[ "public", "final", "void", "setDate", "(", "final", "Date", "date", ")", "{", "this", ".", "date", "=", "date", ";", "if", "(", "date", "instanceof", "DateTime", ")", "{", "if", "(", "Value", ".", "DATE", ".", "equals", "(", "getParameter", "(", "Par...
Sets the date value of this property. The timezone and value of this instance will also be updated accordingly. @param date The date to set.
[ "Sets", "the", "date", "value", "of", "this", "property", ".", "The", "timezone", "and", "value", "of", "this", "instance", "will", "also", "be", "updated", "accordingly", "." ]
7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156
https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/model/property/DateProperty.java#L102-L121
115,199
ical4j/ical4j
src/main/java/net/fortuna/ical4j/model/component/VEvent.java
VEvent.getConsumedTime
public final PeriodList getConsumedTime(final Date rangeStart, final Date rangeEnd) { return getConsumedTime(rangeStart, rangeEnd, true); }
java
public final PeriodList getConsumedTime(final Date rangeStart, final Date rangeEnd) { return getConsumedTime(rangeStart, rangeEnd, true); }
[ "public", "final", "PeriodList", "getConsumedTime", "(", "final", "Date", "rangeStart", ",", "final", "Date", "rangeEnd", ")", "{", "return", "getConsumedTime", "(", "rangeStart", ",", "rangeEnd", ",", "true", ")", ";", "}" ]
Returns a normalised list of periods representing the consumed time for this event. @param rangeStart the start of a range @param rangeEnd the end of a range @return a normalised list of periods representing consumed time for this event @see VEvent#getConsumedTime(Date, Date, boolean)
[ "Returns", "a", "normalised", "list", "of", "periods", "representing", "the", "consumed", "time", "for", "this", "event", "." ]
7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156
https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/model/component/VEvent.java#L436-L439