id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
102,100
jparsec/jparsec
jparsec/src/main/java/org/jparsec/OperatorTable.java
OperatorTable.prefix
public OperatorTable<T> prefix( Parser<? extends Function<? super T, ? extends T>> parser, int precedence) { ops.add(new Operator(parser, precedence, Associativity.PREFIX)); return this; }
java
public OperatorTable<T> prefix( Parser<? extends Function<? super T, ? extends T>> parser, int precedence) { ops.add(new Operator(parser, precedence, Associativity.PREFIX)); return this; }
[ "public", "OperatorTable", "<", "T", ">", "prefix", "(", "Parser", "<", "?", "extends", "Function", "<", "?", "super", "T", ",", "?", "extends", "T", ">", ">", "parser", ",", "int", "precedence", ")", "{", "ops", ".", "add", "(", "new", "Operator", ...
Adds a prefix unary operator. @param parser the parser for the operator. @param precedence the precedence number. @return this.
[ "Adds", "a", "prefix", "unary", "operator", "." ]
df1280259f5da9eb5ffc537437569dddba66cb94
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/OperatorTable.java#L89-L93
102,101
jparsec/jparsec
jparsec/src/main/java/org/jparsec/OperatorTable.java
OperatorTable.postfix
public OperatorTable<T> postfix( Parser<? extends Function<? super T, ? extends T>> parser, int precedence) { ops.add(new Operator(parser, precedence, Associativity.POSTFIX)); return this; }
java
public OperatorTable<T> postfix( Parser<? extends Function<? super T, ? extends T>> parser, int precedence) { ops.add(new Operator(parser, precedence, Associativity.POSTFIX)); return this; }
[ "public", "OperatorTable", "<", "T", ">", "postfix", "(", "Parser", "<", "?", "extends", "Function", "<", "?", "super", "T", ",", "?", "extends", "T", ">", ">", "parser", ",", "int", "precedence", ")", "{", "ops", ".", "add", "(", "new", "Operator", ...
Adds a postfix unary operator. @param parser the parser for the operator. @param precedence the precedence number. @return this.
[ "Adds", "a", "postfix", "unary", "operator", "." ]
df1280259f5da9eb5ffc537437569dddba66cb94
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/OperatorTable.java#L102-L106
102,102
jparsec/jparsec
jparsec/src/main/java/org/jparsec/OperatorTable.java
OperatorTable.infixl
public OperatorTable<T> infixl( Parser<? extends BiFunction<? super T, ? super T, ? extends T>> parser, int precedence) { ops.add(new Operator(parser, precedence, Associativity.LASSOC)); return this; }
java
public OperatorTable<T> infixl( Parser<? extends BiFunction<? super T, ? super T, ? extends T>> parser, int precedence) { ops.add(new Operator(parser, precedence, Associativity.LASSOC)); return this; }
[ "public", "OperatorTable", "<", "T", ">", "infixl", "(", "Parser", "<", "?", "extends", "BiFunction", "<", "?", "super", "T", ",", "?", "super", "T", ",", "?", "extends", "T", ">", ">", "parser", ",", "int", "precedence", ")", "{", "ops", ".", "add...
Adds an infix left-associative binary operator. @param parser the parser for the operator. @param precedence the precedence number. @return this.
[ "Adds", "an", "infix", "left", "-", "associative", "binary", "operator", "." ]
df1280259f5da9eb5ffc537437569dddba66cb94
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/OperatorTable.java#L115-L119
102,103
jparsec/jparsec
jparsec/src/main/java/org/jparsec/OperatorTable.java
OperatorTable.infixr
public OperatorTable<T> infixr( Parser<? extends BiFunction<? super T, ? super T, ? extends T>> parser, int precedence) { ops.add(new Operator(parser, precedence, Associativity.RASSOC)); return this; }
java
public OperatorTable<T> infixr( Parser<? extends BiFunction<? super T, ? super T, ? extends T>> parser, int precedence) { ops.add(new Operator(parser, precedence, Associativity.RASSOC)); return this; }
[ "public", "OperatorTable", "<", "T", ">", "infixr", "(", "Parser", "<", "?", "extends", "BiFunction", "<", "?", "super", "T", ",", "?", "super", "T", ",", "?", "extends", "T", ">", ">", "parser", ",", "int", "precedence", ")", "{", "ops", ".", "add...
Adds an infix right-associative binary operator. @param parser the parser for the operator. @param precedence the precedence number. @return this.
[ "Adds", "an", "infix", "right", "-", "associative", "binary", "operator", "." ]
df1280259f5da9eb5ffc537437569dddba66cb94
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/OperatorTable.java#L128-L132
102,104
jparsec/jparsec
jparsec/src/main/java/org/jparsec/OperatorTable.java
OperatorTable.infixn
public OperatorTable<T> infixn( Parser<? extends BiFunction<? super T, ? super T, ? extends T>> parser, int precedence) { ops.add(new Operator(parser, precedence, Associativity.NASSOC)); return this; }
java
public OperatorTable<T> infixn( Parser<? extends BiFunction<? super T, ? super T, ? extends T>> parser, int precedence) { ops.add(new Operator(parser, precedence, Associativity.NASSOC)); return this; }
[ "public", "OperatorTable", "<", "T", ">", "infixn", "(", "Parser", "<", "?", "extends", "BiFunction", "<", "?", "super", "T", ",", "?", "super", "T", ",", "?", "extends", "T", ">", ">", "parser", ",", "int", "precedence", ")", "{", "ops", ".", "add...
Adds an infix non-associative binary operator. @param parser the parser for the operator. @param precedence the precedence number. @return this.
[ "Adds", "an", "infix", "non", "-", "associative", "binary", "operator", "." ]
df1280259f5da9eb5ffc537437569dddba66cb94
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/OperatorTable.java#L140-L144
102,105
cryptomator/cryptolib
src/main/java/org/cryptomator/cryptolib/Cryptors.java
Cryptors.cleartextSize
public static long cleartextSize(long ciphertextSize, Cryptor cryptor) { checkArgument(ciphertextSize >= 0, "expected ciphertextSize to be positive, but was %s", ciphertextSize); long cleartextChunkSize = cryptor.fileContentCryptor().cleartextChunkSize(); long ciphertextChunkSize = cryptor.fileContentCryptor().ci...
java
public static long cleartextSize(long ciphertextSize, Cryptor cryptor) { checkArgument(ciphertextSize >= 0, "expected ciphertextSize to be positive, but was %s", ciphertextSize); long cleartextChunkSize = cryptor.fileContentCryptor().cleartextChunkSize(); long ciphertextChunkSize = cryptor.fileContentCryptor().ci...
[ "public", "static", "long", "cleartextSize", "(", "long", "ciphertextSize", ",", "Cryptor", "cryptor", ")", "{", "checkArgument", "(", "ciphertextSize", ">=", "0", ",", "\"expected ciphertextSize to be positive, but was %s\"", ",", "ciphertextSize", ")", ";", "long", ...
Calculates the size of the cleartext resulting from the given ciphertext decrypted with the given cryptor. @param ciphertextSize Length of encrypted payload. Not including the {@link FileHeader#getFilesize() length of the header}. @param cryptor The cryptor which defines the cleartext/ciphertext ratio @return Cleartex...
[ "Calculates", "the", "size", "of", "the", "cleartext", "resulting", "from", "the", "given", "ciphertext", "decrypted", "with", "the", "given", "cryptor", "." ]
33bc881f6ee7d4924043ea6309efd2c063ec3638
https://github.com/cryptomator/cryptolib/blob/33bc881f6ee7d4924043ea6309efd2c063ec3638/src/main/java/org/cryptomator/cryptolib/Cryptors.java#L41-L54
102,106
cryptomator/cryptolib
src/main/java/org/cryptomator/cryptolib/Cryptors.java
Cryptors.ciphertextSize
public static long ciphertextSize(long cleartextSize, Cryptor cryptor) { checkArgument(cleartextSize >= 0, "expected cleartextSize to be positive, but was %s", cleartextSize); long cleartextChunkSize = cryptor.fileContentCryptor().cleartextChunkSize(); long ciphertextChunkSize = cryptor.fileContentCryptor().ciphe...
java
public static long ciphertextSize(long cleartextSize, Cryptor cryptor) { checkArgument(cleartextSize >= 0, "expected cleartextSize to be positive, but was %s", cleartextSize); long cleartextChunkSize = cryptor.fileContentCryptor().cleartextChunkSize(); long ciphertextChunkSize = cryptor.fileContentCryptor().ciphe...
[ "public", "static", "long", "ciphertextSize", "(", "long", "cleartextSize", ",", "Cryptor", "cryptor", ")", "{", "checkArgument", "(", "cleartextSize", ">=", "0", ",", "\"expected cleartextSize to be positive, but was %s\"", ",", "cleartextSize", ")", ";", "long", "cl...
Calculates the size of the ciphertext resulting from the given cleartext encrypted with the given cryptor. @param cleartextSize Length of a unencrypted payload. @param cryptor The cryptor which defines the cleartext/ciphertext ratio @return Ciphertext length of a <code>cleartextSize</code>-sized cleartext encrypted w...
[ "Calculates", "the", "size", "of", "the", "ciphertext", "resulting", "from", "the", "given", "cleartext", "encrypted", "with", "the", "given", "cryptor", "." ]
33bc881f6ee7d4924043ea6309efd2c063ec3638
https://github.com/cryptomator/cryptolib/blob/33bc881f6ee7d4924043ea6309efd2c063ec3638/src/main/java/org/cryptomator/cryptolib/Cryptors.java#L65-L75
102,107
cryptomator/cryptolib
src/main/java/org/cryptomator/cryptolib/common/ByteBuffers.java
ByteBuffers.copy
public static int copy(ByteBuffer source, ByteBuffer destination) { final int numBytes = Math.min(source.remaining(), destination.remaining()); final ByteBuffer tmp = source.asReadOnlyBuffer(); tmp.limit(tmp.position() + numBytes); destination.put(tmp); source.position(tmp.position()); // until now only tmp p...
java
public static int copy(ByteBuffer source, ByteBuffer destination) { final int numBytes = Math.min(source.remaining(), destination.remaining()); final ByteBuffer tmp = source.asReadOnlyBuffer(); tmp.limit(tmp.position() + numBytes); destination.put(tmp); source.position(tmp.position()); // until now only tmp p...
[ "public", "static", "int", "copy", "(", "ByteBuffer", "source", ",", "ByteBuffer", "destination", ")", "{", "final", "int", "numBytes", "=", "Math", ".", "min", "(", "source", ".", "remaining", "(", ")", ",", "destination", ".", "remaining", "(", ")", ")...
Copies as many bytes as possible from the given source to the destination buffer. The position of both buffers will be incremented by as many bytes as have been copied. @param source ByteBuffer from which bytes are read @param destination ByteBuffer into which bytes are written @return number of bytes copied, i.e. {@l...
[ "Copies", "as", "many", "bytes", "as", "possible", "from", "the", "given", "source", "to", "the", "destination", "buffer", ".", "The", "position", "of", "both", "buffers", "will", "be", "incremented", "by", "as", "many", "bytes", "as", "have", "been", "cop...
33bc881f6ee7d4924043ea6309efd2c063ec3638
https://github.com/cryptomator/cryptolib/blob/33bc881f6ee7d4924043ea6309efd2c063ec3638/src/main/java/org/cryptomator/cryptolib/common/ByteBuffers.java#L23-L30
102,108
cryptomator/cryptolib
src/main/java/org/cryptomator/cryptolib/api/KeyFile.java
KeyFile.parse
public static KeyFile parse(byte[] serialized) { try (InputStream in = new ByteArrayInputStream(serialized); // Reader reader = new InputStreamReader(in, UTF_8); // JsonReader jsonReader = GSON.newJsonReader(reader)) { JsonObject jsonObj = new JsonParser().parse(jsonReader).getAsJsonObject(); KeyFile re...
java
public static KeyFile parse(byte[] serialized) { try (InputStream in = new ByteArrayInputStream(serialized); // Reader reader = new InputStreamReader(in, UTF_8); // JsonReader jsonReader = GSON.newJsonReader(reader)) { JsonObject jsonObj = new JsonParser().parse(jsonReader).getAsJsonObject(); KeyFile re...
[ "public", "static", "KeyFile", "parse", "(", "byte", "[", "]", "serialized", ")", "{", "try", "(", "InputStream", "in", "=", "new", "ByteArrayInputStream", "(", "serialized", ")", ";", "//", "Reader", "reader", "=", "new", "InputStreamReader", "(", "in", "...
Parses a json keyfile. @param serialized Json content. @return A new KeyFile instance.
[ "Parses", "a", "json", "keyfile", "." ]
33bc881f6ee7d4924043ea6309efd2c063ec3638
https://github.com/cryptomator/cryptolib/blob/33bc881f6ee7d4924043ea6309efd2c063ec3638/src/main/java/org/cryptomator/cryptolib/api/KeyFile.java#L77-L88
102,109
cryptomator/cryptolib
src/main/java/org/cryptomator/cryptolib/api/KeyFile.java
KeyFile.as
public <T extends KeyFile> T as(Class<T> clazz) { T result = GSON.fromJson(jsonObj, clazz); ((KeyFile) result).jsonObj = jsonObj; return result; }
java
public <T extends KeyFile> T as(Class<T> clazz) { T result = GSON.fromJson(jsonObj, clazz); ((KeyFile) result).jsonObj = jsonObj; return result; }
[ "public", "<", "T", "extends", "KeyFile", ">", "T", "as", "(", "Class", "<", "T", ">", "clazz", ")", "{", "T", "result", "=", "GSON", ".", "fromJson", "(", "jsonObj", ",", "clazz", ")", ";", "(", "(", "KeyFile", ")", "result", ")", ".", "jsonObj"...
Creates a new version-specific KeyFile instance from this instance. @param clazz Version-specific subclass of KeyFile. @param <T> Specific KeyFile implementation type. @return New instance of the given class.
[ "Creates", "a", "new", "version", "-", "specific", "KeyFile", "instance", "from", "this", "instance", "." ]
33bc881f6ee7d4924043ea6309efd2c063ec3638
https://github.com/cryptomator/cryptolib/blob/33bc881f6ee7d4924043ea6309efd2c063ec3638/src/main/java/org/cryptomator/cryptolib/api/KeyFile.java#L106-L110
102,110
diffplug/durian
src/com/diffplug/common/base/DurianPlugins.java
DurianPlugins.register
public static <T> void register(Class<T> pluginClass, T pluginImpl) throws IllegalStateException { INSTANCE.registerInternal(pluginClass, pluginImpl); }
java
public static <T> void register(Class<T> pluginClass, T pluginImpl) throws IllegalStateException { INSTANCE.registerInternal(pluginClass, pluginImpl); }
[ "public", "static", "<", "T", ">", "void", "register", "(", "Class", "<", "T", ">", "pluginClass", ",", "T", "pluginImpl", ")", "throws", "IllegalStateException", "{", "INSTANCE", ".", "registerInternal", "(", "pluginClass", ",", "pluginImpl", ")", ";", "}" ...
Registers an implementation as a global override of any injected or default implementations. @param pluginClass The interface which is being registered. @param pluginImpl The implementation of that interface which is being registered. @throws IllegalStateException If called more than once or if a value has already be...
[ "Registers", "an", "implementation", "as", "a", "global", "override", "of", "any", "injected", "or", "default", "implementations", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/DurianPlugins.java#L68-L70
102,111
diffplug/durian
src/com/diffplug/common/base/DurianPlugins.java
DurianPlugins.getPluginImplementationViaProperty
private static Object getPluginImplementationViaProperty(Class<?> pluginClass) { String className = pluginClass.getCanonicalName(); if (className == null) { throw new IllegalArgumentException("Class " + pluginClass + " does not have a canonical name!"); } // Check system properties for plugin class. // Thi...
java
private static Object getPluginImplementationViaProperty(Class<?> pluginClass) { String className = pluginClass.getCanonicalName(); if (className == null) { throw new IllegalArgumentException("Class " + pluginClass + " does not have a canonical name!"); } // Check system properties for plugin class. // Thi...
[ "private", "static", "Object", "getPluginImplementationViaProperty", "(", "Class", "<", "?", ">", "pluginClass", ")", "{", "String", "className", "=", "pluginClass", ".", "getCanonicalName", "(", ")", ";", "if", "(", "className", "==", "null", ")", "{", "throw...
Returns an implementation of the given class using the system properties as a registry.
[ "Returns", "an", "implementation", "of", "the", "given", "class", "using", "the", "system", "properties", "as", "a", "registry", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/DurianPlugins.java#L109-L136
102,112
diffplug/durian
src/com/diffplug/common/base/Functions.java
Functions.forPredicate
public static <T> Function<T, Boolean> forPredicate(Predicate<T> predicate) { return predicate::test; }
java
public static <T> Function<T, Boolean> forPredicate(Predicate<T> predicate) { return predicate::test; }
[ "public", "static", "<", "T", ">", "Function", "<", "T", ",", "Boolean", ">", "forPredicate", "(", "Predicate", "<", "T", ">", "predicate", ")", "{", "return", "predicate", "::", "test", ";", "}" ]
Creates a function that returns the same boolean output as the given predicate for all inputs. <p>The returned function is <i>consistent with equals</i> (as documented at {@link Function#apply}) if and only if {@code predicate} is itself consistent with equals.
[ "Creates", "a", "function", "that", "returns", "the", "same", "boolean", "output", "as", "the", "given", "predicate", "for", "all", "inputs", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/Functions.java#L97-L99
102,113
diffplug/durian
src/com/diffplug/common/base/Either.java
Either.asOptionalLeft
public final Optional<L> asOptionalLeft() { return fold(Optional::of, val -> Optional.<L> empty()); }
java
public final Optional<L> asOptionalLeft() { return fold(Optional::of, val -> Optional.<L> empty()); }
[ "public", "final", "Optional", "<", "L", ">", "asOptionalLeft", "(", ")", "{", "return", "fold", "(", "Optional", "::", "of", ",", "val", "->", "Optional", ".", "<", "L", ">", "empty", "(", ")", ")", ";", "}" ]
Returns the left side as an Optional.
[ "Returns", "the", "left", "side", "as", "an", "Optional", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/Either.java#L58-L60
102,114
diffplug/durian
src/com/diffplug/common/base/Either.java
Either.asOptionalRight
public final Optional<R> asOptionalRight() { return fold(val -> Optional.<R> empty(), Optional::of); }
java
public final Optional<R> asOptionalRight() { return fold(val -> Optional.<R> empty(), Optional::of); }
[ "public", "final", "Optional", "<", "R", ">", "asOptionalRight", "(", ")", "{", "return", "fold", "(", "val", "->", "Optional", ".", "<", "R", ">", "empty", "(", ")", ",", "Optional", "::", "of", ")", ";", "}" ]
Returns the right side as an Optional.
[ "Returns", "the", "right", "side", "as", "an", "Optional", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/Either.java#L63-L65
102,115
diffplug/durian
src/com/diffplug/common/base/Either.java
Either.fold
public final <T> T fold(Function<? super L, ? extends T> left, Function<? super R, ? extends T> right) { if (isLeft()) { return left.apply(getLeft()); } else { return right.apply(getRight()); } }
java
public final <T> T fold(Function<? super L, ? extends T> left, Function<? super R, ? extends T> right) { if (isLeft()) { return left.apply(getLeft()); } else { return right.apply(getRight()); } }
[ "public", "final", "<", "T", ">", "T", "fold", "(", "Function", "<", "?", "super", "L", ",", "?", "extends", "T", ">", "left", ",", "Function", "<", "?", "super", "R", ",", "?", "extends", "T", ">", "right", ")", "{", "if", "(", "isLeft", "(", ...
Applies either the left or the right function as appropriate.
[ "Applies", "either", "the", "left", "or", "the", "right", "function", "as", "appropriate", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/Either.java#L68-L74
102,116
diffplug/durian
src/com/diffplug/common/base/Either.java
Either.accept
public final void accept(Consumer<? super L> left, Consumer<? super R> right) { if (isLeft()) { left.accept(getLeft()); } else { right.accept(getRight()); } }
java
public final void accept(Consumer<? super L> left, Consumer<? super R> right) { if (isLeft()) { left.accept(getLeft()); } else { right.accept(getRight()); } }
[ "public", "final", "void", "accept", "(", "Consumer", "<", "?", "super", "L", ">", "left", ",", "Consumer", "<", "?", "super", "R", ">", "right", ")", "{", "if", "(", "isLeft", "(", ")", ")", "{", "left", ".", "accept", "(", "getLeft", "(", ")", ...
Accepts either the left or the right consumer as appropriate.
[ "Accepts", "either", "the", "left", "or", "the", "right", "consumer", "as", "appropriate", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/Either.java#L77-L83
102,117
diffplug/durian
src/com/diffplug/common/base/Either.java
Either.acceptBoth
public final void acceptBoth(Consumer<? super L> left, Consumer<? super R> right, L defaultLeft, R defaultRight) { left.accept(isLeft() ? getLeft() : defaultLeft); right.accept(isRight() ? getRight() : defaultRight); }
java
public final void acceptBoth(Consumer<? super L> left, Consumer<? super R> right, L defaultLeft, R defaultRight) { left.accept(isLeft() ? getLeft() : defaultLeft); right.accept(isRight() ? getRight() : defaultRight); }
[ "public", "final", "void", "acceptBoth", "(", "Consumer", "<", "?", "super", "L", ">", "left", ",", "Consumer", "<", "?", "super", "R", ">", "right", ",", "L", "defaultLeft", ",", "R", "defaultRight", ")", "{", "left", ".", "accept", "(", "isLeft", "...
Accepts both the left and right consumers, using the default values to set the empty side.
[ "Accepts", "both", "the", "left", "and", "right", "consumers", "using", "the", "default", "values", "to", "set", "the", "empty", "side", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/Either.java#L104-L107
102,118
diffplug/durian
src/com/diffplug/common/base/Either.java
Either.create
public static <L, R> Either<L, R> create(L l, R r) { if (l == null && r != null) { return createRight(r); } else if (l != null && r == null) { return createLeft(l); } else { if (l == null) { throw new IllegalArgumentException("Both arguments were null."); } else { throw new IllegalArgumentExce...
java
public static <L, R> Either<L, R> create(L l, R r) { if (l == null && r != null) { return createRight(r); } else if (l != null && r == null) { return createLeft(l); } else { if (l == null) { throw new IllegalArgumentException("Both arguments were null."); } else { throw new IllegalArgumentExce...
[ "public", "static", "<", "L", ",", "R", ">", "Either", "<", "L", ",", "R", ">", "create", "(", "L", "l", ",", "R", "r", ")", "{", "if", "(", "l", "==", "null", "&&", "r", "!=", "null", ")", "{", "return", "createRight", "(", "r", ")", ";", ...
Creates a left or right, depending on which element is non-null. Precisely one element should be non-null.
[ "Creates", "a", "left", "or", "right", "depending", "on", "which", "element", "is", "non", "-", "null", ".", "Precisely", "one", "element", "should", "be", "non", "-", "null", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/Either.java#L110-L122
102,119
diffplug/durian
src/com/diffplug/common/base/Either.java
Either.createLeft
public static <L, R> Either<L, R> createLeft(L l) { return new Left<>(l); }
java
public static <L, R> Either<L, R> createLeft(L l) { return new Left<>(l); }
[ "public", "static", "<", "L", ",", "R", ">", "Either", "<", "L", ",", "R", ">", "createLeft", "(", "L", "l", ")", "{", "return", "new", "Left", "<>", "(", "l", ")", ";", "}" ]
Creates an instance of Left.
[ "Creates", "an", "instance", "of", "Left", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/Either.java#L125-L127
102,120
diffplug/durian
src/com/diffplug/common/base/Either.java
Either.createRight
public static <L, R> Either<L, R> createRight(R r) { return new Right<>(r); }
java
public static <L, R> Either<L, R> createRight(R r) { return new Right<>(r); }
[ "public", "static", "<", "L", ",", "R", ">", "Either", "<", "L", ",", "R", ">", "createRight", "(", "R", "r", ")", "{", "return", "new", "Right", "<>", "(", "r", ")", ";", "}" ]
Creates an instance of Right.
[ "Creates", "an", "instance", "of", "Right", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/Either.java#L130-L132
102,121
diffplug/durian
src/com/diffplug/common/base/TreeComparison.java
TreeComparison.decorateErrorsWith
public TreeComparison<E, A> decorateErrorsWith(Function<? super E, String> expectedToString, Function<? super A, String> actualToString) { this.expectedToString = expectedToString; this.actualToString = actualToString; return this; }
java
public TreeComparison<E, A> decorateErrorsWith(Function<? super E, String> expectedToString, Function<? super A, String> actualToString) { this.expectedToString = expectedToString; this.actualToString = actualToString; return this; }
[ "public", "TreeComparison", "<", "E", ",", "A", ">", "decorateErrorsWith", "(", "Function", "<", "?", "super", "E", ",", "String", ">", "expectedToString", ",", "Function", "<", "?", "super", "A", ",", "String", ">", "actualToString", ")", "{", "this", "...
Decorates errors thrown by any assertions with the given functions.
[ "Decorates", "errors", "thrown", "by", "any", "assertions", "with", "the", "given", "functions", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeComparison.java#L102-L106
102,122
diffplug/durian
src/com/diffplug/common/base/TreeComparison.java
TreeComparison.createComparisonFailure
private AssertionError createComparisonFailure(String className, String expected, String actual) throws Exception { Class<?> clazz = Class.forName(className); Constructor<?> constructor = clazz.getConstructor(String.class, String.class, String.class); return (AssertionError) constructor.newInstance("", expected, ...
java
private AssertionError createComparisonFailure(String className, String expected, String actual) throws Exception { Class<?> clazz = Class.forName(className); Constructor<?> constructor = clazz.getConstructor(String.class, String.class, String.class); return (AssertionError) constructor.newInstance("", expected, ...
[ "private", "AssertionError", "createComparisonFailure", "(", "String", "className", ",", "String", "expected", ",", "String", "actual", ")", "throws", "Exception", "{", "Class", "<", "?", ">", "clazz", "=", "Class", ".", "forName", "(", "className", ")", ";", ...
Attempts to create an instance of junit's ComparisonFailure exception using reflection.
[ "Attempts", "to", "create", "an", "instance", "of", "junit", "s", "ComparisonFailure", "exception", "using", "reflection", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeComparison.java#L136-L140
102,123
diffplug/durian
src/com/diffplug/common/base/TreeComparison.java
TreeComparison.mapToSame
public <T> SameType<T> mapToSame(Function<? super E, ? extends T> mapExpected, Function<? super A, ? extends T> mapActual) { return new SameTypeImp<>(this, mapExpected, mapActual); }
java
public <T> SameType<T> mapToSame(Function<? super E, ? extends T> mapExpected, Function<? super A, ? extends T> mapActual) { return new SameTypeImp<>(this, mapExpected, mapActual); }
[ "public", "<", "T", ">", "SameType", "<", "T", ">", "mapToSame", "(", "Function", "<", "?", "super", "E", ",", "?", "extends", "T", ">", "mapExpected", ",", "Function", "<", "?", "super", "A", ",", "?", "extends", "T", ">", "mapActual", ")", "{", ...
Maps both sides of the comparison to the same type, for easier comparison and assertions.
[ "Maps", "both", "sides", "of", "the", "comparison", "to", "the", "same", "type", "for", "easier", "comparison", "and", "assertions", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeComparison.java#L143-L145
102,124
diffplug/durian
src/com/diffplug/common/base/TreeNode.java
TreeNode.sortChildrenByContent
public void sortChildrenByContent(Comparator<? super T> comparator) { Comparator<TreeNode<T>> byContent = Comparator.comparing(TreeNode::getContent, comparator); sortChildrenByNode(byContent); }
java
public void sortChildrenByContent(Comparator<? super T> comparator) { Comparator<TreeNode<T>> byContent = Comparator.comparing(TreeNode::getContent, comparator); sortChildrenByNode(byContent); }
[ "public", "void", "sortChildrenByContent", "(", "Comparator", "<", "?", "super", "T", ">", "comparator", ")", "{", "Comparator", "<", "TreeNode", "<", "T", ">>", "byContent", "=", "Comparator", ".", "comparing", "(", "TreeNode", "::", "getContent", ",", "com...
Recursively sorts all children using the given comparator of their content.
[ "Recursively", "sorts", "all", "children", "using", "the", "given", "comparator", "of", "their", "content", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeNode.java#L123-L126
102,125
diffplug/durian
src/com/diffplug/common/base/TreeNode.java
TreeNode.sortChildrenByNode
public void sortChildrenByNode(Comparator<TreeNode<T>> comparator) { Collections.sort(children, comparator); for (TreeNode<T> child : children) { child.sortChildrenByNode(comparator); } }
java
public void sortChildrenByNode(Comparator<TreeNode<T>> comparator) { Collections.sort(children, comparator); for (TreeNode<T> child : children) { child.sortChildrenByNode(comparator); } }
[ "public", "void", "sortChildrenByNode", "(", "Comparator", "<", "TreeNode", "<", "T", ">", ">", "comparator", ")", "{", "Collections", ".", "sort", "(", "children", ",", "comparator", ")", ";", "for", "(", "TreeNode", "<", "T", ">", "child", ":", "childr...
Recursively sorts all children using the given comparator of TreeNode.
[ "Recursively", "sorts", "all", "children", "using", "the", "given", "comparator", "of", "TreeNode", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeNode.java#L129-L134
102,126
diffplug/durian
src/com/diffplug/common/base/TreeNode.java
TreeNode.copy
public static <T> TreeNode<T> copy(TreeDef<T> treeDef, T root) { return copy(treeDef, root, Function.identity()); }
java
public static <T> TreeNode<T> copy(TreeDef<T> treeDef, T root) { return copy(treeDef, root, Function.identity()); }
[ "public", "static", "<", "T", ">", "TreeNode", "<", "T", ">", "copy", "(", "TreeDef", "<", "T", ">", "treeDef", ",", "T", "root", ")", "{", "return", "copy", "(", "treeDef", ",", "root", ",", "Function", ".", "identity", "(", ")", ")", ";", "}" ]
Creates a hierarchy of TreeNodes that copies the structure and content of the given tree.
[ "Creates", "a", "hierarchy", "of", "TreeNodes", "that", "copies", "the", "structure", "and", "content", "of", "the", "given", "tree", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeNode.java#L137-L139
102,127
diffplug/durian
src/com/diffplug/common/base/TreeNode.java
TreeNode.findByContent
public TreeNode<T> findByContent(T content) { Optional<TreeNode<T>> opt = TreeStream.breadthFirst(treeDef(), this).filter(node -> node.getContent().equals(content)).findFirst(); if (opt.isPresent()) { return opt.get(); } else { throw new IllegalArgumentException(this.toString() + " has no child with content...
java
public TreeNode<T> findByContent(T content) { Optional<TreeNode<T>> opt = TreeStream.breadthFirst(treeDef(), this).filter(node -> node.getContent().equals(content)).findFirst(); if (opt.isPresent()) { return opt.get(); } else { throw new IllegalArgumentException(this.toString() + " has no child with content...
[ "public", "TreeNode", "<", "T", ">", "findByContent", "(", "T", "content", ")", "{", "Optional", "<", "TreeNode", "<", "T", ">>", "opt", "=", "TreeStream", ".", "breadthFirst", "(", "treeDef", "(", ")", ",", "this", ")", ".", "filter", "(", "node", "...
Searches breadth-first for the TreeNode with the given content. @throws IllegalArgumentException if no such node exists
[ "Searches", "breadth", "-", "first", "for", "the", "TreeNode", "with", "the", "given", "content", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeNode.java#L271-L278
102,128
diffplug/durian
src/com/diffplug/common/base/TreeQuery.java
TreeQuery.isDescendantOf
public static <T> boolean isDescendantOf(TreeDef.Parented<T> treeDef, T child, T parent) { T candidateParent = treeDef.parentOf(child); while (candidateParent != null) { if (candidateParent.equals(parent)) { return true; } else { candidateParent = treeDef.parentOf(candidateParent); } } return f...
java
public static <T> boolean isDescendantOf(TreeDef.Parented<T> treeDef, T child, T parent) { T candidateParent = treeDef.parentOf(child); while (candidateParent != null) { if (candidateParent.equals(parent)) { return true; } else { candidateParent = treeDef.parentOf(candidateParent); } } return f...
[ "public", "static", "<", "T", ">", "boolean", "isDescendantOf", "(", "TreeDef", ".", "Parented", "<", "T", ">", "treeDef", ",", "T", "child", ",", "T", "parent", ")", "{", "T", "candidateParent", "=", "treeDef", ".", "parentOf", "(", "child", ")", ";",...
Returns true iff child is a descendant of parent.
[ "Returns", "true", "iff", "child", "is", "a", "descendant", "of", "parent", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeQuery.java#L34-L44
102,129
diffplug/durian
src/com/diffplug/common/base/TreeQuery.java
TreeQuery.isDescendantOfOrEqualTo
public static <T> boolean isDescendantOfOrEqualTo(TreeDef.Parented<T> treeDef, T child, T parent) { if (child.equals(parent)) { return true; } else { return isDescendantOf(treeDef, child, parent); } }
java
public static <T> boolean isDescendantOfOrEqualTo(TreeDef.Parented<T> treeDef, T child, T parent) { if (child.equals(parent)) { return true; } else { return isDescendantOf(treeDef, child, parent); } }
[ "public", "static", "<", "T", ">", "boolean", "isDescendantOfOrEqualTo", "(", "TreeDef", ".", "Parented", "<", "T", ">", "treeDef", ",", "T", "child", ",", "T", "parent", ")", "{", "if", "(", "child", ".", "equals", "(", "parent", ")", ")", "{", "ret...
Returns true iff child is a descendant of parent, or if child is equal to parent.
[ "Returns", "true", "iff", "child", "is", "a", "descendant", "of", "parent", "or", "if", "child", "is", "equal", "to", "parent", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeQuery.java#L47-L53
102,130
diffplug/durian
src/com/diffplug/common/base/TreeQuery.java
TreeQuery.root
public static <T> T root(TreeDef.Parented<T> treeDef, T node) { T lastParent; T parent = node; do { lastParent = parent; parent = treeDef.parentOf(lastParent); } while (parent != null); return lastParent; }
java
public static <T> T root(TreeDef.Parented<T> treeDef, T node) { T lastParent; T parent = node; do { lastParent = parent; parent = treeDef.parentOf(lastParent); } while (parent != null); return lastParent; }
[ "public", "static", "<", "T", ">", "T", "root", "(", "TreeDef", ".", "Parented", "<", "T", ">", "treeDef", ",", "T", "node", ")", "{", "T", "lastParent", ";", "T", "parent", "=", "node", ";", "do", "{", "lastParent", "=", "parent", ";", "parent", ...
Returns the root of the given tree.
[ "Returns", "the", "root", "of", "the", "given", "tree", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeQuery.java#L56-L64
102,131
diffplug/durian
src/com/diffplug/common/base/TreeQuery.java
TreeQuery.lowestCommonAncestor
private static <T> Optional<T> lowestCommonAncestor(TreeDef.Parented<T> treeDef, T nodeA, T nodeB) { class TreeSearcher { private T tip; private final Set<T> visited; public TreeSearcher(T start) { this.tip = start; this.visited = new HashSet<>(); } public boolean hasMore() { return tip !...
java
private static <T> Optional<T> lowestCommonAncestor(TreeDef.Parented<T> treeDef, T nodeA, T nodeB) { class TreeSearcher { private T tip; private final Set<T> visited; public TreeSearcher(T start) { this.tip = start; this.visited = new HashSet<>(); } public boolean hasMore() { return tip !...
[ "private", "static", "<", "T", ">", "Optional", "<", "T", ">", "lowestCommonAncestor", "(", "TreeDef", ".", "Parented", "<", "T", ">", "treeDef", ",", "T", "nodeA", ",", "T", "nodeB", ")", "{", "class", "TreeSearcher", "{", "private", "T", "tip", ";", ...
Returns the common parent of the two given elements.
[ "Returns", "the", "common", "parent", "of", "the", "two", "given", "elements", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeQuery.java#L141-L189
102,132
diffplug/durian
src/com/diffplug/common/base/TreeQuery.java
TreeQuery.path
public static <T> String path(TreeDef.Parented<T> treeDef, T node, Function<? super T, String> toString, String delimiter) { List<T> toRoot = toRoot(treeDef, node); ListIterator<T> iterator = toRoot.listIterator(toRoot.size()); StringBuilder builder = new StringBuilder(); while (iterator.hasPrevious()) { T s...
java
public static <T> String path(TreeDef.Parented<T> treeDef, T node, Function<? super T, String> toString, String delimiter) { List<T> toRoot = toRoot(treeDef, node); ListIterator<T> iterator = toRoot.listIterator(toRoot.size()); StringBuilder builder = new StringBuilder(); while (iterator.hasPrevious()) { T s...
[ "public", "static", "<", "T", ">", "String", "path", "(", "TreeDef", ".", "Parented", "<", "T", ">", "treeDef", ",", "T", "node", ",", "Function", "<", "?", "super", "T", ",", "String", ">", "toString", ",", "String", "delimiter", ")", "{", "List", ...
Returns the path of the given node. @param treeDef the treeDef @param node the root of the tree @param toString a function to map each node to a string in the path @param delimiter a string to use as a path separator
[ "Returns", "the", "path", "of", "the", "given", "node", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeQuery.java#L218-L232
102,133
diffplug/durian
src/com/diffplug/common/base/Errors.java
Errors.wrap
public Runnable wrap(Throwing.Runnable runnable) { return () -> { try { runnable.run(); } catch (Throwable e) { handler.accept(e); } }; }
java
public Runnable wrap(Throwing.Runnable runnable) { return () -> { try { runnable.run(); } catch (Throwable e) { handler.accept(e); } }; }
[ "public", "Runnable", "wrap", "(", "Throwing", ".", "Runnable", "runnable", ")", "{", "return", "(", ")", "->", "{", "try", "{", "runnable", ".", "run", "(", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "handler", ".", "accept", "(", "e...
Returns a Runnable whose exceptions are handled by this Errors.
[ "Returns", "a", "Runnable", "whose", "exceptions", "are", "handled", "by", "this", "Errors", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/Errors.java#L168-L176
102,134
diffplug/durian
src/com/diffplug/common/base/Errors.java
Errors.wrap
public <T> Consumer<T> wrap(Throwing.Consumer<T> consumer) { return val -> { try { consumer.accept(val); } catch (Throwable e) { handler.accept(e); } }; }
java
public <T> Consumer<T> wrap(Throwing.Consumer<T> consumer) { return val -> { try { consumer.accept(val); } catch (Throwable e) { handler.accept(e); } }; }
[ "public", "<", "T", ">", "Consumer", "<", "T", ">", "wrap", "(", "Throwing", ".", "Consumer", "<", "T", ">", "consumer", ")", "{", "return", "val", "->", "{", "try", "{", "consumer", ".", "accept", "(", "val", ")", ";", "}", "catch", "(", "Throwa...
Returns a Consumer whose exceptions are handled by this Errors.
[ "Returns", "a", "Consumer", "whose", "exceptions", "are", "handled", "by", "this", "Errors", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/Errors.java#L179-L187
102,135
diffplug/durian
src/com/diffplug/common/base/Errors.java
Errors.asRuntime
public static RuntimeException asRuntime(Throwable e) { if (e instanceof RuntimeException) { return (RuntimeException) e; } else { return new WrappedAsRuntimeException(e); } }
java
public static RuntimeException asRuntime(Throwable e) { if (e instanceof RuntimeException) { return (RuntimeException) e; } else { return new WrappedAsRuntimeException(e); } }
[ "public", "static", "RuntimeException", "asRuntime", "(", "Throwable", "e", ")", "{", "if", "(", "e", "instanceof", "RuntimeException", ")", "{", "return", "(", "RuntimeException", ")", "e", ";", "}", "else", "{", "return", "new", "WrappedAsRuntimeException", ...
Casts or wraps the given exception to be a RuntimeException.
[ "Casts", "or", "wraps", "the", "given", "exception", "to", "be", "a", "RuntimeException", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/Errors.java#L343-L349
102,136
diffplug/durian
src/com/diffplug/common/base/FieldsAndGetters.java
FieldsAndGetters.tryCall
private static Object tryCall(String methodName, Throwing.Supplier<Object> supplier) { try { return supplier.get(); } catch (Throwable error) { return new CallException(methodName, error); } }
java
private static Object tryCall(String methodName, Throwing.Supplier<Object> supplier) { try { return supplier.get(); } catch (Throwable error) { return new CallException(methodName, error); } }
[ "private", "static", "Object", "tryCall", "(", "String", "methodName", ",", "Throwing", ".", "Supplier", "<", "Object", ">", "supplier", ")", "{", "try", "{", "return", "supplier", ".", "get", "(", ")", ";", "}", "catch", "(", "Throwable", "error", ")", ...
Executes the given function, return any exceptions it might throw as wrapped values.
[ "Executes", "the", "given", "function", "return", "any", "exceptions", "it", "might", "throw", "as", "wrapped", "values", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/FieldsAndGetters.java#L102-L108
102,137
diffplug/durian
src/com/diffplug/common/base/FieldsAndGetters.java
FieldsAndGetters.createEntry
private static <K, V> Map.Entry<K, V> createEntry(K key, V value) { return new Map.Entry<K, V>() { @Override public K getKey() { return key; } @Override public V getValue() { return value; } @Override public V setValue(V value) { throw new UnsupportedOperationException(); } ...
java
private static <K, V> Map.Entry<K, V> createEntry(K key, V value) { return new Map.Entry<K, V>() { @Override public K getKey() { return key; } @Override public V getValue() { return value; } @Override public V setValue(V value) { throw new UnsupportedOperationException(); } ...
[ "private", "static", "<", "K", ",", "V", ">", "Map", ".", "Entry", "<", "K", ",", "V", ">", "createEntry", "(", "K", "key", ",", "V", "value", ")", "{", "return", "new", "Map", ".", "Entry", "<", "K", ",", "V", ">", "(", ")", "{", "@", "Ove...
Creates an immutable Map.Entry.
[ "Creates", "an", "immutable", "Map", ".", "Entry", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/FieldsAndGetters.java#L198-L215
102,138
diffplug/durian
src/com/diffplug/common/base/StackDumper.java
StackDumper.dump
public static void dump(String message, Throwable exception) { printEmphasized(StringPrinter.buildString(printer -> { printer.println(message); exception.printStackTrace(printer.toPrintWriter()); })); }
java
public static void dump(String message, Throwable exception) { printEmphasized(StringPrinter.buildString(printer -> { printer.println(message); exception.printStackTrace(printer.toPrintWriter()); })); }
[ "public", "static", "void", "dump", "(", "String", "message", ",", "Throwable", "exception", ")", "{", "printEmphasized", "(", "StringPrinter", ".", "buildString", "(", "printer", "->", "{", "printer", ".", "println", "(", "message", ")", ";", "exception", "...
Dumps the given message and exception stack to the system error console
[ "Dumps", "the", "given", "message", "and", "exception", "stack", "to", "the", "system", "error", "console" ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/StackDumper.java#L45-L50
102,139
diffplug/durian
src/com/diffplug/common/base/StackDumper.java
StackDumper.wrapAndDumpWhenContains
public static PrintStream wrapAndDumpWhenContains(PrintStream source, String trigger) { StringPrinter wrapped = new StringPrinter(StringPrinter.stringsToLines(perLine -> { source.println(perLine); if (perLine.contains(trigger)) { dump("Triggered by " + trigger); } })); return wrapped.toPrintStream();...
java
public static PrintStream wrapAndDumpWhenContains(PrintStream source, String trigger) { StringPrinter wrapped = new StringPrinter(StringPrinter.stringsToLines(perLine -> { source.println(perLine); if (perLine.contains(trigger)) { dump("Triggered by " + trigger); } })); return wrapped.toPrintStream();...
[ "public", "static", "PrintStream", "wrapAndDumpWhenContains", "(", "PrintStream", "source", ",", "String", "trigger", ")", "{", "StringPrinter", "wrapped", "=", "new", "StringPrinter", "(", "StringPrinter", ".", "stringsToLines", "(", "perLine", "->", "{", "source",...
Returns a PrintStream which will redirect all of its output to the source PrintStream. If the trigger string is passed through the wrapped PrintStream, then it will dump the stack trace of the call that printed the trigger. @param source the returned PrintStream will delegate to this stream @param trigger the string w...
[ "Returns", "a", "PrintStream", "which", "will", "redirect", "all", "of", "its", "output", "to", "the", "source", "PrintStream", ".", "If", "the", "trigger", "string", "is", "passed", "through", "the", "wrapped", "PrintStream", "then", "it", "will", "dump", "...
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/StackDumper.java#L98-L106
102,140
diffplug/durian
src/com/diffplug/common/base/StackDumper.java
StackDumper.captureStackBelow
public static List<StackTraceElement> captureStackBelow(Class<?>... clazzes) { List<Class<?>> toIgnore = new ArrayList<>(clazzes.length + 1); toIgnore.addAll(Arrays.asList(clazzes)); toIgnore.add(StackDumper.class); Predicate<StackTraceElement> isSkipped = element -> toIgnore.stream().anyMatch(clazz -> { St...
java
public static List<StackTraceElement> captureStackBelow(Class<?>... clazzes) { List<Class<?>> toIgnore = new ArrayList<>(clazzes.length + 1); toIgnore.addAll(Arrays.asList(clazzes)); toIgnore.add(StackDumper.class); Predicate<StackTraceElement> isSkipped = element -> toIgnore.stream().anyMatch(clazz -> { St...
[ "public", "static", "List", "<", "StackTraceElement", ">", "captureStackBelow", "(", "Class", "<", "?", ">", "...", "clazzes", ")", "{", "List", "<", "Class", "<", "?", ">", ">", "toIgnore", "=", "new", "ArrayList", "<>", "(", "clazzes", ".", "length", ...
Captures all of the current stack which is below the given classes.
[ "Captures", "all", "of", "the", "current", "stack", "which", "is", "below", "the", "given", "classes", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/StackDumper.java#L126-L152
102,141
diffplug/durian
src/com/diffplug/common/base/StackDumper.java
StackDumper.printEmphasized
private static void printEmphasized(String toPrint) { // print the triggered header pristineSysErr.println("+----------\\"); for (String line : toPrint.split("\n")) { pristineSysErr.println("| " + line); } pristineSysErr.println("+----------/"); }
java
private static void printEmphasized(String toPrint) { // print the triggered header pristineSysErr.println("+----------\\"); for (String line : toPrint.split("\n")) { pristineSysErr.println("| " + line); } pristineSysErr.println("+----------/"); }
[ "private", "static", "void", "printEmphasized", "(", "String", "toPrint", ")", "{", "// print the triggered header", "pristineSysErr", ".", "println", "(", "\"+----------\\\\\"", ")", ";", "for", "(", "String", "line", ":", "toPrint", ".", "split", "(", "\"\\n\"",...
Prints the given string to the the given printer, wrapped in hierarchy-friendly braces. Useful for emphasizing a specific event from a sea of logging statements.
[ "Prints", "the", "given", "string", "to", "the", "the", "given", "printer", "wrapped", "in", "hierarchy", "-", "friendly", "braces", ".", "Useful", "for", "emphasizing", "a", "specific", "event", "from", "a", "sea", "of", "logging", "statements", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/StackDumper.java#L158-L165
102,142
diffplug/durian
src/com/diffplug/common/base/StringPrinter.java
StringPrinter.buildString
public static String buildString(Consumer<StringPrinter> printer) { StringBuilder builder = new StringBuilder(); printer.accept(new StringPrinter(builder::append)); return builder.toString(); }
java
public static String buildString(Consumer<StringPrinter> printer) { StringBuilder builder = new StringBuilder(); printer.accept(new StringPrinter(builder::append)); return builder.toString(); }
[ "public", "static", "String", "buildString", "(", "Consumer", "<", "StringPrinter", ">", "printer", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "printer", ".", "accept", "(", "new", "StringPrinter", "(", "builder", "::", ...
Easy way to create a String using a StringPrinter.
[ "Easy", "way", "to", "create", "a", "String", "using", "a", "StringPrinter", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/StringPrinter.java#L57-L61
102,143
diffplug/durian
src/com/diffplug/common/base/StringPrinter.java
StringPrinter.buildStringFromLines
public static String buildStringFromLines(String... lines) { int numChars = lines.length; for (String line : lines) { numChars += line.length(); } StringBuilder builder = new StringBuilder(numChars); for (String line : lines) { builder.append(line); builder.append('\n'); } return builder.toString...
java
public static String buildStringFromLines(String... lines) { int numChars = lines.length; for (String line : lines) { numChars += line.length(); } StringBuilder builder = new StringBuilder(numChars); for (String line : lines) { builder.append(line); builder.append('\n'); } return builder.toString...
[ "public", "static", "String", "buildStringFromLines", "(", "String", "...", "lines", ")", "{", "int", "numChars", "=", "lines", ".", "length", ";", "for", "(", "String", "line", ":", "lines", ")", "{", "numChars", "+=", "line", ".", "length", "(", ")", ...
Easy way to create a String from a bunch of lines.
[ "Easy", "way", "to", "create", "a", "String", "from", "a", "bunch", "of", "lines", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/StringPrinter.java#L64-L75
102,144
diffplug/durian
src/com/diffplug/common/base/StringPrinter.java
StringPrinter.toPrintStream
public PrintStream toPrintStream(Charset charset) { return Errors.rethrow().get(() -> { return new PrintStream(toOutputStream(charset), true, charset.name()); }); }
java
public PrintStream toPrintStream(Charset charset) { return Errors.rethrow().get(() -> { return new PrintStream(toOutputStream(charset), true, charset.name()); }); }
[ "public", "PrintStream", "toPrintStream", "(", "Charset", "charset", ")", "{", "return", "Errors", ".", "rethrow", "(", ")", ".", "get", "(", "(", ")", "->", "{", "return", "new", "PrintStream", "(", "toOutputStream", "(", "charset", ")", ",", "true", ",...
Creates a PrintStream of the given charset, which passes its content to this StringPrinter.
[ "Creates", "a", "PrintStream", "of", "the", "given", "charset", "which", "passes", "its", "content", "to", "this", "StringPrinter", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/StringPrinter.java#L154-L158
102,145
diffplug/durian
src/com/diffplug/common/base/StringPrinter.java
StringPrinter.toWriter
public Writer toWriter() { return new Writer() { @Override public Writer append(char c) { consumer.accept(new String(new char[]{c})); return this; } @Override public Writer append(CharSequence csq) { if (csq instanceof String) { consumer.accept((String) csq); } else { consume...
java
public Writer toWriter() { return new Writer() { @Override public Writer append(char c) { consumer.accept(new String(new char[]{c})); return this; } @Override public Writer append(CharSequence csq) { if (csq instanceof String) { consumer.accept((String) csq); } else { consume...
[ "public", "Writer", "toWriter", "(", ")", "{", "return", "new", "Writer", "(", ")", "{", "@", "Override", "public", "Writer", "append", "(", "char", "c", ")", "{", "consumer", ".", "accept", "(", "new", "String", "(", "new", "char", "[", "]", "{", ...
Creates a Writer which passes its content to this StringPrinter.
[ "Creates", "a", "Writer", "which", "passes", "its", "content", "to", "this", "StringPrinter", "." ]
10631a3480e5491eb6eb6ee06e752d8596914232
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/StringPrinter.java#L161-L227
102,146
Pixplicity/EasyPrefs
library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java
Prefs.getDouble
public static double getDouble(final String key) { return Double.longBitsToDouble(getPreferences().getLong(key, Double.doubleToLongBits(0.0d))); }
java
public static double getDouble(final String key) { return Double.longBitsToDouble(getPreferences().getLong(key, Double.doubleToLongBits(0.0d))); }
[ "public", "static", "double", "getDouble", "(", "final", "String", "key", ")", "{", "return", "Double", ".", "longBitsToDouble", "(", "getPreferences", "(", ")", ".", "getLong", "(", "key", ",", "Double", ".", "doubleToLongBits", "(", "0.0d", ")", ")", ")"...
Returns the double that has been saved as a long raw bits value in the long preferences. Returns 0 if the preference does not exist. @param key The name of the preference to retrieve. @return Returns the preference value if it exists, or 0. @throws ClassCastException if there is a preference with this name that i...
[ "Returns", "the", "double", "that", "has", "been", "saved", "as", "a", "long", "raw", "bits", "value", "in", "the", "long", "preferences", ".", "Returns", "0", "if", "the", "preference", "does", "not", "exist", "." ]
0ca13a403bf099019a13d68b38edcf55fca5a653
https://github.com/Pixplicity/EasyPrefs/blob/0ca13a403bf099019a13d68b38edcf55fca5a653/library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java#L162-L164
102,147
Pixplicity/EasyPrefs
library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java
Prefs.getString
public static String getString(final String key, final String defValue) { return getPreferences().getString(key, defValue); }
java
public static String getString(final String key, final String defValue) { return getPreferences().getString(key, defValue); }
[ "public", "static", "String", "getString", "(", "final", "String", "key", ",", "final", "String", "defValue", ")", "{", "return", "getPreferences", "(", ")", ".", "getString", "(", "key", ",", "defValue", ")", ";", "}" ]
Retrieves a stored String value. @param key The name of the preference to retrieve. @param defValue Value to return if this preference does not exist. @return Returns the preference value if it exists, or defValue. @throws ClassCastException if there is a preference with this name that is not a String. @see andro...
[ "Retrieves", "a", "stored", "String", "value", "." ]
0ca13a403bf099019a13d68b38edcf55fca5a653
https://github.com/Pixplicity/EasyPrefs/blob/0ca13a403bf099019a13d68b38edcf55fca5a653/library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java#L200-L202
102,148
Pixplicity/EasyPrefs
library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java
Prefs.putLong
public static void putLong(final String key, final long value) { final Editor editor = getPreferences().edit(); editor.putLong(key, value); editor.apply(); }
java
public static void putLong(final String key, final long value) { final Editor editor = getPreferences().edit(); editor.putLong(key, value); editor.apply(); }
[ "public", "static", "void", "putLong", "(", "final", "String", "key", ",", "final", "long", "value", ")", "{", "final", "Editor", "editor", "=", "getPreferences", "(", ")", ".", "edit", "(", ")", ";", "editor", ".", "putLong", "(", "key", ",", "value",...
Stores a long value. @param key The name of the preference to modify. @param value The new value for the preference. @see android.content.SharedPreferences.Editor#putLong(String, long)
[ "Stores", "a", "long", "value", "." ]
0ca13a403bf099019a13d68b38edcf55fca5a653
https://github.com/Pixplicity/EasyPrefs/blob/0ca13a403bf099019a13d68b38edcf55fca5a653/library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java#L277-L281
102,149
Pixplicity/EasyPrefs
library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java
Prefs.putDouble
public static void putDouble(final String key, final double value) { final Editor editor = getPreferences().edit(); editor.putLong(key, Double.doubleToRawLongBits(value)); editor.apply(); }
java
public static void putDouble(final String key, final double value) { final Editor editor = getPreferences().edit(); editor.putLong(key, Double.doubleToRawLongBits(value)); editor.apply(); }
[ "public", "static", "void", "putDouble", "(", "final", "String", "key", ",", "final", "double", "value", ")", "{", "final", "Editor", "editor", "=", "getPreferences", "(", ")", ".", "edit", "(", ")", ";", "editor", ".", "putLong", "(", "key", ",", "Dou...
Stores a double value as a long raw bits value. @param key The name of the preference to modify. @param value The double value to be save in the preferences. @see android.content.SharedPreferences.Editor#putLong(String, long)
[ "Stores", "a", "double", "value", "as", "a", "long", "raw", "bits", "value", "." ]
0ca13a403bf099019a13d68b38edcf55fca5a653
https://github.com/Pixplicity/EasyPrefs/blob/0ca13a403bf099019a13d68b38edcf55fca5a653/library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java#L303-L307
102,150
Pixplicity/EasyPrefs
library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java
Prefs.remove
public static void remove(final String key) { SharedPreferences prefs = getPreferences(); final Editor editor = prefs.edit(); if (prefs.contains(key + LENGTH)) { // Workaround for pre-HC's lack of StringSets int stringSetLength = prefs.getInt(key + LENGTH, -1); ...
java
public static void remove(final String key) { SharedPreferences prefs = getPreferences(); final Editor editor = prefs.edit(); if (prefs.contains(key + LENGTH)) { // Workaround for pre-HC's lack of StringSets int stringSetLength = prefs.getInt(key + LENGTH, -1); ...
[ "public", "static", "void", "remove", "(", "final", "String", "key", ")", "{", "SharedPreferences", "prefs", "=", "getPreferences", "(", ")", ";", "final", "Editor", "editor", "=", "prefs", ".", "edit", "(", ")", ";", "if", "(", "prefs", ".", "contains",...
Removes a preference value. @param key The name of the preference to remove. @see android.content.SharedPreferences.Editor#remove(String)
[ "Removes", "a", "preference", "value", "." ]
0ca13a403bf099019a13d68b38edcf55fca5a653
https://github.com/Pixplicity/EasyPrefs/blob/0ca13a403bf099019a13d68b38edcf55fca5a653/library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java#L412-L428
102,151
Pixplicity/EasyPrefs
library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java
Prefs.clear
public static Editor clear() { final Editor editor = getPreferences().edit().clear(); editor.apply(); return editor; }
java
public static Editor clear() { final Editor editor = getPreferences().edit().clear(); editor.apply(); return editor; }
[ "public", "static", "Editor", "clear", "(", ")", "{", "final", "Editor", "editor", "=", "getPreferences", "(", ")", ".", "edit", "(", ")", ".", "clear", "(", ")", ";", "editor", ".", "apply", "(", ")", ";", "return", "editor", ";", "}" ]
Removed all the stored keys and values. @return the {@link Editor} for chaining. The changes have already been committed/applied through the execution of this method. @see android.content.SharedPreferences.Editor#clear()
[ "Removed", "all", "the", "stored", "keys", "and", "values", "." ]
0ca13a403bf099019a13d68b38edcf55fca5a653
https://github.com/Pixplicity/EasyPrefs/blob/0ca13a403bf099019a13d68b38edcf55fca5a653/library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java#L448-L452
102,152
Abnaxos/markdown-doclet
doclet/jdk8/src/main/java/ch/raffael/mddoclet/mdtaglet/MarkdownTagletBase.java
MarkdownTagletBase.fetchMarkdownTagletDescriptionFile
protected String fetchMarkdownTagletDescriptionFile(String resourceName) { final URL url = this.getClass().getResource(resourceName); if( url!=null ) { try { return FileUtils.readFileToString(new File(url.toURI())); } catch (Exception e) { e.printS...
java
protected String fetchMarkdownTagletDescriptionFile(String resourceName) { final URL url = this.getClass().getResource(resourceName); if( url!=null ) { try { return FileUtils.readFileToString(new File(url.toURI())); } catch (Exception e) { e.printS...
[ "protected", "String", "fetchMarkdownTagletDescriptionFile", "(", "String", "resourceName", ")", "{", "final", "URL", "url", "=", "this", ".", "getClass", "(", ")", ".", "getResource", "(", "resourceName", ")", ";", "if", "(", "url", "!=", "null", ")", "{", ...
Fetch the markdown taglet description from a resource within your classpath. @param resourceName the resourceName @return the content of the resource file or *empty string*.
[ "Fetch", "the", "markdown", "taglet", "description", "from", "a", "resource", "within", "your", "classpath", "." ]
e98a9630206fc9c8d813cf2349ff594be8630054
https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/mdtaglet/MarkdownTagletBase.java#L148-L158
102,153
Abnaxos/markdown-doclet
doclet/jdk8/src/main/java/ch/raffael/mddoclet/tags/TodoTagRenderer.java
TodoTagRenderer.render
@Override public void render(Tag tag, StringBuilder target, MarkdownDoclet doclet) { Counter counter; if ( tag.holder() instanceof MemberDoc ) { counter = getCounter(((MemberDoc)tag.holder()).containingClass()); } else { counter = getCounter(tag.holder()); ...
java
@Override public void render(Tag tag, StringBuilder target, MarkdownDoclet doclet) { Counter counter; if ( tag.holder() instanceof MemberDoc ) { counter = getCounter(((MemberDoc)tag.holder()).containingClass()); } else { counter = getCounter(tag.holder()); ...
[ "@", "Override", "public", "void", "render", "(", "Tag", "tag", ",", "StringBuilder", "target", ",", "MarkdownDoclet", "doclet", ")", "{", "Counter", "counter", ";", "if", "(", "tag", ".", "holder", "(", ")", "instanceof", "MemberDoc", ")", "{", "counter",...
Render the tag. @todo TODOs can also be used in member docs ... @param tag The tag to render. @param target The target {@link StringBuilder}. @todo ... or even parameter docs -- which is a little strange, actually. ;) @param doclet The doclet.
[ "Render", "the", "tag", "." ]
e98a9630206fc9c8d813cf2349ff594be8630054
https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/tags/TodoTagRenderer.java#L67-L85
102,154
Abnaxos/markdown-doclet
doclet/jdk8/src/main/java/ch/raffael/mddoclet/RootDocWrapper.java
RootDocWrapper.appendOption
public void appendOption(String... option) { options = Arrays.copyOf(options, options.length + 1); options[options.length - 1] = option; }
java
public void appendOption(String... option) { options = Arrays.copyOf(options, options.length + 1); options[options.length - 1] = option; }
[ "public", "void", "appendOption", "(", "String", "...", "option", ")", "{", "options", "=", "Arrays", ".", "copyOf", "(", "options", ",", "options", ".", "length", "+", "1", ")", ";", "options", "[", "options", ".", "length", "-", "1", "]", "=", "opt...
Append an option to the doclet options. @param option The option to append.
[ "Append", "an", "option", "to", "the", "doclet", "options", "." ]
e98a9630206fc9c8d813cf2349ff594be8630054
https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/RootDocWrapper.java#L52-L55
102,155
Abnaxos/markdown-doclet
doclet/jdk8/src/main/java/ch/raffael/mddoclet/MarkdownDoclet.java
MarkdownDoclet.processOverview
protected void processOverview() { if ( options.getOverviewFile() != null ) { try { rootDoc.setRawCommentText(Files.toString(options.getOverviewFile(), options.getEncoding())); defaultProcess(rootDoc, false); } catch ( IOException e ) { ...
java
protected void processOverview() { if ( options.getOverviewFile() != null ) { try { rootDoc.setRawCommentText(Files.toString(options.getOverviewFile(), options.getEncoding())); defaultProcess(rootDoc, false); } catch ( IOException e ) { ...
[ "protected", "void", "processOverview", "(", ")", "{", "if", "(", "options", ".", "getOverviewFile", "(", ")", "!=", "null", ")", "{", "try", "{", "rootDoc", ".", "setRawCommentText", "(", "Files", ".", "toString", "(", "options", ".", "getOverviewFile", "...
Process the overview file, if specified.
[ "Process", "the", "overview", "file", "if", "specified", "." ]
e98a9630206fc9c8d813cf2349ff594be8630054
https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/MarkdownDoclet.java#L289-L300
102,156
Abnaxos/markdown-doclet
doclet/jdk8/src/main/java/ch/raffael/mddoclet/MarkdownDoclet.java
MarkdownDoclet.processClass
protected void processClass(ClassDoc doc) { defaultProcess(doc, true); for ( MemberDoc member : doc.fields() ) { processMember(member); } for ( MemberDoc member : doc.constructors() ) { processMember(member); } for ( MemberDoc member : doc.methods(...
java
protected void processClass(ClassDoc doc) { defaultProcess(doc, true); for ( MemberDoc member : doc.fields() ) { processMember(member); } for ( MemberDoc member : doc.constructors() ) { processMember(member); } for ( MemberDoc member : doc.methods(...
[ "protected", "void", "processClass", "(", "ClassDoc", "doc", ")", "{", "defaultProcess", "(", "doc", ",", "true", ")", ";", "for", "(", "MemberDoc", "member", ":", "doc", ".", "fields", "(", ")", ")", "{", "processMember", "(", "member", ")", ";", "}",...
Process the class documentation. @param doc The class documentation.
[ "Process", "the", "class", "documentation", "." ]
e98a9630206fc9c8d813cf2349ff594be8630054
https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/MarkdownDoclet.java#L307-L323
102,157
Abnaxos/markdown-doclet
doclet/jdk8/src/main/java/ch/raffael/mddoclet/MarkdownDoclet.java
MarkdownDoclet.processPackage
protected void processPackage(PackageDoc doc) { // (#1) Set foundDoc to false if possible. // foundDoc will be set to true when setRawCommentText() is called, if the method // is called again, JavaDoc will issue a warning about multiple sources for the // package documentation. If there ...
java
protected void processPackage(PackageDoc doc) { // (#1) Set foundDoc to false if possible. // foundDoc will be set to true when setRawCommentText() is called, if the method // is called again, JavaDoc will issue a warning about multiple sources for the // package documentation. If there ...
[ "protected", "void", "processPackage", "(", "PackageDoc", "doc", ")", "{", "// (#1) Set foundDoc to false if possible.", "// foundDoc will be set to true when setRawCommentText() is called, if the method", "// is called again, JavaDoc will issue a warning about multiple sources for the", "// p...
Process the package documentation. @param doc The package documentation.
[ "Process", "the", "package", "documentation", "." ]
e98a9630206fc9c8d813cf2349ff594be8630054
https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/MarkdownDoclet.java#L339-L357
102,158
Abnaxos/markdown-doclet
doclet/jdk8/src/main/java/ch/raffael/mddoclet/MarkdownDoclet.java
MarkdownDoclet.defaultProcess
protected void defaultProcess(Doc doc, boolean fixLeadingSpaces) { try { StringBuilder buf = new StringBuilder(); buf.append(getOptions().toHtml(doc.commentText(), fixLeadingSpaces)); buf.append('\n'); for ( Tag tag : doc.tags() ) { processTag(tag,...
java
protected void defaultProcess(Doc doc, boolean fixLeadingSpaces) { try { StringBuilder buf = new StringBuilder(); buf.append(getOptions().toHtml(doc.commentText(), fixLeadingSpaces)); buf.append('\n'); for ( Tag tag : doc.tags() ) { processTag(tag,...
[ "protected", "void", "defaultProcess", "(", "Doc", "doc", ",", "boolean", "fixLeadingSpaces", ")", "{", "try", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "buf", ".", "append", "(", "getOptions", "(", ")", ".", "toHtml", "(", ...
Default processing of any documentation node. @param doc The documentation. @param fixLeadingSpaces `true` if leading spaces should be fixed. @see Options#toHtml(String, boolean)
[ "Default", "processing", "of", "any", "documentation", "node", "." ]
e98a9630206fc9c8d813cf2349ff594be8630054
https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/MarkdownDoclet.java#L367-L399
102,159
Abnaxos/markdown-doclet
doclet/jdk8/src/main/java/ch/raffael/mddoclet/MarkdownDoclet.java
MarkdownDoclet.processTag
@SuppressWarnings("unchecked") protected void processTag(Tag tag, StringBuilder target) { TagRenderer<Tag> renderer = (TagRenderer<Tag>)tagRenderers.get(tag.kind()); if ( renderer == null ) { renderer = TagRenderer.VERBATIM; } renderer.render(tag, target, this); }
java
@SuppressWarnings("unchecked") protected void processTag(Tag tag, StringBuilder target) { TagRenderer<Tag> renderer = (TagRenderer<Tag>)tagRenderers.get(tag.kind()); if ( renderer == null ) { renderer = TagRenderer.VERBATIM; } renderer.render(tag, target, this); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "void", "processTag", "(", "Tag", "tag", ",", "StringBuilder", "target", ")", "{", "TagRenderer", "<", "Tag", ">", "renderer", "=", "(", "TagRenderer", "<", "Tag", ">", ")", "tagRenderers", "."...
Process a tag. @param tag The tag. @param target The target string builder.
[ "Process", "a", "tag", "." ]
e98a9630206fc9c8d813cf2349ff594be8630054
https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/MarkdownDoclet.java#L407-L414
102,160
Abnaxos/markdown-doclet
doclet/jdk8/src/main/java/ch/raffael/mddoclet/MarkdownDoclet.java
MarkdownDoclet.main
public static void main(String[] args) throws Exception { args = Arrays.copyOf(args, args.length + 2); args[args.length - 2] = "-doclet"; args[args.length - 1] = MarkdownDoclet.class.getName(); Main.main(args); }
java
public static void main(String[] args) throws Exception { args = Arrays.copyOf(args, args.length + 2); args[args.length - 2] = "-doclet"; args[args.length - 1] = MarkdownDoclet.class.getName(); Main.main(args); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "args", "=", "Arrays", ".", "copyOf", "(", "args", ",", "args", ".", "length", "+", "2", ")", ";", "args", "[", "args", ".", "length", "-", "2", ...
Just a main method for debugging. @param args The command line arguments. @throws Exception If anything goes wrong.
[ "Just", "a", "main", "method", "for", "debugging", "." ]
e98a9630206fc9c8d813cf2349ff594be8630054
https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/MarkdownDoclet.java#L520-L525
102,161
Abnaxos/markdown-doclet
doclet/jdk8/src/main/java/ch/raffael/mddoclet/Options.java
Options.load
public String[][] load(String[][] options, DocErrorReporter errorReporter) { LinkedList<String[]> optionsList = new LinkedList<>(Arrays.asList(options)); Iterator<String[]> optionsIter = optionsList.iterator(); while ( optionsIter.hasNext() ) { String[] opt = optionsIter.next(); ...
java
public String[][] load(String[][] options, DocErrorReporter errorReporter) { LinkedList<String[]> optionsList = new LinkedList<>(Arrays.asList(options)); Iterator<String[]> optionsIter = optionsList.iterator(); while ( optionsIter.hasNext() ) { String[] opt = optionsIter.next(); ...
[ "public", "String", "[", "]", "[", "]", "load", "(", "String", "[", "]", "[", "]", "options", ",", "DocErrorReporter", "errorReporter", ")", "{", "LinkedList", "<", "String", "[", "]", ">", "optionsList", "=", "new", "LinkedList", "<>", "(", "Arrays", ...
Loads the options from the command line. @param options The command line options. @param errorReporter The error reporter for printing messages. @return The options to be forwarded to the standard doclet.
[ "Loads", "the", "options", "from", "the", "command", "line", "." ]
e98a9630206fc9c8d813cf2349ff594be8630054
https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/Options.java#L130-L143
102,162
Abnaxos/markdown-doclet
doclet/jdk8/src/main/java/ch/raffael/mddoclet/Options.java
Options.getJavadocVersion
public JavadocQuirks getJavadocVersion() { if ( javadocVersion == null ) { String javaVersion = System.getProperty("java.version"); if ( javaVersion != null && javaVersion.compareTo("1.8") >= 0 ) { return JavadocQuirks.V8; } else { ...
java
public JavadocQuirks getJavadocVersion() { if ( javadocVersion == null ) { String javaVersion = System.getProperty("java.version"); if ( javaVersion != null && javaVersion.compareTo("1.8") >= 0 ) { return JavadocQuirks.V8; } else { ...
[ "public", "JavadocQuirks", "getJavadocVersion", "(", ")", "{", "if", "(", "javadocVersion", "==", "null", ")", "{", "String", "javaVersion", "=", "System", ".", "getProperty", "(", "\"java.version\"", ")", ";", "if", "(", "javaVersion", "!=", "null", "&&", "...
Gets the Javadoc version. @return The Javadoc version.
[ "Gets", "the", "Javadoc", "version", "." ]
e98a9630206fc9c8d813cf2349ff594be8630054
https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/Options.java#L355-L366
102,163
Abnaxos/markdown-doclet
doclet/jdk8/src/main/java/ch/raffael/mddoclet/DocletSerializer.java
DocletSerializer.visit
@Override public void visit(VerbatimNode node) { if ( options.isHighlightEnabled() && !options.isAutoHighlightEnabled() && node.getType().isEmpty() ) { VerbatimNode noHighlightNode = new VerbatimNode(node.getText(), "no-highlight"); noHighlightNode.setStartIndex(node.getStartIndex())...
java
@Override public void visit(VerbatimNode node) { if ( options.isHighlightEnabled() && !options.isAutoHighlightEnabled() && node.getType().isEmpty() ) { VerbatimNode noHighlightNode = new VerbatimNode(node.getText(), "no-highlight"); noHighlightNode.setStartIndex(node.getStartIndex())...
[ "@", "Override", "public", "void", "visit", "(", "VerbatimNode", "node", ")", "{", "if", "(", "options", ".", "isHighlightEnabled", "(", ")", "&&", "!", "options", ".", "isAutoHighlightEnabled", "(", ")", "&&", "node", ".", "getType", "(", ")", ".", "isE...
Overrides the default implementation to set the language to "no-highlight" no language is specified. If highlighting is disabled or auto-highlighting is enabled, this method just calls the default implementation. @param node The AST node.
[ "Overrides", "the", "default", "implementation", "to", "set", "the", "language", "to", "no", "-", "highlight", "no", "language", "is", "specified", ".", "If", "highlighting", "is", "disabled", "or", "auto", "-", "highlighting", "is", "enabled", "this", "method...
e98a9630206fc9c8d813cf2349ff594be8630054
https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/DocletSerializer.java#L47-L58
102,164
Abnaxos/markdown-doclet
doclet/jdk8/src/main/java/ch/raffael/mddoclet/mdtaglet/MarkdownTagletExecutor.java
MarkdownTagletExecutor.createTagletPattern
private static String createTagletPattern(String tagNames) { final StringBuilder regex = new StringBuilder(); final int size = STR_TAGS_REGEX_LIST.size(); for (int regexIdx = 0; regexIdx < size; regexIdx++) { final String tagRegex = STR_TAGS_REGEX_LIST.get(regexIdx); fina...
java
private static String createTagletPattern(String tagNames) { final StringBuilder regex = new StringBuilder(); final int size = STR_TAGS_REGEX_LIST.size(); for (int regexIdx = 0; regexIdx < size; regexIdx++) { final String tagRegex = STR_TAGS_REGEX_LIST.get(regexIdx); fina...
[ "private", "static", "String", "createTagletPattern", "(", "String", "tagNames", ")", "{", "final", "StringBuilder", "regex", "=", "new", "StringBuilder", "(", ")", ";", "final", "int", "size", "=", "STR_TAGS_REGEX_LIST", ".", "size", "(", ")", ";", "for", "...
Creates the taglet pattern from `tagNames`. @param tagNames the tag names @return the regex for the known taglets.
[ "Creates", "the", "taglet", "pattern", "from", "tagNames", "." ]
e98a9630206fc9c8d813cf2349ff594be8630054
https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/mdtaglet/MarkdownTagletExecutor.java#L299-L312
102,165
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/context/ServiceContextFactory.java
ServiceContextFactory.createServiceContext
public static ServiceContext createServiceContext(ServletRequest request) { if (!(request instanceof HttpServletRequest)) { throw new IllegalArgumentException("Expected HttpServletRequest"); } return createServiceContext((HttpServletRequest) request); }
java
public static ServiceContext createServiceContext(ServletRequest request) { if (!(request instanceof HttpServletRequest)) { throw new IllegalArgumentException("Expected HttpServletRequest"); } return createServiceContext((HttpServletRequest) request); }
[ "public", "static", "ServiceContext", "createServiceContext", "(", "ServletRequest", "request", ")", "{", "if", "(", "!", "(", "request", "instanceof", "HttpServletRequest", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Expected HttpServletRequest\"...
Convenience method, it requires that the request is a HttpServletRequest. @see #createServiceContext(HttpServletRequest)
[ "Convenience", "method", "it", "requires", "that", "the", "request", "is", "a", "HttpServletRequest", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/context/ServiceContextFactory.java#L79-L84
102,166
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java
JpaHelper.convertToString
public static String convertToString(Collection<? extends Object> parameters) { if (parameters == null || parameters.isEmpty()) return ""; StringBuilder result = new StringBuilder(); for (Object param : parameters) { if (param instanceof String) pa...
java
public static String convertToString(Collection<? extends Object> parameters) { if (parameters == null || parameters.isEmpty()) return ""; StringBuilder result = new StringBuilder(); for (Object param : parameters) { if (param instanceof String) pa...
[ "public", "static", "String", "convertToString", "(", "Collection", "<", "?", "extends", "Object", ">", "parameters", ")", "{", "if", "(", "parameters", "==", "null", "||", "parameters", ".", "isEmpty", "(", ")", ")", "return", "\"\"", ";", "StringBuilder", ...
Converts a collection with IN parameters to a plain string representation @param parameters collection with IN parameters @return plain string representation
[ "Converts", "a", "collection", "with", "IN", "parameters", "to", "a", "plain", "string", "representation" ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java#L56-L72
102,167
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java
JpaHelper.listFields
public static List<Field> listFields(Class<?> clazz) { assert clazz != null; Class<?> entityClass = clazz; List<Field> list = new ArrayList<Field>(); while (!Object.class.equals(entityClass) && entityClass != null) { list.addAll(Arrays.asList(entityClass.getDeclaredFields()...
java
public static List<Field> listFields(Class<?> clazz) { assert clazz != null; Class<?> entityClass = clazz; List<Field> list = new ArrayList<Field>(); while (!Object.class.equals(entityClass) && entityClass != null) { list.addAll(Arrays.asList(entityClass.getDeclaredFields()...
[ "public", "static", "List", "<", "Field", ">", "listFields", "(", "Class", "<", "?", ">", "clazz", ")", "{", "assert", "clazz", "!=", "null", ";", "Class", "<", "?", ">", "entityClass", "=", "clazz", ";", "List", "<", "Field", ">", "list", "=", "ne...
lists all fields of a given class @param clazz type @return
[ "lists", "all", "fields", "of", "a", "given", "class" ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java#L96-L105
102,168
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java
JpaHelper.findField
public static Field findField(Class<?> clazz, String name) { Class<?> entityClass = clazz; while (!Object.class.equals(entityClass) && entityClass != null) { Field[] fields = entityClass.getDeclaredFields(); for (Field field : fields) { if (name.equals(field....
java
public static Field findField(Class<?> clazz, String name) { Class<?> entityClass = clazz; while (!Object.class.equals(entityClass) && entityClass != null) { Field[] fields = entityClass.getDeclaredFields(); for (Field field : fields) { if (name.equals(field....
[ "public", "static", "Field", "findField", "(", "Class", "<", "?", ">", "clazz", ",", "String", "name", ")", "{", "Class", "<", "?", ">", "entityClass", "=", "clazz", ";", "while", "(", "!", "Object", ".", "class", ".", "equals", "(", "entityClass", "...
tries to find a field by a field name @param clazz type @param name name of the field @return
[ "tries", "to", "find", "a", "field", "by", "a", "field", "name" ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java#L114-L126
102,169
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java
JpaHelper.findProperty
public static Method findProperty(Class<?> clazz, String name) { assert clazz != null; assert name != null; Class<?> entityClass = clazz; while (entityClass != null) { Method[] methods = (entityClass.isInterface() ? entityClass.getMethods() : entityClass.getDeclaredMethods());...
java
public static Method findProperty(Class<?> clazz, String name) { assert clazz != null; assert name != null; Class<?> entityClass = clazz; while (entityClass != null) { Method[] methods = (entityClass.isInterface() ? entityClass.getMethods() : entityClass.getDeclaredMethods());...
[ "public", "static", "Method", "findProperty", "(", "Class", "<", "?", ">", "clazz", ",", "String", "name", ")", "{", "assert", "clazz", "!=", "null", ";", "assert", "name", "!=", "null", ";", "Class", "<", "?", ">", "entityClass", "=", "clazz", ";", ...
tries to find a property method by name @param clazz type @param name name of the property @return
[ "tries", "to", "find", "a", "property", "method", "by", "name" ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java#L135-L150
102,170
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java
JpaHelper.getValue
public static Object getValue(Object instance, String name) { assert instance != null; assert name != null; try { Class<?> clazz = instance.getClass(); Object value = null; Method property = findProperty(clazz, name); if (property != null) {...
java
public static Object getValue(Object instance, String name) { assert instance != null; assert name != null; try { Class<?> clazz = instance.getClass(); Object value = null; Method property = findProperty(clazz, name); if (property != null) {...
[ "public", "static", "Object", "getValue", "(", "Object", "instance", ",", "String", "name", ")", "{", "assert", "instance", "!=", "null", ";", "assert", "name", "!=", "null", ";", "try", "{", "Class", "<", "?", ">", "clazz", "=", "instance", ".", "getC...
tries to get the value from a field or a getter property for a given object instance @param instance the object instance @param name name of the property or field @return @throws IllegalArgumentException @throws IllegalAccessException @throws InvocationTargetException
[ "tries", "to", "get", "the", "value", "from", "a", "field", "or", "a", "getter", "property", "for", "a", "given", "object", "instance" ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java#L162-L185
102,171
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java
JpaHelper.findNamedQuery
public static NamedQuery findNamedQuery(Class<?> type, String name) { NamedQuery annotatedNamedQuery = (NamedQuery) type.getAnnotation(NamedQuery.class); if (annotatedNamedQuery != null) { return annotatedNamedQuery; } NamedQueries annotatedNamedQueries = (NamedQu...
java
public static NamedQuery findNamedQuery(Class<?> type, String name) { NamedQuery annotatedNamedQuery = (NamedQuery) type.getAnnotation(NamedQuery.class); if (annotatedNamedQuery != null) { return annotatedNamedQuery; } NamedQueries annotatedNamedQueries = (NamedQu...
[ "public", "static", "NamedQuery", "findNamedQuery", "(", "Class", "<", "?", ">", "type", ",", "String", "name", ")", "{", "NamedQuery", "annotatedNamedQuery", "=", "(", "NamedQuery", ")", "type", ".", "getAnnotation", "(", "NamedQuery", ".", "class", ")", ";...
get a named query from an entity @param type @param name @return
[ "get", "a", "named", "query", "from", "an", "entity" ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java#L228-L249
102,172
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java
JpaHelper.createResultCountQuery
public static String createResultCountQuery(String query) { String resultCountQueryString = null; int select = query.toLowerCase().indexOf("select"); int from = query.toLowerCase().indexOf("from"); if (select == -1 || from == -1) { return null; } re...
java
public static String createResultCountQuery(String query) { String resultCountQueryString = null; int select = query.toLowerCase().indexOf("select"); int from = query.toLowerCase().indexOf("from"); if (select == -1 || from == -1) { return null; } re...
[ "public", "static", "String", "createResultCountQuery", "(", "String", "query", ")", "{", "String", "resultCountQueryString", "=", "null", ";", "int", "select", "=", "query", ".", "toLowerCase", "(", ")", ".", "indexOf", "(", "\"select\"", ")", ";", "int", "...
Build a query based on the original query to count results @param query @return
[ "Build", "a", "query", "based", "on", "the", "original", "query", "to", "count", "results" ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java#L257-L276
102,173
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java
JpaHelper.toSeparatedString
public static String toSeparatedString(List<?> values, String separator) { return toSeparatedString(values, separator, null); }
java
public static String toSeparatedString(List<?> values, String separator) { return toSeparatedString(values, separator, null); }
[ "public", "static", "String", "toSeparatedString", "(", "List", "<", "?", ">", "values", ",", "String", "separator", ")", "{", "return", "toSeparatedString", "(", "values", ",", "separator", ",", "null", ")", ";", "}" ]
build a single String from a List of objects with a given separator @param values @param separator @return
[ "build", "a", "single", "String", "from", "a", "List", "of", "objects", "with", "a", "given", "separator" ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java#L285-L287
102,174
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java
JpaHelper.toSeparatedString
public static String toSeparatedString(List<?> values, String separator, String prefix) { StringBuilder result = new StringBuilder(); for (Object each : values) { if (each == null) { continue; } if (result.length() > 0) { result....
java
public static String toSeparatedString(List<?> values, String separator, String prefix) { StringBuilder result = new StringBuilder(); for (Object each : values) { if (each == null) { continue; } if (result.length() > 0) { result....
[ "public", "static", "String", "toSeparatedString", "(", "List", "<", "?", ">", "values", ",", "String", "separator", ",", "String", "prefix", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Object", "each", ":"...
build a single String from a List of objects with a given separator and prefix @param values @param separator @param prefix @return
[ "build", "a", "single", "String", "from", "a", "List", "of", "objects", "with", "a", "given", "separator", "and", "prefix" ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java#L297-L313
102,175
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/event/annotation/PublishAdvice.java
PublishAdvice.isJoda
private boolean isJoda(Class<?> clazz) { for (Constructor<?> each : clazz.getConstructors()) { Class<?>[] parameterTypes = each.getParameterTypes(); if (parameterTypes.length > 0) { if (parameterTypes[0].getName().startsWith("org.joda.time.")) { return...
java
private boolean isJoda(Class<?> clazz) { for (Constructor<?> each : clazz.getConstructors()) { Class<?>[] parameterTypes = each.getParameterTypes(); if (parameterTypes.length > 0) { if (parameterTypes[0].getName().startsWith("org.joda.time.")) { return...
[ "private", "boolean", "isJoda", "(", "Class", "<", "?", ">", "clazz", ")", "{", "for", "(", "Constructor", "<", "?", ">", "each", ":", "clazz", ".", "getConstructors", "(", ")", ")", "{", "Class", "<", "?", ">", "[", "]", "parameterTypes", "=", "ea...
Check if joda date time library is used, without introducing runtime dependency.
[ "Check", "if", "joda", "date", "time", "library", "is", "used", "without", "introducing", "runtime", "dependency", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/event/annotation/PublishAdvice.java#L145-L155
102,176
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/errorhandling/ErrorHandlingAdvice.java
ErrorHandlingAdvice.afterThrowing
public void afterThrowing(Method m, Object[] args, Object target, ConcurrencyFailureException e) throws OptimisticLockingException { handleOptimisticLockingException(target, e); }
java
public void afterThrowing(Method m, Object[] args, Object target, ConcurrencyFailureException e) throws OptimisticLockingException { handleOptimisticLockingException(target, e); }
[ "public", "void", "afterThrowing", "(", "Method", "m", ",", "Object", "[", "]", "args", ",", "Object", "target", ",", "ConcurrencyFailureException", "e", ")", "throws", "OptimisticLockingException", "{", "handleOptimisticLockingException", "(", "target", ",", "e", ...
Spring exception for Optimistic Locking.
[ "Spring", "exception", "for", "Optimistic", "Locking", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/errorhandling/ErrorHandlingAdvice.java#L111-L114
102,177
sculptor/sculptor
sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/check/AggregateConstraints.java
AggregateConstraints.checkAggregateReferences
public static boolean checkAggregateReferences(Application app) { Map<DomainObject, Set<DomainObject>> aggregateGroups = getAggregateGroups(app); for (Set<DomainObject> group1 : aggregateGroups.values()) { for (Set<DomainObject> group2 : aggregateGroups.values()) { if (group1 == group2) { continue; ...
java
public static boolean checkAggregateReferences(Application app) { Map<DomainObject, Set<DomainObject>> aggregateGroups = getAggregateGroups(app); for (Set<DomainObject> group1 : aggregateGroups.values()) { for (Set<DomainObject> group2 : aggregateGroups.values()) { if (group1 == group2) { continue; ...
[ "public", "static", "boolean", "checkAggregateReferences", "(", "Application", "app", ")", "{", "Map", "<", "DomainObject", ",", "Set", "<", "DomainObject", ">", ">", "aggregateGroups", "=", "getAggregateGroups", "(", "app", ")", ";", "for", "(", "Set", "<", ...
According to DDD the aggregate root is the only member of the aggregate that objects outside the aggregate boundary may hold references to.
[ "According", "to", "DDD", "the", "aggregate", "root", "is", "the", "only", "member", "of", "the", "aggregate", "that", "objects", "outside", "the", "aggregate", "boundary", "may", "hold", "references", "to", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/check/AggregateConstraints.java#L50-L74
102,178
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/propertyeditor/LocalDateEditor.java
LocalDateEditor.setAsText
public void setAsText(String text) throws IllegalArgumentException { if (this.allowEmpty && !StringUtils.hasText(text)) { // Treat empty String as null value. setValue(null); } else { setValue(new LocalDate(this.formatter.parseDateTime(text))); } }
java
public void setAsText(String text) throws IllegalArgumentException { if (this.allowEmpty && !StringUtils.hasText(text)) { // Treat empty String as null value. setValue(null); } else { setValue(new LocalDate(this.formatter.parseDateTime(text))); } }
[ "public", "void", "setAsText", "(", "String", "text", ")", "throws", "IllegalArgumentException", "{", "if", "(", "this", ".", "allowEmpty", "&&", "!", "StringUtils", ".", "hasText", "(", "text", ")", ")", "{", "// Treat empty String as null value.\r", "setValue", ...
Parse the value from the given text, using the specified format.
[ "Parse", "the", "value", "from", "the", "given", "text", "using", "the", "specified", "format", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/propertyeditor/LocalDateEditor.java#L63-L70
102,179
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/propertyeditor/LocalDateEditor.java
LocalDateEditor.getAsText
public String getAsText() { LocalDate value = (LocalDate) getValue(); return (value != null ? value.toString(this.formatter) : ""); }
java
public String getAsText() { LocalDate value = (LocalDate) getValue(); return (value != null ? value.toString(this.formatter) : ""); }
[ "public", "String", "getAsText", "(", ")", "{", "LocalDate", "value", "=", "(", "LocalDate", ")", "getValue", "(", ")", ";", "return", "(", "value", "!=", "null", "?", "value", ".", "toString", "(", "this", ".", "formatter", ")", ":", "\"\"", ")", ";...
Format the LocalDate as String, using the specified format.
[ "Format", "the", "LocalDate", "as", "String", "using", "the", "specified", "format", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/propertyeditor/LocalDateEditor.java#L75-L78
102,180
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/propertyeditor/EnumEditor.java
EnumEditor.getAsText
public String getAsText() { Enum<?> value = (Enum<?>) getValue(); if (value == null) { return ""; } String text = getMessagesAccessor().getMessage(messagesKeyPrefix + value.name(), (String) null); if (text == null) { return value.toString(); ...
java
public String getAsText() { Enum<?> value = (Enum<?>) getValue(); if (value == null) { return ""; } String text = getMessagesAccessor().getMessage(messagesKeyPrefix + value.name(), (String) null); if (text == null) { return value.toString(); ...
[ "public", "String", "getAsText", "(", ")", "{", "Enum", "<", "?", ">", "value", "=", "(", "Enum", "<", "?", ">", ")", "getValue", "(", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "\"\"", ";", "}", "String", "text", "=", "get...
Format the Enum as translated String
[ "Format", "the", "Enum", "as", "translated", "String" ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/propertyeditor/EnumEditor.java#L64-L76
102,181
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/propertyeditor/EnumEditor.java
EnumEditor.setAsText
public void setAsText(String text) throws IllegalArgumentException { if (text == null || text.equals("")) { setValue(null); return; } Enum<?> value = Enum.valueOf(enumClass, text); setValue(value); }
java
public void setAsText(String text) throws IllegalArgumentException { if (text == null || text.equals("")) { setValue(null); return; } Enum<?> value = Enum.valueOf(enumClass, text); setValue(value); }
[ "public", "void", "setAsText", "(", "String", "text", ")", "throws", "IllegalArgumentException", "{", "if", "(", "text", "==", "null", "||", "text", ".", "equals", "(", "\"\"", ")", ")", "{", "setValue", "(", "null", ")", ";", "return", ";", "}", "Enum...
Parse the value from the given text is not supported by this editor
[ "Parse", "the", "value", "from", "the", "given", "text", "is", "not", "supported", "by", "this", "editor" ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/propertyeditor/EnumEditor.java#L81-L88
102,182
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/context/ServiceContext.java
ServiceContext.getPropertyKeys
public synchronized Iterator<String> getPropertyKeys() { if (properties == null) { properties = new HashMap<String, Serializable>(); } return properties.keySet().iterator(); }
java
public synchronized Iterator<String> getPropertyKeys() { if (properties == null) { properties = new HashMap<String, Serializable>(); } return properties.keySet().iterator(); }
[ "public", "synchronized", "Iterator", "<", "String", ">", "getPropertyKeys", "(", ")", "{", "if", "(", "properties", "==", "null", ")", "{", "properties", "=", "new", "HashMap", "<", "String", ",", "Serializable", ">", "(", ")", ";", "}", "return", "prop...
Gets all property keys for attributes of the ServiceContext object @return property key values, String elements
[ "Gets", "all", "property", "keys", "for", "attributes", "of", "the", "ServiceContext", "object" ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/context/ServiceContext.java#L150-L155
102,183
sculptor/sculptor
sculptor-examples/DDDSample/src/main/java/org/sculptor/dddsample/cargo/domain/RouteSpecification.java
RouteSpecification.forCargo
public static RouteSpecification forCargo(Cargo cargo, DateTime arrivalDeadline) { Validate.notNull(cargo); Validate.notNull(arrivalDeadline); return new RouteSpecification(arrivalDeadline, cargo.getOrigin(), cargo.getDestination()); }
java
public static RouteSpecification forCargo(Cargo cargo, DateTime arrivalDeadline) { Validate.notNull(cargo); Validate.notNull(arrivalDeadline); return new RouteSpecification(arrivalDeadline, cargo.getOrigin(), cargo.getDestination()); }
[ "public", "static", "RouteSpecification", "forCargo", "(", "Cargo", "cargo", ",", "DateTime", "arrivalDeadline", ")", "{", "Validate", ".", "notNull", "(", "cargo", ")", ";", "Validate", ".", "notNull", "(", "arrivalDeadline", ")", ";", "return", "new", "Route...
Factory for creatig a route specification for a cargo, from cargo origin to cargo destination. Use for initial routing. @param cargo cargo @param arrivalDeadline arrival deadline @return A route specification for this cargo and arrival deadline
[ "Factory", "for", "creatig", "a", "route", "specification", "for", "a", "cargo", "from", "cargo", "origin", "to", "cargo", "destination", ".", "Use", "for", "initial", "routing", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-examples/DDDSample/src/main/java/org/sculptor/dddsample/cargo/domain/RouteSpecification.java#L28-L33
102,184
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/errorhandling/SystemException.java
SystemException.unwrapSystemException
public static SystemException unwrapSystemException(Throwable throwable) { if (throwable == null) { return null; } else if (throwable instanceof SystemException) { return (SystemException) throwable; } else if (throwable.getCause() != null) { // recursiv...
java
public static SystemException unwrapSystemException(Throwable throwable) { if (throwable == null) { return null; } else if (throwable instanceof SystemException) { return (SystemException) throwable; } else if (throwable.getCause() != null) { // recursiv...
[ "public", "static", "SystemException", "unwrapSystemException", "(", "Throwable", "throwable", ")", "{", "if", "(", "throwable", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "throwable", "instanceof", "SystemException", ")", "{", "ret...
Looks for SystemException in the cause chain. @return Found SystemException in the cause chain, or null if none found
[ "Looks", "for", "SystemException", "in", "the", "cause", "chain", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/errorhandling/SystemException.java#L126-L138
102,185
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/ChunkFetcherBase.java
ChunkFetcherBase.getDomainObjectsAsList
public List<T> getDomainObjectsAsList(Set<? extends KEY> keys) { // it is not "possible" to use huge number of parameters in a // Restrictions.in criterion and therefore we chunk the query // into pieces List<T> all = new ArrayList<T>(); Iterator<? extends KEY> iter = keys.i...
java
public List<T> getDomainObjectsAsList(Set<? extends KEY> keys) { // it is not "possible" to use huge number of parameters in a // Restrictions.in criterion and therefore we chunk the query // into pieces List<T> all = new ArrayList<T>(); Iterator<? extends KEY> iter = keys.i...
[ "public", "List", "<", "T", ">", "getDomainObjectsAsList", "(", "Set", "<", "?", "extends", "KEY", ">", "keys", ")", "{", "// it is not \"possible\" to use huge number of parameters in a\r", "// Restrictions.in criterion and therefore we chunk the query\r", "// into pieces\r", ...
Fetch existing domain objects based on natural keys @param keys Set of natural keys for the domain objects to fetch @param resultAsSet indicates if the keys are unique or not, eg. the resulting map must be a set of objects. @return Map with keys and domain objects
[ "Fetch", "existing", "domain", "objects", "based", "on", "natural", "keys" ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/ChunkFetcherBase.java#L71-L92
102,186
sculptor/sculptor
sculptor-maven/sculptor-maven-plugin/src/main/java/org/sculptor/maven/plugin/GeneratorMojo.java
GeneratorMojo.executeGenerator
protected boolean executeGenerator() throws MojoExecutionException { // Add resources and output directory to plugins classpath List<Object> classpathEntries = new ArrayList<Object>(); classpathEntries.addAll(project.getResources()); classpathEntries.add(project.getBuild().getOutputDirectory()); extendPlugin...
java
protected boolean executeGenerator() throws MojoExecutionException { // Add resources and output directory to plugins classpath List<Object> classpathEntries = new ArrayList<Object>(); classpathEntries.addAll(project.getResources()); classpathEntries.add(project.getBuild().getOutputDirectory()); extendPlugin...
[ "protected", "boolean", "executeGenerator", "(", ")", "throws", "MojoExecutionException", "{", "// Add resources and output directory to plugins classpath", "List", "<", "Object", ">", "classpathEntries", "=", "new", "ArrayList", "<", "Object", ">", "(", ")", ";", "clas...
Executes the commandline running the Eclipse MWE2 launcher and returns the commandlines exit value.
[ "Executes", "the", "commandline", "running", "the", "Eclipse", "MWE2", "launcher", "and", "returns", "the", "commandlines", "exit", "value", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-maven/sculptor-maven-plugin/src/main/java/org/sculptor/maven/plugin/GeneratorMojo.java#L408-L458
102,187
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/propertyeditor/Option.java
Option.createOptions
public static <T> List<Option<T>> createOptions(Collection<T> domainObjects) { List<Option<T>> options = new ArrayList<Option<T>>(); for (T value : domainObjects) { String id = String.valueOf(getId(value)); options.add(new Option<T>(id, value)); } ...
java
public static <T> List<Option<T>> createOptions(Collection<T> domainObjects) { List<Option<T>> options = new ArrayList<Option<T>>(); for (T value : domainObjects) { String id = String.valueOf(getId(value)); options.add(new Option<T>(id, value)); } ...
[ "public", "static", "<", "T", ">", "List", "<", "Option", "<", "T", ">", ">", "createOptions", "(", "Collection", "<", "T", ">", "domainObjects", ")", "{", "List", "<", "Option", "<", "T", ">>", "options", "=", "new", "ArrayList", "<", "Option", "<",...
Factory method to create a list of Options from a list of DomainObjects. It is expected that the DomainObjects has
[ "Factory", "method", "to", "create", "a", "list", "of", "Options", "from", "a", "list", "of", "DomainObjects", ".", "It", "is", "expected", "that", "the", "DomainObjects", "has" ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/propertyeditor/Option.java#L27-L36
102,188
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/event/DynamicMethodDispatcher.java
DynamicMethodDispatcher.dispatch
public static void dispatch(Object target, Event event, String methodName) { try { MethodUtils.invokeMethod(target, methodName, event); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof RuntimeException) { throw (RuntimeException) e.get...
java
public static void dispatch(Object target, Event event, String methodName) { try { MethodUtils.invokeMethod(target, methodName, event); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof RuntimeException) { throw (RuntimeException) e.get...
[ "public", "static", "void", "dispatch", "(", "Object", "target", ",", "Event", "event", ",", "String", "methodName", ")", "{", "try", "{", "MethodUtils", ".", "invokeMethod", "(", "target", ",", "methodName", ",", "event", ")", ";", "}", "catch", "(", "I...
Runtime dispatch to method with correct event parameter type
[ "Runtime", "dispatch", "to", "method", "with", "correct", "event", "parameter", "type" ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/event/DynamicMethodDispatcher.java#L28-L42
102,189
sculptor/sculptor
sculptor-framework/sculptor-framework-mongodb/src/main/java/org/sculptor/framework/accessimpl/mongodb/MongoDbAccessBaseWithException.java
MongoDbAccessBaseWithException.getDataMapper
@SuppressWarnings("unchecked") public DataMapper<Object, DBObject> getDataMapper(Class<?> domainObjectClass) { if (additionalDataMappers != null) { for (DataMapper<Object, DBObject> each : additionalDataMappers) { if (each.canMapToData(domainObjectClass)) { ...
java
@SuppressWarnings("unchecked") public DataMapper<Object, DBObject> getDataMapper(Class<?> domainObjectClass) { if (additionalDataMappers != null) { for (DataMapper<Object, DBObject> each : additionalDataMappers) { if (each.canMapToData(domainObjectClass)) { ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "DataMapper", "<", "Object", ",", "DBObject", ">", "getDataMapper", "(", "Class", "<", "?", ">", "domainObjectClass", ")", "{", "if", "(", "additionalDataMappers", "!=", "null", ")", "{", "for", "...
Matching DataMapper, if any, otherwise null
[ "Matching", "DataMapper", "if", "any", "otherwise", "null" ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-mongodb/src/main/java/org/sculptor/framework/accessimpl/mongodb/MongoDbAccessBaseWithException.java#L79-L93
102,190
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/propertyeditor/OptionEditor.java
OptionEditor.getAsText
public String getAsText() { Object value = getValue(); if (value == null) { return ""; } String propertyName = null; // used in error handling below try { StringBuffer label = new StringBuffer(); for (int i = 0; i < properties.len...
java
public String getAsText() { Object value = getValue(); if (value == null) { return ""; } String propertyName = null; // used in error handling below try { StringBuffer label = new StringBuffer(); for (int i = 0; i < properties.len...
[ "public", "String", "getAsText", "(", ")", "{", "Object", "value", "=", "getValue", "(", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "\"\"", ";", "}", "String", "propertyName", "=", "null", ";", "// used in error handling below\r", "try...
Format the Object as String of concatenated properties.
[ "Format", "the", "Object", "as", "String", "of", "concatenated", "properties", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/propertyeditor/OptionEditor.java#L66-L103
102,191
sculptor/sculptor
sculptor-maven/sculptor-maven-plugin/src/main/java/org/sculptor/maven/plugin/AbstractGeneratorMojo.java
AbstractGeneratorMojo.cleanDirectory
private void cleanDirectory(File dir) { if (isVerbose() || getLog().isDebugEnabled()) { getLog().info("Deleting previously generated files in directory: " + dir.getPath()); } if (dir.exists()) { try { FileUtils.cleanDirectory(dir); } catch (IOException e) { getLog().warn("Cleaning directory faile...
java
private void cleanDirectory(File dir) { if (isVerbose() || getLog().isDebugEnabled()) { getLog().info("Deleting previously generated files in directory: " + dir.getPath()); } if (dir.exists()) { try { FileUtils.cleanDirectory(dir); } catch (IOException e) { getLog().warn("Cleaning directory faile...
[ "private", "void", "cleanDirectory", "(", "File", "dir", ")", "{", "if", "(", "isVerbose", "(", ")", "||", "getLog", "(", ")", ".", "isDebugEnabled", "(", ")", ")", "{", "getLog", "(", ")", ".", "info", "(", "\"Deleting previously generated files in director...
Deletes all files within the given directory.
[ "Deletes", "all", "files", "within", "the", "given", "directory", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-maven/sculptor-maven-plugin/src/main/java/org/sculptor/maven/plugin/AbstractGeneratorMojo.java#L334-L345
102,192
sculptor/sculptor
sculptor-maven/sculptor-maven-plugin/src/main/java/org/sculptor/maven/plugin/AbstractGeneratorMojo.java
AbstractGeneratorMojo.getProjectRelativePath
protected String getProjectRelativePath(File file) { String path = file.getAbsolutePath(); String prefix = project.getBasedir().getAbsolutePath(); if (path.startsWith(prefix)) { path = path.substring(prefix.length() + 1); } if (File.separatorChar != '/') { path = path.replace(File.separatorChar, '/'); ...
java
protected String getProjectRelativePath(File file) { String path = file.getAbsolutePath(); String prefix = project.getBasedir().getAbsolutePath(); if (path.startsWith(prefix)) { path = path.substring(prefix.length() + 1); } if (File.separatorChar != '/') { path = path.replace(File.separatorChar, '/'); ...
[ "protected", "String", "getProjectRelativePath", "(", "File", "file", ")", "{", "String", "path", "=", "file", ".", "getAbsolutePath", "(", ")", ";", "String", "prefix", "=", "project", ".", "getBasedir", "(", ")", ".", "getAbsolutePath", "(", ")", ";", "i...
Returns the path of given file relative to the enclosing Maven project.
[ "Returns", "the", "path", "of", "given", "file", "relative", "to", "the", "enclosing", "Maven", "project", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-maven/sculptor-maven-plugin/src/main/java/org/sculptor/maven/plugin/AbstractGeneratorMojo.java#L350-L360
102,193
sculptor/sculptor
sculptor-maven/sculptor-maven-plugin/src/main/java/org/sculptor/maven/plugin/AbstractGeneratorMojo.java
AbstractGeneratorMojo.calculateChecksum
private String calculateChecksum(File file) throws IOException { InputStream is = new FileInputStream(file); return DigestUtils.md5Hex(is); }
java
private String calculateChecksum(File file) throws IOException { InputStream is = new FileInputStream(file); return DigestUtils.md5Hex(is); }
[ "private", "String", "calculateChecksum", "(", "File", "file", ")", "throws", "IOException", "{", "InputStream", "is", "=", "new", "FileInputStream", "(", "file", ")", ";", "return", "DigestUtils", ".", "md5Hex", "(", "is", ")", ";", "}" ]
Returns a hex representation of the MD5 checksum from given file.
[ "Returns", "a", "hex", "representation", "of", "the", "MD5", "checksum", "from", "given", "file", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-maven/sculptor-maven-plugin/src/main/java/org/sculptor/maven/plugin/AbstractGeneratorMojo.java#L365-L368
102,194
sculptor/sculptor
sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/PropertiesBase.java
PropertiesBase.initDerivedDefaults
@Inject private void initDerivedDefaults(@Named("Mutable Defaults") MutableConfigurationProvider defaultConfiguration) { if (hasProperty("test.dbunit.dataSetFile")) { // don't generate data set file for each service/consumer defaultConfiguration.setBoolean("generate.test.dbunitTestData", false); } // dep...
java
@Inject private void initDerivedDefaults(@Named("Mutable Defaults") MutableConfigurationProvider defaultConfiguration) { if (hasProperty("test.dbunit.dataSetFile")) { // don't generate data set file for each service/consumer defaultConfiguration.setBoolean("generate.test.dbunitTestData", false); } // dep...
[ "@", "Inject", "private", "void", "initDerivedDefaults", "(", "@", "Named", "(", "\"Mutable Defaults\"", ")", "MutableConfigurationProvider", "defaultConfiguration", ")", "{", "if", "(", "hasProperty", "(", "\"test.dbunit.dataSetFile\"", ")", ")", "{", "// don't generat...
Prepare the default values with values inherited from the configuration.
[ "Prepare", "the", "default", "values", "with", "values", "inherited", "from", "the", "configuration", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/PropertiesBase.java#L49-L114
102,195
sculptor/sculptor
sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/PropertiesBase.java
PropertiesBase.getProperties
Properties getProperties(String prefix, boolean removePrefix) { Properties result = new Properties(); for (String key : getPropertyNames()) { if (key.startsWith(prefix)) { result.put((removePrefix) ? key.substring(prefix.length()) : key, getProperty(key)); } } return result; }
java
Properties getProperties(String prefix, boolean removePrefix) { Properties result = new Properties(); for (String key : getPropertyNames()) { if (key.startsWith(prefix)) { result.put((removePrefix) ? key.substring(prefix.length()) : key, getProperty(key)); } } return result; }
[ "Properties", "getProperties", "(", "String", "prefix", ",", "boolean", "removePrefix", ")", "{", "Properties", "result", "=", "new", "Properties", "(", ")", ";", "for", "(", "String", "key", ":", "getPropertyNames", "(", ")", ")", "{", "if", "(", "key", ...
Gets all properties with a key starting with prefix. @param prefix @param removePrefix remove prefix in the resulting properties or not @return properties starting with prefix
[ "Gets", "all", "properties", "with", "a", "key", "starting", "with", "prefix", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/PropertiesBase.java#L285-L293
102,196
sculptor/sculptor
sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/PropertiesBase.java
PropertiesBase.mapValidationAnnotation
public String mapValidationAnnotation(String annotation, String defaultAnnotation) { String key = "validation.annotation." + toFirstUpper(annotation); if (hasProperty(key)) { return getProperty(key); } else { return defaultAnnotation; } }
java
public String mapValidationAnnotation(String annotation, String defaultAnnotation) { String key = "validation.annotation." + toFirstUpper(annotation); if (hasProperty(key)) { return getProperty(key); } else { return defaultAnnotation; } }
[ "public", "String", "mapValidationAnnotation", "(", "String", "annotation", ",", "String", "defaultAnnotation", ")", "{", "String", "key", "=", "\"validation.annotation.\"", "+", "toFirstUpper", "(", "annotation", ")", ";", "if", "(", "hasProperty", "(", "key", ")...
Gets a single validation annotation from properties. @param annotation shortcut for annotation @param defaultAnnotation default annotation in case annotation could not be found @return fully qualified Annotation Class (without leading @)
[ "Gets", "a", "single", "validation", "annotation", "from", "properties", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/PropertiesBase.java#L546-L553
102,197
sculptor/sculptor
sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/PropertiesBase.java
PropertiesBase.getAllPConfigurationKeyValues
private List<String> getAllPConfigurationKeyValues(ConfigurationProvider configuration) { List<String> keyValues = new ArrayList<String>(); for (String key : configuration.keys()) { keyValues.add(key + "=\"" + configuration.getString(key) + "\""); } Collections.sort(keyValues); return keyValues; }
java
private List<String> getAllPConfigurationKeyValues(ConfigurationProvider configuration) { List<String> keyValues = new ArrayList<String>(); for (String key : configuration.keys()) { keyValues.add(key + "=\"" + configuration.getString(key) + "\""); } Collections.sort(keyValues); return keyValues; }
[ "private", "List", "<", "String", ">", "getAllPConfigurationKeyValues", "(", "ConfigurationProvider", "configuration", ")", "{", "List", "<", "String", ">", "keyValues", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "String", "key", ...
Returns a sorted list of all key-value pairs defined in given configuration instance.
[ "Returns", "a", "sorted", "list", "of", "all", "key", "-", "value", "pairs", "defined", "in", "given", "configuration", "instance", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/PropertiesBase.java#L578-L585
102,198
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/errorhandling/ExceptionHelper.java
ExceptionHelper.unwrapSQLException
public static SQLException unwrapSQLException(Throwable throwable) { if (throwable == null) { return null; } else if (throwable instanceof SQLException) { return (SQLException) throwable; } else if (throwable.getCause() != null) { // recursive call to un...
java
public static SQLException unwrapSQLException(Throwable throwable) { if (throwable == null) { return null; } else if (throwable instanceof SQLException) { return (SQLException) throwable; } else if (throwable.getCause() != null) { // recursive call to un...
[ "public", "static", "SQLException", "unwrapSQLException", "(", "Throwable", "throwable", ")", "{", "if", "(", "throwable", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "throwable", "instanceof", "SQLException", ")", "{", "return", "...
Looks for SQLException in the cause chain. @return Found SQLException in the cause chain, or null if none found
[ "Looks", "for", "SQLException", "in", "the", "cause", "chain", "." ]
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/errorhandling/ExceptionHelper.java#L19-L31
102,199
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/domain/AuditListener.java
AuditListener.changeAuditInformation
@PreUpdate @PrePersist private void changeAuditInformation(Auditable auditableEntity) { Timestamp lastUpdated = new Timestamp(System.currentTimeMillis()); auditableEntity.setLastUpdated(lastUpdated); String lastUpdatedBy = ServiceContextStore.getCurrentUser(); auditableEnti...
java
@PreUpdate @PrePersist private void changeAuditInformation(Auditable auditableEntity) { Timestamp lastUpdated = new Timestamp(System.currentTimeMillis()); auditableEntity.setLastUpdated(lastUpdated); String lastUpdatedBy = ServiceContextStore.getCurrentUser(); auditableEnti...
[ "@", "PreUpdate", "@", "PrePersist", "private", "void", "changeAuditInformation", "(", "Auditable", "auditableEntity", ")", "{", "Timestamp", "lastUpdated", "=", "new", "Timestamp", "(", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "auditableEntity", "....
set audit informations, doesn't modify createdDate and createdBy once set. Only works with DomainObjects that implement the Auditable interface. In other cases a IllegalArgumentException is thrown. @param entity @return
[ "set", "audit", "informations", "doesn", "t", "modify", "createdDate", "and", "createdBy", "once", "set", ".", "Only", "works", "with", "DomainObjects", "that", "implement", "the", "Auditable", "interface", ".", "In", "other", "cases", "a", "IllegalArgumentExcepti...
38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/domain/AuditListener.java#L49-L60