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
partition
stringclasses
1 value
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/configuration/ColumnPrinter.java
ColumnPrinter.addValue
void addValue(String columnName, String value) { addValue(columnNames.indexOf(columnName), value); }
java
void addValue(String columnName, String value) { addValue(columnNames.indexOf(columnName), value); }
[ "void", "addValue", "(", "String", "columnName", ",", "String", "value", ")", "{", "addValue", "(", "columnNames", ".", "indexOf", "(", "columnName", ")", ",", "value", ")", ";", "}" ]
Add a value to the first column with the given name @param columnName name of the column to add to @param value value to add
[ "Add", "a", "value", "to", "the", "first", "column", "with", "the", "given", "name" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/configuration/ColumnPrinter.java#L60-L63
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/configuration/ColumnPrinter.java
ColumnPrinter.addValue
void addValue(int columnIndex, String value) { if ( (columnIndex < 0) || (columnIndex >= data.size()) ) { throw new IllegalArgumentException(); } List<String> stringList = data.get(columnIndex); stringList.add(value); }
java
void addValue(int columnIndex, String value) { if ( (columnIndex < 0) || (columnIndex >= data.size()) ) { throw new IllegalArgumentException(); } List<String> stringList = data.get(columnIndex); stringList.add(value); }
[ "void", "addValue", "(", "int", "columnIndex", ",", "String", "value", ")", "{", "if", "(", "(", "columnIndex", "<", "0", ")", "||", "(", "columnIndex", ">=", "data", ".", "size", "(", ")", ")", ")", "{", "throw", "new", "IllegalArgumentException", "("...
Add a value to the nth column @param columnIndex n @param value value to add
[ "Add", "a", "value", "to", "the", "nth", "column" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/configuration/ColumnPrinter.java#L71-L80
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/configuration/ColumnPrinter.java
ColumnPrinter.generate
List<String> generate() { List<String> lines = Lists.newArrayList(); StringBuilder workStr = new StringBuilder(); List<AtomicInteger> columnWidths = getColumnWidths(); List<Iterator<String>> dataIterators = getDataIterators(); Iterator<AtomicInteger> columnWidthIterator = c...
java
List<String> generate() { List<String> lines = Lists.newArrayList(); StringBuilder workStr = new StringBuilder(); List<AtomicInteger> columnWidths = getColumnWidths(); List<Iterator<String>> dataIterators = getDataIterators(); Iterator<AtomicInteger> columnWidthIterator = c...
[ "List", "<", "String", ">", "generate", "(", ")", "{", "List", "<", "String", ">", "lines", "=", "Lists", ".", "newArrayList", "(", ")", ";", "StringBuilder", "workStr", "=", "new", "StringBuilder", "(", ")", ";", "List", "<", "AtomicInteger", ">", "co...
Generate the output as a list of string lines @return lines
[ "Generate", "the", "output", "as", "a", "list", "of", "string", "lines" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/configuration/ColumnPrinter.java#L110-L155
train
Netflix/governator
governator-commons-cli/src/main/java/com/netflix/governator/commons_cli/Cli.java
Cli.start
public static void start(Class<?> mainClass, final String[] args) { try { LifecycleInjector.bootstrap(mainClass, new AbstractModule() { @Override protected void configure() { bind(String[].class).annotatedWith(Main.class).toInstance(args); ...
java
public static void start(Class<?> mainClass, final String[] args) { try { LifecycleInjector.bootstrap(mainClass, new AbstractModule() { @Override protected void configure() { bind(String[].class).annotatedWith(Main.class).toInstance(args); ...
[ "public", "static", "void", "start", "(", "Class", "<", "?", ">", "mainClass", ",", "final", "String", "[", "]", "args", ")", "{", "try", "{", "LifecycleInjector", ".", "bootstrap", "(", "mainClass", ",", "new", "AbstractModule", "(", ")", "{", "@", "O...
Utility method to start the CommonsCli using a main class and command line arguments @param mainClass @param args
[ "Utility", "method", "to", "start", "the", "CommonsCli", "using", "a", "main", "class", "and", "command", "line", "arguments" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-commons-cli/src/main/java/com/netflix/governator/commons_cli/Cli.java#L15-L26
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/configuration/ConfigurationColumnWriter.java
ConfigurationColumnWriter.output
public void output(Logger log) { Map<String, Entry> entries = config.getSortedEntries(); if ( entries.isEmpty() ) { return; } ColumnPrinter printer = build(entries); log.debug("Configuration Details"); for ( String line : printer.generat...
java
public void output(Logger log) { Map<String, Entry> entries = config.getSortedEntries(); if ( entries.isEmpty() ) { return; } ColumnPrinter printer = build(entries); log.debug("Configuration Details"); for ( String line : printer.generat...
[ "public", "void", "output", "(", "Logger", "log", ")", "{", "Map", "<", "String", ",", "Entry", ">", "entries", "=", "config", ".", "getSortedEntries", "(", ")", ";", "if", "(", "entries", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "Co...
Write the documentation table to a logger @param log
[ "Write", "the", "documentation", "table", "to", "a", "logger" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/configuration/ConfigurationColumnWriter.java#L30-L46
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/configuration/ConfigurationColumnWriter.java
ConfigurationColumnWriter.output
public void output(PrintWriter out) { Map<String, Entry> entries = config.getSortedEntries(); if ( entries.isEmpty() ) { return; } ColumnPrinter printer = build(entries); out.println("Configuration Details"); printer.print(out); }
java
public void output(PrintWriter out) { Map<String, Entry> entries = config.getSortedEntries(); if ( entries.isEmpty() ) { return; } ColumnPrinter printer = build(entries); out.println("Configuration Details"); printer.print(out); }
[ "public", "void", "output", "(", "PrintWriter", "out", ")", "{", "Map", "<", "String", ",", "Entry", ">", "entries", "=", "config", ".", "getSortedEntries", "(", ")", ";", "if", "(", "entries", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", ...
Output documentation table to a PrintWriter @param out
[ "Output", "documentation", "table", "to", "a", "PrintWriter" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/configuration/ConfigurationColumnWriter.java#L61-L74
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/configuration/ConfigurationColumnWriter.java
ConfigurationColumnWriter.build
private ColumnPrinter build(Map<String, Entry> entries) { ColumnPrinter printer = new ColumnPrinter(); printer.addColumn("PROPERTY"); printer.addColumn("FIELD"); printer.addColumn("DEFAULT"); printer.addColumn("VALUE"); printer.addColumn("DESCRIPTION"); Map<...
java
private ColumnPrinter build(Map<String, Entry> entries) { ColumnPrinter printer = new ColumnPrinter(); printer.addColumn("PROPERTY"); printer.addColumn("FIELD"); printer.addColumn("DEFAULT"); printer.addColumn("VALUE"); printer.addColumn("DESCRIPTION"); Map<...
[ "private", "ColumnPrinter", "build", "(", "Map", "<", "String", ",", "Entry", ">", "entries", ")", "{", "ColumnPrinter", "printer", "=", "new", "ColumnPrinter", "(", ")", ";", "printer", ".", "addColumn", "(", "\"PROPERTY\"", ")", ";", "printer", ".", "add...
Construct a ColumnPrinter using the entries @param entries @return
[ "Construct", "a", "ColumnPrinter", "using", "the", "entries" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/configuration/ConfigurationColumnWriter.java#L82-L104
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/configuration/KeyParser.java
KeyParser.parse
public static List<ConfigurationKeyPart> parse(String raw, Map<String, String> contextOverrides) { List<ConfigurationKeyPart> parts = Lists.newArrayList(); int caret = 0; for (; ; ) { int startIndex = raw.indexOf("${", caret); if ( startIndex < 0 ) ...
java
public static List<ConfigurationKeyPart> parse(String raw, Map<String, String> contextOverrides) { List<ConfigurationKeyPart> parts = Lists.newArrayList(); int caret = 0; for (; ; ) { int startIndex = raw.indexOf("${", caret); if ( startIndex < 0 ) ...
[ "public", "static", "List", "<", "ConfigurationKeyPart", ">", "parse", "(", "String", "raw", ",", "Map", "<", "String", ",", "String", ">", "contextOverrides", ")", "{", "List", "<", "ConfigurationKeyPart", ">", "parts", "=", "Lists", ".", "newArrayList", "(...
Parse a key into parts @param raw the key @return parts
[ "Parse", "a", "key", "into", "parts" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/configuration/KeyParser.java#L35-L82
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/lifecycle/LifecycleManager.java
LifecycleManager.add
@Deprecated public void add(Object... objects) throws Exception { for ( Object obj : objects ) { add(obj); } }
java
@Deprecated public void add(Object... objects) throws Exception { for ( Object obj : objects ) { add(obj); } }
[ "@", "Deprecated", "public", "void", "add", "(", "Object", "...", "objects", ")", "throws", "Exception", "{", "for", "(", "Object", "obj", ":", "objects", ")", "{", "add", "(", "obj", ")", ";", "}", "}" ]
Add the objects to the container. Their assets will be loaded, post construct methods called, etc. @param objects objects to add @throws Exception errors
[ "Add", "the", "objects", "to", "the", "container", ".", "Their", "assets", "will", "be", "loaded", "post", "construct", "methods", "called", "etc", "." ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/lifecycle/LifecycleManager.java#L128-L135
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/lifecycle/LifecycleManager.java
LifecycleManager.add
@Deprecated public void add(Object obj) throws Exception { add(obj, null, new LifecycleMethods(obj.getClass())); }
java
@Deprecated public void add(Object obj) throws Exception { add(obj, null, new LifecycleMethods(obj.getClass())); }
[ "@", "Deprecated", "public", "void", "add", "(", "Object", "obj", ")", "throws", "Exception", "{", "add", "(", "obj", ",", "null", ",", "new", "LifecycleMethods", "(", "obj", ".", "getClass", "(", ")", ")", ")", ";", "}" ]
Add the object to the container. Its assets will be loaded, post construct methods called, etc. @param obj object to add @throws Exception errors
[ "Add", "the", "object", "to", "the", "container", ".", "Its", "assets", "will", "be", "loaded", "post", "construct", "methods", "called", "etc", "." ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/lifecycle/LifecycleManager.java#L143-L147
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/lifecycle/LifecycleManager.java
LifecycleManager.getState
public LifecycleState getState(Object obj) { LifecycleStateWrapper lifecycleState = objectStates.get(obj); if ( lifecycleState == null ) { return hasStarted() ? LifecycleState.ACTIVE : LifecycleState.LATENT; } else { synchronized(lifecycleState) { ...
java
public LifecycleState getState(Object obj) { LifecycleStateWrapper lifecycleState = objectStates.get(obj); if ( lifecycleState == null ) { return hasStarted() ? LifecycleState.ACTIVE : LifecycleState.LATENT; } else { synchronized(lifecycleState) { ...
[ "public", "LifecycleState", "getState", "(", "Object", "obj", ")", "{", "LifecycleStateWrapper", "lifecycleState", "=", "objectStates", ".", "get", "(", "obj", ")", ";", "if", "(", "lifecycleState", "==", "null", ")", "{", "return", "hasStarted", "(", ")", "...
Return the current state of the given object or LATENT if unknown @param obj object to check @return state
[ "Return", "the", "current", "state", "of", "the", "given", "object", "or", "LATENT", "if", "unknown" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/lifecycle/LifecycleManager.java#L203-L215
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/configuration/ConfigurationKey.java
ConfigurationKey.getKey
public String getKey(Map<String, String> variableValues) { StringBuilder key = new StringBuilder(); for ( ConfigurationKeyPart p : parts ) { if ( p.isVariable() ) { String value = variableValues.get(p.getValue()); if ( value == null ) ...
java
public String getKey(Map<String, String> variableValues) { StringBuilder key = new StringBuilder(); for ( ConfigurationKeyPart p : parts ) { if ( p.isVariable() ) { String value = variableValues.get(p.getValue()); if ( value == null ) ...
[ "public", "String", "getKey", "(", "Map", "<", "String", ",", "String", ">", "variableValues", ")", "{", "StringBuilder", "key", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "ConfigurationKeyPart", "p", ":", "parts", ")", "{", "if", "(", "p", ...
Return the final key applying variables as needed @param variableValues map of variable names to values @return the key
[ "Return", "the", "final", "key", "applying", "variables", "as", "needed" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/configuration/ConfigurationKey.java#L60-L82
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/configuration/ConfigurationKey.java
ConfigurationKey.getVariableNames
public Collection<String> getVariableNames() { ImmutableSet.Builder<String> builder = ImmutableSet.builder(); for ( ConfigurationKeyPart p : parts ) { if ( p.isVariable() ) { builder.add(p.getValue()); } } return builder.bu...
java
public Collection<String> getVariableNames() { ImmutableSet.Builder<String> builder = ImmutableSet.builder(); for ( ConfigurationKeyPart p : parts ) { if ( p.isVariable() ) { builder.add(p.getValue()); } } return builder.bu...
[ "public", "Collection", "<", "String", ">", "getVariableNames", "(", ")", "{", "ImmutableSet", ".", "Builder", "<", "String", ">", "builder", "=", "ImmutableSet", ".", "builder", "(", ")", ";", "for", "(", "ConfigurationKeyPart", "p", ":", "parts", ")", "{...
Return the names of the variables specified in the key if any @return names (might be zero sized)
[ "Return", "the", "names", "of", "the", "variables", "specified", "in", "the", "key", "if", "any" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/configuration/ConfigurationKey.java#L97-L109
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/guice/LifecycleInjector.java
LifecycleInjector.createChildInjector
public Injector createChildInjector(Collection<Module> modules) { Injector childInjector; Collection<Module> localModules = modules; for (ModuleTransformer transformer : transformers) { localModules = transformer.call(localModules); } //noinspection depr...
java
public Injector createChildInjector(Collection<Module> modules) { Injector childInjector; Collection<Module> localModules = modules; for (ModuleTransformer transformer : transformers) { localModules = transformer.call(localModules); } //noinspection depr...
[ "public", "Injector", "createChildInjector", "(", "Collection", "<", "Module", ">", "modules", ")", "{", "Injector", "childInjector", ";", "Collection", "<", "Module", ">", "localModules", "=", "modules", ";", "for", "(", "ModuleTransformer", "transformer", ":", ...
Create an injector that is a child of the bootstrap bindings only @param modules binding modules @return injector
[ "Create", "an", "injector", "that", "is", "a", "child", "of", "the", "bootstrap", "bindings", "only" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/guice/LifecycleInjector.java#L320-L343
train
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/guice/LifecycleInjector.java
LifecycleInjector.createInjector
public Injector createInjector(Collection<Module> additionalModules) { List<Module> localModules = Lists.newArrayList(); // Add the discovered modules FIRST. The discovered modules // are added, and will subsequently be configured, in module dependency // order which will ...
java
public Injector createInjector(Collection<Module> additionalModules) { List<Module> localModules = Lists.newArrayList(); // Add the discovered modules FIRST. The discovered modules // are added, and will subsequently be configured, in module dependency // order which will ...
[ "public", "Injector", "createInjector", "(", "Collection", "<", "Module", ">", "additionalModules", ")", "{", "List", "<", "Module", ">", "localModules", "=", "Lists", ".", "newArrayList", "(", ")", ";", "// Add the discovered modules FIRST. The discovered modules", ...
Create the main injector @param additionalModules any additional modules @return injector
[ "Create", "the", "main", "injector" ]
c1f4bb1518e759c61f2e9cad8a896ec6beba0294
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/guice/LifecycleInjector.java#L372-L412
train
Netflix/ndbench
ndbench-core/src/main/java/com/netflix/ndbench/core/NdBenchDriver.java
NdBenchDriver.stop
public void stop() { stopWrites(); stopReads(); if (timerRef != null && timerRef.get() != null) { timerRef.get().shutdownNow(); timerRef.set(null); } ndBenchMonitor.resetStats(); }
java
public void stop() { stopWrites(); stopReads(); if (timerRef != null && timerRef.get() != null) { timerRef.get().shutdownNow(); timerRef.set(null); } ndBenchMonitor.resetStats(); }
[ "public", "void", "stop", "(", ")", "{", "stopWrites", "(", ")", ";", "stopReads", "(", ")", ";", "if", "(", "timerRef", "!=", "null", "&&", "timerRef", ".", "get", "(", ")", "!=", "null", ")", "{", "timerRef", ".", "get", "(", ")", ".", "shutdow...
FUNCTIONALITY FOR STOPPING THE WORKERS
[ "FUNCTIONALITY", "FOR", "STOPPING", "THE", "WORKERS" ]
8d664244b5f9d01395248a296b86a3c822e6d764
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-core/src/main/java/com/netflix/ndbench/core/NdBenchDriver.java#L282-L290
train
Netflix/ndbench
ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java
DynoJedisUtils.nonPipelineRead
public String nonPipelineRead(String key) throws Exception { String res = jedisClient.get().get(key); if (res != null) { if (res.isEmpty()) { throw new Exception("Data retrieved is not ok "); } } else { return CacheMiss; } re...
java
public String nonPipelineRead(String key) throws Exception { String res = jedisClient.get().get(key); if (res != null) { if (res.isEmpty()) { throw new Exception("Data retrieved is not ok "); } } else { return CacheMiss; } re...
[ "public", "String", "nonPipelineRead", "(", "String", "key", ")", "throws", "Exception", "{", "String", "res", "=", "jedisClient", ".", "get", "(", ")", ".", "get", "(", "key", ")", ";", "if", "(", "res", "!=", "null", ")", "{", "if", "(", "res", "...
This is the non pipelined version of the reads @param key @return the value of the corresponding key @throws Exception
[ "This", "is", "the", "non", "pipelined", "version", "of", "the", "reads" ]
8d664244b5f9d01395248a296b86a3c822e6d764
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java#L49-L63
train
Netflix/ndbench
ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java
DynoJedisUtils.pipelineRead
public String pipelineRead(String key, int max_pipe_keys, int min_pipe_keys) throws Exception { int pipe_keys = randomGenerator.nextInt(max_pipe_keys); pipe_keys = Math.max(min_pipe_keys, pipe_keys); DynoJedisPipeline pipeline = this.jedisClient.get().pipelined(); Map<String, Response<...
java
public String pipelineRead(String key, int max_pipe_keys, int min_pipe_keys) throws Exception { int pipe_keys = randomGenerator.nextInt(max_pipe_keys); pipe_keys = Math.max(min_pipe_keys, pipe_keys); DynoJedisPipeline pipeline = this.jedisClient.get().pipelined(); Map<String, Response<...
[ "public", "String", "pipelineRead", "(", "String", "key", ",", "int", "max_pipe_keys", ",", "int", "min_pipe_keys", ")", "throws", "Exception", "{", "int", "pipe_keys", "=", "randomGenerator", ".", "nextInt", "(", "max_pipe_keys", ")", ";", "pipe_keys", "=", "...
This is the pipelined version of the reads @param key @return "OK" if everything was read @throws Exception
[ "This", "is", "the", "pipelined", "version", "of", "the", "reads" ]
8d664244b5f9d01395248a296b86a3c822e6d764
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java#L72-L110
train
Netflix/ndbench
ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java
DynoJedisUtils.pipelineReadHGETALL
public String pipelineReadHGETALL(String key, String hm_key_prefix) throws Exception { DynoJedisPipeline pipeline = jedisClient.get().pipelined(); Response<Map<byte[], byte[]>> resp = pipeline.hgetAll((hm_key_prefix + key).getBytes()); pipeline.sync(); if (resp == null || resp.get() == n...
java
public String pipelineReadHGETALL(String key, String hm_key_prefix) throws Exception { DynoJedisPipeline pipeline = jedisClient.get().pipelined(); Response<Map<byte[], byte[]>> resp = pipeline.hgetAll((hm_key_prefix + key).getBytes()); pipeline.sync(); if (resp == null || resp.get() == n...
[ "public", "String", "pipelineReadHGETALL", "(", "String", "key", ",", "String", "hm_key_prefix", ")", "throws", "Exception", "{", "DynoJedisPipeline", "pipeline", "=", "jedisClient", ".", "get", "(", ")", ".", "pipelined", "(", ")", ";", "Response", "<", "Map"...
This the pipelined HGETALL @param key @return the contents of the hash @throws Exception
[ "This", "the", "pipelined", "HGETALL" ]
8d664244b5f9d01395248a296b86a3c822e6d764
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java#L119-L136
train
Netflix/ndbench
ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java
DynoJedisUtils.nonPipelineZRANGE
public String nonPipelineZRANGE(String key, int max_score) { StringBuilder sb = new StringBuilder(); // Return all elements Set<String> returnEntries = this.jedisClient.get().zrange(key, 0, -1); if (returnEntries.isEmpty()) { logger.error("The number of entries in the sorted ...
java
public String nonPipelineZRANGE(String key, int max_score) { StringBuilder sb = new StringBuilder(); // Return all elements Set<String> returnEntries = this.jedisClient.get().zrange(key, 0, -1); if (returnEntries.isEmpty()) { logger.error("The number of entries in the sorted ...
[ "public", "String", "nonPipelineZRANGE", "(", "String", "key", ",", "int", "max_score", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "// Return all elements", "Set", "<", "String", ">", "returnEntries", "=", "this", ".", "jedisC...
Exercising ZRANGE to receive all keys between 0 and MAX_SCORE @param key
[ "Exercising", "ZRANGE", "to", "receive", "all", "keys", "between", "0", "and", "MAX_SCORE" ]
8d664244b5f9d01395248a296b86a3c822e6d764
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java#L143-L154
train
Netflix/ndbench
ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java
DynoJedisUtils.nonpipelineWrite
public String nonpipelineWrite(String key, DataGenerator dataGenerator) { String value = key + "__" + dataGenerator.getRandomValue() + "__" + key; String result = this.jedisClient.get().set(key, value); if (!"OK".equals(result)) { logger.error("SET_ERROR: GOT " + result + " for SET ...
java
public String nonpipelineWrite(String key, DataGenerator dataGenerator) { String value = key + "__" + dataGenerator.getRandomValue() + "__" + key; String result = this.jedisClient.get().set(key, value); if (!"OK".equals(result)) { logger.error("SET_ERROR: GOT " + result + " for SET ...
[ "public", "String", "nonpipelineWrite", "(", "String", "key", ",", "DataGenerator", "dataGenerator", ")", "{", "String", "value", "=", "key", "+", "\"__\"", "+", "dataGenerator", ".", "getRandomValue", "(", ")", "+", "\"__\"", "+", "key", ";", "String", "res...
a simple write without a pipeline @param key @return the result of write (i.e. "OK" if it was successful
[ "a", "simple", "write", "without", "a", "pipeline" ]
8d664244b5f9d01395248a296b86a3c822e6d764
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java#L162-L173
train
Netflix/ndbench
ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java
DynoJedisUtils.pipelineWrite
public String pipelineWrite(String key, DataGenerator dataGenerator, int max_pipe_keys, int min_pipe_keys) throws Exception { // Create a random key between [0,MAX_PIPE_KEYS] int pipe_keys = randomGenerator.nextInt(max_pipe_keys); // Make sure that the number of keys in the pipeline...
java
public String pipelineWrite(String key, DataGenerator dataGenerator, int max_pipe_keys, int min_pipe_keys) throws Exception { // Create a random key between [0,MAX_PIPE_KEYS] int pipe_keys = randomGenerator.nextInt(max_pipe_keys); // Make sure that the number of keys in the pipeline...
[ "public", "String", "pipelineWrite", "(", "String", "key", ",", "DataGenerator", "dataGenerator", ",", "int", "max_pipe_keys", ",", "int", "min_pipe_keys", ")", "throws", "Exception", "{", "// Create a random key between [0,MAX_PIPE_KEYS]", "int", "pipe_keys", "=", "ran...
pipelined version of the write @param key @return "key_n"
[ "pipelined", "version", "of", "the", "write" ]
8d664244b5f9d01395248a296b86a3c822e6d764
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java#L181-L209
train
Netflix/ndbench
ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java
DynoJedisUtils.pipelineWriteHMSET
public String pipelineWriteHMSET(String key, DataGenerator dataGenerator, String hm_key_prefix) { Map<String, String> map = new HashMap<>(); String hmKey = hm_key_prefix + key; map.put((hmKey + "__1"), (key + "__" + dataGenerator.getRandomValue() + "__" + key)); map.put((hmKey + "__2"), ...
java
public String pipelineWriteHMSET(String key, DataGenerator dataGenerator, String hm_key_prefix) { Map<String, String> map = new HashMap<>(); String hmKey = hm_key_prefix + key; map.put((hmKey + "__1"), (key + "__" + dataGenerator.getRandomValue() + "__" + key)); map.put((hmKey + "__2"), ...
[ "public", "String", "pipelineWriteHMSET", "(", "String", "key", ",", "DataGenerator", "dataGenerator", ",", "String", "hm_key_prefix", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "new", "HashMap", "<>", "(", ")", ";", "String", "hmKey", ...
writes with an pipelined HMSET @param key @return the keys of the hash that was stored.
[ "writes", "with", "an", "pipelined", "HMSET" ]
8d664244b5f9d01395248a296b86a3c822e6d764
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java#L217-L229
train
Netflix/ndbench
ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java
DynoJedisUtils.nonPipelineZADD
public String nonPipelineZADD(String key, DataGenerator dataGenerator, String z_key_prefix, int max_score) throws Exception { String zKey = z_key_prefix + key; int success = 0; long returnOp = 0; for (int i = 0; i < max_score; i++) { returnOp = jedisClient.get()....
java
public String nonPipelineZADD(String key, DataGenerator dataGenerator, String z_key_prefix, int max_score) throws Exception { String zKey = z_key_prefix + key; int success = 0; long returnOp = 0; for (int i = 0; i < max_score; i++) { returnOp = jedisClient.get()....
[ "public", "String", "nonPipelineZADD", "(", "String", "key", ",", "DataGenerator", "dataGenerator", ",", "String", "z_key_prefix", ",", "int", "max_score", ")", "throws", "Exception", "{", "String", "zKey", "=", "z_key_prefix", "+", "key", ";", "int", "success",...
This adds MAX_SCORE of elements in a sorted set @param key @return "OK" if all write operations have succeeded @throws Exception
[ "This", "adds", "MAX_SCORE", "of", "elements", "in", "a", "sorted", "set" ]
8d664244b5f9d01395248a296b86a3c822e6d764
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java#L238-L253
train
Netflix/ndbench
ndbench-es-plugins/src/main/java/com/netflix/ndbench/plugin/es/EsRestPlugin.java
EsRestPlugin.init
@Override public synchronized void init(DataGenerator dataGenerator) throws Exception { if (esConfig.getRestClientPort() == 443 && !esConfig.isHttps()) { throw new IllegalArgumentException( "You must set the configuration property 'https' to true if you use the https default ...
java
@Override public synchronized void init(DataGenerator dataGenerator) throws Exception { if (esConfig.getRestClientPort() == 443 && !esConfig.isHttps()) { throw new IllegalArgumentException( "You must set the configuration property 'https' to true if you use the https default ...
[ "@", "Override", "public", "synchronized", "void", "init", "(", "DataGenerator", "dataGenerator", ")", "throws", "Exception", "{", "if", "(", "esConfig", ".", "getRestClientPort", "(", ")", "==", "443", "&&", "!", "esConfig", ".", "isHttps", "(", ")", ")", ...
Initialize key data structures for plugin, using 'synchronized' to ensure other threads are guaranteed visibility of end result of initializing said structures. @throws Exception
[ "Initialize", "key", "data", "structures", "for", "plugin", "using", "synchronized", "to", "ensure", "other", "threads", "are", "guaranteed", "visibility", "of", "end", "result", "of", "initializing", "said", "structures", "." ]
8d664244b5f9d01395248a296b86a3c822e6d764
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-es-plugins/src/main/java/com/netflix/ndbench/plugin/es/EsRestPlugin.java#L105-L171
train
Netflix/ndbench
ndbench-core/src/main/java/com/netflix/ndbench/core/util/NdbUtil.java
NdbUtil.humanReadableByteCount
public static String humanReadableByteCount(final long bytes) { final int base = 1024; // When using the smallest unit no decimal point is needed, because it's the exact number. if (bytes < base) { return bytes + " " + BINARY_UNITS[0]; } final int exponent = (in...
java
public static String humanReadableByteCount(final long bytes) { final int base = 1024; // When using the smallest unit no decimal point is needed, because it's the exact number. if (bytes < base) { return bytes + " " + BINARY_UNITS[0]; } final int exponent = (in...
[ "public", "static", "String", "humanReadableByteCount", "(", "final", "long", "bytes", ")", "{", "final", "int", "base", "=", "1024", ";", "// When using the smallest unit no decimal point is needed, because it's the exact number.", "if", "(", "bytes", "<", "base", ")", ...
FileUtils.byteCountToDisplaySize rounds down the size, hence using this for more precision. @param bytes bytes @return human readable bytes
[ "FileUtils", ".", "byteCountToDisplaySize", "rounds", "down", "the", "size", "hence", "using", "this", "for", "more", "precision", "." ]
8d664244b5f9d01395248a296b86a3c822e6d764
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-core/src/main/java/com/netflix/ndbench/core/util/NdbUtil.java#L19-L31
train
Netflix/ndbench
ndbench-es-plugins/src/main/java/com/netflix/ndbench/plugin/es/EsWriter.java
EsWriter.constructIndexName
static String constructIndexName(String indexName, int indexRollsPerDay, Date date) { if (indexRollsPerDay > 0) { ZonedDateTime zdt = ZonedDateTime.ofInstant(date.toInstant(), ZoneId.of("UTC")); int minutesPerRoll = 1440 / indexRollsPerDay; int minutesElapsedSinceStartOfDay ...
java
static String constructIndexName(String indexName, int indexRollsPerDay, Date date) { if (indexRollsPerDay > 0) { ZonedDateTime zdt = ZonedDateTime.ofInstant(date.toInstant(), ZoneId.of("UTC")); int minutesPerRoll = 1440 / indexRollsPerDay; int minutesElapsedSinceStartOfDay ...
[ "static", "String", "constructIndexName", "(", "String", "indexName", ",", "int", "indexRollsPerDay", ",", "Date", "date", ")", "{", "if", "(", "indexRollsPerDay", ">", "0", ")", "{", "ZonedDateTime", "zdt", "=", "ZonedDateTime", ".", "ofInstant", "(", "date",...
methods below are package scoped to facilitate unit testing
[ "methods", "below", "are", "package", "scoped", "to", "facilitate", "unit", "testing" ]
8d664244b5f9d01395248a296b86a3c822e6d764
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-es-plugins/src/main/java/com/netflix/ndbench/plugin/es/EsWriter.java#L195-L208
train
Netflix/ndbench
ndbench-janusgraph-plugins/src/main/java/com/netflix/ndbench/plugin/janusgraph/JanusGraphPluginCQL.java
JanusGraphPluginCQL.readBulk
public List<String> readBulk(final List<String> keys) throws Exception { List<String> responses = new ArrayList<>(keys.size()); JanusGraphTransaction transaction = useJanusgraphTransaction ? graph.newTransaction() : null; try { for (String key : keys) { String respon...
java
public List<String> readBulk(final List<String> keys) throws Exception { List<String> responses = new ArrayList<>(keys.size()); JanusGraphTransaction transaction = useJanusgraphTransaction ? graph.newTransaction() : null; try { for (String key : keys) { String respon...
[ "public", "List", "<", "String", ">", "readBulk", "(", "final", "List", "<", "String", ">", "keys", ")", "throws", "Exception", "{", "List", "<", "String", ">", "responses", "=", "new", "ArrayList", "<>", "(", "keys", ".", "size", "(", ")", ")", ";",...
Perform a bulk read operation @return a list of response codes @throws Exception
[ "Perform", "a", "bulk", "read", "operation" ]
8d664244b5f9d01395248a296b86a3c822e6d764
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-janusgraph-plugins/src/main/java/com/netflix/ndbench/plugin/janusgraph/JanusGraphPluginCQL.java#L137-L151
train
Netflix/ndbench
ndbench-janusgraph-plugins/src/main/java/com/netflix/ndbench/plugin/janusgraph/JanusGraphPluginCQL.java
JanusGraphPluginCQL.writeBulk
public List<String> writeBulk(final List<String> keys) throws Exception { List<String> responses = new ArrayList<>(keys.size()); for (String key : keys) { String response = writeSingle(key); responses.add(response); } return responses; }
java
public List<String> writeBulk(final List<String> keys) throws Exception { List<String> responses = new ArrayList<>(keys.size()); for (String key : keys) { String response = writeSingle(key); responses.add(response); } return responses; }
[ "public", "List", "<", "String", ">", "writeBulk", "(", "final", "List", "<", "String", ">", "keys", ")", "throws", "Exception", "{", "List", "<", "String", ">", "responses", "=", "new", "ArrayList", "<>", "(", "keys", ".", "size", "(", ")", ")", ";"...
Perform a bulk write operation @return a list of response codes @throws Exception
[ "Perform", "a", "bulk", "write", "operation" ]
8d664244b5f9d01395248a296b86a3c822e6d764
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-janusgraph-plugins/src/main/java/com/netflix/ndbench/plugin/janusgraph/JanusGraphPluginCQL.java#L158-L165
train
Netflix/ndbench
ndbench-cockroachdb-plugins/src/main/java/com/netflix/ndbench/plugin/cockroachdb/operations/CockroachDBPluginBase.java
CockroachDBPluginBase.getNDelimitedStrings
public String getNDelimitedStrings(int n) { return IntStream.range(0, config.getColsPerRow()).mapToObj(i -> "'" + dataGenerator.getRandomValue() + "'").collect(Collectors.joining(",")); }
java
public String getNDelimitedStrings(int n) { return IntStream.range(0, config.getColsPerRow()).mapToObj(i -> "'" + dataGenerator.getRandomValue() + "'").collect(Collectors.joining(",")); }
[ "public", "String", "getNDelimitedStrings", "(", "int", "n", ")", "{", "return", "IntStream", ".", "range", "(", "0", ",", "config", ".", "getColsPerRow", "(", ")", ")", ".", "mapToObj", "(", "i", "->", "\"'\"", "+", "dataGenerator", ".", "getRandomValue",...
Assumes delimiter to be comma since that covers all the usecase for now. Will parameterize if use cases differ on delimiter. @param n @return
[ "Assumes", "delimiter", "to", "be", "comma", "since", "that", "covers", "all", "the", "usecase", "for", "now", ".", "Will", "parameterize", "if", "use", "cases", "differ", "on", "delimiter", "." ]
8d664244b5f9d01395248a296b86a3c822e6d764
https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-cockroachdb-plugins/src/main/java/com/netflix/ndbench/plugin/cockroachdb/operations/CockroachDBPluginBase.java#L131-L134
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteCursorAdapter.java
OrmLiteCursorAdapter.doBindView
protected void doBindView(View itemView, Context context, Cursor cursor) { try { @SuppressWarnings("unchecked") ViewType itemViewType = (ViewType) itemView; bindView(itemViewType, context, cursorToObject(cursor)); } catch (SQLException e) { throw new RuntimeException(e); } }
java
protected void doBindView(View itemView, Context context, Cursor cursor) { try { @SuppressWarnings("unchecked") ViewType itemViewType = (ViewType) itemView; bindView(itemViewType, context, cursorToObject(cursor)); } catch (SQLException e) { throw new RuntimeException(e); } }
[ "protected", "void", "doBindView", "(", "View", "itemView", ",", "Context", "context", ",", "Cursor", "cursor", ")", "{", "try", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "ViewType", "itemViewType", "=", "(", "ViewType", ")", "itemView", ";", ...
This is here to make sure that the user really wants to override it.
[ "This", "is", "here", "to", "make", "sure", "that", "the", "user", "really", "wants", "to", "override", "it", "." ]
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteCursorAdapter.java#L45-L53
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteCursorAdapter.java
OrmLiteCursorAdapter.getTypedItem
public T getTypedItem(int position) { try { return cursorToObject((Cursor) super.getItem(position)); } catch (SQLException e) { throw new RuntimeException(e); } }
java
public T getTypedItem(int position) { try { return cursorToObject((Cursor) super.getItem(position)); } catch (SQLException e) { throw new RuntimeException(e); } }
[ "public", "T", "getTypedItem", "(", "int", "position", ")", "{", "try", "{", "return", "cursorToObject", "(", "(", "Cursor", ")", "super", ".", "getItem", "(", "position", ")", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "new",...
Returns a T object at the current position.
[ "Returns", "a", "T", "object", "at", "the", "current", "position", "." ]
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteCursorAdapter.java#L58-L64
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteCursorAdapter.java
OrmLiteCursorAdapter.cursorToObject
protected T cursorToObject(Cursor cursor) throws SQLException { return preparedQuery.mapRow(new AndroidDatabaseResults(cursor, null, true)); }
java
protected T cursorToObject(Cursor cursor) throws SQLException { return preparedQuery.mapRow(new AndroidDatabaseResults(cursor, null, true)); }
[ "protected", "T", "cursorToObject", "(", "Cursor", "cursor", ")", "throws", "SQLException", "{", "return", "preparedQuery", ".", "mapRow", "(", "new", "AndroidDatabaseResults", "(", "cursor", ",", "null", ",", "true", ")", ")", ";", "}" ]
Map a single row to our cursor object.
[ "Map", "a", "single", "row", "to", "our", "cursor", "object", "." ]
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteCursorAdapter.java#L69-L71
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteCursorAdapter.java
OrmLiteCursorAdapter.changeCursor
public void changeCursor(Cursor cursor, PreparedQuery<T> preparedQuery) { setPreparedQuery(preparedQuery); super.changeCursor(cursor); }
java
public void changeCursor(Cursor cursor, PreparedQuery<T> preparedQuery) { setPreparedQuery(preparedQuery); super.changeCursor(cursor); }
[ "public", "void", "changeCursor", "(", "Cursor", "cursor", ",", "PreparedQuery", "<", "T", ">", "preparedQuery", ")", "{", "setPreparedQuery", "(", "preparedQuery", ")", ";", "super", ".", "changeCursor", "(", "cursor", ")", ";", "}" ]
Change the cursor associated with the prepared query.
[ "Change", "the", "cursor", "associated", "with", "the", "prepared", "query", "." ]
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteCursorAdapter.java#L85-L88
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/AndroidCompiledStatement.java
AndroidCompiledStatement.execSql
static int execSql(SQLiteDatabase db, String label, String finalSql, Object[] argArray) throws SQLException { try { db.execSQL(finalSql, argArray); } catch (android.database.SQLException e) { throw SqlExceptionUtil.create("Problems executing " + label + " Android statement: " + finalSql, e); } int result;...
java
static int execSql(SQLiteDatabase db, String label, String finalSql, Object[] argArray) throws SQLException { try { db.execSQL(finalSql, argArray); } catch (android.database.SQLException e) { throw SqlExceptionUtil.create("Problems executing " + label + " Android statement: " + finalSql, e); } int result;...
[ "static", "int", "execSql", "(", "SQLiteDatabase", "db", ",", "String", "label", ",", "String", "finalSql", ",", "Object", "[", "]", "argArray", ")", "throws", "SQLException", "{", "try", "{", "db", ".", "execSQL", "(", "finalSql", ",", "argArray", ")", ...
Execute some SQL on the database and return the number of rows changed.
[ "Execute", "some", "SQL", "on", "the", "database", "and", "return", "the", "number", "of", "rows", "changed", "." ]
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/AndroidCompiledStatement.java#L212-L234
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java
OrmLiteConfigUtil.writeConfigFile
public static void writeConfigFile(String fileName, boolean sortClasses) throws SQLException, IOException { List<Class<?>> classList = new ArrayList<Class<?>>(); findAnnotatedClasses(classList, new File("."), 0); writeConfigFile(fileName, classList.toArray(new Class[classList.size()]), sortClasses); }
java
public static void writeConfigFile(String fileName, boolean sortClasses) throws SQLException, IOException { List<Class<?>> classList = new ArrayList<Class<?>>(); findAnnotatedClasses(classList, new File("."), 0); writeConfigFile(fileName, classList.toArray(new Class[classList.size()]), sortClasses); }
[ "public", "static", "void", "writeConfigFile", "(", "String", "fileName", ",", "boolean", "sortClasses", ")", "throws", "SQLException", ",", "IOException", "{", "List", "<", "Class", "<", "?", ">", ">", "classList", "=", "new", "ArrayList", "<", "Class", "<"...
Finds the annotated classes in the current directory or below and writes a configuration file to the file-name in the raw folder. @param sortClasses Set to true to sort the classes by name before the file is generated.
[ "Finds", "the", "annotated", "classes", "in", "the", "current", "directory", "or", "below", "and", "writes", "a", "configuration", "file", "to", "the", "file", "-", "name", "in", "the", "raw", "folder", "." ]
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java#L115-L119
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java
OrmLiteConfigUtil.writeConfigFile
public static void writeConfigFile(File configFile, boolean sortClasses) throws SQLException, IOException { writeConfigFile(configFile, new File("."), sortClasses); }
java
public static void writeConfigFile(File configFile, boolean sortClasses) throws SQLException, IOException { writeConfigFile(configFile, new File("."), sortClasses); }
[ "public", "static", "void", "writeConfigFile", "(", "File", "configFile", ",", "boolean", "sortClasses", ")", "throws", "SQLException", ",", "IOException", "{", "writeConfigFile", "(", "configFile", ",", "new", "File", "(", "\".\"", ")", ",", "sortClasses", ")",...
Finds the annotated classes in the current directory or below and writes a configuration file. @param sortClasses Set to true to sort the classes by name before the file is generated.
[ "Finds", "the", "annotated", "classes", "in", "the", "current", "directory", "or", "below", "and", "writes", "a", "configuration", "file", "." ]
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java#L159-L161
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java
OrmLiteConfigUtil.findRawDir
protected static File findRawDir(File dir) { for (int i = 0; dir != null && i < 20; i++) { File rawDir = findResRawDir(dir); if (rawDir != null) { return rawDir; } dir = dir.getParentFile(); } return null; }
java
protected static File findRawDir(File dir) { for (int i = 0; dir != null && i < 20; i++) { File rawDir = findResRawDir(dir); if (rawDir != null) { return rawDir; } dir = dir.getParentFile(); } return null; }
[ "protected", "static", "File", "findRawDir", "(", "File", "dir", ")", "{", "for", "(", "int", "i", "=", "0", ";", "dir", "!=", "null", "&&", "i", "<", "20", ";", "i", "++", ")", "{", "File", "rawDir", "=", "findResRawDir", "(", "dir", ")", ";", ...
Look for the resource-directory in the current directory or the directories above. Then look for the raw-directory underneath the resource-directory.
[ "Look", "for", "the", "resource", "-", "directory", "in", "the", "current", "directory", "or", "the", "directories", "above", ".", "Then", "look", "for", "the", "raw", "-", "directory", "underneath", "the", "resource", "-", "directory", "." ]
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java#L261-L270
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java
OrmLiteConfigUtil.getPackageOfClass
private static String getPackageOfClass(File file) throws IOException { BufferedReader reader = new BufferedReader(new FileReader(file)); try { while (true) { String line = reader.readLine(); if (line == null) { return null; } if (line.contains("package")) { String[] parts = line.split(...
java
private static String getPackageOfClass(File file) throws IOException { BufferedReader reader = new BufferedReader(new FileReader(file)); try { while (true) { String line = reader.readLine(); if (line == null) { return null; } if (line.contains("package")) { String[] parts = line.split(...
[ "private", "static", "String", "getPackageOfClass", "(", "File", "file", ")", "throws", "IOException", "{", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "file", ")", ")", ";", "try", "{", "while", "(", "true", ")",...
Returns the package name of a file that has one of the annotations we are looking for. @return Package prefix string or null or no annotations.
[ "Returns", "the", "package", "name", "of", "a", "file", "that", "has", "one", "of", "the", "annotations", "we", "are", "looking", "for", "." ]
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java#L401-L419
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java
OrmLiteConfigUtil.findResRawDir
private static File findResRawDir(File dir) { for (File file : dir.listFiles()) { if (file.getName().equals(RESOURCE_DIR_NAME) && file.isDirectory()) { File[] rawFiles = file.listFiles(new FileFilter() { @Override public boolean accept(File file) { return file.getName().equals(RAW_DIR_NAME) && ...
java
private static File findResRawDir(File dir) { for (File file : dir.listFiles()) { if (file.getName().equals(RESOURCE_DIR_NAME) && file.isDirectory()) { File[] rawFiles = file.listFiles(new FileFilter() { @Override public boolean accept(File file) { return file.getName().equals(RAW_DIR_NAME) && ...
[ "private", "static", "File", "findResRawDir", "(", "File", "dir", ")", "{", "for", "(", "File", "file", ":", "dir", ".", "listFiles", "(", ")", ")", "{", "if", "(", "file", ".", "getName", "(", ")", ".", "equals", "(", "RESOURCE_DIR_NAME", ")", "&&",...
Look for the resource directory with raw beneath it.
[ "Look", "for", "the", "resource", "directory", "with", "raw", "beneath", "it", "." ]
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java#L424-L439
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OpenHelperManager.java
OpenHelperManager.innerSetHelperClass
private static void innerSetHelperClass(Class<? extends OrmLiteSqliteOpenHelper> openHelperClass) { // make sure if that there are not 2 helper classes in an application if (openHelperClass == null) { throw new IllegalStateException("Helper class was trying to be reset to null"); } else if (helperClass == null...
java
private static void innerSetHelperClass(Class<? extends OrmLiteSqliteOpenHelper> openHelperClass) { // make sure if that there are not 2 helper classes in an application if (openHelperClass == null) { throw new IllegalStateException("Helper class was trying to be reset to null"); } else if (helperClass == null...
[ "private", "static", "void", "innerSetHelperClass", "(", "Class", "<", "?", "extends", "OrmLiteSqliteOpenHelper", ">", "openHelperClass", ")", "{", "// make sure if that there are not 2 helper classes in an application", "if", "(", "openHelperClass", "==", "null", ")", "{",...
Set the helper class and make sure we aren't changing it to another class.
[ "Set", "the", "helper", "class", "and", "make", "sure", "we", "aren", "t", "changing", "it", "to", "another", "class", "." ]
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OpenHelperManager.java#L145-L155
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OpenHelperManager.java
OpenHelperManager.constructHelper
private static OrmLiteSqliteOpenHelper constructHelper(Context context, Class<? extends OrmLiteSqliteOpenHelper> openHelperClass) { Constructor<?> constructor; try { constructor = openHelperClass.getConstructor(Context.class); } catch (Exception e) { throw new IllegalStateException( "Could not find ...
java
private static OrmLiteSqliteOpenHelper constructHelper(Context context, Class<? extends OrmLiteSqliteOpenHelper> openHelperClass) { Constructor<?> constructor; try { constructor = openHelperClass.getConstructor(Context.class); } catch (Exception e) { throw new IllegalStateException( "Could not find ...
[ "private", "static", "OrmLiteSqliteOpenHelper", "constructHelper", "(", "Context", "context", ",", "Class", "<", "?", "extends", "OrmLiteSqliteOpenHelper", ">", "openHelperClass", ")", "{", "Constructor", "<", "?", ">", "constructor", ";", "try", "{", "constructor",...
Call the constructor on our helper class.
[ "Call", "the", "constructor", "on", "our", "helper", "class", "." ]
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OpenHelperManager.java#L206-L221
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OpenHelperManager.java
OpenHelperManager.lookupHelperClass
private static Class<? extends OrmLiteSqliteOpenHelper> lookupHelperClass(Context context, Class<?> componentClass) { // see if we have the magic resource class name set Resources resources = context.getResources(); int resourceId = resources.getIdentifier(HELPER_CLASS_RESOURCE_NAME, "string", context.getPackage...
java
private static Class<? extends OrmLiteSqliteOpenHelper> lookupHelperClass(Context context, Class<?> componentClass) { // see if we have the magic resource class name set Resources resources = context.getResources(); int resourceId = resources.getIdentifier(HELPER_CLASS_RESOURCE_NAME, "string", context.getPackage...
[ "private", "static", "Class", "<", "?", "extends", "OrmLiteSqliteOpenHelper", ">", "lookupHelperClass", "(", "Context", "context", ",", "Class", "<", "?", ">", "componentClass", ")", "{", "// see if we have the magic resource class name set", "Resources", "resources", "...
Lookup the helper class either from the resource string or by looking for a generic parameter.
[ "Lookup", "the", "helper", "class", "either", "from", "the", "resource", "string", "or", "by", "looking", "for", "a", "generic", "parameter", "." ]
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OpenHelperManager.java#L226-L273
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/DatabaseTableConfigUtil.java
DatabaseTableConfigUtil.fromClass
public static <T> DatabaseTableConfig<T> fromClass(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); String tableName = DatabaseTableConfig.extractTableName(databaseType, clazz); List<DatabaseFieldConfig> fieldConfigs = new ...
java
public static <T> DatabaseTableConfig<T> fromClass(ConnectionSource connectionSource, Class<T> clazz) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); String tableName = DatabaseTableConfig.extractTableName(databaseType, clazz); List<DatabaseFieldConfig> fieldConfigs = new ...
[ "public", "static", "<", "T", ">", "DatabaseTableConfig", "<", "T", ">", "fromClass", "(", "ConnectionSource", "connectionSource", ",", "Class", "<", "T", ">", "clazz", ")", "throws", "SQLException", "{", "DatabaseType", "databaseType", "=", "connectionSource", ...
Build our list table config from a class using some annotation fu around.
[ "Build", "our", "list", "table", "config", "from", "a", "class", "using", "some", "annotation", "fu", "around", "." ]
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/DatabaseTableConfigUtil.java#L61-L79
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/DatabaseTableConfigUtil.java
DatabaseTableConfigUtil.lookupClasses
private static int[] lookupClasses() { Class<?> annotationMemberArrayClazz; try { annotationFactoryClazz = Class.forName("org.apache.harmony.lang.annotation.AnnotationFactory"); annotationMemberClazz = Class.forName("org.apache.harmony.lang.annotation.AnnotationMember"); annotationMemberArrayClazz = Class....
java
private static int[] lookupClasses() { Class<?> annotationMemberArrayClazz; try { annotationFactoryClazz = Class.forName("org.apache.harmony.lang.annotation.AnnotationFactory"); annotationMemberClazz = Class.forName("org.apache.harmony.lang.annotation.AnnotationMember"); annotationMemberArrayClazz = Class....
[ "private", "static", "int", "[", "]", "lookupClasses", "(", ")", "{", "Class", "<", "?", ">", "annotationMemberArrayClazz", ";", "try", "{", "annotationFactoryClazz", "=", "Class", ".", "forName", "(", "\"org.apache.harmony.lang.annotation.AnnotationFactory\"", ")", ...
This does all of the class reflection fu to find our classes, find the order of field names, and construct our array of ConfigField entries the correspond to the AnnotationMember array.
[ "This", "does", "all", "of", "the", "class", "reflection", "fu", "to", "find", "our", "classes", "find", "the", "order", "of", "field", "names", "and", "construct", "our", "array", "of", "ConfigField", "entries", "the", "correspond", "to", "the", "Annotation...
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/DatabaseTableConfigUtil.java#L92-L144
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/DatabaseTableConfigUtil.java
DatabaseTableConfigUtil.configFieldNameToNum
private static int configFieldNameToNum(String configName) { if (configName.equals("columnName")) { return COLUMN_NAME; } else if (configName.equals("dataType")) { return DATA_TYPE; } else if (configName.equals("defaultValue")) { return DEFAULT_VALUE; } else if (configName.equals("width")) { return ...
java
private static int configFieldNameToNum(String configName) { if (configName.equals("columnName")) { return COLUMN_NAME; } else if (configName.equals("dataType")) { return DATA_TYPE; } else if (configName.equals("defaultValue")) { return DEFAULT_VALUE; } else if (configName.equals("width")) { return ...
[ "private", "static", "int", "configFieldNameToNum", "(", "String", "configName", ")", "{", "if", "(", "configName", ".", "equals", "(", "\"columnName\"", ")", ")", "{", "return", "COLUMN_NAME", ";", "}", "else", "if", "(", "configName", ".", "equals", "(", ...
Convert the name of the @DatabaseField fields into a number for easy processing later.
[ "Convert", "the", "name", "of", "the" ]
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/DatabaseTableConfigUtil.java#L184-L248
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/DatabaseTableConfigUtil.java
DatabaseTableConfigUtil.buildConfig
private static DatabaseFieldConfig buildConfig(DatabaseField databaseField, String tableName, Field field) throws Exception { InvocationHandler proxy = Proxy.getInvocationHandler(databaseField); if (proxy.getClass() != annotationFactoryClazz) { return null; } // this should be an array of AnnotationMember...
java
private static DatabaseFieldConfig buildConfig(DatabaseField databaseField, String tableName, Field field) throws Exception { InvocationHandler proxy = Proxy.getInvocationHandler(databaseField); if (proxy.getClass() != annotationFactoryClazz) { return null; } // this should be an array of AnnotationMember...
[ "private", "static", "DatabaseFieldConfig", "buildConfig", "(", "DatabaseField", "databaseField", ",", "String", "tableName", ",", "Field", "field", ")", "throws", "Exception", "{", "InvocationHandler", "proxy", "=", "Proxy", ".", "getInvocationHandler", "(", "databas...
Instead of calling the annotation methods directly, we peer inside the proxy and investigate the array of AnnotationMember objects stored by the AnnotationFactory.
[ "Instead", "of", "calling", "the", "annotation", "methods", "directly", "we", "peer", "inside", "the", "proxy", "and", "investigate", "the", "array", "of", "AnnotationMember", "objects", "stored", "by", "the", "AnnotationFactory", "." ]
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/DatabaseTableConfigUtil.java#L292-L312
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteBaseActivity.java
OrmLiteBaseActivity.getHelper
public H getHelper() { if (helper == null) { if (!created) { throw new IllegalStateException("A call has not been made to onCreate() yet so the helper is null"); } else if (destroyed) { throw new IllegalStateException( "A call to onDestroy has already been made and the helper cannot be used after ...
java
public H getHelper() { if (helper == null) { if (!created) { throw new IllegalStateException("A call has not been made to onCreate() yet so the helper is null"); } else if (destroyed) { throw new IllegalStateException( "A call to onDestroy has already been made and the helper cannot be used after ...
[ "public", "H", "getHelper", "(", ")", "{", "if", "(", "helper", "==", "null", ")", "{", "if", "(", "!", "created", ")", "{", "throw", "new", "IllegalStateException", "(", "\"A call has not been made to onCreate() yet so the helper is null\"", ")", ";", "}", "els...
Get a helper for this action.
[ "Get", "a", "helper", "for", "this", "action", "." ]
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteBaseActivity.java#L34-L47
train
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/BaseOrmLiteLoader.java
BaseOrmLiteLoader.onStartLoading
@Override protected void onStartLoading() { // XXX: do we really return the cached results _before_ checking if the content has changed? if (cachedResults != null) { deliverResult(cachedResults); } if (takeContentChanged() || cachedResults == null) { forceLoad(); } // watch for data changes dao.reg...
java
@Override protected void onStartLoading() { // XXX: do we really return the cached results _before_ checking if the content has changed? if (cachedResults != null) { deliverResult(cachedResults); } if (takeContentChanged() || cachedResults == null) { forceLoad(); } // watch for data changes dao.reg...
[ "@", "Override", "protected", "void", "onStartLoading", "(", ")", "{", "// XXX: do we really return the cached results _before_ checking if the content has changed?", "if", "(", "cachedResults", "!=", "null", ")", "{", "deliverResult", "(", "cachedResults", ")", ";", "}", ...
Starts an asynchronous load of the data. When the result is ready the callbacks will be called on the UI thread. If a previous load has been completed and is still valid the result may be passed to the callbacks immediately. <p> Must be called from the UI thread. </p>
[ "Starts", "an", "asynchronous", "load", "of", "the", "data", ".", "When", "the", "result", "is", "ready", "the", "callbacks", "will", "be", "called", "on", "the", "UI", "thread", ".", "If", "a", "previous", "load", "has", "been", "completed", "and", "is"...
e82327a868ae242f994730fe2389f79684d7bcab
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/BaseOrmLiteLoader.java#L49-L60
train
Microsoft/spring-data-cosmosdb
src/main/java/com/microsoft/azure/spring/data/cosmosdb/common/TelemetrySender.java
TelemetrySender.executeRequest
private ResponseEntity<String> executeRequest(final TelemetryEventData eventData) { final HttpHeaders headers = new HttpHeaders(); headers.add(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON.toString()); try { final RestTemplate restTemplate = new RestTemplate(); final HttpE...
java
private ResponseEntity<String> executeRequest(final TelemetryEventData eventData) { final HttpHeaders headers = new HttpHeaders(); headers.add(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON.toString()); try { final RestTemplate restTemplate = new RestTemplate(); final HttpE...
[ "private", "ResponseEntity", "<", "String", ">", "executeRequest", "(", "final", "TelemetryEventData", "eventData", ")", "{", "final", "HttpHeaders", "headers", "=", "new", "HttpHeaders", "(", ")", ";", "headers", ".", "add", "(", "HttpHeaders", ".", "CONTENT_TY...
Align the retry times with sdk
[ "Align", "the", "retry", "times", "with", "sdk" ]
f349fce5892f225794eae865ca9a12191cac243c
https://github.com/Microsoft/spring-data-cosmosdb/blob/f349fce5892f225794eae865ca9a12191cac243c/src/main/java/com/microsoft/azure/spring/data/cosmosdb/common/TelemetrySender.java#L39-L54
train
Microsoft/spring-data-cosmosdb
src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java
SimpleDocumentDbRepository.save
@Override public <S extends T> S save(S entity) { Assert.notNull(entity, "entity must not be null"); // save entity if (information.isNew(entity)) { return operation.insert(information.getCollectionName(), entity, createKey(information.get...
java
@Override public <S extends T> S save(S entity) { Assert.notNull(entity, "entity must not be null"); // save entity if (information.isNew(entity)) { return operation.insert(information.getCollectionName(), entity, createKey(information.get...
[ "@", "Override", "public", "<", "S", "extends", "T", ">", "S", "save", "(", "S", "entity", ")", "{", "Assert", ".", "notNull", "(", "entity", ",", "\"entity must not be null\"", ")", ";", "// save entity", "if", "(", "information", ".", "isNew", "(", "en...
save entity without partition @param entity to be saved @param <S> @return entity
[ "save", "entity", "without", "partition" ]
f349fce5892f225794eae865ca9a12191cac243c
https://github.com/Microsoft/spring-data-cosmosdb/blob/f349fce5892f225794eae865ca9a12191cac243c/src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java#L63-L78
train
Microsoft/spring-data-cosmosdb
src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java
SimpleDocumentDbRepository.saveAll
@Override public <S extends T> Iterable<S> saveAll(Iterable<S> entities) { Assert.notNull(entities, "Iterable entities should not be null"); entities.forEach(this::save); return entities; }
java
@Override public <S extends T> Iterable<S> saveAll(Iterable<S> entities) { Assert.notNull(entities, "Iterable entities should not be null"); entities.forEach(this::save); return entities; }
[ "@", "Override", "public", "<", "S", "extends", "T", ">", "Iterable", "<", "S", ">", "saveAll", "(", "Iterable", "<", "S", ">", "entities", ")", "{", "Assert", ".", "notNull", "(", "entities", ",", "\"Iterable entities should not be null\"", ")", ";", "ent...
batch save entities @param entities @param <S> @return
[ "batch", "save", "entities" ]
f349fce5892f225794eae865ca9a12191cac243c
https://github.com/Microsoft/spring-data-cosmosdb/blob/f349fce5892f225794eae865ca9a12191cac243c/src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java#L95-L102
train
Microsoft/spring-data-cosmosdb
src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java
SimpleDocumentDbRepository.findAll
@Override public Iterable<T> findAll() { return operation.findAll(information.getCollectionName(), information.getJavaType()); }
java
@Override public Iterable<T> findAll() { return operation.findAll(information.getCollectionName(), information.getJavaType()); }
[ "@", "Override", "public", "Iterable", "<", "T", ">", "findAll", "(", ")", "{", "return", "operation", ".", "findAll", "(", "information", ".", "getCollectionName", "(", ")", ",", "information", ".", "getJavaType", "(", ")", ")", ";", "}" ]
find all entities from one collection without configuring partition key value @return
[ "find", "all", "entities", "from", "one", "collection", "without", "configuring", "partition", "key", "value" ]
f349fce5892f225794eae865ca9a12191cac243c
https://github.com/Microsoft/spring-data-cosmosdb/blob/f349fce5892f225794eae865ca9a12191cac243c/src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java#L109-L112
train
Microsoft/spring-data-cosmosdb
src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java
SimpleDocumentDbRepository.findAllById
@Override public List<T> findAllById(Iterable<ID> ids) { Assert.notNull(ids, "Iterable ids should not be null"); return operation.findByIds(ids, information.getJavaType(), information.getCollectionName()); }
java
@Override public List<T> findAllById(Iterable<ID> ids) { Assert.notNull(ids, "Iterable ids should not be null"); return operation.findByIds(ids, information.getJavaType(), information.getCollectionName()); }
[ "@", "Override", "public", "List", "<", "T", ">", "findAllById", "(", "Iterable", "<", "ID", ">", "ids", ")", "{", "Assert", ".", "notNull", "(", "ids", ",", "\"Iterable ids should not be null\"", ")", ";", "return", "operation", ".", "findByIds", "(", "id...
find entities based on id list from one collection without partitions @param ids @return
[ "find", "entities", "based", "on", "id", "list", "from", "one", "collection", "without", "partitions" ]
f349fce5892f225794eae865ca9a12191cac243c
https://github.com/Microsoft/spring-data-cosmosdb/blob/f349fce5892f225794eae865ca9a12191cac243c/src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java#L120-L125
train
Microsoft/spring-data-cosmosdb
src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java
SimpleDocumentDbRepository.findById
@Override public Optional<T> findById(ID id) { Assert.notNull(id, "id must not be null"); if (id instanceof String && !StringUtils.hasText((String) id)) { return Optional.empty(); } return Optional.ofNullable(operation.findById(information.getCollectionName(), id, infor...
java
@Override public Optional<T> findById(ID id) { Assert.notNull(id, "id must not be null"); if (id instanceof String && !StringUtils.hasText((String) id)) { return Optional.empty(); } return Optional.ofNullable(operation.findById(information.getCollectionName(), id, infor...
[ "@", "Override", "public", "Optional", "<", "T", ">", "findById", "(", "ID", "id", ")", "{", "Assert", ".", "notNull", "(", "id", ",", "\"id must not be null\"", ")", ";", "if", "(", "id", "instanceof", "String", "&&", "!", "StringUtils", ".", "hasText",...
find one entity per id without partitions @param id @return
[ "find", "one", "entity", "per", "id", "without", "partitions" ]
f349fce5892f225794eae865ca9a12191cac243c
https://github.com/Microsoft/spring-data-cosmosdb/blob/f349fce5892f225794eae865ca9a12191cac243c/src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java#L133-L142
train
Microsoft/spring-data-cosmosdb
src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java
SimpleDocumentDbRepository.deleteById
@Override public void deleteById(ID id) { Assert.notNull(id, "id to be deleted should not be null"); operation.deleteById(information.getCollectionName(), id, null); }
java
@Override public void deleteById(ID id) { Assert.notNull(id, "id to be deleted should not be null"); operation.deleteById(information.getCollectionName(), id, null); }
[ "@", "Override", "public", "void", "deleteById", "(", "ID", "id", ")", "{", "Assert", ".", "notNull", "(", "id", ",", "\"id to be deleted should not be null\"", ")", ";", "operation", ".", "deleteById", "(", "information", ".", "getCollectionName", "(", ")", "...
delete one document per id without configuring partition key value @param id
[ "delete", "one", "document", "per", "id", "without", "configuring", "partition", "key", "value" ]
f349fce5892f225794eae865ca9a12191cac243c
https://github.com/Microsoft/spring-data-cosmosdb/blob/f349fce5892f225794eae865ca9a12191cac243c/src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java#L159-L164
train
Microsoft/spring-data-cosmosdb
src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java
SimpleDocumentDbRepository.delete
@Override public void delete(T entity) { Assert.notNull(entity, "entity to be deleted should not be null"); final String partitionKeyValue = information.getPartitionKeyFieldValue(entity); operation.deleteById(information.getCollectionName(), information.getId(entity), ...
java
@Override public void delete(T entity) { Assert.notNull(entity, "entity to be deleted should not be null"); final String partitionKeyValue = information.getPartitionKeyFieldValue(entity); operation.deleteById(information.getCollectionName(), information.getId(entity), ...
[ "@", "Override", "public", "void", "delete", "(", "T", "entity", ")", "{", "Assert", ".", "notNull", "(", "entity", ",", "\"entity to be deleted should not be null\"", ")", ";", "final", "String", "partitionKeyValue", "=", "information", ".", "getPartitionKeyFieldVa...
delete one document per entity @param entity
[ "delete", "one", "document", "per", "entity" ]
f349fce5892f225794eae865ca9a12191cac243c
https://github.com/Microsoft/spring-data-cosmosdb/blob/f349fce5892f225794eae865ca9a12191cac243c/src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java#L171-L180
train
Microsoft/spring-data-cosmosdb
src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java
SimpleDocumentDbRepository.deleteAll
@Override public void deleteAll(Iterable<? extends T> entities) { Assert.notNull(entities, "Iterable entities should not be null"); StreamSupport.stream(entities.spliterator(), true).forEach(this::delete); }
java
@Override public void deleteAll(Iterable<? extends T> entities) { Assert.notNull(entities, "Iterable entities should not be null"); StreamSupport.stream(entities.spliterator(), true).forEach(this::delete); }
[ "@", "Override", "public", "void", "deleteAll", "(", "Iterable", "<", "?", "extends", "T", ">", "entities", ")", "{", "Assert", ".", "notNull", "(", "entities", ",", "\"Iterable entities should not be null\"", ")", ";", "StreamSupport", ".", "stream", "(", "en...
delete list of entities without partitions @param entities
[ "delete", "list", "of", "entities", "without", "partitions" ]
f349fce5892f225794eae865ca9a12191cac243c
https://github.com/Microsoft/spring-data-cosmosdb/blob/f349fce5892f225794eae865ca9a12191cac243c/src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java#L195-L200
train
Microsoft/spring-data-cosmosdb
src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java
SimpleDocumentDbRepository.existsById
@Override public boolean existsById(ID primaryKey) { Assert.notNull(primaryKey, "primaryKey should not be null"); return findById(primaryKey).isPresent(); }
java
@Override public boolean existsById(ID primaryKey) { Assert.notNull(primaryKey, "primaryKey should not be null"); return findById(primaryKey).isPresent(); }
[ "@", "Override", "public", "boolean", "existsById", "(", "ID", "primaryKey", ")", "{", "Assert", ".", "notNull", "(", "primaryKey", ",", "\"primaryKey should not be null\"", ")", ";", "return", "findById", "(", "primaryKey", ")", ".", "isPresent", "(", ")", ";...
check if an entity exists per id without partition @param primaryKey @return
[ "check", "if", "an", "entity", "exists", "per", "id", "without", "partition" ]
f349fce5892f225794eae865ca9a12191cac243c
https://github.com/Microsoft/spring-data-cosmosdb/blob/f349fce5892f225794eae865ca9a12191cac243c/src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java#L208-L213
train
Microsoft/spring-data-cosmosdb
src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java
SimpleDocumentDbRepository.findAll
@Override public Page<T> findAll(Pageable pageable) { Assert.notNull(pageable, "pageable should not be null"); return operation.findAll(pageable, information.getJavaType(), information.getCollectionName()); }
java
@Override public Page<T> findAll(Pageable pageable) { Assert.notNull(pageable, "pageable should not be null"); return operation.findAll(pageable, information.getJavaType(), information.getCollectionName()); }
[ "@", "Override", "public", "Page", "<", "T", ">", "findAll", "(", "Pageable", "pageable", ")", "{", "Assert", ".", "notNull", "(", "pageable", ",", "\"pageable should not be null\"", ")", ";", "return", "operation", ".", "findAll", "(", "pageable", ",", "inf...
FindQuerySpecGenerator Returns a Page of entities meeting the paging restriction provided in the Pageable object. @param pageable @return a page of entities
[ "FindQuerySpecGenerator", "Returns", "a", "Page", "of", "entities", "meeting", "the", "paging", "restriction", "provided", "in", "the", "Pageable", "object", "." ]
f349fce5892f225794eae865ca9a12191cac243c
https://github.com/Microsoft/spring-data-cosmosdb/blob/f349fce5892f225794eae865ca9a12191cac243c/src/main/java/com/microsoft/azure/spring/data/cosmosdb/repository/support/SimpleDocumentDbRepository.java#L236-L241
train
Microsoft/spring-data-cosmosdb
src/main/java/com/microsoft/azure/spring/data/cosmosdb/core/convert/MappingDocumentDbConverter.java
MappingDocumentDbConverter.toDocumentDBValue
public static Object toDocumentDBValue(Object fromPropertyValue) { if (fromPropertyValue == null) { return null; } // com.microsoft.azure.documentdb.JsonSerializable#set(String, T) cannot set values for Date and Enum correctly if (fromPropertyValue instanceof Date) { ...
java
public static Object toDocumentDBValue(Object fromPropertyValue) { if (fromPropertyValue == null) { return null; } // com.microsoft.azure.documentdb.JsonSerializable#set(String, T) cannot set values for Date and Enum correctly if (fromPropertyValue instanceof Date) { ...
[ "public", "static", "Object", "toDocumentDBValue", "(", "Object", "fromPropertyValue", ")", "{", "if", "(", "fromPropertyValue", "==", "null", ")", "{", "return", "null", ";", "}", "// com.microsoft.azure.documentdb.JsonSerializable#set(String, T) cannot set values for Date a...
Convert a property value to the value stored in CosmosDB @param fromPropertyValue @return
[ "Convert", "a", "property", "value", "to", "the", "value", "stored", "in", "CosmosDB" ]
f349fce5892f225794eae865ca9a12191cac243c
https://github.com/Microsoft/spring-data-cosmosdb/blob/f349fce5892f225794eae865ca9a12191cac243c/src/main/java/com/microsoft/azure/spring/data/cosmosdb/core/convert/MappingDocumentDbConverter.java#L166-L182
train
revelc/formatter-maven-plugin
src/main/java/net/revelc/code/formatter/model/Profiles.java
Profiles.addProfile
public void addProfile(Profile profile) { if (PROFILE_KIND.equals(profile.getKind())) { this.profileList.add(profile.getSettings()); } }
java
public void addProfile(Profile profile) { if (PROFILE_KIND.equals(profile.getKind())) { this.profileList.add(profile.getSettings()); } }
[ "public", "void", "addProfile", "(", "Profile", "profile", ")", "{", "if", "(", "PROFILE_KIND", ".", "equals", "(", "profile", ".", "getKind", "(", ")", ")", ")", "{", "this", ".", "profileList", ".", "add", "(", "profile", ".", "getSettings", "(", ")"...
Adds the profile. @param profile the profile
[ "Adds", "the", "profile", "." ]
a237073ce6220e73ad6b1faef412fe0660485cf4
https://github.com/revelc/formatter-maven-plugin/blob/a237073ce6220e73ad6b1faef412fe0660485cf4/src/main/java/net/revelc/code/formatter/model/Profiles.java#L40-L44
train
revelc/formatter-maven-plugin
src/main/java/net/revelc/code/formatter/model/RuleSet.java
RuleSet.addRuleInstances
@Override public void addRuleInstances(Digester digester) { digester.addObjectCreate("profiles", Profiles.class); digester.addObjectCreate(PROFILES_PROFILE, Profile.class); digester.addObjectCreate(PROFILES_PROFILE_SETTING, Setting.class); digester.addSetNext(PROFILES_PROFILE, "addP...
java
@Override public void addRuleInstances(Digester digester) { digester.addObjectCreate("profiles", Profiles.class); digester.addObjectCreate(PROFILES_PROFILE, Profile.class); digester.addObjectCreate(PROFILES_PROFILE_SETTING, Setting.class); digester.addSetNext(PROFILES_PROFILE, "addP...
[ "@", "Override", "public", "void", "addRuleInstances", "(", "Digester", "digester", ")", "{", "digester", ".", "addObjectCreate", "(", "\"profiles\"", ",", "Profiles", ".", "class", ")", ";", "digester", ".", "addObjectCreate", "(", "PROFILES_PROFILE", ",", "Pro...
Adds the rule instances. @param digester the digester @see org.apache.commons.digester3.RuleSetBase#addRuleInstances(org.apache.commons.digester3.Digester)
[ "Adds", "the", "rule", "instances", "." ]
a237073ce6220e73ad6b1faef412fe0660485cf4
https://github.com/revelc/formatter-maven-plugin/blob/a237073ce6220e73ad6b1faef412fe0660485cf4/src/main/java/net/revelc/code/formatter/model/RuleSet.java#L37-L49
train
revelc/formatter-maven-plugin
src/main/java/net/revelc/code/formatter/FormatterMojo.java
FormatterMojo.addCollectionFiles
List<File> addCollectionFiles(File newBasedir) { final DirectoryScanner ds = new DirectoryScanner(); ds.setBasedir(newBasedir); if (this.includes != null && this.includes.length > 0) { ds.setIncludes(this.includes); } else { ds.setIncludes(DEFAULT_INCLUDES); ...
java
List<File> addCollectionFiles(File newBasedir) { final DirectoryScanner ds = new DirectoryScanner(); ds.setBasedir(newBasedir); if (this.includes != null && this.includes.length > 0) { ds.setIncludes(this.includes); } else { ds.setIncludes(DEFAULT_INCLUDES); ...
[ "List", "<", "File", ">", "addCollectionFiles", "(", "File", "newBasedir", ")", "{", "final", "DirectoryScanner", "ds", "=", "new", "DirectoryScanner", "(", ")", ";", "ds", ".", "setBasedir", "(", "newBasedir", ")", ";", "if", "(", "this", ".", "includes",...
Add source files to the files list.
[ "Add", "source", "files", "to", "the", "files", "list", "." ]
a237073ce6220e73ad6b1faef412fe0660485cf4
https://github.com/revelc/formatter-maven-plugin/blob/a237073ce6220e73ad6b1faef412fe0660485cf4/src/main/java/net/revelc/code/formatter/FormatterMojo.java#L369-L389
train
revelc/formatter-maven-plugin
src/main/java/net/revelc/code/formatter/FormatterMojo.java
FormatterMojo.storeFileHashCache
private void storeFileHashCache(Properties props) { File cacheFile = new File(this.targetDirectory, CACHE_PROPERTIES_FILENAME); try (OutputStream out = new BufferedOutputStream(new FileOutputStream(cacheFile))) { props.store(out, null); } catch (IOException e) { getLog()....
java
private void storeFileHashCache(Properties props) { File cacheFile = new File(this.targetDirectory, CACHE_PROPERTIES_FILENAME); try (OutputStream out = new BufferedOutputStream(new FileOutputStream(cacheFile))) { props.store(out, null); } catch (IOException e) { getLog()....
[ "private", "void", "storeFileHashCache", "(", "Properties", "props", ")", "{", "File", "cacheFile", "=", "new", "File", "(", "this", ".", "targetDirectory", ",", "CACHE_PROPERTIES_FILENAME", ")", ";", "try", "(", "OutputStream", "out", "=", "new", "BufferedOutpu...
Store file hash cache. @param props the props
[ "Store", "file", "hash", "cache", "." ]
a237073ce6220e73ad6b1faef412fe0660485cf4
https://github.com/revelc/formatter-maven-plugin/blob/a237073ce6220e73ad6b1faef412fe0660485cf4/src/main/java/net/revelc/code/formatter/FormatterMojo.java#L411-L418
train
revelc/formatter-maven-plugin
src/main/java/net/revelc/code/formatter/FormatterMojo.java
FormatterMojo.readFileHashCacheFile
private Properties readFileHashCacheFile() { Properties props = new Properties(); Log log = getLog(); if (!this.targetDirectory.exists()) { this.targetDirectory.mkdirs(); } else if (!this.targetDirectory.isDirectory()) { log.warn("Something strange here as the '" ...
java
private Properties readFileHashCacheFile() { Properties props = new Properties(); Log log = getLog(); if (!this.targetDirectory.exists()) { this.targetDirectory.mkdirs(); } else if (!this.targetDirectory.isDirectory()) { log.warn("Something strange here as the '" ...
[ "private", "Properties", "readFileHashCacheFile", "(", ")", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "Log", "log", "=", "getLog", "(", ")", ";", "if", "(", "!", "this", ".", "targetDirectory", ".", "exists", "(", ")", ")", "...
Read file hash cache file. @return the properties
[ "Read", "file", "hash", "cache", "file", "." ]
a237073ce6220e73ad6b1faef412fe0660485cf4
https://github.com/revelc/formatter-maven-plugin/blob/a237073ce6220e73ad6b1faef412fe0660485cf4/src/main/java/net/revelc/code/formatter/FormatterMojo.java#L425-L447
train
revelc/formatter-maven-plugin
src/main/java/net/revelc/code/formatter/FormatterMojo.java
FormatterMojo.formatFile
private void formatFile(File file, ResultCollector rc, Properties hashCache, String basedirPath) throws MojoFailureException, MojoExecutionException { try { doFormatFile(file, rc, hashCache, basedirPath, false); } catch (IOException | MalformedTreeException | BadLocationException...
java
private void formatFile(File file, ResultCollector rc, Properties hashCache, String basedirPath) throws MojoFailureException, MojoExecutionException { try { doFormatFile(file, rc, hashCache, basedirPath, false); } catch (IOException | MalformedTreeException | BadLocationException...
[ "private", "void", "formatFile", "(", "File", "file", ",", "ResultCollector", "rc", ",", "Properties", "hashCache", ",", "String", "basedirPath", ")", "throws", "MojoFailureException", ",", "MojoExecutionException", "{", "try", "{", "doFormatFile", "(", "file", ",...
Format file. @param file the file @param rc the rc @param hashCache the hash cache @param basedirPath the basedir path
[ "Format", "file", "." ]
a237073ce6220e73ad6b1faef412fe0660485cf4
https://github.com/revelc/formatter-maven-plugin/blob/a237073ce6220e73ad6b1faef412fe0660485cf4/src/main/java/net/revelc/code/formatter/FormatterMojo.java#L461-L469
train
revelc/formatter-maven-plugin
src/main/java/net/revelc/code/formatter/FormatterMojo.java
FormatterMojo.readFileAsString
private String readFileAsString(File file) throws java.io.IOException { StringBuilder fileData = new StringBuilder(1000); try (BufferedReader reader = new BufferedReader(ReaderFactory.newReader(file, this.encoding))) { char[] buf = new char[1024]; int numRead = 0; whi...
java
private String readFileAsString(File file) throws java.io.IOException { StringBuilder fileData = new StringBuilder(1000); try (BufferedReader reader = new BufferedReader(ReaderFactory.newReader(file, this.encoding))) { char[] buf = new char[1024]; int numRead = 0; whi...
[ "private", "String", "readFileAsString", "(", "File", "file", ")", "throws", "java", ".", "io", ".", "IOException", "{", "StringBuilder", "fileData", "=", "new", "StringBuilder", "(", "1000", ")", ";", "try", "(", "BufferedReader", "reader", "=", "new", "Buf...
Read the given file and return the content as a string. @param file the file @return the string @throws IOException Signals that an I/O exception has occurred.
[ "Read", "the", "given", "file", "and", "return", "the", "content", "as", "a", "string", "." ]
a237073ce6220e73ad6b1faef412fe0660485cf4
https://github.com/revelc/formatter-maven-plugin/blob/a237073ce6220e73ad6b1faef412fe0660485cf4/src/main/java/net/revelc/code/formatter/FormatterMojo.java#L597-L609
train
revelc/formatter-maven-plugin
src/main/java/net/revelc/code/formatter/FormatterMojo.java
FormatterMojo.writeStringToFile
private void writeStringToFile(String str, File file) throws IOException { if (!file.exists() && file.isDirectory()) { return; } try (BufferedWriter bw = new BufferedWriter(WriterFactory.newWriter(file, this.encoding))) { bw.write(str); } }
java
private void writeStringToFile(String str, File file) throws IOException { if (!file.exists() && file.isDirectory()) { return; } try (BufferedWriter bw = new BufferedWriter(WriterFactory.newWriter(file, this.encoding))) { bw.write(str); } }
[ "private", "void", "writeStringToFile", "(", "String", "str", ",", "File", "file", ")", "throws", "IOException", "{", "if", "(", "!", "file", ".", "exists", "(", ")", "&&", "file", ".", "isDirectory", "(", ")", ")", "{", "return", ";", "}", "try", "(...
Write the given string to a file. @param str the str @param file the file @throws IOException Signals that an I/O exception has occurred.
[ "Write", "the", "given", "string", "to", "a", "file", "." ]
a237073ce6220e73ad6b1faef412fe0660485cf4
https://github.com/revelc/formatter-maven-plugin/blob/a237073ce6220e73ad6b1faef412fe0660485cf4/src/main/java/net/revelc/code/formatter/FormatterMojo.java#L621-L629
train
codecentric/spring-boot-starter-batch-web
batch-web-spring-boot-autoconfigure/src/main/java/de/codecentric/batch/web/JobOperationsController.java
JobOperationsController.getNextJobParameters
private JobParameters getNextJobParameters(Job job) throws JobParametersNotFoundException { String jobIdentifier = job.getName(); JobParameters jobParameters; List<JobInstance> lastInstances = jobExplorer.getJobInstances(jobIdentifier, 0, 1); JobParametersIncrementer incrementer = job.getJobParametersIncrement...
java
private JobParameters getNextJobParameters(Job job) throws JobParametersNotFoundException { String jobIdentifier = job.getName(); JobParameters jobParameters; List<JobInstance> lastInstances = jobExplorer.getJobInstances(jobIdentifier, 0, 1); JobParametersIncrementer incrementer = job.getJobParametersIncrement...
[ "private", "JobParameters", "getNextJobParameters", "(", "Job", "job", ")", "throws", "JobParametersNotFoundException", "{", "String", "jobIdentifier", "=", "job", ".", "getName", "(", ")", ";", "JobParameters", "jobParameters", ";", "List", "<", "JobInstance", ">",...
Borrowed from CommandLineJobRunner. @param job the job that we need to find the next parameters for @return the next job parameters if they can be located @throws JobParametersNotFoundException if there is a problem
[ "Borrowed", "from", "CommandLineJobRunner", "." ]
faf5f59f179f82621dd6709cbde6240214f51864
https://github.com/codecentric/spring-boot-starter-batch-web/blob/faf5f59f179f82621dd6709cbde6240214f51864/batch-web-spring-boot-autoconfigure/src/main/java/de/codecentric/batch/web/JobOperationsController.java#L233-L251
train
codecentric/spring-boot-starter-batch-web
batch-web-spring-boot-samples/batch-boot-simple/src/main/java/de/codecentric/batch/simple/item/DummyItemReader.java
DummyItemReader.read
@Override public String read() throws Exception { String item = null; if (index < input.length) { item = input[index++]; LOGGER.info(item); return item; } else { return null; } }
java
@Override public String read() throws Exception { String item = null; if (index < input.length) { item = input[index++]; LOGGER.info(item); return item; } else { return null; } }
[ "@", "Override", "public", "String", "read", "(", ")", "throws", "Exception", "{", "String", "item", "=", "null", ";", "if", "(", "index", "<", "input", ".", "length", ")", "{", "item", "=", "input", "[", "index", "++", "]", ";", "LOGGER", ".", "in...
Reads next record from input
[ "Reads", "next", "record", "from", "input" ]
faf5f59f179f82621dd6709cbde6240214f51864
https://github.com/codecentric/spring-boot-starter-batch-web/blob/faf5f59f179f82621dd6709cbde6240214f51864/batch-web-spring-boot-samples/batch-boot-simple/src/main/java/de/codecentric/batch/simple/item/DummyItemReader.java#L21-L32
train
Netflix/astyanax
astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java
ShardedDistributedMessageQueue.getShardKey
String getShardKey(Message message) { return getShardKey(message.getTokenTime(), this.modShardPolicy.getMessageShard(message, metadata)); }
java
String getShardKey(Message message) { return getShardKey(message.getTokenTime(), this.modShardPolicy.getMessageShard(message, metadata)); }
[ "String", "getShardKey", "(", "Message", "message", ")", "{", "return", "getShardKey", "(", "message", ".", "getTokenTime", "(", ")", ",", "this", ".", "modShardPolicy", ".", "getMessageShard", "(", "message", ",", "metadata", ")", ")", ";", "}" ]
Return the shard for this message @param message @return
[ "Return", "the", "shard", "for", "this", "message" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java#L420-L422
train
Netflix/astyanax
astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java
ShardedDistributedMessageQueue.getShardKey
private String getShardKey(long messageTime, int modShard) { long timePartition; if (metadata.getPartitionDuration() != null) timePartition = (messageTime / metadata.getPartitionDuration()) % metadata.getPartitionCount(); else timePartition = 0; return getName() +...
java
private String getShardKey(long messageTime, int modShard) { long timePartition; if (metadata.getPartitionDuration() != null) timePartition = (messageTime / metadata.getPartitionDuration()) % metadata.getPartitionCount(); else timePartition = 0; return getName() +...
[ "private", "String", "getShardKey", "(", "long", "messageTime", ",", "int", "modShard", ")", "{", "long", "timePartition", ";", "if", "(", "metadata", ".", "getPartitionDuration", "(", ")", "!=", "null", ")", "timePartition", "=", "(", "messageTime", "/", "m...
Return the shard for this timestamp @param messageTime @param modShard @return
[ "Return", "the", "shard", "for", "this", "timestamp" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java#L430-L437
train
Netflix/astyanax
astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java
ShardedDistributedMessageQueue.getKeyHistory
@Override public List<MessageHistory> getKeyHistory(String key, Long startTime, Long endTime, int count) throws MessageQueueException { List<MessageHistory> list = Lists.newArrayList(); ColumnList<UUID> columns; try { columns = keyspace.prepareQuery(historyColumnFamily) ...
java
@Override public List<MessageHistory> getKeyHistory(String key, Long startTime, Long endTime, int count) throws MessageQueueException { List<MessageHistory> list = Lists.newArrayList(); ColumnList<UUID> columns; try { columns = keyspace.prepareQuery(historyColumnFamily) ...
[ "@", "Override", "public", "List", "<", "MessageHistory", ">", "getKeyHistory", "(", "String", "key", ",", "Long", "startTime", ",", "Long", "endTime", ",", "int", "count", ")", "throws", "MessageQueueException", "{", "List", "<", "MessageHistory", ">", "list"...
Return history for a single key for the specified time range TODO: honor the time range :)
[ "Return", "history", "for", "a", "single", "key", "for", "the", "specified", "time", "range" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java#L988-L1010
train
Netflix/astyanax
astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java
ShardedDistributedMessageQueue.peekMessages
@Override public List<Message> peekMessages(int itemsToPeek) throws MessageQueueException { List<Message> messages = Lists.newArrayList(); for (MessageQueueShard shard : shardReaderPolicy.listShards()) { messages.addAll(peekMessages(shard.getName(), itemsToPeek - messages.size())); ...
java
@Override public List<Message> peekMessages(int itemsToPeek) throws MessageQueueException { List<Message> messages = Lists.newArrayList(); for (MessageQueueShard shard : shardReaderPolicy.listShards()) { messages.addAll(peekMessages(shard.getName(), itemsToPeek - messages.size())); ...
[ "@", "Override", "public", "List", "<", "Message", ">", "peekMessages", "(", "int", "itemsToPeek", ")", "throws", "MessageQueueException", "{", "List", "<", "Message", ">", "messages", "=", "Lists", ".", "newArrayList", "(", ")", ";", "for", "(", "MessageQue...
Iterate through shards attempting to extract itemsToPeek items. Will return once itemToPeek items have been read or all shards have been checked. Note that this call does not take into account the message trigger time and will likely return messages that aren't due to be executed yet. @return List of items
[ "Iterate", "through", "shards", "attempting", "to", "extract", "itemsToPeek", "items", ".", "Will", "return", "once", "itemToPeek", "items", "have", "been", "read", "or", "all", "shards", "have", "been", "checked", "." ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java#L1020-L1032
train
Netflix/astyanax
astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java
ShardedDistributedMessageQueue.peekMessages
private Collection<Message> peekMessages(String shardName, int itemsToPeek) throws MessageQueueException { try { ColumnList<MessageQueueEntry> result = keyspace.prepareQuery(queueColumnFamily) .setConsistencyLevel(consistencyLevel) .getKey(shardName) ...
java
private Collection<Message> peekMessages(String shardName, int itemsToPeek) throws MessageQueueException { try { ColumnList<MessageQueueEntry> result = keyspace.prepareQuery(queueColumnFamily) .setConsistencyLevel(consistencyLevel) .getKey(shardName) ...
[ "private", "Collection", "<", "Message", ">", "peekMessages", "(", "String", "shardName", ",", "int", "itemsToPeek", ")", "throws", "MessageQueueException", "{", "try", "{", "ColumnList", "<", "MessageQueueEntry", ">", "result", "=", "keyspace", ".", "prepareQuery...
Peek into messages contained in the shard. This call does not take trigger time into account and will return messages that are not yet due to be executed @param shardName @param itemsToPeek @return @throws MessageQueueException
[ "Peek", "into", "messages", "contained", "in", "the", "shard", ".", "This", "call", "does", "not", "take", "trigger", "time", "into", "account", "and", "will", "return", "messages", "that", "are", "not", "yet", "due", "to", "be", "executed" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java#L1042-L1069
train
Netflix/astyanax
astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java
ShardedDistributedMessageQueue.extractMessageFromColumn
Message extractMessageFromColumn(Column<MessageQueueEntry> column) { // Next, parse the message metadata and add a timeout entry Message message = null; try { ByteArrayInputStream bais = new ByteArrayInputStream(column.getByteArrayValue()); message = mapper.readValue(bais...
java
Message extractMessageFromColumn(Column<MessageQueueEntry> column) { // Next, parse the message metadata and add a timeout entry Message message = null; try { ByteArrayInputStream bais = new ByteArrayInputStream(column.getByteArrayValue()); message = mapper.readValue(bais...
[ "Message", "extractMessageFromColumn", "(", "Column", "<", "MessageQueueEntry", ">", "column", ")", "{", "// Next, parse the message metadata and add a timeout entry", "Message", "message", "=", "null", ";", "try", "{", "ByteArrayInputStream", "bais", "=", "new", "ByteArr...
Extract a message body from a column @param column @return
[ "Extract", "a", "message", "body", "from", "a", "column" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java#L1076-L1092
train
Netflix/astyanax
astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java
ShardedDistributedMessageQueue.hasMessages
private boolean hasMessages(String shardName) throws MessageQueueException { UUID currentTime = TimeUUIDUtils.getUniqueTimeUUIDinMicros(); try { ColumnList<MessageQueueEntry> result = keyspace.prepareQuery(queueColumnFamily) .setConsistencyLevel(consistencyLevel) ...
java
private boolean hasMessages(String shardName) throws MessageQueueException { UUID currentTime = TimeUUIDUtils.getUniqueTimeUUIDinMicros(); try { ColumnList<MessageQueueEntry> result = keyspace.prepareQuery(queueColumnFamily) .setConsistencyLevel(consistencyLevel) ...
[ "private", "boolean", "hasMessages", "(", "String", "shardName", ")", "throws", "MessageQueueException", "{", "UUID", "currentTime", "=", "TimeUUIDUtils", ".", "getUniqueTimeUUIDinMicros", "(", ")", ";", "try", "{", "ColumnList", "<", "MessageQueueEntry", ">", "resu...
Fast check to see if a shard has messages to process @param shardName @throws MessageQueueException
[ "Fast", "check", "to", "see", "if", "a", "shard", "has", "messages", "to", "process" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java#L1099-L1125
train
Netflix/astyanax
astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/ColumnPrefixDistributedRowLock.java
ColumnPrefixDistributedRowLock.verifyLock
public void verifyLock(long curTimeInMicros) throws Exception, BusyLockException, StaleLockException { if (lockColumn == null) throw new IllegalStateException("verifyLock() called without attempting to take the lock"); // Read back all columns. There should be only 1 if we got the ...
java
public void verifyLock(long curTimeInMicros) throws Exception, BusyLockException, StaleLockException { if (lockColumn == null) throw new IllegalStateException("verifyLock() called without attempting to take the lock"); // Read back all columns. There should be only 1 if we got the ...
[ "public", "void", "verifyLock", "(", "long", "curTimeInMicros", ")", "throws", "Exception", ",", "BusyLockException", ",", "StaleLockException", "{", "if", "(", "lockColumn", "==", "null", ")", "throw", "new", "IllegalStateException", "(", "\"verifyLock() called witho...
Verify that the lock was acquired. This shouldn't be called unless it's part of a recipe built on top of ColumnPrefixDistributedRowLock. @param curTimeInMicros @throws BusyLockException
[ "Verify", "that", "the", "lock", "was", "acquired", ".", "This", "shouldn", "t", "be", "called", "unless", "it", "s", "part", "of", "a", "recipe", "built", "on", "top", "of", "ColumnPrefixDistributedRowLock", "." ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/ColumnPrefixDistributedRowLock.java#L282-L303
train
Netflix/astyanax
astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/ColumnPrefixDistributedRowLock.java
ColumnPrefixDistributedRowLock.release
@Override public void release() throws Exception { if (!locksToDelete.isEmpty() || lockColumn != null) { MutationBatch m = keyspace.prepareMutationBatch().setConsistencyLevel(consistencyLevel); fillReleaseMutation(m, false); m.execute(); } }
java
@Override public void release() throws Exception { if (!locksToDelete.isEmpty() || lockColumn != null) { MutationBatch m = keyspace.prepareMutationBatch().setConsistencyLevel(consistencyLevel); fillReleaseMutation(m, false); m.execute(); } }
[ "@", "Override", "public", "void", "release", "(", ")", "throws", "Exception", "{", "if", "(", "!", "locksToDelete", ".", "isEmpty", "(", ")", "||", "lockColumn", "!=", "null", ")", "{", "MutationBatch", "m", "=", "keyspace", ".", "prepareMutationBatch", "...
Release the lock by releasing this and any other stale lock columns
[ "Release", "the", "lock", "by", "releasing", "this", "and", "any", "other", "stale", "lock", "columns" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/ColumnPrefixDistributedRowLock.java#L308-L315
train
Netflix/astyanax
astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/ColumnPrefixDistributedRowLock.java
ColumnPrefixDistributedRowLock.releaseLocks
public Map<String, Long> releaseLocks(boolean force) throws Exception { Map<String, Long> locksToDelete = readLockColumns(); MutationBatch m = keyspace.prepareMutationBatch().setConsistencyLevel(consistencyLevel); ColumnListMutation<String> row = m.withRow(columnFamily, key); long now =...
java
public Map<String, Long> releaseLocks(boolean force) throws Exception { Map<String, Long> locksToDelete = readLockColumns(); MutationBatch m = keyspace.prepareMutationBatch().setConsistencyLevel(consistencyLevel); ColumnListMutation<String> row = m.withRow(columnFamily, key); long now =...
[ "public", "Map", "<", "String", ",", "Long", ">", "releaseLocks", "(", "boolean", "force", ")", "throws", "Exception", "{", "Map", "<", "String", ",", "Long", ">", "locksToDelete", "=", "readLockColumns", "(", ")", ";", "MutationBatch", "m", "=", "keyspace...
Delete locks columns. Set force=true to remove locks that haven't expired yet. This operation first issues a read to cassandra and then deletes columns in the response. @param force - Force delete of non expired locks as well @return Map of locks released @throws Exception
[ "Delete", "locks", "columns", ".", "Set", "force", "=", "true", "to", "remove", "locks", "that", "haven", "t", "expired", "yet", "." ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/ColumnPrefixDistributedRowLock.java#L428-L442
train
Netflix/astyanax
astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/ColumnPrefixDistributedRowLock.java
ColumnPrefixDistributedRowLock.generateTimeoutValue
private ByteBuffer generateTimeoutValue(long timeout) { if (columnFamily.getDefaultValueSerializer() == ByteBufferSerializer.get() || columnFamily.getDefaultValueSerializer() == LongSerializer.get()) { return LongSerializer.get().toByteBuffer(timeout); } else { ...
java
private ByteBuffer generateTimeoutValue(long timeout) { if (columnFamily.getDefaultValueSerializer() == ByteBufferSerializer.get() || columnFamily.getDefaultValueSerializer() == LongSerializer.get()) { return LongSerializer.get().toByteBuffer(timeout); } else { ...
[ "private", "ByteBuffer", "generateTimeoutValue", "(", "long", "timeout", ")", "{", "if", "(", "columnFamily", ".", "getDefaultValueSerializer", "(", ")", "==", "ByteBufferSerializer", ".", "get", "(", ")", "||", "columnFamily", ".", "getDefaultValueSerializer", "(",...
Generate the expire time value to put in the column value. @param timeout
[ "Generate", "the", "expire", "time", "value", "to", "put", "in", "the", "column", "value", "." ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/ColumnPrefixDistributedRowLock.java#L482-L490
train
Netflix/astyanax
astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/ColumnPrefixDistributedRowLock.java
ColumnPrefixDistributedRowLock.readTimeoutValue
public long readTimeoutValue(Column<?> column) { if (columnFamily.getDefaultValueSerializer() == ByteBufferSerializer.get() || columnFamily.getDefaultValueSerializer() == LongSerializer.get()) { return column.getLongValue(); } else { return Long.parseLong(colu...
java
public long readTimeoutValue(Column<?> column) { if (columnFamily.getDefaultValueSerializer() == ByteBufferSerializer.get() || columnFamily.getDefaultValueSerializer() == LongSerializer.get()) { return column.getLongValue(); } else { return Long.parseLong(colu...
[ "public", "long", "readTimeoutValue", "(", "Column", "<", "?", ">", "column", ")", "{", "if", "(", "columnFamily", ".", "getDefaultValueSerializer", "(", ")", "==", "ByteBufferSerializer", ".", "get", "(", ")", "||", "columnFamily", ".", "getDefaultValueSerializ...
Read the expiration time from the column value @param column
[ "Read", "the", "expiration", "time", "from", "the", "column", "value" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/ColumnPrefixDistributedRowLock.java#L496-L504
train
Netflix/astyanax
astyanax-cassandra/src/main/java/com/netflix/astyanax/util/WriteAheadMutationBatchExecutor.java
WriteAheadMutationBatchExecutor.replayWal
public List<ListenableFuture<OperationResult<Void>>> replayWal(int count) { List<ListenableFuture<OperationResult<Void>>> futures = Lists.newArrayList(); WriteAheadEntry walEntry; while (null != (walEntry = wal.readNextEntry()) && count-- > 0) { MutationBatch m = keyspace.prepareMuta...
java
public List<ListenableFuture<OperationResult<Void>>> replayWal(int count) { List<ListenableFuture<OperationResult<Void>>> futures = Lists.newArrayList(); WriteAheadEntry walEntry; while (null != (walEntry = wal.readNextEntry()) && count-- > 0) { MutationBatch m = keyspace.prepareMuta...
[ "public", "List", "<", "ListenableFuture", "<", "OperationResult", "<", "Void", ">", ">", ">", "replayWal", "(", "int", "count", ")", "{", "List", "<", "ListenableFuture", "<", "OperationResult", "<", "Void", ">>>", "futures", "=", "Lists", ".", "newArrayLis...
Replay records from the WAL
[ "Replay", "records", "from", "the", "WAL" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-cassandra/src/main/java/com/netflix/astyanax/util/WriteAheadMutationBatchExecutor.java#L71-L85
train
Netflix/astyanax
astyanax-cassandra/src/main/java/com/netflix/astyanax/util/WriteAheadMutationBatchExecutor.java
WriteAheadMutationBatchExecutor.execute
public ListenableFuture<OperationResult<Void>> execute(final MutationBatch m) throws WalException { final WriteAheadEntry walEntry = wal.createEntry(); walEntry.writeMutation(m); return executeWalEntry(walEntry, m); }
java
public ListenableFuture<OperationResult<Void>> execute(final MutationBatch m) throws WalException { final WriteAheadEntry walEntry = wal.createEntry(); walEntry.writeMutation(m); return executeWalEntry(walEntry, m); }
[ "public", "ListenableFuture", "<", "OperationResult", "<", "Void", ">", ">", "execute", "(", "final", "MutationBatch", "m", ")", "throws", "WalException", "{", "final", "WriteAheadEntry", "walEntry", "=", "wal", ".", "createEntry", "(", ")", ";", "walEntry", "...
Write a mutation to the wal and execute it
[ "Write", "a", "mutation", "to", "the", "wal", "and", "execute", "it" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-cassandra/src/main/java/com/netflix/astyanax/util/WriteAheadMutationBatchExecutor.java#L90-L94
train
Netflix/astyanax
astyanax-cassandra/src/main/java/com/netflix/astyanax/mapping/Mapping.java
Mapping.getColumnValue
public <V> V getColumnValue(T instance, String columnName, Class<V> valueClass) { Field field = fields.get(columnName); if (field == null) { throw new IllegalArgumentException("Column not found: " + columnName); } try { return value...
java
public <V> V getColumnValue(T instance, String columnName, Class<V> valueClass) { Field field = fields.get(columnName); if (field == null) { throw new IllegalArgumentException("Column not found: " + columnName); } try { return value...
[ "public", "<", "V", ">", "V", "getColumnValue", "(", "T", "instance", ",", "String", "columnName", ",", "Class", "<", "V", ">", "valueClass", ")", "{", "Field", "field", "=", "fields", ".", "get", "(", "columnName", ")", ";", "if", "(", "field", "=="...
Return the value for the given column from the given instance @param instance the instance @param columnName name of the column (must match a corresponding annotated field in the instance's class) @param valueClass type of the value (must match the actual native type in the instance's class) @return value
[ "Return", "the", "value", "for", "the", "given", "column", "from", "the", "given", "instance" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-cassandra/src/main/java/com/netflix/astyanax/mapping/Mapping.java#L180-L192
train
Netflix/astyanax
astyanax-cassandra/src/main/java/com/netflix/astyanax/mapping/Mapping.java
Mapping.setColumnValue
public <V> void setColumnValue(T instance, String columnName, V value) { Field field = fields.get(columnName); if (field == null) { throw new IllegalArgumentException("Column not found: " + columnName); } try { field.set(instance, value); ...
java
public <V> void setColumnValue(T instance, String columnName, V value) { Field field = fields.get(columnName); if (field == null) { throw new IllegalArgumentException("Column not found: " + columnName); } try { field.set(instance, value); ...
[ "public", "<", "V", ">", "void", "setColumnValue", "(", "T", "instance", ",", "String", "columnName", ",", "V", "value", ")", "{", "Field", "field", "=", "fields", ".", "get", "(", "columnName", ")", ";", "if", "(", "field", "==", "null", ")", "{", ...
Set the value for the given column for the given instance @param instance the instance @param columnName name of the column (must match a corresponding annotated field in the instance's class) @param value The value (must match the actual native type in the instance's class)
[ "Set", "the", "value", "for", "the", "given", "column", "for", "the", "given", "instance" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-cassandra/src/main/java/com/netflix/astyanax/mapping/Mapping.java#L219-L230
train
Netflix/astyanax
astyanax-cassandra/src/main/java/com/netflix/astyanax/mapping/Mapping.java
Mapping.fillMutation
public void fillMutation(T instance, ColumnListMutation<String> mutation) { for (String fieldName : getNames()) { Coercions.setColumnMutationFromField(instance, fields.get(fieldName), fieldName, mutation); } }
java
public void fillMutation(T instance, ColumnListMutation<String> mutation) { for (String fieldName : getNames()) { Coercions.setColumnMutationFromField(instance, fields.get(fieldName), fieldName, mutation); } }
[ "public", "void", "fillMutation", "(", "T", "instance", ",", "ColumnListMutation", "<", "String", ">", "mutation", ")", "{", "for", "(", "String", "fieldName", ":", "getNames", "(", ")", ")", "{", "Coercions", ".", "setColumnMutationFromField", "(", "instance"...
Map a bean to a column mutation. i.e. set the columns in the mutation to the corresponding values from the instance @param instance instance @param mutation mutation
[ "Map", "a", "bean", "to", "a", "column", "mutation", ".", "i", ".", "e", ".", "set", "the", "columns", "in", "the", "mutation", "to", "the", "corresponding", "values", "from", "the", "instance" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-cassandra/src/main/java/com/netflix/astyanax/mapping/Mapping.java#L241-L245
train
Netflix/astyanax
astyanax-cassandra/src/main/java/com/netflix/astyanax/mapping/Mapping.java
Mapping.newInstance
public T newInstance(ColumnList<String> columns) throws IllegalAccessException, InstantiationException { return initInstance(clazz.newInstance(), columns); }
java
public T newInstance(ColumnList<String> columns) throws IllegalAccessException, InstantiationException { return initInstance(clazz.newInstance(), columns); }
[ "public", "T", "newInstance", "(", "ColumnList", "<", "String", ">", "columns", ")", "throws", "IllegalAccessException", ",", "InstantiationException", "{", "return", "initInstance", "(", "clazz", ".", "newInstance", "(", ")", ",", "columns", ")", ";", "}" ]
Allocate a new instance and populate it with the values from the given column list @param columns column list @return the allocated instance @throws IllegalAccessException if a new instance could not be instantiated @throws InstantiationException if a new instance could not be instantiated
[ "Allocate", "a", "new", "instance", "and", "populate", "it", "with", "the", "values", "from", "the", "given", "column", "list" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-cassandra/src/main/java/com/netflix/astyanax/mapping/Mapping.java#L259-L262
train
Netflix/astyanax
astyanax-cassandra/src/main/java/com/netflix/astyanax/mapping/Mapping.java
Mapping.initInstance
public T initInstance(T instance, ColumnList<String> columns) { for (com.netflix.astyanax.model.Column<String> column : columns) { Field field = fields.get(column.getName()); if (field != null) { // otherwise it may be a column that was // removed, etc. ...
java
public T initInstance(T instance, ColumnList<String> columns) { for (com.netflix.astyanax.model.Column<String> column : columns) { Field field = fields.get(column.getName()); if (field != null) { // otherwise it may be a column that was // removed, etc. ...
[ "public", "T", "initInstance", "(", "T", "instance", ",", "ColumnList", "<", "String", ">", "columns", ")", "{", "for", "(", "com", ".", "netflix", ".", "astyanax", ".", "model", ".", "Column", "<", "String", ">", "column", ":", "columns", ")", "{", ...
Populate the given instance with the values from the given column list @param instance instance @param columns column this @return instance (as a convenience for chaining)
[ "Populate", "the", "given", "instance", "with", "the", "values", "from", "the", "given", "column", "list" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-cassandra/src/main/java/com/netflix/astyanax/mapping/Mapping.java#L273-L282
train
Netflix/astyanax
astyanax-cassandra/src/main/java/com/netflix/astyanax/mapping/Mapping.java
Mapping.getAll
public List<T> getAll(Rows<?, String> rows) throws InstantiationException, IllegalAccessException { List<T> list = Lists.newArrayList(); for (Row<?, String> row : rows) { if (!row.getColumns().isEmpty()) { list.add(newInstance(row.getColumns())); } ...
java
public List<T> getAll(Rows<?, String> rows) throws InstantiationException, IllegalAccessException { List<T> list = Lists.newArrayList(); for (Row<?, String> row : rows) { if (!row.getColumns().isEmpty()) { list.add(newInstance(row.getColumns())); } ...
[ "public", "List", "<", "T", ">", "getAll", "(", "Rows", "<", "?", ",", "String", ">", "rows", ")", "throws", "InstantiationException", ",", "IllegalAccessException", "{", "List", "<", "T", ">", "list", "=", "Lists", ".", "newArrayList", "(", ")", ";", ...
Load a set of rows into new instances populated with values from the column lists @param rows the rows @return list of new instances @throws IllegalAccessException if a new instance could not be instantiated @throws InstantiationException if a new instance could not be instantiated
[ "Load", "a", "set", "of", "rows", "into", "new", "instances", "populated", "with", "values", "from", "the", "column", "lists" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-cassandra/src/main/java/com/netflix/astyanax/mapping/Mapping.java#L296-L305
train
Netflix/astyanax
astyanax-cql/src/main/java/com/netflix/astyanax/cql/reads/CFRowKeysQueryGen.java
CFRowKeysQueryGen.getQueryStatement
public BoundStatement getQueryStatement(CqlRowSliceQueryImpl<?,?> rowSliceQuery, boolean useCaching) { switch (rowSliceQuery.getColQueryType()) { case AllColumns: return SelectAllColumnsForRowKeys.getBoundStatement(rowSliceQuery, useCaching); case ColumnSet: return SelectColumnSetForRowKeys.getBoundState...
java
public BoundStatement getQueryStatement(CqlRowSliceQueryImpl<?,?> rowSliceQuery, boolean useCaching) { switch (rowSliceQuery.getColQueryType()) { case AllColumns: return SelectAllColumnsForRowKeys.getBoundStatement(rowSliceQuery, useCaching); case ColumnSet: return SelectColumnSetForRowKeys.getBoundState...
[ "public", "BoundStatement", "getQueryStatement", "(", "CqlRowSliceQueryImpl", "<", "?", ",", "?", ">", "rowSliceQuery", ",", "boolean", "useCaching", ")", "{", "switch", "(", "rowSliceQuery", ".", "getColQueryType", "(", ")", ")", "{", "case", "AllColumns", ":",...
Main method that is used to generate the java driver statement from the given Astyanax row slice query. Note that the method allows the caller to specify whether to use caching or not. If caching is disabled, then the PreparedStatement is generated every time If caching is enabled, then the cached PreparedStatement is...
[ "Main", "method", "that", "is", "used", "to", "generate", "the", "java", "driver", "statement", "from", "the", "given", "Astyanax", "row", "slice", "query", ".", "Note", "that", "the", "method", "allows", "the", "caller", "to", "specify", "whether", "to", ...
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-cql/src/main/java/com/netflix/astyanax/cql/reads/CFRowKeysQueryGen.java#L266-L283
train
Netflix/astyanax
astyanax-core/src/main/java/com/netflix/astyanax/connectionpool/impl/HostConnectionPoolPartition.java
HostConnectionPoolPartition.setPools
public synchronized boolean setPools(Collection<HostConnectionPool<CL>> newPools) { Set<HostConnectionPool<CL>> toRemove = Sets.newHashSet(this.pools); // Add new pools not previously seen boolean didChange = false; for (HostConnectionPool<CL> pool : newPools) { if (...
java
public synchronized boolean setPools(Collection<HostConnectionPool<CL>> newPools) { Set<HostConnectionPool<CL>> toRemove = Sets.newHashSet(this.pools); // Add new pools not previously seen boolean didChange = false; for (HostConnectionPool<CL> pool : newPools) { if (...
[ "public", "synchronized", "boolean", "setPools", "(", "Collection", "<", "HostConnectionPool", "<", "CL", ">", ">", "newPools", ")", "{", "Set", "<", "HostConnectionPool", "<", "CL", ">>", "toRemove", "=", "Sets", ".", "newHashSet", "(", "this", ".", "pools"...
Sets all pools for this partition. Removes old partitions and adds new one. @param newPools
[ "Sets", "all", "pools", "for", "this", "partition", ".", "Removes", "old", "partitions", "and", "adds", "new", "one", "." ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-core/src/main/java/com/netflix/astyanax/connectionpool/impl/HostConnectionPoolPartition.java#L64-L84
train
Netflix/astyanax
astyanax-core/src/main/java/com/netflix/astyanax/connectionpool/impl/HostConnectionPoolPartition.java
HostConnectionPoolPartition.addPool
public synchronized boolean addPool(HostConnectionPool<CL> pool) { if (this.pools.add(pool)) { refresh(); return true; } return false; }
java
public synchronized boolean addPool(HostConnectionPool<CL> pool) { if (this.pools.add(pool)) { refresh(); return true; } return false; }
[ "public", "synchronized", "boolean", "addPool", "(", "HostConnectionPool", "<", "CL", ">", "pool", ")", "{", "if", "(", "this", ".", "pools", ".", "add", "(", "pool", ")", ")", "{", "refresh", "(", ")", ";", "return", "true", ";", "}", "return", "fal...
Add a new pool to the partition. Checks to see if the pool already existed. If so then there is no need to refresh the pool. @param pool @return True if anything changed
[ "Add", "a", "new", "pool", "to", "the", "partition", ".", "Checks", "to", "see", "if", "the", "pool", "already", "existed", ".", "If", "so", "then", "there", "is", "no", "need", "to", "refresh", "the", "pool", "." ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-core/src/main/java/com/netflix/astyanax/connectionpool/impl/HostConnectionPoolPartition.java#L92-L98
train
Netflix/astyanax
astyanax-core/src/main/java/com/netflix/astyanax/connectionpool/impl/HostConnectionPoolPartition.java
HostConnectionPoolPartition.refresh
public synchronized void refresh() { List<HostConnectionPool<CL>> pools = Lists.newArrayList(); for (HostConnectionPool<CL> pool : this.pools) { if (!pool.isReconnecting()) { pools.add(pool); } } this.activePools.set(strategy.sortAndfilterPartition...
java
public synchronized void refresh() { List<HostConnectionPool<CL>> pools = Lists.newArrayList(); for (HostConnectionPool<CL> pool : this.pools) { if (!pool.isReconnecting()) { pools.add(pool); } } this.activePools.set(strategy.sortAndfilterPartition...
[ "public", "synchronized", "void", "refresh", "(", ")", "{", "List", "<", "HostConnectionPool", "<", "CL", ">>", "pools", "=", "Lists", ".", "newArrayList", "(", ")", ";", "for", "(", "HostConnectionPool", "<", "CL", ">", "pool", ":", "this", ".", "pools"...
Refresh the partition
[ "Refresh", "the", "partition" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-core/src/main/java/com/netflix/astyanax/connectionpool/impl/HostConnectionPoolPartition.java#L135-L143
train
Netflix/astyanax
astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/OneStepDistributedRowLock.java
OneStepDistributedRowLock.fillReleaseMutation
public void fillReleaseMutation(MutationBatch m, boolean excludeCurrentLock) { // Add the deletes to the end of the mutation ColumnListMutation<C> row = m.withRow(columnFamily, key); for (C c : locksToDelete) { row.deleteColumn(c); } if (!excludeCurrentLock && lockCol...
java
public void fillReleaseMutation(MutationBatch m, boolean excludeCurrentLock) { // Add the deletes to the end of the mutation ColumnListMutation<C> row = m.withRow(columnFamily, key); for (C c : locksToDelete) { row.deleteColumn(c); } if (!excludeCurrentLock && lockCol...
[ "public", "void", "fillReleaseMutation", "(", "MutationBatch", "m", ",", "boolean", "excludeCurrentLock", ")", "{", "// Add the deletes to the end of the mutation", "ColumnListMutation", "<", "C", ">", "row", "=", "m", ".", "withRow", "(", "columnFamily", ",", "key", ...
Fill a mutation that will release the locks. This may be used from a separate recipe to release multiple locks. @param m
[ "Fill", "a", "mutation", "that", "will", "release", "the", "locks", ".", "This", "may", "be", "used", "from", "a", "separate", "recipe", "to", "release", "multiple", "locks", "." ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-recipes/src/main/java/com/netflix/astyanax/recipes/locks/OneStepDistributedRowLock.java#L441-L451
train
Netflix/astyanax
astyanax-cassandra/src/main/java/com/netflix/astyanax/shallows/EmptyCheckpointManager.java
EmptyCheckpointManager.trackCheckpoint
@Override public void trackCheckpoint(String startToken, String checkpointToken) { tokenMap.put(startToken, checkpointToken); }
java
@Override public void trackCheckpoint(String startToken, String checkpointToken) { tokenMap.put(startToken, checkpointToken); }
[ "@", "Override", "public", "void", "trackCheckpoint", "(", "String", "startToken", ",", "String", "checkpointToken", ")", "{", "tokenMap", ".", "put", "(", "startToken", ",", "checkpointToken", ")", ";", "}" ]
Do nothing since checkpoints aren't being persisted.
[ "Do", "nothing", "since", "checkpoints", "aren", "t", "being", "persisted", "." ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-cassandra/src/main/java/com/netflix/astyanax/shallows/EmptyCheckpointManager.java#L31-L34
train
Netflix/astyanax
astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftConverter.java
ThriftConverter.getColumnParent
public static <K> ColumnParent getColumnParent(ColumnFamily<?, ?> columnFamily, ColumnPath<?> path) throws BadRequestException { ColumnParent cp = new ColumnParent(); cp.setColumn_family(columnFamily.getName()); if (path != null) { Iterator<ByteBuffer> columns = path.iter...
java
public static <K> ColumnParent getColumnParent(ColumnFamily<?, ?> columnFamily, ColumnPath<?> path) throws BadRequestException { ColumnParent cp = new ColumnParent(); cp.setColumn_family(columnFamily.getName()); if (path != null) { Iterator<ByteBuffer> columns = path.iter...
[ "public", "static", "<", "K", ">", "ColumnParent", "getColumnParent", "(", "ColumnFamily", "<", "?", ",", "?", ">", "columnFamily", ",", "ColumnPath", "<", "?", ">", "path", ")", "throws", "BadRequestException", "{", "ColumnParent", "cp", "=", "new", "Column...
Construct a Hector ColumnParent based on the information in the query and the type of column family being queried. @param <K> @param columnFamily @param path @return @throws BadRequestException
[ "Construct", "a", "Hector", "ColumnParent", "based", "on", "the", "information", "in", "the", "query", "and", "the", "type", "of", "column", "family", "being", "queried", "." ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftConverter.java#L68-L79
train
Netflix/astyanax
astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftConverter.java
ThriftConverter.getColumnPath
public static <K> org.apache.cassandra.thrift.ColumnPath getColumnPath(ColumnFamily<?, ?> columnFamily, ColumnPath<?> path) throws BadRequestException { org.apache.cassandra.thrift.ColumnPath cp = new org.apache.cassandra.thrift.ColumnPath(); cp.setColumn_family(columnFamily.getName()); ...
java
public static <K> org.apache.cassandra.thrift.ColumnPath getColumnPath(ColumnFamily<?, ?> columnFamily, ColumnPath<?> path) throws BadRequestException { org.apache.cassandra.thrift.ColumnPath cp = new org.apache.cassandra.thrift.ColumnPath(); cp.setColumn_family(columnFamily.getName()); ...
[ "public", "static", "<", "K", ">", "org", ".", "apache", ".", "cassandra", ".", "thrift", ".", "ColumnPath", "getColumnPath", "(", "ColumnFamily", "<", "?", ",", "?", ">", "columnFamily", ",", "ColumnPath", "<", "?", ">", "path", ")", "throws", "BadReque...
Construct a Thrift ColumnPath based on the information in the query and the type of column family being queried. @param <K> @param columnFamily @param path @return @throws NotFoundException @throws InvalidRequestException @throws TException
[ "Construct", "a", "Thrift", "ColumnPath", "based", "on", "the", "information", "in", "the", "query", "and", "the", "type", "of", "column", "family", "being", "queried", "." ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftConverter.java#L93-L112
train
Netflix/astyanax
astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftConverter.java
ThriftConverter.getPredicate
public static <C> SlicePredicate getPredicate(ColumnSlice<C> columns, Serializer<C> colSer) { // Get all the columns if (columns == null) { SlicePredicate predicate = new SlicePredicate(); predicate.setSlice_range(new SliceRange(ByteBuffer.wrap(new byte[0]), ByteBuffer.wrap(new b...
java
public static <C> SlicePredicate getPredicate(ColumnSlice<C> columns, Serializer<C> colSer) { // Get all the columns if (columns == null) { SlicePredicate predicate = new SlicePredicate(); predicate.setSlice_range(new SliceRange(ByteBuffer.wrap(new byte[0]), ByteBuffer.wrap(new b...
[ "public", "static", "<", "C", ">", "SlicePredicate", "getPredicate", "(", "ColumnSlice", "<", "C", ">", "columns", ",", "Serializer", "<", "C", ">", "colSer", ")", "{", "// Get all the columns", "if", "(", "columns", "==", "null", ")", "{", "SlicePredicate",...
Return a Hector SlicePredicate based on the provided column slice @param <C> @param columns @param colSer @return
[ "Return", "a", "Hector", "SlicePredicate", "based", "on", "the", "provided", "column", "slice" ]
bcc3fd26e2dda05a923751aa32b139f6209fecdf
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftConverter.java#L122-L145
train