code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public static void assertCauseMessage(final Throwable ex, final String expectedMessage) {
assertThat(ex.getCause()).isNotNull();
assertThat(ex.getCause().getMessage()).isEqualTo(expectedMessage);
} | java |
public static void assertCauseCauseMessage(final Throwable ex, final String expectedMessage) {
assertThat(ex.getCause()).isNotNull();
assertThat(ex.getCause().getCause()).isNotNull();
assertThat(ex.getCause().getCause().getMessage()).isEqualTo(expectedMessage);
} | java |
public static Set<ConstraintViolation<Object>> validate(final Object obj, final Class<?>... scopes) {
if (scopes == null) {
return validator().validate(obj, Default.class);
}
return validator().validate(obj, scopes);
} | java |
public static List<File> findFilesRecursive(final File dir, final String extension) {
final String dotExtension = "." + extension;
final List<File> files = new ArrayList<>();
final FileProcessor fileProcessor = new FileProcessor(new FileHandler() {
@Override
public final ... | java |
public static final Index indexAllClasses(final List<File> classFiles) {
final Indexer indexer = new Indexer();
indexAllClasses(indexer, classFiles);
return indexer.complete();
} | java |
public static final void indexAllClasses(final Indexer indexer, final List<File> classFiles) {
classFiles.forEach(file -> {
try {
final InputStream in = new FileInputStream(file);
try {
indexer.index(in);
} finally {
... | java |
public static ClassInfo classInfo(final ClassLoader cl, final Class<?> clasz) {
return classInfo(cl, clasz.getName());
} | java |
public static ClassInfo classInfo(final ClassLoader cl, final String className) {
final Index index = index(cl, className);
return index.getClassByName(DotName.createSimple(className));
} | java |
public static Index index(final ClassLoader cl, final String className) {
final Indexer indexer = new Indexer();
index(indexer, cl, className);
return indexer.complete();
} | java |
public static void index(final Indexer indexer, final ClassLoader cl, final String className) {
final InputStream stream = cl.getResourceAsStream(className.replace('.', '/') + ".class");
try {
indexer.index(stream);
} catch (final IOException ex) {
throw new RuntimeExcept... | java |
public static String replaceXmlAttr(final String xml, final KV... keyValues) {
final List<String> searchList = new ArrayList<String>();
final List<String> replacementList = new ArrayList<String>();
for (final KV kv : keyValues) {
final String tag = kv.getKey() + "=\"";
... | java |
public static boolean isExpectedType(final Class<?> expectedClass, final Object obj) {
final Class<?> actualClass;
if (obj == null) {
actualClass = null;
} else {
actualClass = obj.getClass();
}
return Objects.equals(expectedClass, actualClass);
} | java |
public static boolean isExpectedException(final Class<? extends Exception> expectedClass,
final String expectedMessage, final Exception ex) {
if (!isExpectedType(expectedClass, ex)) {
return false;
}
if ((expectedClass != null) && (expectedMessage != null) && (ex != null)... | java |
public final boolean isAlwaysAllowed(final String packageName) {
if (packageName.equals("java.lang")) {
return true;
}
return Utils.findAllowedByName(getAlwaysAllowed(), packageName) != null;
} | java |
public final void validate() throws InvalidDependenciesDefinitionException {
int errorCount = 0;
final StringBuilder sb = new StringBuilder("Duplicate package entries in 'allowed' and 'forbidden': ");
final List<Package<NotDependsOn>> list = getForbidden();
for (int i = 0; i < list... | java |
public final Package<DependsOn> findAllowedByName(final String packageName) {
final List<Package<DependsOn>> list = getAllowed();
for (final Package<DependsOn> pkg : list) {
if (pkg.getName().equals(packageName)) {
return pkg;
}
}
return nul... | java |
public final Package<NotDependsOn> findForbiddenByName(final String packageName) {
final List<Package<NotDependsOn>> list = getForbidden();
for (final Package<NotDependsOn> pkg : list) {
if (pkg.getName().equals(packageName)) {
return pkg;
}
}
... | java |
public static XStream createXStream() {
final Class<?>[] classes = new Class[] { Dependencies.class, Package.class, DependsOn.class, NotDependsOn.class, Dependency.class };
final XStream xstream = new XStream();
XStream.setupDefaultSecurity(xstream);
xstream.allowTypes(classes);
... | java |
public static Dependencies load(final File file) {
Utils4J.checkNotNull("file", file);
Utils4J.checkValidFile(file);
try {
final InputStream inputStream = new BufferedInputStream(new FileInputStream(file));
try {
return load(inputStream);
... | java |
public static Dependencies load(final InputStream inputStream) {
Utils4J.checkNotNull("inputStream", inputStream);
final XStream xstream = createXStream();
final Reader reader = new InputStreamReader(inputStream);
return (Dependencies) xstream.fromXML(reader);
} | java |
public static Dependencies load(final Class<?> clasz, final String resourcePathAndName) {
Utils4J.checkNotNull("clasz", clasz);
Utils4J.checkNotNull("resourcePathAndName", resourcePathAndName);
try {
final URL url = clasz.getResource(resourcePathAndName);
if (url =... | java |
public static void save(final File file, final Dependencies dependencies) {
Utils4J.checkNotNull("file", file);
Utils4J.checkValidFile(file);
final XStream xstream = createXStream();
try {
final Writer writer = new FileWriter(file);
try {
xs... | java |
public final void findCallingMethodsInJar(final File file) throws IOException {
try (final JarFile jarFile = new JarFile(file)) {
final Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
final JarEntry entry = entries.nextElem... | java |
public final void findCallingMethodsInDir(final File dir, final FileFilter filter) {
final FileProcessor fileProcessor = new FileProcessor(new FileHandler() {
@Override
public final FileHandlerResult handleFile(final File file) {
if (file.isDirectory()) {
... | java |
public final void addCall(final MCAMethod found, final int line) {
calls.add(new MCAMethodCall(found, className, methodName, methodDescr, source, line));
} | java |
private void createDefaultExtractOperation(){
this.currentStreamOperation = new DStreamOperation(this.operationIdCounter++);
this.currentStreamOperation.addStreamOperationFunction(Ops.extract.name(), s -> s);
} | java |
public static File toJar(File sourceDir, String jarName) {
if (!sourceDir.isAbsolute()) {
throw new IllegalArgumentException("Source must be expressed through absolute path");
}
Manifest manifest = new Manifest();
manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
File jarFile = new... | java |
private String installConfiguration(String configurationName, InputStream confFileInputStream){
String outputPath;
try {
File confDir = new File(System.getProperty("java.io.tmpdir") + "/dstream_" + UUID.randomUUID());
confDir.mkdirs();
File executionConfig = new File(confDir, configurationName);
executi... | java |
public static <T, U, E extends Exception> BiConsumer<T, U> sneaked(
SneakyBiConsumer<T, U, E> biConsumer) {
return (t, u) -> {
@SuppressWarnings("unchecked")
SneakyBiConsumer<T, U, RuntimeException> castedBiConsumer =
(SneakyBiConsumer<T, U, RuntimeException>) biConsumer;
castedBiC... | java |
public static <T, U, R, E extends Exception> BiFunction<T, U, R> sneaked(
SneakyBiFunction<T, U, R, E> biFunction) {
return (t, u) -> {
@SuppressWarnings("unchecked")
SneakyBiFunction<T, U, R, RuntimeException> castedBiFunction =
(SneakyBiFunction<T, U, R, RuntimeException>) biFunction;
... | java |
public static <T, E extends Exception> BinaryOperator<T> sneaked(
SneakyBinaryOperator<T, E> binaryOperator) {
return (t1, t2) -> {
@SuppressWarnings("unchecked")
SneakyBinaryOperator<T, RuntimeException> castedBinaryOperator =
(SneakyBinaryOperator<T, RuntimeException>) binaryOperator;
... | java |
public static <T, U, E extends Exception> BiPredicate<T, U> sneaked(
SneakyBiPredicate<T, U, E> biPredicate) {
return (t, u) -> {
@SuppressWarnings("unchecked")
SneakyBiPredicate<T, U, RuntimeException> castedBiPredicate =
(SneakyBiPredicate<T, U, RuntimeException>) biPredicate;
re... | java |
public static <T, E extends Exception> Consumer<T> sneaked(SneakyConsumer<T, E> consumer) {
return t -> {
@SuppressWarnings("unchecked")
SneakyConsumer<T, RuntimeException> casedConsumer =
(SneakyConsumer<T, RuntimeException>) consumer;
casedConsumer.accept(t);
};
} | java |
public static <T, R, E extends Exception> Function<T, R> sneaked(
SneakyFunction<T, R, E> function) {
return t -> {
@SuppressWarnings("unchecked")
SneakyFunction<T, R, RuntimeException> f1 = (SneakyFunction<T, R, RuntimeException>) function;
return f1.apply(t);
};
} | java |
public static <T, E extends Exception> Predicate<T> sneaked(SneakyPredicate<T, E> predicate) {
return t -> {
@SuppressWarnings("unchecked")
SneakyPredicate<T, RuntimeException> castedSneakyPredicate =
(SneakyPredicate<T, RuntimeException>) predicate;
return castedSneakyPredicate.test(t);... | java |
public static <E extends Exception> Runnable sneaked(SneakyRunnable<E> runnable) {
return () -> {
@SuppressWarnings("unchecked")
SneakyRunnable<RuntimeException> castedRunnable = (SneakyRunnable<RuntimeException>) runnable;
castedRunnable.run();
};
} | java |
public static <T, E extends Exception> Supplier<T> sneaked(SneakySupplier<T, E> supplier) {
return () -> {
@SuppressWarnings("unchecked")
SneakySupplier<T, RuntimeException> castedSupplier =
(SneakySupplier<T, RuntimeException>) supplier;
return castedSupplier.get();
};
} | java |
public static <T, E extends Exception> UnaryOperator<T> sneaked(
SneakyUnaryOperator<T, E> unaryOperator) {
return t -> {
@SuppressWarnings("unchecked")
SneakyUnaryOperator<T, RuntimeException> castedUnaryOperator =
(SneakyUnaryOperator<T, RuntimeException>) unaryOperator;
return c... | java |
public static String[] split(String input, char delimiter){
if(input == null) throw new NullPointerException("input cannot be null");
final int len = input.length();
// find the number of strings to split into
int nSplits = 1;
for (int i = 0; i < len; i++) {
... | java |
public static void split(String input, char delimiter, Consumer<String> callbackPerSubstring) {
if(input == null) throw new NullPointerException("input cannot be null");
final int len = input.length();
int lastMark = 0;
for (int i = 0; i < len; i++) {
if (in... | java |
public static String firstPartOfCamelCase(String camelcased) {
// by starting to count before the isUpperCase-check,
// we do not care if the strings starts with a lower- or uppercase
int end = 0;
while (++end < camelcased.length()) {
if (Character.isUpperCase(camelcased.char... | java |
public static String decapitalize(String word) {
return Character.toLowerCase(word.charAt(0)) + word.substring(1);
} | java |
private <I, D extends Descriptor> boolean satisfies(ScannerPlugin<I, D> selectedPlugin, D descriptor) {
return !(selectedPlugin.getClass().isAnnotationPresent(Requires.class) && descriptor == null);
} | java |
protected <I> boolean accepts(ScannerPlugin<I, ?> selectedPlugin, I item, String path, Scope scope) {
boolean accepted = false;
try {
accepted = selectedPlugin.accepts(item, path, scope);
} catch (IOException e) {
LOGGER.error("Plugin " + selectedPlugin + " failed to che... | java |
private <D extends Descriptor> void pushDesriptor(Class<D> type, D descriptor) {
if (descriptor != null) {
scannerContext.push(type, descriptor);
scannerContext.setCurrentDescriptor(descriptor);
}
} | java |
private <D extends Descriptor> void popDescriptor(Class<D> type, D descriptor) {
if (descriptor != null) {
scannerContext.setCurrentDescriptor(null);
scannerContext.pop(type);
}
} | java |
private List<ScannerPlugin<?, ?>> getScannerPluginsForType(final Class<?> type) {
List<ScannerPlugin<?, ?>> plugins = scannerPluginsPerType.get(type);
if (plugins == null) {
// The list of all scanner plugins which accept the given type
final List<ScannerPlugin<?, ?>> candidates ... | java |
private <T> List<? super T> bind(final ResultSet results, final Class<T> klass, final List<? super T> instances)
throws SQLException {
if (results == null) {
throw new NullPointerException("results is null");
}
if (klass == null) {
throw new NullPointerExcepti... | java |
public MetadataContext addSuppressionPaths(@NonNull final String suppressionPath,
@NonNull final String... otherPaths) {
addSuppressionPath(suppressionPath);
for (final String otherPath : otherPaths) {
addSuppressionPath(otherPath);
}
... | java |
public void stop() {
CompletableFuture.runAsync(() -> {
try {
bootstrap.getInjector().getInstance(Server.class).stop();
} catch (Exception ignore) {
// Ignore NPE. At this point the server REALLY should be possible to find
}
bootstr... | java |
public Jawn onStartup(Runnable callback) {
Objects.requireNonNull(callback);
bootstrapper.onStartup(callback);
return this;
} | java |
public Jawn onShutdown(Runnable callback) {
Objects.requireNonNull(callback);
bootstrapper.onShutdown(callback);
return this;
} | java |
@Override
public String asText() throws ParsableException {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream()))) {
return reader.lines().collect(Collectors.joining());
} catch (IOException e) {
throw new ParsableException("Reading ... | java |
@Override
public byte[] asBytes() throws IOException {
try (ServletInputStream stream = request.getInputStream()) {
ByteArrayOutputStream array = new ByteArrayOutputStream(stream.available());
return array.toByteArray();
}
} | java |
private void executeGroup(RuleSet ruleSet, Group group, Severity parentSeverity) throws RuleException {
if (!executedGroups.contains(group)) {
ruleVisitor.beforeGroup(group, getEffectiveSeverity(group, parentSeverity, parentSeverity));
for (Map.Entry<String, Severity> conceptEntry : grou... | java |
private Severity getEffectiveSeverity(SeverityRule rule, Severity parentSeverity, Severity requestedSeverity) {
Severity effectiveSeverity = requestedSeverity != null ? requestedSeverity : parentSeverity;
return effectiveSeverity != null ? effectiveSeverity : rule.getSeverity();
} | java |
private void validateConstraint(RuleSet ruleSet, Constraint constraint, Severity severity) throws RuleException {
if (!executedConstraints.contains(constraint)) {
if (applyRequiredConcepts(ruleSet, constraint)) {
ruleVisitor.visitConstraint(constraint, severity);
} else {... | java |
private boolean applyConcept(RuleSet ruleSet, Concept concept, Severity severity) throws RuleException {
Boolean result = executedConcepts.get(concept);
if (result == null) {
if (applyRequiredConcepts(ruleSet, concept)) {
result = ruleVisitor.visitConcept(concept, severity);
... | java |
private boolean isSuppressedRow(String ruleId, Map<String, Object> row, String primaryColumn) {
Object primaryValue = row.get(primaryColumn);
if (primaryValue != null && Suppress.class.isAssignableFrom(primaryValue.getClass())) {
Suppress suppress = (Suppress) primaryValue;
for (... | java |
protected <T extends ExecutableRule<?>> Status getStatus(T executableRule, List<String> columnNames, List<Map<String, Object>> rows,
AnalyzerContext context) throws RuleException {
return context.verify(executableRule, columnNames, rows);
} | java |
private static <T> T getAnnotationValue(Annotation annotation, String value, Class<T> expectedType) {
Class<? extends Annotation> annotationType = annotation.annotationType();
Method valueMethod;
try {
valueMethod = annotationType.getDeclaredMethod(value);
} catch (NoSuchMeth... | java |
private int verifyRuleResults(Collection<? extends Result<? extends ExecutableRule>> results, Severity warnOnSeverity, Severity failOnSeverity, String type,
String header, boolean logResult) {
int violations = 0;
for (Result<?> result : results) {
if (Result.Status.FAILURE.equals... | java |
private List<String> getResultRows(Result<?> result, boolean logResult) {
List<String> rows = new ArrayList<>();
if (logResult) {
for (Map<String, Object> columns : result.getRows()) {
StringBuilder row = new StringBuilder();
for (Map.Entry<String, Object> ent... | java |
private void logDescription(LoggingStrategy loggingStrategy, Rule rule) {
String description = rule.getDescription();
StringTokenizer tokenizer = new StringTokenizer(description, "\n");
while (tokenizer.hasMoreTokens()) {
loggingStrategy.log(tokenizer.nextToken().replaceAll("(\\r|\\n... | java |
public static String escapeRuleId(Rule rule) {
return rule != null ? rule.getId().replaceAll("\\:", "_") : null;
} | java |
public static String getLabel(Object value) {
if (value != null) {
if (value instanceof CompositeObject) {
CompositeObject descriptor = (CompositeObject) value;
String label = getLanguageLabel(descriptor);
return label != null ? label : descriptor.toSt... | java |
public final static Class<?> getCompiledClass(String className, boolean useCache) throws CompilationException, ClassLoadException {
try {
if (! useCache) {
/*String compilationResult = compileClass(className);
System.out.println("************ compilat... | java |
public final Result json(Object obj) {
final Result response = ok().contentType(MediaType.APPLICATION_JSON).renderable(obj);
holder.setControllerResult(response);
return response;
} | java |
public Result xml(Object obj) {
Result response = ok();
holder.setControllerResult(response);
response.contentType(MediaType.APPLICATION_XML).renderable(obj);
return response;
} | java |
private void extractRules(RuleSource ruleSource, Collection<?> blocks, RuleSetBuilder builder) throws RuleException {
for (Object element : blocks) {
if (element instanceof AbstractBlock) {
AbstractBlock block = (AbstractBlock) element;
if (EXECUTABLE_RULE_TYPES.conta... | java |
private Map<String, Boolean> getRequiresConcepts(RuleSource ruleSource, String id, Attributes attributes) throws RuleException {
Map<String, String> requiresDeclarations = getReferences(attributes, REQUIRES_CONCEPTS);
Map<String, Boolean> required = new HashMap<>();
for (Map.Entry<String, String... | java |
private Map<String, String> getReferences(Attributes attributes, String attributeName) {
String attribute = attributes.getString(attributeName);
Set<String> references = new HashSet<>();
if (attribute != null && !attribute.trim().isEmpty()) {
references.addAll(asList(attribute.split(... | java |
private Severity getSeverity(Attributes attributes, Severity defaultSeverity) throws RuleException {
String severity = attributes.getString(SEVERITY);
if (severity == null) {
return defaultSeverity;
}
Severity value = Severity.fromValue(severity.toLowerCase());
return... | java |
private String unescapeHtml(Object content) {
return content != null ? content.toString().replace("<", "<").replace(">", ">") : "";
} | java |
private Report getReport(AbstractBlock part) {
Object primaryReportColum = part.getAttributes().get(PRIMARY_REPORT_COLUM);
Object reportType = part.getAttributes().get(REPORT_TYPE);
Properties reportProperties = parseProperties(part, REPORT_PROPERTIES);
Report.ReportBuilder reportBuilder... | java |
private Properties parseProperties(AbstractBlock part, String attributeName) {
Properties properties = new Properties();
Object attribute = part.getAttributes().get(attributeName);
if (attribute == null) {
return properties;
}
Scanner propertiesScanner = new Scanner(a... | java |
public final static Class<?> getCompiledClass(String fullClassName, boolean useCache) throws Err.Compilation, Err.UnloadableClass {
try {
if (! useCache) {
DynamicClassLoader dynamicClassLoader = new DynamicClassLoader(fullClassName.substring(0, fullClassName.lastIndexOf('.')));
... | java |
public String getKeyOrDefault(String key) {
if (StringUtils.isBlank(key)) {
if (this.hasDefaultEnvironment()) {
return defaultEnvironment;
} else {
throw new MultiEnvSupportException("[environment] property is mandatory and can't be empty");
}
... | java |
@Override
public T get(Object key) {
String sKey = (String) key;
if (StringUtils.isBlank(sKey) && this.hasDefaultEnvironment()) {
sKey = defaultEnvironment;
} else if (StringUtils.isBlank(sKey)) {
throw new MultiEnvSupportException("[environment] property is mandatory... | java |
protected T resolve(String sKey, T value) {
LOG.error("Fail to find environment [{}] in {}", sKey, this.keySet());
throw new MultiEnvSupportException(String.format(
"Fail to find configuration for environment %s", sKey));
} | java |
public ImageHandlerBuilder resize(int width, int height) {
BufferedImage resize = Scalr.resize(image, Scalr.Mode.FIT_EXACT, width, height);
image.flush();
image = resize;
return this;
} | java |
public ImageHandlerBuilder resizeToHeight(int size) {
if (image.getHeight() < size) return this;
BufferedImage resize = Scalr.resize(image, Scalr.Mode.FIT_TO_HEIGHT, Math.min(size, image.getHeight()));
image.flush();
image = resize;
return this;
} | java |
public ImageHandlerBuilder resizeToWidth(int size) {
if (image.getWidth() < size) return this;
BufferedImage resize = Scalr.resize(image, Scalr.Mode.FIT_TO_WIDTH, size);
image.flush();
image = resize;
return this;
} | java |
public String save(String uploadFolder) throws ControllerException {
String realPath = info.getRealPath(uploadFolder);
fn.sanitise();
String imagename = uniqueImagename(realPath, fn.fullPath());
try {
ImageIO.write(image, fn.extension(), new File(realPath, imagename));... | java |
String uniqueImagename(String folder, String filename) {
String buildFileName = filename;//.replace(' ', '_');
while ( (new File(folder , buildFileName)).exists())
buildFileName = fn.increment();
return buildFileName;//output.getPath();
} | java |
private List<JqassistantRules> readXmlSource(RuleSource ruleSource) {
List<JqassistantRules> rules = new ArrayList<>();
try (InputStream inputStream = ruleSource.getInputStream()) {
JqassistantRules jqassistantRules = jaxbUnmarshaller.unmarshal(inputStream);
rules.add(jqassistant... | java |
private Report getReport(ReportType reportType) {
String type = null;
String primaryColumn = null;
Properties properties = new Properties();
if (reportType != null) {
type = reportType.getType();
primaryColumn = reportType.getPrimaryColumn();
for (Prop... | java |
private Verification getVerification(VerificationType verificationType) throws RuleException {
if (verificationType != null) {
RowCountVerificationType rowCountVerificationType = verificationType.getRowCount();
AggregationVerificationType aggregationVerificationType = verificationType.ge... | java |
private Severity getSeverity(SeverityEnumType severityType, Severity defaultSeverity) throws RuleException {
return severityType == null ? defaultSeverity : Severity.fromValue(severityType.value());
} | java |
public void printScopes(Map<String, Scope> scopes) {
logger.info("Scopes [" + scopes.size() + "]");
for (String scopeName : scopes.keySet()) {
logger.info("\t" + scopeName);
}
} | java |
private void shutdownGracefully(final Iterator<EventExecutorGroup> iterator) {
if (iterator.hasNext()) {
EventExecutorGroup group = iterator.next();
if (!group.isShuttingDown()) {
group.shutdownGracefully().addListener(future -> {
if (!future.isSuccess... | java |
public static void decode(final Map<String, String> map, final String data) {
//String[] keyValues = StringUtil.split(data, '&');
StringUtil.split(data, '&', keyValue -> {
final int indexOfSeperator = keyValue.indexOf('=');
if (indexOfSeperator > -1) {
... | java |
public static <T> T selectValue(T defaultValue, T... overrides) {
for (T override : overrides) {
if (override != null) {
return override;
}
}
return defaultValue;
} | java |
public static <T> void verifyDeprecatedOption(String deprecatedOption, T value, String option) {
if (value != null) {
LOGGER.warn("The option '" + deprecatedOption + "' is deprecated, use '" + option + "' instead.");
}
} | java |
<T> Deque<T> getValues(Class<T> key) {
Deque<T> values = (Deque<T>) contextValuesPerKey.get(key);
if (values == null) {
values = new LinkedList<>();
contextValuesPerKey.put(key, values);
}
return values;
} | java |
public void apply(UnaryOperator<String> function) {
this.filename = function.apply(this.filename);
if (path != null && !path.isEmpty())
this.path = function.apply(this.path);
} | java |
public String increment() {
// filename[count].jpg
int count = 0;
String newFilename,
altered = filename();
if (altered.charAt(altered.length()-1) == RIGHT) { //(last char == 'v') we assume that a suffix already has been applied
int rightBracket = ... | java |
public static <T> Supplier<T> memoizeLock(Supplier<T> delegate) {
AtomicReference<T> value = new AtomicReference<>();
return () -> {
// A 2-field variant of Double Checked Locking.
T val = value.get();
if (val == null) {
synchronized(value) {
... | java |
public static String getControllerForResult(Route route) {
if (route == null || route.getController() == null) return Constants.ROOT_CONTROLLER_NAME;
return RouterHelper.getReverseRouteFast(route.getController()).substring(1);
} | java |
private <T, U> T[] locateAll(final ClassLocator locator, final Class<T> clazz, final Consumer<T> bootstrapper) {
Set<Class<? extends T>> set = locator.subtypeOf(clazz);
if (!set.isEmpty()) {
@SuppressWarnings("unchecked")
T[] all = (T[]) Array.newInstance(clazz, se... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.