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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
TGIO/RNCryptorNative | rncryptor-native/src/main/java/tgio/rncryptor/RNCryptorNative.java | RNCryptorNative.decryptAsync | public static void decryptAsync(String encrypted, String password, RNCryptorNativeCallback RNCryptorNativeCallback) {
String decrypted;
try {
decrypted = new RNCryptorNative().decrypt(encrypted, password);
RNCryptorNativeCallback.done(decrypted, null);
} catch (Exception ... | java | public static void decryptAsync(String encrypted, String password, RNCryptorNativeCallback RNCryptorNativeCallback) {
String decrypted;
try {
decrypted = new RNCryptorNative().decrypt(encrypted, password);
RNCryptorNativeCallback.done(decrypted, null);
} catch (Exception ... | [
"public",
"static",
"void",
"decryptAsync",
"(",
"String",
"encrypted",
",",
"String",
"password",
",",
"RNCryptorNativeCallback",
"RNCryptorNativeCallback",
")",
"{",
"String",
"decrypted",
";",
"try",
"{",
"decrypted",
"=",
"new",
"RNCryptorNative",
"(",
")",
".... | Decrypts encrypted base64 string and returns via callback
@param encrypted base64 string
@param password strong generated password
@param RNCryptorNativeCallback just a callback | [
"Decrypts",
"encrypted",
"base64",
"string",
"and",
"returns",
"via",
"callback"
] | 5209f10b988e4033c0b769a40b0d6cc99ea16af7 | https://github.com/TGIO/RNCryptorNative/blob/5209f10b988e4033c0b769a40b0d6cc99ea16af7/rncryptor-native/src/main/java/tgio/rncryptor/RNCryptorNative.java#L64-L72 | train |
TGIO/RNCryptorNative | rncryptor-native/src/main/java/tgio/rncryptor/RNCryptorNative.java | RNCryptorNative.encryptAsync | public static void encryptAsync(String raw, String password, RNCryptorNativeCallback RNCryptorNativeCallback) {
byte[] encrypted;
try {
encrypted = new RNCryptorNative().encrypt(raw, password);
RNCryptorNativeCallback.done(new String(encrypted, "UTF-8"), null);
} catch (E... | java | public static void encryptAsync(String raw, String password, RNCryptorNativeCallback RNCryptorNativeCallback) {
byte[] encrypted;
try {
encrypted = new RNCryptorNative().encrypt(raw, password);
RNCryptorNativeCallback.done(new String(encrypted, "UTF-8"), null);
} catch (E... | [
"public",
"static",
"void",
"encryptAsync",
"(",
"String",
"raw",
",",
"String",
"password",
",",
"RNCryptorNativeCallback",
"RNCryptorNativeCallback",
")",
"{",
"byte",
"[",
"]",
"encrypted",
";",
"try",
"{",
"encrypted",
"=",
"new",
"RNCryptorNative",
"(",
")"... | Encrypts raw string and returns result via callback
@param raw just a raw string
@param password strong generated password
@param RNCryptorNativeCallback just a callback | [
"Encrypts",
"raw",
"string",
"and",
"returns",
"result",
"via",
"callback"
] | 5209f10b988e4033c0b769a40b0d6cc99ea16af7 | https://github.com/TGIO/RNCryptorNative/blob/5209f10b988e4033c0b769a40b0d6cc99ea16af7/rncryptor-native/src/main/java/tgio/rncryptor/RNCryptorNative.java#L80-L89 | train |
TGIO/RNCryptorNative | rncryptor-native/src/main/java/tgio/rncryptor/RNCryptorNative.java | RNCryptorNative.encryptFile | public static void encryptFile(File raw, File encryptedFile, String password) throws IOException {
byte[] b = readBytes(raw);
String encodedImage = Base64.encodeToString(b, Base64.DEFAULT);
byte[] encryptedBytes = new RNCryptorNative().encrypt(encodedImage, password);
writeBytes(encrypte... | java | public static void encryptFile(File raw, File encryptedFile, String password) throws IOException {
byte[] b = readBytes(raw);
String encodedImage = Base64.encodeToString(b, Base64.DEFAULT);
byte[] encryptedBytes = new RNCryptorNative().encrypt(encodedImage, password);
writeBytes(encrypte... | [
"public",
"static",
"void",
"encryptFile",
"(",
"File",
"raw",
",",
"File",
"encryptedFile",
",",
"String",
"password",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"b",
"=",
"readBytes",
"(",
"raw",
")",
";",
"String",
"encodedImage",
"=",
"Base64... | Encrypts file using password
@param raw the original file to be encrypted
@param encryptedFile the result file
@param password strong generated password
@throws IOException | [
"Encrypts",
"file",
"using",
"password"
] | 5209f10b988e4033c0b769a40b0d6cc99ea16af7 | https://github.com/TGIO/RNCryptorNative/blob/5209f10b988e4033c0b769a40b0d6cc99ea16af7/rncryptor-native/src/main/java/tgio/rncryptor/RNCryptorNative.java#L98-L103 | train |
TGIO/RNCryptorNative | rncryptor-native/src/main/java/tgio/rncryptor/RNCryptorNative.java | RNCryptorNative.decryptFile | public static void decryptFile(File encryptedFile, File result, String password) throws IOException {
byte[] b = readBytes(encryptedFile);
String decryptedImageString = new RNCryptorNative().decrypt(new String(b), password);
byte[] decodedBytes = Base64.decode(decryptedImageString, 0);
w... | java | public static void decryptFile(File encryptedFile, File result, String password) throws IOException {
byte[] b = readBytes(encryptedFile);
String decryptedImageString = new RNCryptorNative().decrypt(new String(b), password);
byte[] decodedBytes = Base64.decode(decryptedImageString, 0);
w... | [
"public",
"static",
"void",
"decryptFile",
"(",
"File",
"encryptedFile",
",",
"File",
"result",
",",
"String",
"password",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"b",
"=",
"readBytes",
"(",
"encryptedFile",
")",
";",
"String",
"decryptedImageStri... | Decrypts file using password
@param encryptedFile file which needs to be decrypted
@param result destination file for decrypted file
@param password strong generated password
@throws IOException | [
"Decrypts",
"file",
"using",
"password"
] | 5209f10b988e4033c0b769a40b0d6cc99ea16af7 | https://github.com/TGIO/RNCryptorNative/blob/5209f10b988e4033c0b769a40b0d6cc99ea16af7/rncryptor-native/src/main/java/tgio/rncryptor/RNCryptorNative.java#L112-L117 | train |
TGIO/RNCryptorNative | jncryptor/src/main/java/org/cryptonode/jncryptor/AES256JNCryptor.java | AES256JNCryptor.arraysEqual | static boolean arraysEqual(byte[] array1, byte[] array2) {
if (array1.length != array2.length) {
return false;
}
boolean isEqual = true;
for (int i = 0; i < array1.length; i++) {
if (array1[i] != array2[i]) {
isEqual = false;
}
}
return isEqual;
} | java | static boolean arraysEqual(byte[] array1, byte[] array2) {
if (array1.length != array2.length) {
return false;
}
boolean isEqual = true;
for (int i = 0; i < array1.length; i++) {
if (array1[i] != array2[i]) {
isEqual = false;
}
}
return isEqual;
} | [
"static",
"boolean",
"arraysEqual",
"(",
"byte",
"[",
"]",
"array1",
",",
"byte",
"[",
"]",
"array2",
")",
"{",
"if",
"(",
"array1",
".",
"length",
"!=",
"array2",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"boolean",
"isEqual",
"=",
"true... | Compares arrays for equality in constant time. This avoids
certain types of timing attacks.
@param array1 the first array
@param array2 the second array
@return whether the arrays match | [
"Compares",
"arrays",
"for",
"equality",
"in",
"constant",
"time",
".",
"This",
"avoids",
"certain",
"types",
"of",
"timing",
"attacks",
"."
] | 5209f10b988e4033c0b769a40b0d6cc99ea16af7 | https://github.com/TGIO/RNCryptorNative/blob/5209f10b988e4033c0b769a40b0d6cc99ea16af7/jncryptor/src/main/java/org/cryptonode/jncryptor/AES256JNCryptor.java#L453-L465 | train |
TGIO/RNCryptorNative | jncryptor/src/main/java/org/cryptonode/jncryptor/AES256JNCryptorInputStream.java | AES256JNCryptorInputStream.initializeStream | private void initializeStream() throws IOException {
int headerDataSize;
if (isPasswordEncrypted) {
headerDataSize = AES256v3Ciphertext.HEADER_SIZE
+ AES256v3Ciphertext.ENCRYPTION_SALT_LENGTH
+ AES256v3Ciphertext.HMAC_SALT_LENGTH
+ AES256v3Ciphertext.AES_BLOCK_SIZE;
} els... | java | private void initializeStream() throws IOException {
int headerDataSize;
if (isPasswordEncrypted) {
headerDataSize = AES256v3Ciphertext.HEADER_SIZE
+ AES256v3Ciphertext.ENCRYPTION_SALT_LENGTH
+ AES256v3Ciphertext.HMAC_SALT_LENGTH
+ AES256v3Ciphertext.AES_BLOCK_SIZE;
} els... | [
"private",
"void",
"initializeStream",
"(",
")",
"throws",
"IOException",
"{",
"int",
"headerDataSize",
";",
"if",
"(",
"isPasswordEncrypted",
")",
"{",
"headerDataSize",
"=",
"AES256v3Ciphertext",
".",
"HEADER_SIZE",
"+",
"AES256v3Ciphertext",
".",
"ENCRYPTION_SALT_L... | Reads the header data, derives keys if necessary and creates the input
streams.
@throws IOException
if an error occurs
@throws EOFException
if we run out of data before reading the header | [
"Reads",
"the",
"header",
"data",
"derives",
"keys",
"if",
"necessary",
"and",
"creates",
"the",
"input",
"streams",
"."
] | 5209f10b988e4033c0b769a40b0d6cc99ea16af7 | https://github.com/TGIO/RNCryptorNative/blob/5209f10b988e4033c0b769a40b0d6cc99ea16af7/jncryptor/src/main/java/org/cryptonode/jncryptor/AES256JNCryptorInputStream.java#L103-L183 | train |
TGIO/RNCryptorNative | jncryptor/src/main/java/org/cryptonode/jncryptor/AES256JNCryptorInputStream.java | AES256JNCryptorInputStream.completeRead | private int completeRead(int b) throws IOException, StreamIntegrityException {
if (b == END_OF_STREAM) {
handleEndOfStream();
} else {
// Have we reached the end of the stream?
int c = pushbackInputStream.read();
if (c == END_OF_STREAM) {
handleEndOfStream();
} else {
... | java | private int completeRead(int b) throws IOException, StreamIntegrityException {
if (b == END_OF_STREAM) {
handleEndOfStream();
} else {
// Have we reached the end of the stream?
int c = pushbackInputStream.read();
if (c == END_OF_STREAM) {
handleEndOfStream();
} else {
... | [
"private",
"int",
"completeRead",
"(",
"int",
"b",
")",
"throws",
"IOException",
",",
"StreamIntegrityException",
"{",
"if",
"(",
"b",
"==",
"END_OF_STREAM",
")",
"{",
"handleEndOfStream",
"(",
")",
";",
"}",
"else",
"{",
"// Have we reached the end of the stream?... | Updates the HMAC value and handles the end of stream.
@param b
the result of a read operation
@return the value {@code b}
@throws IOException
@throws StreamIntegrityException | [
"Updates",
"the",
"HMAC",
"value",
"and",
"handles",
"the",
"end",
"of",
"stream",
"."
] | 5209f10b988e4033c0b769a40b0d6cc99ea16af7 | https://github.com/TGIO/RNCryptorNative/blob/5209f10b988e4033c0b769a40b0d6cc99ea16af7/jncryptor/src/main/java/org/cryptonode/jncryptor/AES256JNCryptorInputStream.java#L288-L302 | train |
TGIO/RNCryptorNative | jncryptor/src/main/java/org/cryptonode/jncryptor/AES256JNCryptorInputStream.java | AES256JNCryptorInputStream.handleEndOfStream | private void handleEndOfStream() throws StreamIntegrityException {
if (endOfStreamHandled) {
return;
}
endOfStreamHandled = true;
byte[] originalHMAC = trailerIn.getTrailer();
byte[] calculateHMAC = mac.doFinal();
if (! AES256JNCryptor.arraysEqual(originalHMAC, calculateHMAC)) {
t... | java | private void handleEndOfStream() throws StreamIntegrityException {
if (endOfStreamHandled) {
return;
}
endOfStreamHandled = true;
byte[] originalHMAC = trailerIn.getTrailer();
byte[] calculateHMAC = mac.doFinal();
if (! AES256JNCryptor.arraysEqual(originalHMAC, calculateHMAC)) {
t... | [
"private",
"void",
"handleEndOfStream",
"(",
")",
"throws",
"StreamIntegrityException",
"{",
"if",
"(",
"endOfStreamHandled",
")",
"{",
"return",
";",
"}",
"endOfStreamHandled",
"=",
"true",
";",
"byte",
"[",
"]",
"originalHMAC",
"=",
"trailerIn",
".",
"getTrail... | Verifies the HMAC value and throws an exception if it fails.
@throws IOException
if the HMAC value is incorrect | [
"Verifies",
"the",
"HMAC",
"value",
"and",
"throws",
"an",
"exception",
"if",
"it",
"fails",
"."
] | 5209f10b988e4033c0b769a40b0d6cc99ea16af7 | https://github.com/TGIO/RNCryptorNative/blob/5209f10b988e4033c0b769a40b0d6cc99ea16af7/jncryptor/src/main/java/org/cryptonode/jncryptor/AES256JNCryptorInputStream.java#L310-L323 | train |
TGIO/RNCryptorNative | jncryptor/src/main/java/org/cryptonode/jncryptor/StreamUtils.java | StreamUtils.readAllBytes | static int readAllBytes(InputStream in, byte[] buffer) throws IOException {
int index = 0;
while (index < buffer.length) {
int read = in.read(buffer, index, buffer.length - index);
if (read == -1) {
return index;
}
index += read;
}
return index;
} | java | static int readAllBytes(InputStream in, byte[] buffer) throws IOException {
int index = 0;
while (index < buffer.length) {
int read = in.read(buffer, index, buffer.length - index);
if (read == -1) {
return index;
}
index += read;
}
return index;
} | [
"static",
"int",
"readAllBytes",
"(",
"InputStream",
"in",
",",
"byte",
"[",
"]",
"buffer",
")",
"throws",
"IOException",
"{",
"int",
"index",
"=",
"0",
";",
"while",
"(",
"index",
"<",
"buffer",
".",
"length",
")",
"{",
"int",
"read",
"=",
"in",
"."... | Attempts to fill the buffer by reading as many bytes as available. The
returned number indicates how many bytes were read, which may be smaller
than the buffer size if EOF was reached.
@param in
input stream
@param buffer
buffer to fill
@return the number of bytes read
@throws IOException | [
"Attempts",
"to",
"fill",
"the",
"buffer",
"by",
"reading",
"as",
"many",
"bytes",
"as",
"available",
".",
"The",
"returned",
"number",
"indicates",
"how",
"many",
"bytes",
"were",
"read",
"which",
"may",
"be",
"smaller",
"than",
"the",
"buffer",
"size",
"... | 5209f10b988e4033c0b769a40b0d6cc99ea16af7 | https://github.com/TGIO/RNCryptorNative/blob/5209f10b988e4033c0b769a40b0d6cc99ea16af7/jncryptor/src/main/java/org/cryptonode/jncryptor/StreamUtils.java#L38-L50 | train |
TGIO/RNCryptorNative | jncryptor/src/main/java/org/cryptonode/jncryptor/StreamUtils.java | StreamUtils.readAllBytesOrFail | static void readAllBytesOrFail(InputStream in, byte[] buffer)
throws IOException {
int read = readAllBytes(in, buffer);
if (read != buffer.length) {
throw new EOFException(String.format(
"Expected %d bytes but read %d bytes.", buffer.length, read));
}
} | java | static void readAllBytesOrFail(InputStream in, byte[] buffer)
throws IOException {
int read = readAllBytes(in, buffer);
if (read != buffer.length) {
throw new EOFException(String.format(
"Expected %d bytes but read %d bytes.", buffer.length, read));
}
} | [
"static",
"void",
"readAllBytesOrFail",
"(",
"InputStream",
"in",
",",
"byte",
"[",
"]",
"buffer",
")",
"throws",
"IOException",
"{",
"int",
"read",
"=",
"readAllBytes",
"(",
"in",
",",
"buffer",
")",
";",
"if",
"(",
"read",
"!=",
"buffer",
".",
"length"... | Fills the buffer from the input stream. Throws exception if EOF occurs
before buffer is filled.
@param in
the input stream
@param buffer
the buffer to fill
@throws IOException | [
"Fills",
"the",
"buffer",
"from",
"the",
"input",
"stream",
".",
"Throws",
"exception",
"if",
"EOF",
"occurs",
"before",
"buffer",
"is",
"filled",
"."
] | 5209f10b988e4033c0b769a40b0d6cc99ea16af7 | https://github.com/TGIO/RNCryptorNative/blob/5209f10b988e4033c0b769a40b0d6cc99ea16af7/jncryptor/src/main/java/org/cryptonode/jncryptor/StreamUtils.java#L62-L69 | train |
graphql-java/java-dataloader | src/main/java/org/dataloader/DataLoader.java | DataLoader.clear | public DataLoader<K, V> clear(K key) {
Object cacheKey = getCacheKey(key);
synchronized (this) {
futureCache.delete(cacheKey);
}
return this;
} | java | public DataLoader<K, V> clear(K key) {
Object cacheKey = getCacheKey(key);
synchronized (this) {
futureCache.delete(cacheKey);
}
return this;
} | [
"public",
"DataLoader",
"<",
"K",
",",
"V",
">",
"clear",
"(",
"K",
"key",
")",
"{",
"Object",
"cacheKey",
"=",
"getCacheKey",
"(",
"key",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"futureCache",
".",
"delete",
"(",
"cacheKey",
")",
";",
"}",
... | Clears the future with the specified key from the cache, if caching is enabled, so it will be re-fetched
on the next load request.
@param key the key to remove
@return the data loader for fluent coding | [
"Clears",
"the",
"future",
"with",
"the",
"specified",
"key",
"from",
"the",
"cache",
"if",
"caching",
"is",
"enabled",
"so",
"it",
"will",
"be",
"re",
"-",
"fetched",
"on",
"the",
"next",
"load",
"request",
"."
] | dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc | https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/DataLoader.java#L501-L507 | train |
graphql-java/java-dataloader | src/main/java/org/dataloader/DataLoader.java | DataLoader.prime | public DataLoader<K, V> prime(K key, V value) {
Object cacheKey = getCacheKey(key);
synchronized (this) {
if (!futureCache.containsKey(cacheKey)) {
futureCache.set(cacheKey, CompletableFuture.completedFuture(value));
}
}
return this;
} | java | public DataLoader<K, V> prime(K key, V value) {
Object cacheKey = getCacheKey(key);
synchronized (this) {
if (!futureCache.containsKey(cacheKey)) {
futureCache.set(cacheKey, CompletableFuture.completedFuture(value));
}
}
return this;
} | [
"public",
"DataLoader",
"<",
"K",
",",
"V",
">",
"prime",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"Object",
"cacheKey",
"=",
"getCacheKey",
"(",
"key",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"!",
"futureCache",
".",
"cont... | Primes the cache with the given key and value.
@param key the key
@param value the value
@return the data loader for fluent coding | [
"Primes",
"the",
"cache",
"with",
"the",
"given",
"key",
"and",
"value",
"."
] | dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc | https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/DataLoader.java#L529-L537 | train |
graphql-java/java-dataloader | src/main/java/org/dataloader/DataLoader.java | DataLoader.prime | public DataLoader<K, V> prime(K key, Exception error) {
Object cacheKey = getCacheKey(key);
if (!futureCache.containsKey(cacheKey)) {
futureCache.set(cacheKey, CompletableFutureKit.failedFuture(error));
}
return this;
} | java | public DataLoader<K, V> prime(K key, Exception error) {
Object cacheKey = getCacheKey(key);
if (!futureCache.containsKey(cacheKey)) {
futureCache.set(cacheKey, CompletableFutureKit.failedFuture(error));
}
return this;
} | [
"public",
"DataLoader",
"<",
"K",
",",
"V",
">",
"prime",
"(",
"K",
"key",
",",
"Exception",
"error",
")",
"{",
"Object",
"cacheKey",
"=",
"getCacheKey",
"(",
"key",
")",
";",
"if",
"(",
"!",
"futureCache",
".",
"containsKey",
"(",
"cacheKey",
")",
"... | Primes the cache with the given key and error.
@param key the key
@param error the exception to prime instead of a value
@return the data loader for fluent coding | [
"Primes",
"the",
"cache",
"with",
"the",
"given",
"key",
"and",
"error",
"."
] | dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc | https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/DataLoader.java#L547-L553 | train |
graphql-java/java-dataloader | src/main/java/org/dataloader/Try.java | Try.tryCall | public static <V> Try<V> tryCall(Callable<V> callable) {
try {
return Try.succeeded(callable.call());
} catch (Exception e) {
return Try.failed(e);
}
} | java | public static <V> Try<V> tryCall(Callable<V> callable) {
try {
return Try.succeeded(callable.call());
} catch (Exception e) {
return Try.failed(e);
}
} | [
"public",
"static",
"<",
"V",
">",
"Try",
"<",
"V",
">",
"tryCall",
"(",
"Callable",
"<",
"V",
">",
"callable",
")",
"{",
"try",
"{",
"return",
"Try",
".",
"succeeded",
"(",
"callable",
".",
"call",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Excepti... | Calls the callable and if it returns a value, the Try is successful with that value or if throws
and exception the Try captures that
@param callable the code to call
@param <V> the value type
@return a Try which is the result of the call | [
"Calls",
"the",
"callable",
"and",
"if",
"it",
"returns",
"a",
"value",
"the",
"Try",
"is",
"successful",
"with",
"that",
"value",
"or",
"if",
"throws",
"and",
"exception",
"the",
"Try",
"captures",
"that"
] | dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc | https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/Try.java#L81-L87 | train |
graphql-java/java-dataloader | src/main/java/org/dataloader/Try.java | Try.tryStage | public static <V> CompletionStage<Try<V>> tryStage(CompletionStage<V> completionStage) {
return completionStage.handle((value, throwable) -> {
if (throwable != null) {
return failed(throwable);
}
return succeeded(value);
});
} | java | public static <V> CompletionStage<Try<V>> tryStage(CompletionStage<V> completionStage) {
return completionStage.handle((value, throwable) -> {
if (throwable != null) {
return failed(throwable);
}
return succeeded(value);
});
} | [
"public",
"static",
"<",
"V",
">",
"CompletionStage",
"<",
"Try",
"<",
"V",
">",
">",
"tryStage",
"(",
"CompletionStage",
"<",
"V",
">",
"completionStage",
")",
"{",
"return",
"completionStage",
".",
"handle",
"(",
"(",
"value",
",",
"throwable",
")",
"-... | Creates a CompletionStage that, when it completes, will capture into a Try whether the given completionStage
was successful or not
@param completionStage the completion stage that will complete
@param <V> the value type
@return a Try which is the result of the call | [
"Creates",
"a",
"CompletionStage",
"that",
"when",
"it",
"completes",
"will",
"capture",
"into",
"a",
"Try",
"whether",
"the",
"given",
"completionStage",
"was",
"successful",
"or",
"not"
] | dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc | https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/Try.java#L98-L105 | train |
graphql-java/java-dataloader | src/main/java/org/dataloader/Try.java | Try.map | public <U> Try<U> map(Function<? super V, U> mapper) {
if (isSuccess()) {
return succeeded(mapper.apply(value));
}
return failed(this.throwable);
} | java | public <U> Try<U> map(Function<? super V, U> mapper) {
if (isSuccess()) {
return succeeded(mapper.apply(value));
}
return failed(this.throwable);
} | [
"public",
"<",
"U",
">",
"Try",
"<",
"U",
">",
"map",
"(",
"Function",
"<",
"?",
"super",
"V",
",",
"U",
">",
"mapper",
")",
"{",
"if",
"(",
"isSuccess",
"(",
")",
")",
"{",
"return",
"succeeded",
"(",
"mapper",
".",
"apply",
"(",
"value",
")",... | Maps the Try into another Try with a different type
@param mapper the function to map the current Try to a new Try
@param <U> the target type
@return the mapped Try | [
"Maps",
"the",
"Try",
"into",
"another",
"Try",
"with",
"a",
"different",
"type"
] | dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc | https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/Try.java#L154-L159 | train |
graphql-java/java-dataloader | src/main/java/org/dataloader/Try.java | Try.flatMap | public <U> Try<U> flatMap(Function<? super V, Try<U>> mapper) {
if (isSuccess()) {
return mapper.apply(value);
}
return failed(this.throwable);
} | java | public <U> Try<U> flatMap(Function<? super V, Try<U>> mapper) {
if (isSuccess()) {
return mapper.apply(value);
}
return failed(this.throwable);
} | [
"public",
"<",
"U",
">",
"Try",
"<",
"U",
">",
"flatMap",
"(",
"Function",
"<",
"?",
"super",
"V",
",",
"Try",
"<",
"U",
">",
">",
"mapper",
")",
"{",
"if",
"(",
"isSuccess",
"(",
")",
")",
"{",
"return",
"mapper",
".",
"apply",
"(",
"value",
... | Flats maps the Try into another Try type
@param mapper the flat map function
@param <U> the target type
@return a new Try | [
"Flats",
"maps",
"the",
"Try",
"into",
"another",
"Try",
"type"
] | dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc | https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/Try.java#L169-L174 | train |
graphql-java/java-dataloader | src/main/java/org/dataloader/Try.java | Try.recover | public Try<V> recover(Function<Throwable, V> recoverFunction) {
if (isFailure()) {
return succeeded(recoverFunction.apply(throwable));
}
return this;
} | java | public Try<V> recover(Function<Throwable, V> recoverFunction) {
if (isFailure()) {
return succeeded(recoverFunction.apply(throwable));
}
return this;
} | [
"public",
"Try",
"<",
"V",
">",
"recover",
"(",
"Function",
"<",
"Throwable",
",",
"V",
">",
"recoverFunction",
")",
"{",
"if",
"(",
"isFailure",
"(",
")",
")",
"{",
"return",
"succeeded",
"(",
"recoverFunction",
".",
"apply",
"(",
"throwable",
")",
")... | Called the recover function of the Try failed otherwise returns this if it was successful.
@param recoverFunction the function to recover from a throwable into a new value
@return a Try of the same type | [
"Called",
"the",
"recover",
"function",
"of",
"the",
"Try",
"failed",
"otherwise",
"returns",
"this",
"if",
"it",
"was",
"successful",
"."
] | dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc | https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/Try.java#L238-L243 | train |
graphql-java/java-dataloader | src/main/java/org/dataloader/stats/Statistics.java | Statistics.combine | public Statistics combine(Statistics other) {
return new Statistics(
this.loadCount + other.getLoadCount(),
this.loadErrorCount + other.getLoadErrorCount(),
this.batchInvokeCount + other.getBatchInvokeCount(),
this.batchLoadCount + other.getBatchLo... | java | public Statistics combine(Statistics other) {
return new Statistics(
this.loadCount + other.getLoadCount(),
this.loadErrorCount + other.getLoadErrorCount(),
this.batchInvokeCount + other.getBatchInvokeCount(),
this.batchLoadCount + other.getBatchLo... | [
"public",
"Statistics",
"combine",
"(",
"Statistics",
"other",
")",
"{",
"return",
"new",
"Statistics",
"(",
"this",
".",
"loadCount",
"+",
"other",
".",
"getLoadCount",
"(",
")",
",",
"this",
".",
"loadErrorCount",
"+",
"other",
".",
"getLoadErrorCount",
"(... | This will combine this set of statistics with another set of statistics so that they become the combined count of each
@param other the other statistics to combine
@return a new statistics object of the combined counts | [
"This",
"will",
"combine",
"this",
"set",
"of",
"statistics",
"with",
"another",
"set",
"of",
"statistics",
"so",
"that",
"they",
"become",
"the",
"combined",
"count",
"of",
"each"
] | dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc | https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/stats/Statistics.java#L131-L140 | train |
graphql-java/java-dataloader | src/main/java/org/dataloader/DataLoaderRegistry.java | DataLoaderRegistry.register | public DataLoaderRegistry register(String key, DataLoader<?, ?> dataLoader) {
dataLoaders.put(key, dataLoader);
return this;
} | java | public DataLoaderRegistry register(String key, DataLoader<?, ?> dataLoader) {
dataLoaders.put(key, dataLoader);
return this;
} | [
"public",
"DataLoaderRegistry",
"register",
"(",
"String",
"key",
",",
"DataLoader",
"<",
"?",
",",
"?",
">",
"dataLoader",
")",
"{",
"dataLoaders",
".",
"put",
"(",
"key",
",",
"dataLoader",
")",
";",
"return",
"this",
";",
"}"
] | This will register a new dataloader
@param key the key to put the data loader under
@param dataLoader the data loader to register
@return this registry | [
"This",
"will",
"register",
"a",
"new",
"dataloader"
] | dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc | https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/DataLoaderRegistry.java#L28-L31 | train |
graphql-java/java-dataloader | src/main/java/org/dataloader/DataLoaderRegistry.java | DataLoaderRegistry.combine | public DataLoaderRegistry combine(DataLoaderRegistry registry) {
DataLoaderRegistry combined = new DataLoaderRegistry();
this.dataLoaders.forEach(combined::register);
registry.dataLoaders.forEach(combined::register);
return combined;
} | java | public DataLoaderRegistry combine(DataLoaderRegistry registry) {
DataLoaderRegistry combined = new DataLoaderRegistry();
this.dataLoaders.forEach(combined::register);
registry.dataLoaders.forEach(combined::register);
return combined;
} | [
"public",
"DataLoaderRegistry",
"combine",
"(",
"DataLoaderRegistry",
"registry",
")",
"{",
"DataLoaderRegistry",
"combined",
"=",
"new",
"DataLoaderRegistry",
"(",
")",
";",
"this",
".",
"dataLoaders",
".",
"forEach",
"(",
"combined",
"::",
"register",
")",
";",
... | This will combine all the current data loaders in this registry and all the data loaders from the specified registry
and return a new combined registry
@param registry the registry to combine into this registry
@return a new combined registry | [
"This",
"will",
"combine",
"all",
"the",
"current",
"data",
"loaders",
"in",
"this",
"registry",
"and",
"all",
"the",
"data",
"loaders",
"from",
"the",
"specified",
"registry",
"and",
"return",
"a",
"new",
"combined",
"registry"
] | dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc | https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/DataLoaderRegistry.java#L41-L47 | train |
graphql-java/java-dataloader | src/main/java/org/dataloader/DataLoaderRegistry.java | DataLoaderRegistry.getDataLoader | @SuppressWarnings("unchecked")
public <K, V> DataLoader<K, V> getDataLoader(String key) {
return (DataLoader<K, V>) dataLoaders.get(key);
} | java | @SuppressWarnings("unchecked")
public <K, V> DataLoader<K, V> getDataLoader(String key) {
return (DataLoader<K, V>) dataLoaders.get(key);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"K",
",",
"V",
">",
"DataLoader",
"<",
"K",
",",
"V",
">",
"getDataLoader",
"(",
"String",
"key",
")",
"{",
"return",
"(",
"DataLoader",
"<",
"K",
",",
"V",
">",
")",
"dataLoaders",
"... | Returns the dataloader that was registered under the specified key
@param key the key of the data loader
@param <K> the type of keys
@param <V> the type of values
@return a data loader or null if its not present | [
"Returns",
"the",
"dataloader",
"that",
"was",
"registered",
"under",
"the",
"specified",
"key"
] | dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc | https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/DataLoaderRegistry.java#L77-L80 | train |
talsma-ict/umldoclet | src/main/java/nl/talsmasoftware/umldoclet/util/UriUtils.java | UriUtils.addPathComponent | public static URI addPathComponent(URI uri, String component) {
if (uri != null && component != null) try {
return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(),
Optional.ofNullable(uri.getPath()).map(path -> join(path, component, '/')).orElse(component... | java | public static URI addPathComponent(URI uri, String component) {
if (uri != null && component != null) try {
return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(),
Optional.ofNullable(uri.getPath()).map(path -> join(path, component, '/')).orElse(component... | [
"public",
"static",
"URI",
"addPathComponent",
"(",
"URI",
"uri",
",",
"String",
"component",
")",
"{",
"if",
"(",
"uri",
"!=",
"null",
"&&",
"component",
"!=",
"null",
")",
"try",
"{",
"return",
"new",
"URI",
"(",
"uri",
".",
"getScheme",
"(",
")",
... | This method adds a 'component' to the path of an URI.
@param uri The URI to add a path component to
@param component The component to add to the end of the uri path, separated by a slash ({@code '/'}) character
@return The new URI | [
"This",
"method",
"adds",
"a",
"component",
"to",
"the",
"path",
"of",
"an",
"URI",
"."
] | 373b23f2646603fddca4a495e9eccbb4a4491fdf | https://github.com/talsma-ict/umldoclet/blob/373b23f2646603fddca4a495e9eccbb4a4491fdf/src/main/java/nl/talsmasoftware/umldoclet/util/UriUtils.java#L44-L54 | train |
talsma-ict/umldoclet | src/main/java/nl/talsmasoftware/umldoclet/javadoc/UMLFactory.java | UMLFactory.includeSuperclass | private boolean includeSuperclass(TypeElement superclass) {
if (env.isIncluded(superclass)) return true;
// TODO Make configurable:
// See https://github.com/talsma-ict/umldoclet/issues/148
return superclass.getModifiers().contains(Modifier.PUBLIC)
|| superclass.getModifi... | java | private boolean includeSuperclass(TypeElement superclass) {
if (env.isIncluded(superclass)) return true;
// TODO Make configurable:
// See https://github.com/talsma-ict/umldoclet/issues/148
return superclass.getModifiers().contains(Modifier.PUBLIC)
|| superclass.getModifi... | [
"private",
"boolean",
"includeSuperclass",
"(",
"TypeElement",
"superclass",
")",
"{",
"if",
"(",
"env",
".",
"isIncluded",
"(",
"superclass",
")",
")",
"return",
"true",
";",
"// TODO Make configurable:",
"// See https://github.com/talsma-ict/umldoclet/issues/148",
"retu... | Determine whether a superclass is included in the documentation.
<p>
Introduced to fix <a href="https://github.com/talsma-ict/umldoclet/issues/146">issue 146</a>:
skip superclass if not included in the documentation.
@param superclass The superclass to test.
@return {@code true} if the superclass is within the docume... | [
"Determine",
"whether",
"a",
"superclass",
"is",
"included",
"in",
"the",
"documentation",
"."
] | 373b23f2646603fddca4a495e9eccbb4a4491fdf | https://github.com/talsma-ict/umldoclet/blob/373b23f2646603fddca4a495e9eccbb4a4491fdf/src/main/java/nl/talsmasoftware/umldoclet/javadoc/UMLFactory.java#L189-L195 | train |
talsma-ict/umldoclet | src/main/java/nl/talsmasoftware/umldoclet/uml/Diagram.java | Diagram.getDiagramFile | private File getDiagramFile(FileFormat format) {
File base = getDiagramBaseFile();
return new File(base.getParent(), base.getName() + format.getFileSuffix());
} | java | private File getDiagramFile(FileFormat format) {
File base = getDiagramBaseFile();
return new File(base.getParent(), base.getName() + format.getFileSuffix());
} | [
"private",
"File",
"getDiagramFile",
"(",
"FileFormat",
"format",
")",
"{",
"File",
"base",
"=",
"getDiagramBaseFile",
"(",
")",
";",
"return",
"new",
"File",
"(",
"base",
".",
"getParent",
"(",
")",
",",
"base",
".",
"getName",
"(",
")",
"+",
"format",
... | The diagram file in the specified format.
@param format The diagram file format.
@return The diagram file. | [
"The",
"diagram",
"file",
"in",
"the",
"specified",
"format",
"."
] | 373b23f2646603fddca4a495e9eccbb4a4491fdf | https://github.com/talsma-ict/umldoclet/blob/373b23f2646603fddca4a495e9eccbb4a4491fdf/src/main/java/nl/talsmasoftware/umldoclet/uml/Diagram.java#L111-L114 | train |
talsma-ict/umldoclet | src/main/java/nl/talsmasoftware/umldoclet/util/FileUtils.java | FileUtils.relativePath | public static String relativePath(File from, File to) {
if (from == null || to == null) return null;
try {
if (from.isFile()) from = from.getParentFile();
if (!from.isDirectory()) throw new IllegalArgumentException("Not a directory: " + from);
final String[] fromPart... | java | public static String relativePath(File from, File to) {
if (from == null || to == null) return null;
try {
if (from.isFile()) from = from.getParentFile();
if (!from.isDirectory()) throw new IllegalArgumentException("Not a directory: " + from);
final String[] fromPart... | [
"public",
"static",
"String",
"relativePath",
"(",
"File",
"from",
",",
"File",
"to",
")",
"{",
"if",
"(",
"from",
"==",
"null",
"||",
"to",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"if",
"(",
"from",
".",
"isFile",
"(",
")",
")",
"f... | Returns the relative path from one file to another.
@param from The source file.
@param to The target file.
@return The relative path from the source to the target file. | [
"Returns",
"the",
"relative",
"path",
"from",
"one",
"file",
"to",
"another",
"."
] | 373b23f2646603fddca4a495e9eccbb4a4491fdf | https://github.com/talsma-ict/umldoclet/blob/373b23f2646603fddca4a495e9eccbb4a4491fdf/src/main/java/nl/talsmasoftware/umldoclet/util/FileUtils.java#L49-L73 | train |
talsma-ict/umldoclet | src/main/java/nl/talsmasoftware/umldoclet/html/DiagramCollector.java | DiagramCollector.collectDiagrams | Collection<UmlDiagram> collectDiagrams() throws IOException {
if (diagramExtensions.isEmpty()) return Collections.emptySet();
try {
Files.walkFileTree(imagesDirectory.orElse(basedir).toPath(), this);
return unmodifiableCollection(collected.get());
} finally {
... | java | Collection<UmlDiagram> collectDiagrams() throws IOException {
if (diagramExtensions.isEmpty()) return Collections.emptySet();
try {
Files.walkFileTree(imagesDirectory.orElse(basedir).toPath(), this);
return unmodifiableCollection(collected.get());
} finally {
... | [
"Collection",
"<",
"UmlDiagram",
">",
"collectDiagrams",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"diagramExtensions",
".",
"isEmpty",
"(",
")",
")",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"try",
"{",
"Files",
".",
"walkFileTree",... | Collects all generated diagram files by walking the specified path.
@return The collected diagrams
@throws IOException In case there were I/O errors walking the path | [
"Collects",
"all",
"generated",
"diagram",
"files",
"by",
"walking",
"the",
"specified",
"path",
"."
] | 373b23f2646603fddca4a495e9eccbb4a4491fdf | https://github.com/talsma-ict/umldoclet/blob/373b23f2646603fddca4a495e9eccbb4a4491fdf/src/main/java/nl/talsmasoftware/umldoclet/html/DiagramCollector.java#L70-L78 | train |
talsma-ict/umldoclet | src/main/java/nl/talsmasoftware/umldoclet/rendering/indent/Indentation.java | Indentation.resolve | private static Indentation resolve(final int width, final char ch, final int level) {
return width == 0 ? NONE
: ch == ' ' ? spaces(width, level)
: width == 1 && ch == '\t' ? tabs(level)
: new Indentation(width, ch, level);
} | java | private static Indentation resolve(final int width, final char ch, final int level) {
return width == 0 ? NONE
: ch == ' ' ? spaces(width, level)
: width == 1 && ch == '\t' ? tabs(level)
: new Indentation(width, ch, level);
} | [
"private",
"static",
"Indentation",
"resolve",
"(",
"final",
"int",
"width",
",",
"final",
"char",
"ch",
",",
"final",
"int",
"level",
")",
"{",
"return",
"width",
"==",
"0",
"?",
"NONE",
":",
"ch",
"==",
"'",
"'",
"?",
"spaces",
"(",
"width",
",",
... | Internal 'factory' method that tries to resolve a constant indentation instance before returning a new object.
@param width The indentation width for one indentation unit
@param ch The character used in the indentation
@param level The numer of logical indentations to apply
@return the requested indentation either ... | [
"Internal",
"factory",
"method",
"that",
"tries",
"to",
"resolve",
"a",
"constant",
"indentation",
"instance",
"before",
"returning",
"a",
"new",
"object",
"."
] | 373b23f2646603fddca4a495e9eccbb4a4491fdf | https://github.com/talsma-ict/umldoclet/blob/373b23f2646603fddca4a495e9eccbb4a4491fdf/src/main/java/nl/talsmasoftware/umldoclet/rendering/indent/Indentation.java#L100-L105 | train |
sendgrid/smtpapi-java | src/main/java/com/sendgrid/smtpapi/SMTPAPI.java | SMTPAPI.toCodePointArray | private int[] toCodePointArray(String input) {
int len = input.length();
int[] codePointArray = new int[input.codePointCount(0, len)];
for (int i = 0, j = 0; i < len; i = input.offsetByCodePoints(i, 1)) {
codePointArray[j++] = input.codePointAt(i);
}
return codePointArray;
} | java | private int[] toCodePointArray(String input) {
int len = input.length();
int[] codePointArray = new int[input.codePointCount(0, len)];
for (int i = 0, j = 0; i < len; i = input.offsetByCodePoints(i, 1)) {
codePointArray[j++] = input.codePointAt(i);
}
return codePointArray;
} | [
"private",
"int",
"[",
"]",
"toCodePointArray",
"(",
"String",
"input",
")",
"{",
"int",
"len",
"=",
"input",
".",
"length",
"(",
")",
";",
"int",
"[",
"]",
"codePointArray",
"=",
"new",
"int",
"[",
"input",
".",
"codePointCount",
"(",
"0",
",",
"len... | convert from string to code point array | [
"convert",
"from",
"string",
"to",
"code",
"point",
"array"
] | 7eb260faabc29feaf1814da5745e4d5cc4fca31c | https://github.com/sendgrid/smtpapi-java/blob/7eb260faabc29feaf1814da5745e4d5cc4fca31c/src/main/java/com/sendgrid/smtpapi/SMTPAPI.java#L209-L216 | train |
kumuluz/kumuluzee | tools/loader/src/main/java/com/kumuluz/ee/loader/jar/JarEntryInfo.java | JarEntryInfo.getJarBytes | public byte[] getJarBytes() throws EeClassLoaderException {
DataInputStream dataInputStream = null;
byte[] bytes;
try {
long jarEntrySize = jarEntry.getSize();
if (jarEntrySize <= 0 || jarEntrySize >= Integer.MAX_VALUE) {
throw new EeClassLoaderExceptio... | java | public byte[] getJarBytes() throws EeClassLoaderException {
DataInputStream dataInputStream = null;
byte[] bytes;
try {
long jarEntrySize = jarEntry.getSize();
if (jarEntrySize <= 0 || jarEntrySize >= Integer.MAX_VALUE) {
throw new EeClassLoaderExceptio... | [
"public",
"byte",
"[",
"]",
"getJarBytes",
"(",
")",
"throws",
"EeClassLoaderException",
"{",
"DataInputStream",
"dataInputStream",
"=",
"null",
";",
"byte",
"[",
"]",
"bytes",
";",
"try",
"{",
"long",
"jarEntrySize",
"=",
"jarEntry",
".",
"getSize",
"(",
")... | Read JAR entry and return byte array of this JAR entry. | [
"Read",
"JAR",
"entry",
"and",
"return",
"byte",
"array",
"of",
"this",
"JAR",
"entry",
"."
] | 86fbce2acc04264f20d548173d5d9f28d79cb415 | https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/tools/loader/src/main/java/com/kumuluz/ee/loader/jar/JarEntryInfo.java#L84-L112 | train |
kumuluz/kumuluzee | common/src/main/java/com/kumuluz/ee/common/utils/StringUtils.java | StringUtils.camelCaseToHyphenCase | public static String camelCaseToHyphenCase(String s) {
StringBuilder parsedString = new StringBuilder(s.substring(0, 1).toLowerCase());
for (char c : s.substring(1).toCharArray()) {
if (Character.isUpperCase(c)) {
parsedString.append("-").append(Character.toLowerCase(c));
... | java | public static String camelCaseToHyphenCase(String s) {
StringBuilder parsedString = new StringBuilder(s.substring(0, 1).toLowerCase());
for (char c : s.substring(1).toCharArray()) {
if (Character.isUpperCase(c)) {
parsedString.append("-").append(Character.toLowerCase(c));
... | [
"public",
"static",
"String",
"camelCaseToHyphenCase",
"(",
"String",
"s",
")",
"{",
"StringBuilder",
"parsedString",
"=",
"new",
"StringBuilder",
"(",
"s",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toLowerCase",
"(",
")",
")",
";",
"for",
"(",
"c... | Parse upper camel case to lower hyphen case.
@param s string in upper camel case format
@return string in lower hyphen case format | [
"Parse",
"upper",
"camel",
"case",
"to",
"lower",
"hyphen",
"case",
"."
] | 86fbce2acc04264f20d548173d5d9f28d79cb415 | https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/common/src/main/java/com/kumuluz/ee/common/utils/StringUtils.java#L39-L53 | train |
kumuluz/kumuluzee | common/src/main/java/com/kumuluz/ee/common/utils/StringUtils.java | StringUtils.hyphenCaseToCamelCase | public static String hyphenCaseToCamelCase(String s) {
List<String> words = Stream.of(s.split("-")).filter(w -> !"".equals(w)).collect(Collectors.toList());
if (words.size() < 2) {
return s;
}
StringBuilder parsedString = new StringBuilder(words.get(0));
for (int ... | java | public static String hyphenCaseToCamelCase(String s) {
List<String> words = Stream.of(s.split("-")).filter(w -> !"".equals(w)).collect(Collectors.toList());
if (words.size() < 2) {
return s;
}
StringBuilder parsedString = new StringBuilder(words.get(0));
for (int ... | [
"public",
"static",
"String",
"hyphenCaseToCamelCase",
"(",
"String",
"s",
")",
"{",
"List",
"<",
"String",
">",
"words",
"=",
"Stream",
".",
"of",
"(",
"s",
".",
"split",
"(",
"\"-\"",
")",
")",
".",
"filter",
"(",
"w",
"->",
"!",
"\"\"",
".",
"eq... | Parse lower hyphen case to upper camel case.
@param s string in lower hyphen case format
@return string in upper camel case format | [
"Parse",
"lower",
"hyphen",
"case",
"to",
"upper",
"camel",
"case",
"."
] | 86fbce2acc04264f20d548173d5d9f28d79cb415 | https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/common/src/main/java/com/kumuluz/ee/common/utils/StringUtils.java#L61-L77 | train |
kumuluz/kumuluzee | common/src/main/java/com/kumuluz/ee/configuration/sources/FileConfigurationSource.java | FileConfigurationSource.representsArray | private boolean representsArray(String key) {
int openingBracket = key.indexOf("[");
int closingBracket = key.indexOf("]");
return closingBracket == key.length() - 1 && openingBracket != -1;
} | java | private boolean representsArray(String key) {
int openingBracket = key.indexOf("[");
int closingBracket = key.indexOf("]");
return closingBracket == key.length() - 1 && openingBracket != -1;
} | [
"private",
"boolean",
"representsArray",
"(",
"String",
"key",
")",
"{",
"int",
"openingBracket",
"=",
"key",
".",
"indexOf",
"(",
"\"[\"",
")",
";",
"int",
"closingBracket",
"=",
"key",
".",
"indexOf",
"(",
"\"]\"",
")",
";",
"return",
"closingBracket",
"... | Returns true, if key represents an array.
@param key configuration key
@return true if the config key represents an array, false otherwise. | [
"Returns",
"true",
"if",
"key",
"represents",
"an",
"array",
"."
] | 86fbce2acc04264f20d548173d5d9f28d79cb415 | https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/common/src/main/java/com/kumuluz/ee/configuration/sources/FileConfigurationSource.java#L323-L330 | train |
kumuluz/kumuluzee | common/src/main/java/com/kumuluz/ee/configuration/sources/FileConfigurationSource.java | FileConfigurationSource.getValue | private Object getValue(String key) {
// iterate over configuration tree
String[] splittedKeys = key.split("\\.");
Object value = config;
for (int i = 0; i < splittedKeys.length; i++) {
String splittedKey = splittedKeys[i];
if (value == null) {
... | java | private Object getValue(String key) {
// iterate over configuration tree
String[] splittedKeys = key.split("\\.");
Object value = config;
for (int i = 0; i < splittedKeys.length; i++) {
String splittedKey = splittedKeys[i];
if (value == null) {
... | [
"private",
"Object",
"getValue",
"(",
"String",
"key",
")",
"{",
"// iterate over configuration tree",
"String",
"[",
"]",
"splittedKeys",
"=",
"key",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"Object",
"value",
"=",
"config",
";",
"for",
"(",
"int",
"i",
... | Parses configuration map, returns value for given key.
@param key configuration key
@return Value for given key. | [
"Parses",
"configuration",
"map",
"returns",
"value",
"for",
"given",
"key",
"."
] | 86fbce2acc04264f20d548173d5d9f28d79cb415 | https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/common/src/main/java/com/kumuluz/ee/configuration/sources/FileConfigurationSource.java#L338-L405 | train |
kumuluz/kumuluzee | tools/loader/src/main/java/com/kumuluz/ee/loader/EeClassLoader.java | EeClassLoader.loadJar | private void loadJar(final JarFileInfo jarFileInfo) {
final String JAR_SUFFIX = ".jar";
jarFiles.add(jarFileInfo);
jarFileInfo.getJarFile()
.stream()
.parallel()
.filter(je -> !je.isDirectory() && je.getName().toLowerCase().endsWith(JAR_SUFFIX))
... | java | private void loadJar(final JarFileInfo jarFileInfo) {
final String JAR_SUFFIX = ".jar";
jarFiles.add(jarFileInfo);
jarFileInfo.getJarFile()
.stream()
.parallel()
.filter(je -> !je.isDirectory() && je.getName().toLowerCase().endsWith(JAR_SUFFIX))
... | [
"private",
"void",
"loadJar",
"(",
"final",
"JarFileInfo",
"jarFileInfo",
")",
"{",
"final",
"String",
"JAR_SUFFIX",
"=",
"\".jar\"",
";",
"jarFiles",
".",
"add",
"(",
"jarFileInfo",
")",
";",
"jarFileInfo",
".",
"getJarFile",
"(",
")",
".",
"stream",
"(",
... | Loads specified JAR. | [
"Loads",
"specified",
"JAR",
"."
] | 86fbce2acc04264f20d548173d5d9f28d79cb415 | https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/tools/loader/src/main/java/com/kumuluz/ee/loader/EeClassLoader.java#L250-L282 | train |
kumuluz/kumuluzee | tools/loader/src/main/java/com/kumuluz/ee/loader/EeClassLoader.java | EeClassLoader.findJarNativeEntry | private JarEntryInfo findJarNativeEntry(String libraryName) {
String name = System.mapLibraryName(libraryName);
for (JarFileInfo jarFileInfo : jarFiles) {
JarFile jarFile = jarFileInfo.getJarFile();
Enumeration<JarEntry> entries = jarFile.entries();
while (entries.has... | java | private JarEntryInfo findJarNativeEntry(String libraryName) {
String name = System.mapLibraryName(libraryName);
for (JarFileInfo jarFileInfo : jarFiles) {
JarFile jarFile = jarFileInfo.getJarFile();
Enumeration<JarEntry> entries = jarFile.entries();
while (entries.has... | [
"private",
"JarEntryInfo",
"findJarNativeEntry",
"(",
"String",
"libraryName",
")",
"{",
"String",
"name",
"=",
"System",
".",
"mapLibraryName",
"(",
"libraryName",
")",
";",
"for",
"(",
"JarFileInfo",
"jarFileInfo",
":",
"jarFiles",
")",
"{",
"JarFile",
"jarFil... | Finds native library entry.
@param libraryName Library name. For example for the library name "Native"
- Windows returns entry "Native.dll"
- Linux returns entry "libNative.so"
- Mac returns entry "libNative.jnilib" or "libNative.dylib"
(depending on Apple or Oracle JDK and/or JDK version)
@return Native library entry... | [
"Finds",
"native",
"library",
"entry",
"."
] | 86fbce2acc04264f20d548173d5d9f28d79cb415 | https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/tools/loader/src/main/java/com/kumuluz/ee/loader/EeClassLoader.java#L353-L379 | train |
kumuluz/kumuluzee | tools/loader/src/main/java/com/kumuluz/ee/loader/EeClassLoader.java | EeClassLoader.findJarClass | private Class<?> findJarClass(String className) throws EeClassLoaderException {
Class<?> clazz = classes.get(className);
if (clazz != null) {
return clazz;
}
// Char '/' works for Win32 and Unix.
String fullClassName = className.replace('.', '/') + ".class";
... | java | private Class<?> findJarClass(String className) throws EeClassLoaderException {
Class<?> clazz = classes.get(className);
if (clazz != null) {
return clazz;
}
// Char '/' works for Win32 and Unix.
String fullClassName = className.replace('.', '/') + ".class";
... | [
"private",
"Class",
"<",
"?",
">",
"findJarClass",
"(",
"String",
"className",
")",
"throws",
"EeClassLoaderException",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"classes",
".",
"get",
"(",
"className",
")",
";",
"if",
"(",
"clazz",
"!=",
"null",
")",
... | Loads class from a JAR and searches for all jar-in-jar. | [
"Loads",
"class",
"from",
"a",
"JAR",
"and",
"searches",
"for",
"all",
"jar",
"-",
"in",
"-",
"jar",
"."
] | 86fbce2acc04264f20d548173d5d9f28d79cb415 | https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/tools/loader/src/main/java/com/kumuluz/ee/loader/EeClassLoader.java#L384-L412 | train |
kumuluz/kumuluzee | components/cdi/weld/src/main/java/com/kumuluz/ee/configuration/cdi/interceptors/ConfigBundleInterceptor.java | ConfigBundleInterceptor.loadConfiguration | @PostConstruct
public Object loadConfiguration(InvocationContext ic) throws Exception {
Object target = ic.getTarget();
Class targetClass = target.getClass();
if (targetClassIsProxied(targetClass)) {
targetClass = targetClass.getSuperclass();
}
ConfigBundle con... | java | @PostConstruct
public Object loadConfiguration(InvocationContext ic) throws Exception {
Object target = ic.getTarget();
Class targetClass = target.getClass();
if (targetClassIsProxied(targetClass)) {
targetClass = targetClass.getSuperclass();
}
ConfigBundle con... | [
"@",
"PostConstruct",
"public",
"Object",
"loadConfiguration",
"(",
"InvocationContext",
"ic",
")",
"throws",
"Exception",
"{",
"Object",
"target",
"=",
"ic",
".",
"getTarget",
"(",
")",
";",
"Class",
"targetClass",
"=",
"target",
".",
"getClass",
"(",
")",
... | Method initialises class fields from configuration. | [
"Method",
"initialises",
"class",
"fields",
"from",
"configuration",
"."
] | 86fbce2acc04264f20d548173d5d9f28d79cb415 | https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/components/cdi/weld/src/main/java/com/kumuluz/ee/configuration/cdi/interceptors/ConfigBundleInterceptor.java#L59-L75 | train |
kumuluz/kumuluzee | components/cdi/weld/src/main/java/com/kumuluz/ee/configuration/cdi/interceptors/ConfigBundleInterceptor.java | ConfigBundleInterceptor.getValueOfPrimitive | private Optional getValueOfPrimitive(Class type, String key) {
if (type.equals(String.class)) {
return configurationUtil.get(key);
} else if (type.equals(Boolean.class) || type.equals(boolean.class)) {
return configurationUtil.getBoolean(key);
} else if (type.equals(Floa... | java | private Optional getValueOfPrimitive(Class type, String key) {
if (type.equals(String.class)) {
return configurationUtil.get(key);
} else if (type.equals(Boolean.class) || type.equals(boolean.class)) {
return configurationUtil.getBoolean(key);
} else if (type.equals(Floa... | [
"private",
"Optional",
"getValueOfPrimitive",
"(",
"Class",
"type",
",",
"String",
"key",
")",
"{",
"if",
"(",
"type",
".",
"equals",
"(",
"String",
".",
"class",
")",
")",
"{",
"return",
"configurationUtil",
".",
"get",
"(",
"key",
")",
";",
"}",
"els... | Returns a value of a primitive configuration type
@param type configuration value type
@param key configuration value key
@return | [
"Returns",
"a",
"value",
"of",
"a",
"primitive",
"configuration",
"type"
] | 86fbce2acc04264f20d548173d5d9f28d79cb415 | https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/components/cdi/weld/src/main/java/com/kumuluz/ee/configuration/cdi/interceptors/ConfigBundleInterceptor.java#L189-L207 | train |
kumuluz/kumuluzee | components/cdi/weld/src/main/java/com/kumuluz/ee/configuration/cdi/interceptors/ConfigBundleInterceptor.java | ConfigBundleInterceptor.processNestedObject | private Object processNestedObject(Class targetClass, Method method, Class parameterType, String keyPrefix,
Map<Class, Class> processedClassRelations, int arrayIndex, boolean
watchAllFields) throws Exception {
Object nestedTa... | java | private Object processNestedObject(Class targetClass, Method method, Class parameterType, String keyPrefix,
Map<Class, Class> processedClassRelations, int arrayIndex, boolean
watchAllFields) throws Exception {
Object nestedTa... | [
"private",
"Object",
"processNestedObject",
"(",
"Class",
"targetClass",
",",
"Method",
"method",
",",
"Class",
"parameterType",
",",
"String",
"keyPrefix",
",",
"Map",
"<",
"Class",
",",
"Class",
">",
"processedClassRelations",
",",
"int",
"arrayIndex",
",",
"b... | Create a new instance for nested class, check for cycles and populate nested instance.
@param targetClass target class
@param method processed method
@param parameterType parameter type
@param keyPrefix prefix used for generation of a configuration key
@param proces... | [
"Create",
"a",
"new",
"instance",
"for",
"nested",
"class",
"check",
"for",
"cycles",
"and",
"populate",
"nested",
"instance",
"."
] | 86fbce2acc04264f20d548173d5d9f28d79cb415 | https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/components/cdi/weld/src/main/java/com/kumuluz/ee/configuration/cdi/interceptors/ConfigBundleInterceptor.java#L222-L251 | train |
kumuluz/kumuluzee | components/cdi/weld/src/main/java/com/kumuluz/ee/configuration/cdi/interceptors/ConfigBundleInterceptor.java | ConfigBundleInterceptor.getKeyPrefix | private String getKeyPrefix(Class targetClass) {
String prefix = ((ConfigBundle) targetClass.getAnnotation(ConfigBundle.class)).value();
if (prefix.isEmpty()) {
prefix = StringUtils.camelCaseToHyphenCase(targetClass.getSimpleName());
}
if (".".equals(prefix)) {
... | java | private String getKeyPrefix(Class targetClass) {
String prefix = ((ConfigBundle) targetClass.getAnnotation(ConfigBundle.class)).value();
if (prefix.isEmpty()) {
prefix = StringUtils.camelCaseToHyphenCase(targetClass.getSimpleName());
}
if (".".equals(prefix)) {
... | [
"private",
"String",
"getKeyPrefix",
"(",
"Class",
"targetClass",
")",
"{",
"String",
"prefix",
"=",
"(",
"(",
"ConfigBundle",
")",
"targetClass",
".",
"getAnnotation",
"(",
"ConfigBundle",
".",
"class",
")",
")",
".",
"value",
"(",
")",
";",
"if",
"(",
... | Generate a key prefix from annotation, class name, or parent prefix in case of nested classes.
@param targetClass target class
@return key prefix | [
"Generate",
"a",
"key",
"prefix",
"from",
"annotation",
"class",
"name",
"or",
"parent",
"prefix",
"in",
"case",
"of",
"nested",
"classes",
"."
] | 86fbce2acc04264f20d548173d5d9f28d79cb415 | https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/components/cdi/weld/src/main/java/com/kumuluz/ee/configuration/cdi/interceptors/ConfigBundleInterceptor.java#L293-L306 | train |
kumuluz/kumuluzee | components/cdi/weld/src/main/java/com/kumuluz/ee/configuration/cdi/interceptors/ConfigBundleInterceptor.java | ConfigBundleInterceptor.setterToField | private String setterToField(String setter) {
return Character.toLowerCase(setter.charAt(3)) + setter.substring(4);
} | java | private String setterToField(String setter) {
return Character.toLowerCase(setter.charAt(3)) + setter.substring(4);
} | [
"private",
"String",
"setterToField",
"(",
"String",
"setter",
")",
"{",
"return",
"Character",
".",
"toLowerCase",
"(",
"setter",
".",
"charAt",
"(",
"3",
")",
")",
"+",
"setter",
".",
"substring",
"(",
"4",
")",
";",
"}"
] | Parse setter name to field name.
@param setter name of the setter method
@return field name | [
"Parse",
"setter",
"name",
"to",
"field",
"name",
"."
] | 86fbce2acc04264f20d548173d5d9f28d79cb415 | https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/components/cdi/weld/src/main/java/com/kumuluz/ee/configuration/cdi/interceptors/ConfigBundleInterceptor.java#L314-L316 | train |
pippo-java/pippo | pippo-session-parent/pippo-session-xmemcached/src/main/java/ro/pippo/session/xmemcached/XmemcachedFactory.java | XmemcachedFactory.create | public static MemcachedClient create(final PippoSettings settings) {
String host = settings.getString(HOST, "localhost:11211");
String prot = settings.getString(PROT, "BINARY");
CommandFactory protocol;
switch (prot) {
case "BINARY":
protocol = new BinaryComma... | java | public static MemcachedClient create(final PippoSettings settings) {
String host = settings.getString(HOST, "localhost:11211");
String prot = settings.getString(PROT, "BINARY");
CommandFactory protocol;
switch (prot) {
case "BINARY":
protocol = new BinaryComma... | [
"public",
"static",
"MemcachedClient",
"create",
"(",
"final",
"PippoSettings",
"settings",
")",
"{",
"String",
"host",
"=",
"settings",
".",
"getString",
"(",
"HOST",
",",
"\"localhost:11211\"",
")",
";",
"String",
"prot",
"=",
"settings",
".",
"getString",
"... | Create a memcached client with pippo settings.
@param settings pippo settings
@return memcached client | [
"Create",
"a",
"memcached",
"client",
"with",
"pippo",
"settings",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-session-parent/pippo-session-xmemcached/src/main/java/ro/pippo/session/xmemcached/XmemcachedFactory.java#L58-L78 | train |
pippo-java/pippo | pippo-server-parent/pippo-undertow/src/main/java/ro/pippo/undertow/UndertowSettings.java | UndertowSettings.getOption | private <T> Option<T> getOption(String parameter) {
try {
Field field = UndertowOptions.class.getDeclaredField(parameter);
if (Option.class.getName().equals(field.getType().getTypeName())) {
Object value = field.get(null);
return (Option<T>) value;
... | java | private <T> Option<T> getOption(String parameter) {
try {
Field field = UndertowOptions.class.getDeclaredField(parameter);
if (Option.class.getName().equals(field.getType().getTypeName())) {
Object value = field.get(null);
return (Option<T>) value;
... | [
"private",
"<",
"T",
">",
"Option",
"<",
"T",
">",
"getOption",
"(",
"String",
"parameter",
")",
"{",
"try",
"{",
"Field",
"field",
"=",
"UndertowOptions",
".",
"class",
".",
"getDeclaredField",
"(",
"parameter",
")",
";",
"if",
"(",
"Option",
".",
"cl... | Returns Options for given parameter if present else null | [
"Returns",
"Options",
"for",
"given",
"parameter",
"if",
"present",
"else",
"null"
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-server-parent/pippo-undertow/src/main/java/ro/pippo/undertow/UndertowSettings.java#L160-L171 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/DefaultUriMatcher.java | DefaultUriMatcher.replacePosixClasses | private String replacePosixClasses(String input) {
return input
.replace(":alnum:", "\\p{Alnum}")
.replace(":alpha:", "\\p{L}")
.replace(":ascii:", "\\p{ASCII}")
.replace(":digit:", "\\p{Digit}")
.replace(":xdigit:", "\\p{XDigit}");
} | java | private String replacePosixClasses(String input) {
return input
.replace(":alnum:", "\\p{Alnum}")
.replace(":alpha:", "\\p{L}")
.replace(":ascii:", "\\p{ASCII}")
.replace(":digit:", "\\p{Digit}")
.replace(":xdigit:", "\\p{XDigit}");
} | [
"private",
"String",
"replacePosixClasses",
"(",
"String",
"input",
")",
"{",
"return",
"input",
".",
"replace",
"(",
"\":alnum:\"",
",",
"\"\\\\p{Alnum}\"",
")",
".",
"replace",
"(",
"\":alpha:\"",
",",
"\"\\\\p{L}\"",
")",
".",
"replace",
"(",
"\":ascii:\"",
... | Replace any specified POSIX character classes with the Java equivalent.
@param input
@return a Java regex | [
"Replace",
"any",
"specified",
"POSIX",
"character",
"classes",
"with",
"the",
"Java",
"equivalent",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/DefaultUriMatcher.java#L234-L241 | train |
pippo-java/pippo | pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerRegistry.java | ControllerRegistry.register | public void register(Package... packages) {
List<String> packageNames = Arrays.stream(packages)
.map(Package::getName)
.collect(Collectors.toList());
register(packageNames.toArray(new String[packageNames.size()]));
} | java | public void register(Package... packages) {
List<String> packageNames = Arrays.stream(packages)
.map(Package::getName)
.collect(Collectors.toList());
register(packageNames.toArray(new String[packageNames.size()]));
} | [
"public",
"void",
"register",
"(",
"Package",
"...",
"packages",
")",
"{",
"List",
"<",
"String",
">",
"packageNames",
"=",
"Arrays",
".",
"stream",
"(",
"packages",
")",
".",
"map",
"(",
"Package",
"::",
"getName",
")",
".",
"collect",
"(",
"Collectors"... | Register all controller methods in the specified packages.
@param packages | [
"Register",
"all",
"controller",
"methods",
"in",
"the",
"specified",
"packages",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerRegistry.java#L69-L75 | train |
pippo-java/pippo | pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerRegistry.java | ControllerRegistry.register | public void register(String... packageNames) {
Collection<Class<? extends Controller>> classes = getControllerClasses(packageNames);
if (classes.isEmpty()) {
log.warn("No annotated controllers found in package(s) '{}'", Arrays.toString(packageNames));
return;
}
l... | java | public void register(String... packageNames) {
Collection<Class<? extends Controller>> classes = getControllerClasses(packageNames);
if (classes.isEmpty()) {
log.warn("No annotated controllers found in package(s) '{}'", Arrays.toString(packageNames));
return;
}
l... | [
"public",
"void",
"register",
"(",
"String",
"...",
"packageNames",
")",
"{",
"Collection",
"<",
"Class",
"<",
"?",
"extends",
"Controller",
">",
">",
"classes",
"=",
"getControllerClasses",
"(",
"packageNames",
")",
";",
"if",
"(",
"classes",
".",
"isEmpty"... | Register all controller methods in the specified package names.
@param packageNames | [
"Register",
"all",
"controller",
"methods",
"in",
"the",
"specified",
"package",
"names",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerRegistry.java#L82-L94 | train |
pippo-java/pippo | pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerRegistry.java | ControllerRegistry.register | public void register(Class<? extends Controller>... controllerClasses) {
for (Class<? extends Controller> controllerClass : controllerClasses) {
register(controllerClass);
}
} | java | public void register(Class<? extends Controller>... controllerClasses) {
for (Class<? extends Controller> controllerClass : controllerClasses) {
register(controllerClass);
}
} | [
"public",
"void",
"register",
"(",
"Class",
"<",
"?",
"extends",
"Controller",
">",
"...",
"controllerClasses",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
"extends",
"Controller",
">",
"controllerClass",
":",
"controllerClasses",
")",
"{",
"register",
"(",
"co... | Register all controller methods in the specified controller classes.
@param controllerClasses | [
"Register",
"all",
"controller",
"methods",
"in",
"the",
"specified",
"controller",
"classes",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerRegistry.java#L101-L105 | train |
pippo-java/pippo | pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerRegistry.java | ControllerRegistry.registerControllerMethods | private void registerControllerMethods(Map<Method, Class<? extends Annotation>> controllerMethods, Controller controller) {
List<Route> controllerRoutes = createControllerRoutes(controllerMethods);
for (Route controllerRoute : controllerRoutes) {
if (controller != null) {
((C... | java | private void registerControllerMethods(Map<Method, Class<? extends Annotation>> controllerMethods, Controller controller) {
List<Route> controllerRoutes = createControllerRoutes(controllerMethods);
for (Route controllerRoute : controllerRoutes) {
if (controller != null) {
((C... | [
"private",
"void",
"registerControllerMethods",
"(",
"Map",
"<",
"Method",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
">",
"controllerMethods",
",",
"Controller",
"controller",
")",
"{",
"List",
"<",
"Route",
">",
"controllerRoutes",
"=",
"createContr... | Register the controller methods as routes.
@param controllerMethods
@param controller | [
"Register",
"the",
"controller",
"methods",
"as",
"routes",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerRegistry.java#L162-L172 | train |
pippo-java/pippo | pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerRegistry.java | ControllerRegistry.createControllerRoutes | @SuppressWarnings("unchecked")
private List<Route> createControllerRoutes(Map<Method, Class<? extends Annotation>> controllerMethods) {
List<Route> routes = new ArrayList<>();
Class<? extends Controller> controllerClass = (Class<? extends Controller>) controllerMethods.keySet().iterator().next().ge... | java | @SuppressWarnings("unchecked")
private List<Route> createControllerRoutes(Map<Method, Class<? extends Annotation>> controllerMethods) {
List<Route> routes = new ArrayList<>();
Class<? extends Controller> controllerClass = (Class<? extends Controller>) controllerMethods.keySet().iterator().next().ge... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"List",
"<",
"Route",
">",
"createControllerRoutes",
"(",
"Map",
"<",
"Method",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
">",
"controllerMethods",
")",
"{",
"List",
"<",
"Route",
">"... | Create controller routes from controller methods.
@param controllerMethods
@return | [
"Create",
"controller",
"routes",
"from",
"controller",
"methods",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerRegistry.java#L180-L238 | train |
pippo-java/pippo | pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerRegistry.java | ControllerRegistry.getControllerPaths | private Set<String> getControllerPaths(Class<?> controllerClass) {
Set<String> parentPaths = Collections.emptySet();
if (controllerClass.getSuperclass() != null) {
parentPaths = getControllerPaths(controllerClass.getSuperclass());
}
Set<String> paths = new LinkedHashSet<>();... | java | private Set<String> getControllerPaths(Class<?> controllerClass) {
Set<String> parentPaths = Collections.emptySet();
if (controllerClass.getSuperclass() != null) {
parentPaths = getControllerPaths(controllerClass.getSuperclass());
}
Set<String> paths = new LinkedHashSet<>();... | [
"private",
"Set",
"<",
"String",
">",
"getControllerPaths",
"(",
"Class",
"<",
"?",
">",
"controllerClass",
")",
"{",
"Set",
"<",
"String",
">",
"parentPaths",
"=",
"Collections",
".",
"emptySet",
"(",
")",
";",
"if",
"(",
"controllerClass",
".",
"getSuper... | Recursively builds the paths for the controller class.
@param controllerClass
@return the paths for the controller | [
"Recursively",
"builds",
"the",
"paths",
"for",
"the",
"controller",
"class",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerRegistry.java#L281-L308 | train |
pippo-java/pippo | pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerRegistry.java | ControllerRegistry.sortControllerMethods | private Collection<Method> sortControllerMethods(Set<Method> controllerMethods) {
List<Method> list = new ArrayList<>(controllerMethods);
list.sort((m1, m2) -> {
int o1 = Integer.MAX_VALUE;
Order order1 = ClassUtils.getAnnotation(m1, Order.class);
if (order1 != null) ... | java | private Collection<Method> sortControllerMethods(Set<Method> controllerMethods) {
List<Method> list = new ArrayList<>(controllerMethods);
list.sort((m1, m2) -> {
int o1 = Integer.MAX_VALUE;
Order order1 = ClassUtils.getAnnotation(m1, Order.class);
if (order1 != null) ... | [
"private",
"Collection",
"<",
"Method",
">",
"sortControllerMethods",
"(",
"Set",
"<",
"Method",
">",
"controllerMethods",
")",
"{",
"List",
"<",
"Method",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
"controllerMethods",
")",
";",
"list",
".",
"sort",
... | Sort the controller's methods by their preferred order, if specified.
@param controllerMethods
@return a sorted list of methods | [
"Sort",
"the",
"controller",
"s",
"methods",
"by",
"their",
"preferred",
"order",
"if",
"specified",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerRegistry.java#L316-L343 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/util/StringUtils.java | StringUtils.getFileExtension | public static String getFileExtension(String value) {
int index = value.lastIndexOf('.');
if (index > -1) {
return value.substring(index + 1);
}
return "";
} | java | public static String getFileExtension(String value) {
int index = value.lastIndexOf('.');
if (index > -1) {
return value.substring(index + 1);
}
return "";
} | [
"public",
"static",
"String",
"getFileExtension",
"(",
"String",
"value",
")",
"{",
"int",
"index",
"=",
"value",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"index",
">",
"-",
"1",
")",
"{",
"return",
"value",
".",
"substring",
"(",
"ind... | Returns the file extension of the value without the dot or an empty string.
@param value
@return the extension without dot or an empry string | [
"Returns",
"the",
"file",
"extension",
"of",
"the",
"value",
"without",
"the",
"dot",
"or",
"an",
"empty",
"string",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/util/StringUtils.java#L210-L217 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/util/StringUtils.java | StringUtils.getPrefix | public static String getPrefix(String input, char delimiter) {
int index = input.indexOf(delimiter);
if (index > -1) {
return input.substring(0, index);
}
return input;
} | java | public static String getPrefix(String input, char delimiter) {
int index = input.indexOf(delimiter);
if (index > -1) {
return input.substring(0, index);
}
return input;
} | [
"public",
"static",
"String",
"getPrefix",
"(",
"String",
"input",
",",
"char",
"delimiter",
")",
"{",
"int",
"index",
"=",
"input",
".",
"indexOf",
"(",
"delimiter",
")",
";",
"if",
"(",
"index",
">",
"-",
"1",
")",
"{",
"return",
"input",
".",
"sub... | Returns the prefix of the input string from 0 to the first index of the delimiter OR it returns the input string.
@param input
@param delimiter
@return the prefix substring or the entire input string if the delimiter is not found | [
"Returns",
"the",
"prefix",
"of",
"the",
"input",
"string",
"from",
"0",
"to",
"the",
"first",
"index",
"of",
"the",
"delimiter",
"OR",
"it",
"returns",
"the",
"input",
"string",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/util/StringUtils.java#L226-L233 | train |
pippo-java/pippo | pippo-server-parent/pippo-jetty/src/main/java/ro/pippo/jetty/JettyServer.java | JettyServer.asJettyFriendlyPath | private String asJettyFriendlyPath(String path, String name) {
try {
new URL(path);
log.debug("Defer interpretation of {} URL '{}' to Jetty", name, path);
return path;
} catch (MalformedURLException e) {
//Expected. We've got a path and not a URL
... | java | private String asJettyFriendlyPath(String path, String name) {
try {
new URL(path);
log.debug("Defer interpretation of {} URL '{}' to Jetty", name, path);
return path;
} catch (MalformedURLException e) {
//Expected. We've got a path and not a URL
... | [
"private",
"String",
"asJettyFriendlyPath",
"(",
"String",
"path",
",",
"String",
"name",
")",
"{",
"try",
"{",
"new",
"URL",
"(",
"path",
")",
";",
"log",
".",
"debug",
"(",
"\"Defer interpretation of {} URL '{}' to Jetty\"",
",",
"name",
",",
"path",
")",
... | Jetty treats non-URL paths are file paths interpreted in the current working directory.
Provide ability to accept paths to resources on the Classpath.
@param path
@param name Descriptive name of what is for. Used in logs, error messages
@return Path in a format Jetty will understand, even if it is a Classpath-relative... | [
"Jetty",
"treats",
"non",
"-",
"URL",
"paths",
"are",
"file",
"paths",
"interpreted",
"in",
"the",
"current",
"working",
"directory",
".",
"Provide",
"ability",
"to",
"accept",
"paths",
"to",
"resources",
"on",
"the",
"Classpath",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-server-parent/pippo-jetty/src/main/java/ro/pippo/jetty/JettyServer.java#L134-L158 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/route/WebjarsResourceHandler.java | WebjarsResourceHandler.locatePomProperties | private List<String> locatePomProperties() {
List<String> propertiesFiles = new ArrayList<>();
List<URL> packageUrls = ClasspathUtils.getResources(getResourceBasePath());
for (URL packageUrl : packageUrls) {
if (packageUrl.getProtocol().equals("jar")) {
// We only car... | java | private List<String> locatePomProperties() {
List<String> propertiesFiles = new ArrayList<>();
List<URL> packageUrls = ClasspathUtils.getResources(getResourceBasePath());
for (URL packageUrl : packageUrls) {
if (packageUrl.getProtocol().equals("jar")) {
// We only car... | [
"private",
"List",
"<",
"String",
">",
"locatePomProperties",
"(",
")",
"{",
"List",
"<",
"String",
">",
"propertiesFiles",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"URL",
">",
"packageUrls",
"=",
"ClasspathUtils",
".",
"getResources",
"(... | Locate all Webjars Maven pom.properties files on the classpath.
@return a list of Maven pom.properties files on the classpath | [
"Locate",
"all",
"Webjars",
"Maven",
"pom",
".",
"properties",
"files",
"on",
"the",
"classpath",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/route/WebjarsResourceHandler.java#L148-L173 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/AbstractTemplateEngine.java | AbstractTemplateEngine.init | @Override
public void init(Application application) {
languages = application.getLanguages();
messages = application.getMessages();
router = application.getRouter();
pippoSettings = application.getPippoSettings();
fileExtension = pippoSettings.getString(PippoConstants.SETTIN... | java | @Override
public void init(Application application) {
languages = application.getLanguages();
messages = application.getMessages();
router = application.getRouter();
pippoSettings = application.getPippoSettings();
fileExtension = pippoSettings.getString(PippoConstants.SETTIN... | [
"@",
"Override",
"public",
"void",
"init",
"(",
"Application",
"application",
")",
"{",
"languages",
"=",
"application",
".",
"getLanguages",
"(",
")",
";",
"messages",
"=",
"application",
".",
"getMessages",
"(",
")",
";",
"router",
"=",
"application",
".",... | Performs common initialization for template engines.
Implementations must override this method to do their own template engine specific initialization.
To use the convenience of this class, implementations must invoke this class's implementation before
performing their own initialization.
@param application reference... | [
"Performs",
"common",
"initialization",
"for",
"template",
"engines",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/AbstractTemplateEngine.java#L53-L62 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Languages.java | Languages.getLanguageComponent | public String getLanguageComponent(String language) {
if (StringUtils.isNullOrEmpty(language)) {
return "";
}
if (language.contains("-")) {
return language.split("-")[0];
} else if (language.contains("_")) {
return language.split("_")[0];
}
... | java | public String getLanguageComponent(String language) {
if (StringUtils.isNullOrEmpty(language)) {
return "";
}
if (language.contains("-")) {
return language.split("-")[0];
} else if (language.contains("_")) {
return language.split("_")[0];
}
... | [
"public",
"String",
"getLanguageComponent",
"(",
"String",
"language",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"language",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"if",
"(",
"language",
".",
"contains",
"(",
"\"-\"",
")",
")",
"... | Returns the language component of a language string.
@param language
@return the language component | [
"Returns",
"the",
"language",
"component",
"of",
"a",
"language",
"string",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Languages.java#L79-L91 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Languages.java | Languages.clearLanguageCookie | public void clearLanguageCookie(Response response) {
String cookieName = generateLanguageCookie("").getName();
response.removeCookie(cookieName);
} | java | public void clearLanguageCookie(Response response) {
String cookieName = generateLanguageCookie("").getName();
response.removeCookie(cookieName);
} | [
"public",
"void",
"clearLanguageCookie",
"(",
"Response",
"response",
")",
"{",
"String",
"cookieName",
"=",
"generateLanguageCookie",
"(",
"\"\"",
")",
".",
"getName",
"(",
")",
";",
"response",
".",
"removeCookie",
"(",
"cookieName",
")",
";",
"}"
] | Clears the application language cookie.
@param response | [
"Clears",
"the",
"application",
"language",
"cookie",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Languages.java#L142-L145 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Languages.java | Languages.getLanguageOrDefault | public String getLanguageOrDefault(RouteContext routeContext) {
final String cookieName = generateLanguageCookie(defaultLanguage).getName();
// Step 1: Look for a Response cookie.
// The Response always has priority over the Request because it may have
// been set earlier in the Handler... | java | public String getLanguageOrDefault(RouteContext routeContext) {
final String cookieName = generateLanguageCookie(defaultLanguage).getName();
// Step 1: Look for a Response cookie.
// The Response always has priority over the Request because it may have
// been set earlier in the Handler... | [
"public",
"String",
"getLanguageOrDefault",
"(",
"RouteContext",
"routeContext",
")",
"{",
"final",
"String",
"cookieName",
"=",
"generateLanguageCookie",
"(",
"defaultLanguage",
")",
".",
"getName",
"(",
")",
";",
"// Step 1: Look for a Response cookie.",
"// The Respons... | Returns the language for the request. This process considers Request &
Response cookies, the Request ACCEPT_LANGUAGE header, and finally the
application default language.
@param routeContext
@return the language for the request | [
"Returns",
"the",
"language",
"for",
"the",
"request",
".",
"This",
"process",
"considers",
"Request",
"&",
"Response",
"cookies",
"the",
"Request",
"ACCEPT_LANGUAGE",
"header",
"and",
"finally",
"the",
"application",
"default",
"language",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Languages.java#L176-L203 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Languages.java | Languages.getLocaleOrDefault | public Locale getLocaleOrDefault(String language) {
String lang = getLanguageOrDefault(language);
return Locale.forLanguageTag(lang);
} | java | public Locale getLocaleOrDefault(String language) {
String lang = getLanguageOrDefault(language);
return Locale.forLanguageTag(lang);
} | [
"public",
"Locale",
"getLocaleOrDefault",
"(",
"String",
"language",
")",
"{",
"String",
"lang",
"=",
"getLanguageOrDefault",
"(",
"language",
")",
";",
"return",
"Locale",
".",
"forLanguageTag",
"(",
"lang",
")",
";",
"}"
] | Returns the Java Locale for the specified language or the Locale for the
default language if the requested language can not be mapped to a Locale.
@param language
@return a Java Locale | [
"Returns",
"the",
"Java",
"Locale",
"for",
"the",
"specified",
"language",
"or",
"the",
"Locale",
"for",
"the",
"default",
"language",
"if",
"the",
"requested",
"language",
"can",
"not",
"be",
"mapped",
"to",
"a",
"Locale",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Languages.java#L225-L228 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Languages.java | Languages.getLanguageOrDefault | public String getLanguageOrDefault(String language) {
if (!StringUtils.isNullOrEmpty(language)) {
// Check if we get a registered mapping for the language input
// string. The language may be either 'language-country' or
// 'language'.
String[] languages = languag... | java | public String getLanguageOrDefault(String language) {
if (!StringUtils.isNullOrEmpty(language)) {
// Check if we get a registered mapping for the language input
// string. The language may be either 'language-country' or
// 'language'.
String[] languages = languag... | [
"public",
"String",
"getLanguageOrDefault",
"(",
"String",
"language",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"language",
")",
")",
"{",
"// Check if we get a registered mapping for the language input",
"// string. The language may be either 'lang... | Returns a registered language if one can be matched from the input string
OR returns the default language. The input string may be a simple
language or locale value or may be as complex as an ACCEPT-LANGUAGE
header.
@param language
@return the language or the default language | [
"Returns",
"a",
"registered",
"language",
"if",
"one",
"can",
"be",
"matched",
"from",
"the",
"input",
"string",
"OR",
"returns",
"the",
"default",
"language",
".",
"The",
"input",
"string",
"may",
"be",
"a",
"simple",
"language",
"or",
"locale",
"value",
... | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Languages.java#L239-L259 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Languages.java | Languages.getDefaultLanguage | private String getDefaultLanguage(List<String> applicationLanguages) {
if (applicationLanguages.isEmpty()) {
String NO_LANGUAGES_TEXT = "Please specify the supported languages in 'application.properties'."
+ " For example 'application.languages=en, ro, de, pt-BR' makes 'en' your defa... | java | private String getDefaultLanguage(List<String> applicationLanguages) {
if (applicationLanguages.isEmpty()) {
String NO_LANGUAGES_TEXT = "Please specify the supported languages in 'application.properties'."
+ " For example 'application.languages=en, ro, de, pt-BR' makes 'en' your defa... | [
"private",
"String",
"getDefaultLanguage",
"(",
"List",
"<",
"String",
">",
"applicationLanguages",
")",
"{",
"if",
"(",
"applicationLanguages",
".",
"isEmpty",
"(",
")",
")",
"{",
"String",
"NO_LANGUAGES_TEXT",
"=",
"\"Please specify the supported languages in 'applica... | Returns the default language as derived from PippoSettings.
@param applicationLanguages
@return the default language | [
"Returns",
"the",
"default",
"language",
"as",
"derived",
"from",
"PippoSettings",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Languages.java#L280-L291 | train |
pippo-java/pippo | pippo-session-parent/pippo-session-mongodb/src/main/java/ro/pippo/session/mongodb/MongoDBSessionDataStorage.java | MongoDBSessionDataStorage.createIndex | private void createIndex(long idleTime) {
try {
this.sessions.createIndex(
new Document(SESSION_TTL, 1),
new IndexOptions()
.expireAfter(idleTime, TimeUnit.SECONDS)
.name(SESSION_INDEX_NAME));
} catch (MongoExcep... | java | private void createIndex(long idleTime) {
try {
this.sessions.createIndex(
new Document(SESSION_TTL, 1),
new IndexOptions()
.expireAfter(idleTime, TimeUnit.SECONDS)
.name(SESSION_INDEX_NAME));
} catch (MongoExcep... | [
"private",
"void",
"createIndex",
"(",
"long",
"idleTime",
")",
"{",
"try",
"{",
"this",
".",
"sessions",
".",
"createIndex",
"(",
"new",
"Document",
"(",
"SESSION_TTL",
",",
"1",
")",
",",
"new",
"IndexOptions",
"(",
")",
".",
"expireAfter",
"(",
"idleT... | Create TTL index
@param idleTime idle time in seconds
@see <a href="https://docs.mongodb.com/manual/core/index-ttl/">Mongo docs</a> | [
"Create",
"TTL",
"index"
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-session-parent/pippo-session-mongodb/src/main/java/ro/pippo/session/mongodb/MongoDBSessionDataStorage.java#L113-L128 | train |
pippo-java/pippo | pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerHandler.java | ControllerHandler.initInterceptors | protected void initInterceptors() {
interceptors = new ArrayList<>();
ControllerUtils.collectRouteInterceptors(controllerMethod).forEach(handlerClass -> {
try {
interceptors.add(handlerClass.newInstance());
} catch (InstantiationException | IllegalAccessException ... | java | protected void initInterceptors() {
interceptors = new ArrayList<>();
ControllerUtils.collectRouteInterceptors(controllerMethod).forEach(handlerClass -> {
try {
interceptors.add(handlerClass.newInstance());
} catch (InstantiationException | IllegalAccessException ... | [
"protected",
"void",
"initInterceptors",
"(",
")",
"{",
"interceptors",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"ControllerUtils",
".",
"collectRouteInterceptors",
"(",
"controllerMethod",
")",
".",
"forEach",
"(",
"handlerClass",
"->",
"{",
"try",
"{",
... | Init interceptors from controller method. | [
"Init",
"interceptors",
"from",
"controller",
"method",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerHandler.java#L191-L200 | train |
pippo-java/pippo | pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerHandler.java | ControllerHandler.initExtractors | protected void initExtractors() {
Parameter[] parameters = controllerMethod.getParameters();
extractors = new MethodParameterExtractor[parameters.length];
for (int i = 0; i < parameters.length; i++) {
MethodParameter parameter = new MethodParameter(controllerMethod, i);
M... | java | protected void initExtractors() {
Parameter[] parameters = controllerMethod.getParameters();
extractors = new MethodParameterExtractor[parameters.length];
for (int i = 0; i < parameters.length; i++) {
MethodParameter parameter = new MethodParameter(controllerMethod, i);
M... | [
"protected",
"void",
"initExtractors",
"(",
")",
"{",
"Parameter",
"[",
"]",
"parameters",
"=",
"controllerMethod",
".",
"getParameters",
"(",
")",
";",
"extractors",
"=",
"new",
"MethodParameterExtractor",
"[",
"parameters",
".",
"length",
"]",
";",
"for",
"(... | Init extractors from controller method. | [
"Init",
"extractors",
"from",
"controller",
"method",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerHandler.java#L205-L223 | train |
pippo-java/pippo | pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerHandler.java | ControllerHandler.validateConsumes | protected void validateConsumes(Collection<String> contentTypes) {
Set<String> ignoreConsumes = new TreeSet<>();
ignoreConsumes.add(Consumes.ALL);
// these are handled by the TemplateEngine
ignoreConsumes.add(Consumes.HTML);
ignoreConsumes.add(Consumes.XHTML);
// these ... | java | protected void validateConsumes(Collection<String> contentTypes) {
Set<String> ignoreConsumes = new TreeSet<>();
ignoreConsumes.add(Consumes.ALL);
// these are handled by the TemplateEngine
ignoreConsumes.add(Consumes.HTML);
ignoreConsumes.add(Consumes.XHTML);
// these ... | [
"protected",
"void",
"validateConsumes",
"(",
"Collection",
"<",
"String",
">",
"contentTypes",
")",
"{",
"Set",
"<",
"String",
">",
"ignoreConsumes",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"ignoreConsumes",
".",
"add",
"(",
"Consumes",
".",
"ALL",
")... | Validates that the declared consumes can actually be processed by Pippo.
@param contentTypes | [
"Validates",
"that",
"the",
"declared",
"consumes",
"can",
"actually",
"be",
"processed",
"by",
"Pippo",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerHandler.java#L230-L264 | train |
pippo-java/pippo | pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerHandler.java | ControllerHandler.validateProduces | protected void validateProduces(Collection<String> contentTypes) {
Set<String> ignoreProduces = new TreeSet<>();
ignoreProduces.add(Produces.TEXT);
ignoreProduces.add(Produces.HTML);
ignoreProduces.add(Produces.XHTML);
for (String produces : declaredProduces) {
if (i... | java | protected void validateProduces(Collection<String> contentTypes) {
Set<String> ignoreProduces = new TreeSet<>();
ignoreProduces.add(Produces.TEXT);
ignoreProduces.add(Produces.HTML);
ignoreProduces.add(Produces.XHTML);
for (String produces : declaredProduces) {
if (i... | [
"protected",
"void",
"validateProduces",
"(",
"Collection",
"<",
"String",
">",
"contentTypes",
")",
"{",
"Set",
"<",
"String",
">",
"ignoreProduces",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"ignoreProduces",
".",
"add",
"(",
"Produces",
".",
"TEXT",
"... | Validates that the declared content-types can actually be generated by Pippo.
@param contentTypes | [
"Validates",
"that",
"the",
"declared",
"content",
"-",
"types",
"can",
"actually",
"be",
"generated",
"by",
"Pippo",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/ControllerHandler.java#L271-L287 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/route/DefaultRouteContext.java | DefaultRouteContext.runFinallyRoutes | @Override
public void runFinallyRoutes() {
while (iterator.hasNext()) {
Route route = iterator.next().getRoute();
if (route.isRunAsFinally()) {
try {
handleRoute(route);
} catch (Exception e) {
log.error("Unexpec... | java | @Override
public void runFinallyRoutes() {
while (iterator.hasNext()) {
Route route = iterator.next().getRoute();
if (route.isRunAsFinally()) {
try {
handleRoute(route);
} catch (Exception e) {
log.error("Unexpec... | [
"@",
"Override",
"public",
"void",
"runFinallyRoutes",
"(",
")",
"{",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"Route",
"route",
"=",
"iterator",
".",
"next",
"(",
")",
".",
"getRoute",
"(",
")",
";",
"if",
"(",
"route",
".",
"... | Execute all routes that are flagged to run as finally. | [
"Execute",
"all",
"routes",
"that",
"are",
"flagged",
"to",
"run",
"as",
"finally",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/route/DefaultRouteContext.java#L291-L311 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/ContentTypeEngines.java | ContentTypeEngines.hasContentTypeEngine | public boolean hasContentTypeEngine(String contentTypeOrSuffix) {
String sanitizedTypes = sanitizeContentTypes(contentTypeOrSuffix);
String[] types = sanitizedTypes.split(",");
for (String type : types) {
if (engines.containsKey(type)) {
return true;
}
... | java | public boolean hasContentTypeEngine(String contentTypeOrSuffix) {
String sanitizedTypes = sanitizeContentTypes(contentTypeOrSuffix);
String[] types = sanitizedTypes.split(",");
for (String type : types) {
if (engines.containsKey(type)) {
return true;
}
... | [
"public",
"boolean",
"hasContentTypeEngine",
"(",
"String",
"contentTypeOrSuffix",
")",
"{",
"String",
"sanitizedTypes",
"=",
"sanitizeContentTypes",
"(",
"contentTypeOrSuffix",
")",
";",
"String",
"[",
"]",
"types",
"=",
"sanitizedTypes",
".",
"split",
"(",
"\",\""... | Returns true if there is an engine registered for the content type or content type suffix.
@param contentTypeOrSuffix
@return true if there is an engine for the content type | [
"Returns",
"true",
"if",
"there",
"is",
"an",
"engine",
"registered",
"for",
"the",
"content",
"type",
"or",
"content",
"type",
"suffix",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/ContentTypeEngines.java#L54-L64 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/ContentTypeEngines.java | ContentTypeEngines.registerContentTypeEngine | public ContentTypeEngine registerContentTypeEngine(Class<? extends ContentTypeEngine> engineClass) {
ContentTypeEngine engine;
try {
engine = engineClass.newInstance();
} catch (Exception e) {
throw new PippoRuntimeException(e, "Failed to instantiate '{}'", engineClass.ge... | java | public ContentTypeEngine registerContentTypeEngine(Class<? extends ContentTypeEngine> engineClass) {
ContentTypeEngine engine;
try {
engine = engineClass.newInstance();
} catch (Exception e) {
throw new PippoRuntimeException(e, "Failed to instantiate '{}'", engineClass.ge... | [
"public",
"ContentTypeEngine",
"registerContentTypeEngine",
"(",
"Class",
"<",
"?",
"extends",
"ContentTypeEngine",
">",
"engineClass",
")",
"{",
"ContentTypeEngine",
"engine",
";",
"try",
"{",
"engine",
"=",
"engineClass",
".",
"newInstance",
"(",
")",
";",
"}",
... | Registers a content type engine if no other engine has been registered
for the content type.
@param engineClass
@return the engine instance, if it is registered | [
"Registers",
"a",
"content",
"type",
"engine",
"if",
"no",
"other",
"engine",
"has",
"been",
"registered",
"for",
"the",
"content",
"type",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/ContentTypeEngines.java#L91-L106 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/ContentTypeEngines.java | ContentTypeEngines.setContentTypeEngine | public void setContentTypeEngine(ContentTypeEngine engine) {
String contentType = engine.getContentType();
String suffix = StringUtils.removeStart(contentType.substring(contentType.lastIndexOf('/') + 1), "x-");
engines.put(engine.getContentType(), engine);
suffixes.put(suffix.toLowerCas... | java | public void setContentTypeEngine(ContentTypeEngine engine) {
String contentType = engine.getContentType();
String suffix = StringUtils.removeStart(contentType.substring(contentType.lastIndexOf('/') + 1), "x-");
engines.put(engine.getContentType(), engine);
suffixes.put(suffix.toLowerCas... | [
"public",
"void",
"setContentTypeEngine",
"(",
"ContentTypeEngine",
"engine",
")",
"{",
"String",
"contentType",
"=",
"engine",
".",
"getContentType",
"(",
")",
";",
"String",
"suffix",
"=",
"StringUtils",
".",
"removeStart",
"(",
"contentType",
".",
"substring",
... | Sets the engine for it's specified content type. An suffix for the engine is also registered based on the
specific type; extension types are supported and the leading "x-" is trimmed out.
@param engine | [
"Sets",
"the",
"engine",
"for",
"it",
"s",
"specified",
"content",
"type",
".",
"An",
"suffix",
"for",
"the",
"engine",
"is",
"also",
"registered",
"based",
"on",
"the",
"specific",
"type",
";",
"extension",
"types",
"are",
"supported",
"and",
"the",
"lead... | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/ContentTypeEngines.java#L142-L150 | train |
pippo-java/pippo | pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/util/ClassUtils.java | ClassUtils.getSubTypesOf | public static <T> Collection<Class<? extends T>> getSubTypesOf(Class<T> type, String... packageNames) {
List<Class<? extends T>> classes = getClasses(packageNames).stream()
.filter(aClass -> type.isAssignableFrom(aClass))
.map(aClass -> (Class<? extends T>) aClass)
... | java | public static <T> Collection<Class<? extends T>> getSubTypesOf(Class<T> type, String... packageNames) {
List<Class<? extends T>> classes = getClasses(packageNames).stream()
.filter(aClass -> type.isAssignableFrom(aClass))
.map(aClass -> (Class<? extends T>) aClass)
... | [
"public",
"static",
"<",
"T",
">",
"Collection",
"<",
"Class",
"<",
"?",
"extends",
"T",
">",
">",
"getSubTypesOf",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"...",
"packageNames",
")",
"{",
"List",
"<",
"Class",
"<",
"?",
"extends",
"T",
... | Gets all sub types in hierarchy of a given type. | [
"Gets",
"all",
"sub",
"types",
"in",
"hierarchy",
"of",
"a",
"given",
"type",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/util/ClassUtils.java#L130-L137 | train |
pippo-java/pippo | pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/util/ClassUtils.java | ClassUtils.getAnnotation | public static <T extends Annotation> T getAnnotation(Method method, Class<T> annotationClass) {
T annotation = method.getAnnotation(annotationClass);
if (annotation == null) {
annotation = getAnnotation(method.getDeclaringClass(), annotationClass);
}
return annotation;
} | java | public static <T extends Annotation> T getAnnotation(Method method, Class<T> annotationClass) {
T annotation = method.getAnnotation(annotationClass);
if (annotation == null) {
annotation = getAnnotation(method.getDeclaringClass(), annotationClass);
}
return annotation;
} | [
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"getAnnotation",
"(",
"Method",
"method",
",",
"Class",
"<",
"T",
">",
"annotationClass",
")",
"{",
"T",
"annotation",
"=",
"method",
".",
"getAnnotation",
"(",
"annotationClass",
")",
";",
"... | Extract the annotation from the controllerMethod or the declaring class.
@param method
@param annotationClass
@param <T>
@return the annotation or null | [
"Extract",
"the",
"annotation",
"from",
"the",
"controllerMethod",
"or",
"the",
"declaring",
"class",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-controller-parent/pippo-controller/src/main/java/ro/pippo/controller/util/ClassUtils.java#L155-L162 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/util/IoUtils.java | IoUtils.copy | public static long copy(InputStream input, OutputStream output) throws IOException {
byte[] buffer = new byte[2 * 1024];
long total = 0;
int count;
while ((count = input.read(buffer)) != -1) {
output.write(buffer, 0, count);
total += count;
}
retu... | java | public static long copy(InputStream input, OutputStream output) throws IOException {
byte[] buffer = new byte[2 * 1024];
long total = 0;
int count;
while ((count = input.read(buffer)) != -1) {
output.write(buffer, 0, count);
total += count;
}
retu... | [
"public",
"static",
"long",
"copy",
"(",
"InputStream",
"input",
",",
"OutputStream",
"output",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"2",
"*",
"1024",
"]",
";",
"long",
"total",
"=",
"0",
";",
"int",
... | Copies all data from an InputStream to an OutputStream.
@return the number of bytes copied
@throws IOException if an I/O error occurs | [
"Copies",
"all",
"data",
"from",
"an",
"InputStream",
"to",
"an",
"OutputStream",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/util/IoUtils.java#L46-L56 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Request.java | Request.getParameter | public ParameterValue getParameter(String name) {
if (!getParameters().containsKey(name)) {
return buildParameterValue();
}
return getParameters().get(name);
} | java | public ParameterValue getParameter(String name) {
if (!getParameters().containsKey(name)) {
return buildParameterValue();
}
return getParameters().get(name);
} | [
"public",
"ParameterValue",
"getParameter",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"getParameters",
"(",
")",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"return",
"buildParameterValue",
"(",
")",
";",
"}",
"return",
"getParameters",
"(",
")"... | Returns one parameter value. | [
"Returns",
"one",
"parameter",
"value",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Request.java#L98-L104 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Request.java | Request.getQueryParameter | public ParameterValue getQueryParameter(String name) {
if (!getQueryParameters().containsKey(name)) {
return buildParameterValue();
}
return getQueryParameters().get(name);
} | java | public ParameterValue getQueryParameter(String name) {
if (!getQueryParameters().containsKey(name)) {
return buildParameterValue();
}
return getQueryParameters().get(name);
} | [
"public",
"ParameterValue",
"getQueryParameter",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"getQueryParameters",
"(",
")",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"return",
"buildParameterValue",
"(",
")",
";",
"}",
"return",
"getQueryParameters... | Returns one query parameter value. | [
"Returns",
"one",
"query",
"parameter",
"value",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Request.java#L116-L122 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Request.java | Request.getPathParameter | public ParameterValue getPathParameter(String name) {
if (!getPathParameters().containsKey(name)) {
return buildParameterValue();
}
return getPathParameters().get(name);
} | java | public ParameterValue getPathParameter(String name) {
if (!getPathParameters().containsKey(name)) {
return buildParameterValue();
}
return getPathParameters().get(name);
} | [
"public",
"ParameterValue",
"getPathParameter",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"getPathParameters",
"(",
")",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"return",
"buildParameterValue",
"(",
")",
";",
"}",
"return",
"getPathParameters",
... | Returns one path parameter. | [
"Returns",
"one",
"path",
"parameter",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Request.java#L134-L140 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Request.java | Request.getApplicationUriWithQuery | public String getApplicationUriWithQuery() {
StringBuilder sb = new StringBuilder();
sb.append(getApplicationUri());
if (getQuery() != null) {
sb.append('?').append(getQuery());
}
return sb.toString();
} | java | public String getApplicationUriWithQuery() {
StringBuilder sb = new StringBuilder();
sb.append(getApplicationUri());
if (getQuery() != null) {
sb.append('?').append(getQuery());
}
return sb.toString();
} | [
"public",
"String",
"getApplicationUriWithQuery",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"getApplicationUri",
"(",
")",
")",
";",
"if",
"(",
"getQuery",
"(",
")",
"!=",
"null",
")",
"{"... | Returns the uri with the query string relative to the application root path.
@return the application-relative uri with the query | [
"Returns",
"the",
"uri",
"with",
"the",
"query",
"string",
"relative",
"to",
"the",
"application",
"root",
"path",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Request.java#L496-L504 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.loadProperties | private Properties loadProperties(File baseDir, Properties currentProperties, String key, boolean override) throws IOException {
Properties loadedProperties = new Properties();
String include = (String) currentProperties.remove(key);
if (!StringUtils.isNullOrEmpty(include)) {
// all... | java | private Properties loadProperties(File baseDir, Properties currentProperties, String key, boolean override) throws IOException {
Properties loadedProperties = new Properties();
String include = (String) currentProperties.remove(key);
if (!StringUtils.isNullOrEmpty(include)) {
// all... | [
"private",
"Properties",
"loadProperties",
"(",
"File",
"baseDir",
",",
"Properties",
"currentProperties",
",",
"String",
"key",
",",
"boolean",
"override",
")",
"throws",
"IOException",
"{",
"Properties",
"loadedProperties",
"=",
"new",
"Properties",
"(",
")",
";... | Recursively read referenced properties files.
@param baseDir
@param currentProperties
@param key
@param override
@return the merged properties
@throws IOException | [
"Recursively",
"read",
"referenced",
"properties",
"files",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L301-L351 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.addInterpolationValue | protected void addInterpolationValue(String name, String value) {
interpolationValues.put(String.format("${%s}", name), value);
interpolationValues.put(String.format("@{%s}", name), value);
} | java | protected void addInterpolationValue(String name, String value) {
interpolationValues.put(String.format("${%s}", name), value);
interpolationValues.put(String.format("@{%s}", name), value);
} | [
"protected",
"void",
"addInterpolationValue",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"interpolationValues",
".",
"put",
"(",
"String",
".",
"format",
"(",
"\"${%s}\"",
",",
"name",
")",
",",
"value",
")",
";",
"interpolationValues",
".",
"p... | Add a value that may be interpolated.
@param name
@param value | [
"Add",
"a",
"value",
"that",
"may",
"be",
"interpolated",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L385-L388 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.interpolateString | protected String interpolateString(String value) {
String interpolatedValue = value;
for (Map.Entry<String, String> entry : interpolationValues.entrySet()) {
interpolatedValue = interpolatedValue.replace(entry.getKey(), entry.getValue());
}
return interpolatedValue;
} | java | protected String interpolateString(String value) {
String interpolatedValue = value;
for (Map.Entry<String, String> entry : interpolationValues.entrySet()) {
interpolatedValue = interpolatedValue.replace(entry.getKey(), entry.getValue());
}
return interpolatedValue;
} | [
"protected",
"String",
"interpolateString",
"(",
"String",
"value",
")",
"{",
"String",
"interpolatedValue",
"=",
"value",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"interpolationValues",
".",
"entrySet",
"(",
")"... | Interpolates a string value using System properties and Environment variables.
@param value
@return an interpolated string | [
"Interpolates",
"a",
"string",
"value",
"using",
"System",
"properties",
"and",
"Environment",
"variables",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L396-L403 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.getSettingNames | public List<String> getSettingNames(String startingWith) {
List<String> names = new ArrayList<>();
Properties props = getProperties();
if (StringUtils.isNullOrEmpty(startingWith)) {
names.addAll(props.stringPropertyNames());
} else {
startingWith = startingWith.to... | java | public List<String> getSettingNames(String startingWith) {
List<String> names = new ArrayList<>();
Properties props = getProperties();
if (StringUtils.isNullOrEmpty(startingWith)) {
names.addAll(props.stringPropertyNames());
} else {
startingWith = startingWith.to... | [
"public",
"List",
"<",
"String",
">",
"getSettingNames",
"(",
"String",
"startingWith",
")",
"{",
"List",
"<",
"String",
">",
"names",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Properties",
"props",
"=",
"getProperties",
"(",
")",
";",
"if",
"(",
... | Returns the list of settings whose name starts with the specified prefix. If
the prefix is null or empty, all settings names are returned.
@param startingWith
@return list of setting names | [
"Returns",
"the",
"list",
"of",
"settings",
"whose",
"name",
"starts",
"with",
"the",
"specified",
"prefix",
".",
"If",
"the",
"prefix",
"is",
"null",
"or",
"empty",
"all",
"settings",
"names",
"are",
"returned",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L421-L437 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.getString | public String getString(String name, String defaultValue) {
String value = getProperties().getProperty(name, defaultValue);
value = overrides.getProperty(name, value);
return value;
} | java | public String getString(String name, String defaultValue) {
String value = getProperties().getProperty(name, defaultValue);
value = overrides.getProperty(name, value);
return value;
} | [
"public",
"String",
"getString",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getProperties",
"(",
")",
".",
"getProperty",
"(",
"name",
",",
"defaultValue",
")",
";",
"value",
"=",
"overrides",
".",
"getProperty",... | Returns the string value for the specified name. If the name does not exist
or the value for the name can not be interpreted as a string, the
defaultValue is returned.
@param name
@param defaultValue
@return name value or defaultValue | [
"Returns",
"the",
"string",
"value",
"for",
"the",
"specified",
"name",
".",
"If",
"the",
"name",
"does",
"not",
"exist",
"or",
"the",
"value",
"for",
"the",
"name",
"can",
"not",
"be",
"interpreted",
"as",
"a",
"string",
"the",
"defaultValue",
"is",
"re... | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L448-L453 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.getBoolean | public boolean getBoolean(String name, boolean defaultValue) {
String value = getString(name, null);
if (!StringUtils.isNullOrEmpty(value)) {
return Boolean.parseBoolean(value.trim());
}
return defaultValue;
} | java | public boolean getBoolean(String name, boolean defaultValue) {
String value = getString(name, null);
if (!StringUtils.isNullOrEmpty(value)) {
return Boolean.parseBoolean(value.trim());
}
return defaultValue;
} | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"name",
",",
"boolean",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getString",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"!",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"value",
")",
")",
"{",... | Returns the boolean value for the specified name. If the name does not
exist or the value for the name can not be interpreted as a boolean, the
defaultValue is returned.
@param name
@param defaultValue
@return name value or defaultValue | [
"Returns",
"the",
"boolean",
"value",
"for",
"the",
"specified",
"name",
".",
"If",
"the",
"name",
"does",
"not",
"exist",
"or",
"the",
"value",
"for",
"the",
"name",
"can",
"not",
"be",
"interpreted",
"as",
"a",
"boolean",
"the",
"defaultValue",
"is",
"... | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L477-L484 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.getInteger | public int getInteger(String name, int defaultValue) {
try {
String value = getString(name, null);
if (!StringUtils.isNullOrEmpty(value)) {
return Integer.parseInt(value.trim());
}
} catch (NumberFormatException e) {
log.warn("Failed to par... | java | public int getInteger(String name, int defaultValue) {
try {
String value = getString(name, null);
if (!StringUtils.isNullOrEmpty(value)) {
return Integer.parseInt(value.trim());
}
} catch (NumberFormatException e) {
log.warn("Failed to par... | [
"public",
"int",
"getInteger",
"(",
"String",
"name",
",",
"int",
"defaultValue",
")",
"{",
"try",
"{",
"String",
"value",
"=",
"getString",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"!",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"value",
")",
")"... | Returns the integer value for the specified name. If the name does not
exist or the value for the name can not be interpreted as an integer, the
defaultValue is returned.
@param name
@param defaultValue
@return name value or defaultValue | [
"Returns",
"the",
"integer",
"value",
"for",
"the",
"specified",
"name",
".",
"If",
"the",
"name",
"does",
"not",
"exist",
"or",
"the",
"value",
"for",
"the",
"name",
"can",
"not",
"be",
"interpreted",
"as",
"an",
"integer",
"the",
"defaultValue",
"is",
... | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L495-L507 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.getLong | public long getLong(String name, long defaultValue) {
try {
String value = getString(name, null);
if (!StringUtils.isNullOrEmpty(value)) {
return Long.parseLong(value.trim());
}
} catch (NumberFormatException e) {
log.warn("Failed to parse ... | java | public long getLong(String name, long defaultValue) {
try {
String value = getString(name, null);
if (!StringUtils.isNullOrEmpty(value)) {
return Long.parseLong(value.trim());
}
} catch (NumberFormatException e) {
log.warn("Failed to parse ... | [
"public",
"long",
"getLong",
"(",
"String",
"name",
",",
"long",
"defaultValue",
")",
"{",
"try",
"{",
"String",
"value",
"=",
"getString",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"!",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"value",
")",
")",... | Returns the long value for the specified name. If the name does not
exist or the value for the name can not be interpreted as an long, the
defaultValue is returned.
@param name
@param defaultValue
@return name value or defaultValue | [
"Returns",
"the",
"long",
"value",
"for",
"the",
"specified",
"name",
".",
"If",
"the",
"name",
"does",
"not",
"exist",
"or",
"the",
"value",
"for",
"the",
"name",
"can",
"not",
"be",
"interpreted",
"as",
"an",
"long",
"the",
"defaultValue",
"is",
"retur... | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L518-L530 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.getFloat | public float getFloat(String name, float defaultValue) {
try {
String value = getString(name, null);
if (!StringUtils.isNullOrEmpty(value)) {
return Float.parseFloat(value.trim());
}
} catch (NumberFormatException e) {
log.warn("Failed to p... | java | public float getFloat(String name, float defaultValue) {
try {
String value = getString(name, null);
if (!StringUtils.isNullOrEmpty(value)) {
return Float.parseFloat(value.trim());
}
} catch (NumberFormatException e) {
log.warn("Failed to p... | [
"public",
"float",
"getFloat",
"(",
"String",
"name",
",",
"float",
"defaultValue",
")",
"{",
"try",
"{",
"String",
"value",
"=",
"getString",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"!",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"value",
")",
"... | Returns the float value for the specified name. If the name does not
exist or the value for the name can not be interpreted as a float, the
defaultValue is returned.
@param name
@param defaultValue
@return name value or defaultValue | [
"Returns",
"the",
"float",
"value",
"for",
"the",
"specified",
"name",
".",
"If",
"the",
"name",
"does",
"not",
"exist",
"or",
"the",
"value",
"for",
"the",
"name",
"can",
"not",
"be",
"interpreted",
"as",
"a",
"float",
"the",
"defaultValue",
"is",
"retu... | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L541-L553 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.getDouble | public double getDouble(String name, double defaultValue) {
try {
String value = getString(name, null);
if (!StringUtils.isNullOrEmpty(value)) {
return Double.parseDouble(value.trim());
}
} catch (NumberFormatException e) {
log.warn("Failed... | java | public double getDouble(String name, double defaultValue) {
try {
String value = getString(name, null);
if (!StringUtils.isNullOrEmpty(value)) {
return Double.parseDouble(value.trim());
}
} catch (NumberFormatException e) {
log.warn("Failed... | [
"public",
"double",
"getDouble",
"(",
"String",
"name",
",",
"double",
"defaultValue",
")",
"{",
"try",
"{",
"String",
"value",
"=",
"getString",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"!",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"value",
")",
... | Returns the double value for the specified name. If the name does not
exist or the value for the name can not be interpreted as a double, the
defaultValue is returned.
@param name
@param defaultValue
@return name value or defaultValue | [
"Returns",
"the",
"double",
"value",
"for",
"the",
"specified",
"name",
".",
"If",
"the",
"name",
"does",
"not",
"exist",
"or",
"the",
"value",
"for",
"the",
"name",
"can",
"not",
"be",
"interpreted",
"as",
"a",
"double",
"the",
"defaultValue",
"is",
"re... | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L564-L576 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.getChar | public char getChar(String name, char defaultValue) {
String value = getString(name, null);
if (!StringUtils.isNullOrEmpty(value)) {
return value.trim().charAt(0);
}
return defaultValue;
} | java | public char getChar(String name, char defaultValue) {
String value = getString(name, null);
if (!StringUtils.isNullOrEmpty(value)) {
return value.trim().charAt(0);
}
return defaultValue;
} | [
"public",
"char",
"getChar",
"(",
"String",
"name",
",",
"char",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getString",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"!",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"value",
")",
")",
"{",
"retur... | Returns the char value for the specified name. If the name does not exist
or the value for the name can not be interpreted as a char, the
defaultValue is returned.
@param name
@param defaultValue
@return name value or defaultValue | [
"Returns",
"the",
"char",
"value",
"for",
"the",
"specified",
"name",
".",
"If",
"the",
"name",
"does",
"not",
"exist",
"or",
"the",
"value",
"for",
"the",
"name",
"can",
"not",
"be",
"interpreted",
"as",
"a",
"char",
"the",
"defaultValue",
"is",
"return... | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L587-L594 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.getRequiredString | public String getRequiredString(String name) {
String value = getString(name, null);
if (value != null) {
return value.trim();
}
throw new PippoRuntimeException("Setting '{}' has not been configured!", name);
} | java | public String getRequiredString(String name) {
String value = getString(name, null);
if (value != null) {
return value.trim();
}
throw new PippoRuntimeException("Setting '{}' has not been configured!", name);
} | [
"public",
"String",
"getRequiredString",
"(",
"String",
"name",
")",
"{",
"String",
"value",
"=",
"getString",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"value",
".",
"trim",
"(",
")",
";",
"}",
"throw"... | Returns the string value for the specified name. If the name does not
exist an exception is thrown.
@param name
@return name value | [
"Returns",
"the",
"string",
"value",
"for",
"the",
"specified",
"name",
".",
"If",
"the",
"name",
"does",
"not",
"exist",
"an",
"exception",
"is",
"thrown",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L603-L609 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.getStrings | public List<String> getStrings(String name, String delimiter) {
String value = getString(name, null);
if (StringUtils.isNullOrEmpty(value)) {
return Collections.emptyList();
}
value = value.trim();
// to handles cases where value is specified like [a,b, c]
if... | java | public List<String> getStrings(String name, String delimiter) {
String value = getString(name, null);
if (StringUtils.isNullOrEmpty(value)) {
return Collections.emptyList();
}
value = value.trim();
// to handles cases where value is specified like [a,b, c]
if... | [
"public",
"List",
"<",
"String",
">",
"getStrings",
"(",
"String",
"name",
",",
"String",
"delimiter",
")",
"{",
"String",
"value",
"=",
"getString",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"value",
")",
... | Returns a list of strings from the specified name using the specified delimiter.
@param name
@param delimiter
@return list of strings | [
"Returns",
"a",
"list",
"of",
"strings",
"from",
"the",
"specified",
"name",
"using",
"the",
"specified",
"delimiter",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L628-L640 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.getIntegers | public List<Integer> getIntegers(String name, String delimiter) {
List<String> strings = getStrings(name, delimiter);
List<Integer> ints = new ArrayList<>(strings.size());
for (String value : strings) {
try {
int i = Integer.parseInt(value);
ints.add(... | java | public List<Integer> getIntegers(String name, String delimiter) {
List<String> strings = getStrings(name, delimiter);
List<Integer> ints = new ArrayList<>(strings.size());
for (String value : strings) {
try {
int i = Integer.parseInt(value);
ints.add(... | [
"public",
"List",
"<",
"Integer",
">",
"getIntegers",
"(",
"String",
"name",
",",
"String",
"delimiter",
")",
"{",
"List",
"<",
"String",
">",
"strings",
"=",
"getStrings",
"(",
"name",
",",
"delimiter",
")",
";",
"List",
"<",
"Integer",
">",
"ints",
"... | Returns a list of integers from the specified name using the specified delimiter.
@param name
@param delimiter
@return list of integers | [
"Returns",
"a",
"list",
"of",
"integers",
"from",
"the",
"specified",
"name",
"using",
"the",
"specified",
"delimiter",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L659-L672 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.getLongs | public List<Long> getLongs(String name, String delimiter) {
List<String> strings = getStrings(name, delimiter);
List<Long> longs = new ArrayList<>(strings.size());
for (String value : strings) {
try {
long i = Long.parseLong(value);
longs.add(i);
... | java | public List<Long> getLongs(String name, String delimiter) {
List<String> strings = getStrings(name, delimiter);
List<Long> longs = new ArrayList<>(strings.size());
for (String value : strings) {
try {
long i = Long.parseLong(value);
longs.add(i);
... | [
"public",
"List",
"<",
"Long",
">",
"getLongs",
"(",
"String",
"name",
",",
"String",
"delimiter",
")",
"{",
"List",
"<",
"String",
">",
"strings",
"=",
"getStrings",
"(",
"name",
",",
"delimiter",
")",
";",
"List",
"<",
"Long",
">",
"longs",
"=",
"n... | Returns a list of longs from the specified name using the specified delimiter.
@param name
@param delimiter
@return list of longs | [
"Returns",
"a",
"list",
"of",
"longs",
"from",
"the",
"specified",
"name",
"using",
"the",
"specified",
"delimiter",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L691-L704 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.getFloats | public List<Float> getFloats(String name, String delimiter) {
List<String> strings = getStrings(name, delimiter);
List<Float> floats = new ArrayList<>(strings.size());
for (String value : strings) {
try {
float i = Float.parseFloat(value);
floats.add(... | java | public List<Float> getFloats(String name, String delimiter) {
List<String> strings = getStrings(name, delimiter);
List<Float> floats = new ArrayList<>(strings.size());
for (String value : strings) {
try {
float i = Float.parseFloat(value);
floats.add(... | [
"public",
"List",
"<",
"Float",
">",
"getFloats",
"(",
"String",
"name",
",",
"String",
"delimiter",
")",
"{",
"List",
"<",
"String",
">",
"strings",
"=",
"getStrings",
"(",
"name",
",",
"delimiter",
")",
";",
"List",
"<",
"Float",
">",
"floats",
"=",
... | Returns a list of floats from the specified name using the specified delimiter.
@param name
@param delimiter
@return list of floats | [
"Returns",
"a",
"list",
"of",
"floats",
"from",
"the",
"specified",
"name",
"using",
"the",
"specified",
"delimiter",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L723-L735 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.getDoubles | public List<Double> getDoubles(String name, String delimiter) {
List<String> strings = getStrings(name, delimiter);
List<Double> doubles = new ArrayList<>(strings.size());
for (String value : strings) {
try {
double i = Double.parseDouble(value);
doub... | java | public List<Double> getDoubles(String name, String delimiter) {
List<String> strings = getStrings(name, delimiter);
List<Double> doubles = new ArrayList<>(strings.size());
for (String value : strings) {
try {
double i = Double.parseDouble(value);
doub... | [
"public",
"List",
"<",
"Double",
">",
"getDoubles",
"(",
"String",
"name",
",",
"String",
"delimiter",
")",
"{",
"List",
"<",
"String",
">",
"strings",
"=",
"getStrings",
"(",
"name",
",",
"delimiter",
")",
";",
"List",
"<",
"Double",
">",
"doubles",
"... | Returns a list of doubles from the specified name using the specified delimiter.
@param name
@param delimiter
@return list of doubles | [
"Returns",
"a",
"list",
"of",
"doubles",
"from",
"the",
"specified",
"name",
"using",
"the",
"specified",
"delimiter",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L754-L766 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.extractTimeUnit | private TimeUnit extractTimeUnit(String name, String defaultValue) {
String value = getString(name, defaultValue);
try {
final String[] s = value.split(" ", 2);
return TimeUnit.valueOf(s[1].trim().toUpperCase());
} catch (Exception e) {
throw new PippoRuntimeE... | java | private TimeUnit extractTimeUnit(String name, String defaultValue) {
String value = getString(name, defaultValue);
try {
final String[] s = value.split(" ", 2);
return TimeUnit.valueOf(s[1].trim().toUpperCase());
} catch (Exception e) {
throw new PippoRuntimeE... | [
"private",
"TimeUnit",
"extractTimeUnit",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getString",
"(",
"name",
",",
"defaultValue",
")",
";",
"try",
"{",
"final",
"String",
"[",
"]",
"s",
"=",
"value",
".",
"s... | Extracts the TimeUnit from the name.
@param name
@param defaultValue
@return the extracted TimeUnit | [
"Extracts",
"the",
"TimeUnit",
"from",
"the",
"name",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L985-L993 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/util/ClasspathUtils.java | ClasspathUtils.locateOnClasspath | public static URL locateOnClasspath(String resourceName) {
URL url = null;
// attempt to load from the context classpath
ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader != null) {
url = loader.getResource(resourceName);
if (url !=... | java | public static URL locateOnClasspath(String resourceName) {
URL url = null;
// attempt to load from the context classpath
ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader != null) {
url = loader.getResource(resourceName);
if (url !=... | [
"public",
"static",
"URL",
"locateOnClasspath",
"(",
"String",
"resourceName",
")",
"{",
"URL",
"url",
"=",
"null",
";",
"// attempt to load from the context classpath",
"ClassLoader",
"loader",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoade... | Tries to find a resource with the given name in the classpath.
@param resourceName the name of the resource
@return the URL to the found resource or <b>null</b> if the resource
cannot be found | [
"Tries",
"to",
"find",
"a",
"resource",
"with",
"the",
"given",
"name",
"in",
"the",
"classpath",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/util/ClasspathUtils.java#L44-L67 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/util/ClasspathUtils.java | ClasspathUtils.getResources | public static List<URL> getResources(String name) {
List<URL> list = new ArrayList<>();
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Enumeration<URL> resources = loader.getResources(name);
while (resources.hasMoreElements()) {
... | java | public static List<URL> getResources(String name) {
List<URL> list = new ArrayList<>();
try {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Enumeration<URL> resources = loader.getResources(name);
while (resources.hasMoreElements()) {
... | [
"public",
"static",
"List",
"<",
"URL",
">",
"getResources",
"(",
"String",
"name",
")",
"{",
"List",
"<",
"URL",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"try",
"{",
"ClassLoader",
"loader",
"=",
"Thread",
".",
"currentThread",
"(",
... | Return a list of resource URLs that match the given name.
@param name
@return a list of resource URLs that match the name | [
"Return",
"a",
"list",
"of",
"resource",
"URLs",
"that",
"match",
"the",
"given",
"name",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/util/ClasspathUtils.java#L75-L90 | train |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/reload/ReloadWatcher.java | ReloadWatcher.registerDirectory | private void registerDirectory(Path dir) throws IOException {
Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
WatchKey key = dir.register(watchService, EN... | java | private void registerDirectory(Path dir) throws IOException {
Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
WatchKey key = dir.register(watchService, EN... | [
"private",
"void",
"registerDirectory",
"(",
"Path",
"dir",
")",
"throws",
"IOException",
"{",
"Files",
".",
"walkFileTree",
"(",
"dir",
",",
"new",
"SimpleFileVisitor",
"<",
"Path",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"FileVisitResult",
"preVisitDi... | Register the given directory, and all its sub-directories. | [
"Register",
"the",
"given",
"directory",
"and",
"all",
"its",
"sub",
"-",
"directories",
"."
] | cb5ccb453bffcc3cf386adc660674812d10b9726 | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/reload/ReloadWatcher.java#L197-L209 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.