_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q159300 | StreamUtils.ofNullable | train | public static <T> Stream<T> ofNullable(Iterable<T> iterable) {
return null == iterable ? Stream.empty() : stream(iterable);
} | java | {
"resource": ""
} |
q159301 | StreamUtils.ofNullable | train | public static IntStream ofNullable(int[] nullable) {
return null == nullable ? IntStream.empty() : Arrays.stream(nullable);
} | java | {
"resource": ""
} |
q159302 | StreamUtils.ofNullable | train | public static LongStream ofNullable(long[] nullable) {
return null == nullable ? LongStream.empty() : Arrays.stream(nullable);
} | java | {
"resource": ""
} |
q159303 | StreamUtils.ofNullable | train | public static DoubleStream ofNullable(double[] nullable) {
return null == nullable ? DoubleStream.empty() : Arrays.stream(nullable);
} | java | {
"resource": ""
} |
q159304 | StreamUtils.ofNullable | train | public static <T> Stream<T> ofNullable(T[] nullable) {
return null == nullable ? Stream.empty() : Stream.of(nullable);
} | java | {
"resource": ""
} |
q159305 | StreamUtils.cycle | train | public static <T> Stream<T> cycle(T...items) {
return IntStream.iterate(0, i -> i == items.length - 1 ? 0 : i + 1).mapToObj(i -> items[i]);
} | java | {
"resource": ""
} |
q159306 | CompletableFutures.toFutureList | train | public static <T> Collector<CompletableFuture<T>, ?, CompletableFuture<List<T>>> toFutureList() {
return Collectors.collectingAndThen(
Collectors.<CompletableFuture<T>>toList(),
futures -> {
AtomicLong resultsRemaining = new AtomicLong(futures.size());
... | java | {
"resource": ""
} |
q159307 | JsonBasedPropertiesProvider.convertToMap | train | @SuppressWarnings("unchecked")
private Map<String, Object> convertToMap(Object jsonDocument) {
Map<String, Object> jsonMap = new LinkedHashMap<>();
// Document is a text block
if (!(jsonDocument instanceof JSONObject)) {
jsonMap.put("content", jsonDocument);
return jsonMap;
}
JSONObj... | java | {
"resource": ""
} |
q159308 | EnvironmentVariablesConfigurationSource.convertToPropertiesKey | train | private static String convertToPropertiesKey(String environmentVariableKey, String environmentContext) {
return environmentVariableKey.substring(environmentContext.length()).replace(ENV_DELIMITER, PROPERTIES_DELIMITER);
} | java | {
"resource": ""
} |
q159309 | FormatBasedPropertiesProvider.flatten | train | @SuppressWarnings("unchecked")
Map<String, Object> flatten(Map<String, Object> source) {
Map<String, Object> result = new LinkedHashMap<>();
for (String key : source.keySet()) {
Object value = source.get(key);
if (value instanceof Map) {
Map<String, Object> subMap = flatten((Map<String, ... | java | {
"resource": ""
} |
q159310 | YamlBasedPropertiesProvider.convertToMap | train | @SuppressWarnings("unchecked")
private Map<String, Object> convertToMap(Object yamlDocument) {
Map<String, Object> yamlMap = new LinkedHashMap<>();
// Document is a text block
if (!(yamlDocument instanceof Map)) {
yamlMap.put("content", yamlDocument);
return yamlMap;
}
for (Map.Entr... | java | {
"resource": ""
} |
q159311 | ClasspathConfigurationSource.getConfiguration | train | @Override
public Properties getConfiguration(Environment environment) {
Properties properties = new Properties();
Path pathPrefix = Paths.get(environment.getName());
URL url = getClass().getClassLoader().getResource(pathPrefix.toString());
if (url == null && !environment.getName().isEmpty()) {
... | java | {
"resource": ""
} |
q159312 | NatsConnectionReader.gatherOp | train | void gatherOp(int maxPos) throws IOException {
try {
while(this.bufferPosition < maxPos) {
byte b = this.buffer[this.bufferPosition];
this.bufferPosition++;
if (gotCR) {
if (b == NatsConnection.LF) { // Got CRLF, jump to par... | java | {
"resource": ""
} |
q159313 | NatsConnectionReader.gatherMessageProtocol | train | void gatherMessageProtocol(int maxPos) throws IOException {
try {
while(this.bufferPosition < maxPos) {
byte b = this.buffer[this.bufferPosition];
this.bufferPosition++;
if (gotCR) {
if (b == NatsConnection.LF) {
... | java | {
"resource": ""
} |
q159314 | NatsConnectionReader.gatherProtocol | train | void gatherProtocol(int maxPos) throws IOException {
// protocol buffer has max capacity, shouldn't need resizing
try {
while(this.bufferPosition < maxPos) {
byte b = this.buffer[this.bufferPosition];
this.bufferPosition++;
if (gotCR) {... | java | {
"resource": ""
} |
q159315 | NatsConnectionReader.gatherMessageData | train | void gatherMessageData(int maxPos) throws IOException {
try {
while(this.bufferPosition < maxPos) {
int possible = maxPos - this.bufferPosition;
int want = msgData.length - msgDataPosition;
// Grab all we can, until we get to the CR/LF
... | java | {
"resource": ""
} |
q159316 | NatsConnectionWriter.stop | train | Future<Boolean> stop() {
this.startStopLock.lock();
try {
this.running.set(false);
this.outgoing.pause();
this.reconnectOutgoing.pause();
// Clear old ping/pong requests
byte[] pingRequest = NatsConnection.OP_PING.getBytes(Standard... | java | {
"resource": ""
} |
q159317 | MessageQueue.accumulate | train | NatsMessage accumulate(long maxSize, long maxMessages, Duration timeout)
throws InterruptedException {
if (!this.singleThreadedReader) {
throw new IllegalStateException("Accumulate is only supported in single reader mode.");
}
if (!this.isRunning()) {
... | java | {
"resource": ""
} |
q159318 | Benchmark.close | train | public final void close() {
while (subChannel.size() > 0) {
subs.addSample(subChannel.poll());
}
while (pubChannel.size() > 0) {
pubs.addSample(pubChannel.poll());
}
if (subs.hasSamples()) {
start = subs.getStart();
end = subs.getE... | java | {
"resource": ""
} |
q159319 | Benchmark.report | train | public final String report() {
StringBuilder sb = new StringBuilder();
sb.append(String.format("%s stats: %s\n", name, this));
if (pubs.hasSamples()) {
String indent = " ";
if (subs.hasSamples()) {
sb.append(String.format("%sPub stats: %s\n", ind... | java | {
"resource": ""
} |
q159320 | Benchmark.csv | train | public final String csv() {
StringBuilder sb = new StringBuilder();
String header =
"#RunID, ClientID, MsgCount, MsgBytes, MsgsPerSec, BytesPerSec, DurationSecs";
sb.append(String.format("%s stats: %s\n", name, this));
sb.append(header); sb.append("\n");
sb.appen... | java | {
"resource": ""
} |
q159321 | NKey.createAccount | train | public static NKey createAccount(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.ACCOUNT, random);
} | java | {
"resource": ""
} |
q159322 | NKey.createCluster | train | public static NKey createCluster(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.CLUSTER, random);
} | java | {
"resource": ""
} |
q159323 | NKey.createOperator | train | public static NKey createOperator(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.OPERATOR, random);
} | java | {
"resource": ""
} |
q159324 | NKey.createServer | train | public static NKey createServer(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.SERVER, random);
} | java | {
"resource": ""
} |
q159325 | NKey.createUser | train | public static NKey createUser(SecureRandom random)
throws IOException, NoSuchProviderException, NoSuchAlgorithmException {
return createPair(Type.USER, random);
} | java | {
"resource": ""
} |
q159326 | NKey.fromPublicKey | train | public static NKey fromPublicKey(char[] publicKey) {
byte[] raw = decode(publicKey);
int prefix = raw[0] & 0xFF;
if (!checkValidPublicPrefixByte(prefix)) {
throw new IllegalArgumentException("Not a valid public NKey");
}
Type type = NKey.Type.fromPrefix(prefix);
... | java | {
"resource": ""
} |
q159327 | NKey.fromSeed | train | public static NKey fromSeed(char[] seed) {
DecodedSeed decoded = decodeSeed(seed); // Should throw on bad seed
if (decoded.bytes.length == ED25519_PRIVATE_KEYSIZE) {
return new NKey(Type.fromPrefix(decoded.prefix), null, seed);
} else {
try {
return creat... | java | {
"resource": ""
} |
q159328 | NKey.clear | train | public void clear() {
Random r = new Random();
if (privateKeyAsSeed != null) {
for (int i=0; i< privateKeyAsSeed.length ; i++) {
privateKeyAsSeed[i] = (char)(r.nextInt(26) + 'a');
}
Arrays.fill(privateKeyAsSeed, '\0');
}
if (publicKey !... | java | {
"resource": ""
} |
q159329 | NKey.sign | train | public byte[] sign(byte[] input) throws GeneralSecurityException, IOException {
Signature sgr = new EdDSAEngine(MessageDigest.getInstance(NKey.ed25519.getHashAlgorithm()));
PrivateKey sKey = getKeyPair().getPrivate();
sgr.initSign(sKey);
sgr.update(input);
return sgr.sign();
... | java | {
"resource": ""
} |
q159330 | NKey.verify | train | public boolean verify(byte[] input, byte[] signature) throws GeneralSecurityException, IOException {
Signature sgr = new EdDSAEngine(MessageDigest.getInstance(NKey.ed25519.getHashAlgorithm()));
PublicKey sKey = null;
if (privateKeyAsSeed != null) {
sKey = getKeyPair().getPublic();
... | java | {
"resource": ""
} |
q159331 | NatsServerInfo.unescapeString | train | String unescapeString(String st) {
StringBuilder sb = new StringBuilder(st.length());
for (int i = 0; i < st.length(); i++) {
char ch = st.charAt(i);
if (ch == '\\') {
char nextChar = (i == st.length() - 1) ? '\\' : st.charAt(i + 1);
swit... | java | {
"resource": ""
} |
q159332 | SampleGroup.addSample | train | public void addSample(Sample stat) {
samples.add(stat);
if (samples.size() == 1) {
start = stat.start;
end = stat.end;
}
this.ioBytes += stat.ioBytes;
this.jobMsgCnt += stat.jobMsgCnt;
this.msgCnt += stat.msgCnt;
this.msgBytes += stat.msgBy... | java | {
"resource": ""
} |
q159333 | SampleGroup.minRate | train | public long minRate() {
long min = (samples.isEmpty() ? 0L : samples.get(0).rate());
for (Sample s : samples) {
min = Math.min(min, s.rate());
}
return min;
} | java | {
"resource": ""
} |
q159334 | SampleGroup.maxRate | train | public long maxRate() {
long max = (samples.isEmpty() ? 0L : samples.get(0).rate());
for (Sample s : samples) {
max = Math.max(max, s.rate());
}
return max;
} | java | {
"resource": ""
} |
q159335 | SampleGroup.avgRate | train | public long avgRate() {
long sum = 0L;
for (Sample s : samples) {
sum += s.rate();
}
return sum / (long) samples.size();
} | java | {
"resource": ""
} |
q159336 | SampleGroup.stdDev | train | public double stdDev() {
double avg = avgRate();
double sum = 0.0;
for (Sample s : samples) {
sum += Math.pow((double) s.rate() - avg, 2);
}
double variance = sum / (double) samples.size();
return Math.sqrt(variance);
} | java | {
"resource": ""
} |
q159337 | SampleGroup.statistics | train | public String statistics() {
DecimalFormat formatter = new DecimalFormat("#,###");
DecimalFormat floatFormatter = new DecimalFormat("#,###.00");
return String.format("min %s | avg %s | max %s | stddev %s msgs",
formatter.format(minRate()), formatter.format(avgRate()),
... | java | {
"resource": ""
} |
q159338 | NatsConnection.connect | train | void connect(boolean reconnectOnConnect) throws InterruptedException, IOException {
if (options.getServers().size() == 0) {
throw new IllegalArgumentException("No servers provided in options");
}
for (String serverURI : getServers()) {
if (isClosed()) {
... | java | {
"resource": ""
} |
q159339 | NatsConnection.reconnect | train | void reconnect() throws InterruptedException {
long maxTries = options.getMaxReconnect();
long tries = 0;
String lastServer = null;
if (isClosed()) {
return;
}
if (maxTries == 0) {
this.close();
return;
}
... | java | {
"resource": ""
} |
q159340 | NatsConnection.closeSocket | train | void closeSocket(boolean tryReconnectIfConnected) throws InterruptedException {
boolean wasConnected = false;
statusLock.lock();
try {
if (isDisconnectingOrClosed()) {
waitForDisconnectOrClose(this.options.getConnectionTimeout());
return;
... | java | {
"resource": ""
} |
q159341 | NatsConnection.closeSocketImpl | train | void closeSocketImpl() {
this.currentServerURI = null;
// Signal the reader and writer
this.reader.stop();
this.writer.stop();
// Close the current socket and cancel anyone waiting for it
this.dataPortFuture.cancel(true);
try {
if (this.d... | java | {
"resource": ""
} |
q159342 | NUID.next | train | public final synchronized String next() {
// Increment and capture.
seq += inc;
if (seq >= maxSeq) {
randomizePrefix();
resetSequential();
}
// Copy prefix
char[] b = new char[totalLen];
System.arraycopy(pre, 0, b, 0, preLen);
// ... | java | {
"resource": ""
} |
q159343 | NUID.resetSequential | train | void resetSequential() {
seq = nextLong(prand, maxSeq);
inc = minInc + nextLong(prand, maxInc - minInc);
} | java | {
"resource": ""
} |
q159344 | NatsSubscription.unsubscribe | train | public void unsubscribe() {
if (this.dispatcher != null) {
throw new IllegalStateException(
"Subscriptions that belong to a dispatcher cannot respond to unsubscribe directly.");
} else if (this.incoming == null) {
throw new IllegalStateException("This subscrip... | java | {
"resource": ""
} |
q159345 | NatsSubscription.unsubscribe | train | public Subscription unsubscribe(int after) {
if (this.dispatcher != null) {
throw new IllegalStateException(
"Subscriptions that belong to a dispatcher cannot respond to unsubscribe directly.");
} else if (this.incoming == null) {
throw new IllegalStateExcepti... | java | {
"resource": ""
} |
q159346 | Nats.connectAsynchronously | train | public static void connectAsynchronously(Options options, boolean reconnectOnConnect)
throws InterruptedException {
if (options.getConnectionListener() == null) {
throw new IllegalArgumentException("Connection Listener required in connectAsynchronously");
}
Thread t = n... | java | {
"resource": ""
} |
q159347 | Nats.credentials | train | public static AuthHandler credentials(String jwtFile, String nkeyFile) {
return NatsImpl.credentials(jwtFile, nkeyFile);
} | java | {
"resource": ""
} |
q159348 | FileAuthHandler.sign | train | public byte[] sign(byte[] nonce) {
try {
char[] keyChars = this.readKeyChars();
NKey nkey = NKey.fromSeed(keyChars);
byte[] sig = nkey.sign(nonce);
nkey.clear();
return sig;
} catch (Exception exp) {
throw new IllegalStateException... | java | {
"resource": ""
} |
q159349 | FileAuthHandler.getID | train | public char[] getID() {
try {
char[] keyChars = this.readKeyChars();
NKey nkey = NKey.fromSeed(keyChars);
char[] pubKey = nkey.getPublicKey();
nkey.clear();
return pubKey;
} catch (Exception exp) {
throw new IllegalStateException("... | java | {
"resource": ""
} |
q159350 | AdminFilter.skipResource | train | private boolean skipResource(HttpServletRequest request, HttpServletResponse response) {
String path = request.getServletPath();
if (path.contains(".")) {
path = path.substring(0, path.lastIndexOf("."));
}
boolean skip = path.startsWith(FACES_RESOURCES) || shouldIgnoreResourc... | java | {
"resource": ""
} |
q159351 | AdminFilter.isValidRecoveryUrl | train | private boolean isValidRecoveryUrl(StringBuilder recoveryUrl) {
String pageSuffix = adminConfig.getPageSufix();
return !recoveryUrl.toString().contains(Constants.DEFAULT_INDEX_PAGE.replace("xhtml", pageSuffix)) && !recoveryUrl.toString().contains(Constants.DEFAULT_ACCESS_DENIED_PAGE.replace("xhtml", adm... | java | {
"resource": ""
} |
q159352 | AdminConfig.getProperty | train | private String getProperty(String property) {
return has(System.getProperty(property)) ? System.getProperty(property)
: has(userConfigFile.getProperty(property)) ? userConfigFile.getProperty(property)
: adminConfigFile.getProperty(property);
} | java | {
"resource": ""
} |
q159353 | AdminConfig.getPageSufix | train | public String getPageSufix() {
if(has(pageSuffix)) {
return pageSuffix;
}
if(!has(indexPage) && !has(loginPage)) {
pageSuffix = Constants.DEFAULT_PAGE_FORMAT;
}
if(has(indexPage)) {
pageSuffix = indexPage.substring(indexPage.lastIndexOf('.')+1)... | java | {
"resource": ""
} |
q159354 | CustomExceptionHandler.findErrorPage | train | private String findErrorPage(Throwable exception) {
if (exception instanceof EJBException && exception.getCause() != null) {
exception = exception.getCause();
}
String errorPage = WebXml.INSTANCE.findErrorPageLocation(exception);
return errorPage;
} | java | {
"resource": ""
} |
q159355 | CustomExceptionHandler.validationFailed | train | private void validationFailed(FacesContext context) {
Map<Object, Object> callbackParams = (Map<Object, Object>) context.getAttributes().get("CALLBACK_PARAMS");
if(callbackParams == null) {
callbackParams = new HashMap<>();
callbackParams.put("CALLBACK_PARAMS",callbackParams);
... | java | {
"resource": ""
} |
q159356 | CustomExceptionHandler.findErrorMessages | train | private void findErrorMessages(FacesContext context) {
if (context.getMessageList().isEmpty() || context.isValidationFailed()) {
return;
}
for (FacesMessage msg : context.getMessageList()) {
if (msg.getSeverity().equals(FacesMessage.SEVERITY_ERROR) || msg.getSeverity().eq... | java | {
"resource": ""
} |
q159357 | ParameterBuilder.matching | train | public ParameterBuilder matching(String regex) {
Validate.notNull(regex, "regex is required");
this.pattern = Pattern.compile(regex);
return this;
} | java | {
"resource": ""
} |
q159358 | FeatureState.copy | train | public FeatureState copy() {
FeatureState copy = new FeatureState(feature);
copy.setEnabled(this.enabled);
copy.setStrategyId(this.strategyId);
for (Entry<String, String> entry : this.parameters.entrySet()) {
copy.setParameter(entry.getKey(), entry.getValue());
}
... | java | {
"resource": ""
} |
q159359 | FeatureState.getUsers | train | @Deprecated
public List<String> getUsers() {
String value = getParameter(UsernameActivationStrategy.PARAM_USERS);
if (Strings.isNotBlank(value)) {
return Strings.splitAndTrim(value, ",");
}
return Collections.emptyList();
} | java | {
"resource": ""
} |
q159360 | FeatureState.addUsers | train | @Deprecated
public FeatureState addUsers(Collection<String> users) {
Set<String> set = new LinkedHashSet<>();
set.addAll(this.getUsers());
set.addAll(users);
String setAsString = Strings.trimToNull(Strings.join(set, ","));
setParameter(UsernameActivationStrategy.PARAM_USERS, ... | java | {
"resource": ""
} |
q159361 | FeatureState.setParameter | train | public FeatureState setParameter(String name, String value) {
if (value != null) {
this.parameters.put(name, value);
}
else {
this.parameters.remove(name);
}
return this;
} | java | {
"resource": ""
} |
q159362 | HttpServletRequestHolder.bind | train | public static void bind(HttpServletRequest request) {
if (request != null && threadLocal.get() != null) {
throw new IllegalStateException("HttpServletRequestHolder.bind() called for a "
+ "thread that already has a request associated with it. It's likely that the request "
... | java | {
"resource": ""
} |
q159363 | TogglzOverheadBenchmark.toggleEnabledState | train | @Setup(Level.Iteration)
public void toggleEnabledState() {
enabled = !enabled;
manager.setFeatureState(new FeatureState(OverheadFeature.FEATURE, enabled));
} | java | {
"resource": ""
} |
q159364 | TogglzProperties.getFeatureProperties | train | public Properties getFeatureProperties() {
Properties properties = new Properties();
for (String name : features.keySet()) {
properties.setProperty(name, features.get(name).spec());
}
return properties;
} | java | {
"resource": ""
} |
q159365 | Services.get | train | public static <E> Collection<E> get(Class<? extends E> service) {
Iterator<? extends E> implementations = ServiceLoader.load(service).iterator();
Collection<E> result = new ArrayList<E>();
while (implementations.hasNext()) {
result.add(implementations.next());
}
ret... | java | {
"resource": ""
} |
q159366 | SchemaUpdater.execute | train | private void execute(String sql) throws SQLException {
Statement statement = connection.createStatement();
try {
statement.executeUpdate(substitute(sql));
} finally {
DbUtils.closeQuietly(statement);
}
} | java | {
"resource": ""
} |
q159367 | FeatureManagerObjectFactory.createInstance | train | protected Object createInstance(String classname) {
// get the classloader to use
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if (classLoader == null) {
classLoader = this.getClass().getClassLoader();
}
// create an instance of the clas... | java | {
"resource": ""
} |
q159368 | XTokenQueue.consumeToAny | train | public String consumeToAny(String... seq) {
int start = pos;
while (!isEmpty() && !matchesAny(seq)) {
pos++;
}
String data = queue.substring(start, pos);
return data;
} | java | {
"resource": ""
} |
q159369 | XTokenQueue.unescape | train | public static String unescape(String in) {
StringBuilder out = new StringBuilder();
char last = 0;
for (char c : in.toCharArray()) {
if (c == ESC) {
if (last != 0 && last == ESC)
out.append(c);
} else
out.append(c);
... | java | {
"resource": ""
} |
q159370 | FastDatePrinter.applyRules | train | @Deprecated
protected StringBuffer applyRules(final Calendar calendar, final StringBuffer buf) {
return (StringBuffer) applyRules(calendar, (Appendable) buf);
} | java | {
"resource": ""
} |
q159371 | Headers.of | train | public static Headers of(String... namesAndValues) {
if (namesAndValues == null) throw new NullPointerException("namesAndValues == null");
if (namesAndValues.length % 2 != 0) {
throw new IllegalArgumentException("Expected alternating header names and values");
}
// Make a de... | java | {
"resource": ""
} |
q159372 | Headers.getDate | train | public Date getDate(String name) {
String value = get(name);
return value != null ? HttpDate.parse(value) : null;
} | java | {
"resource": ""
} |
q159373 | Headers.names | train | public Set<String> names() {
TreeSet<String> result = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
for (int i = 0, size = size(); i < size; i++) {
result.add(name(i));
}
return Collections.unmodifiableSet(result);
} | java | {
"resource": ""
} |
q159374 | MultipartBody.appendQuotedString | train | static StringBuilder appendQuotedString(StringBuilder target, String key) {
target.append('"');
for (int i = 0, len = key.length(); i < len; i++) {
char ch = key.charAt(i);
switch (ch) {
case '\n':
target.append("%0A");
brea... | java | {
"resource": ""
} |
q159375 | SplashScreen.getParent | train | public Parent getParent() {
final ImageView imageView = new ImageView(getClass().getResource(getImagePath()).toExternalForm());
final ProgressBar splashProgressBar = new ProgressBar();
splashProgressBar.setPrefWidth(imageView.getImage().getWidth());
final VBox vbox = new VBox();
vbox.getChildren().addAll(ima... | java | {
"resource": ""
} |
q159376 | AbstractFxmlView.getURLResource | train | private URL getURLResource(final FXMLView annotation) {
if (annotation != null && !annotation.value().equals("")) {
return getClass().getResource(annotation.value());
} else {
return getClass().getResource(getFxmlPath());
}
} | java | {
"resource": ""
} |
q159377 | AbstractFxmlView.loadSynchronously | train | private FXMLLoader loadSynchronously(final URL resource, final Optional<ResourceBundle> bundle) throws IllegalStateException {
final FXMLLoader loader = new FXMLLoader(resource, bundle.orElse(null));
loader.setControllerFactory(this::createControllerForType);
try {
loader.load();
} catch (final IOException... | java | {
"resource": ""
} |
q159378 | AbstractFxmlView.ensureFxmlLoaderInitialized | train | private void ensureFxmlLoaderInitialized() {
if (fxmlLoader != null) {
return;
}
fxmlLoader = loadSynchronously(resource, bundle);
presenterProperty.set(fxmlLoader.getController());
} | java | {
"resource": ""
} |
q159379 | AbstractFxmlView.getView | train | public void getView(final Consumer<Parent> consumer) {
CompletableFuture.supplyAsync(this::getView, Platform::runLater).thenAccept(consumer);
} | java | {
"resource": ""
} |
q159380 | AbstractFxmlView.addCSSIfAvailable | train | void addCSSIfAvailable(final Parent parent) {
// Read global css when available:
final List<String> list = PropertyReaderHelper.get(applicationContext.getEnvironment(), "javafx.css");
if (!list.isEmpty()) {
list.forEach(css -> parent.getStylesheets().add(getClass().getResource(css).toExternalForm()));
}
... | java | {
"resource": ""
} |
q159381 | AbstractFxmlView.addCSSFromAnnotation | train | private void addCSSFromAnnotation(final Parent parent) {
if (annotation != null && annotation.css().length > 0) {
for (final String cssFile : annotation.css()) {
final URL uri = getClass().getResource(cssFile);
if (uri != null) {
final String uriToCss = uri.toExternalForm();
parent.getStylesheets... | java | {
"resource": ""
} |
q159382 | AbstractFxmlView.getBundleName | train | private String getBundleName() {
if (StringUtils.isEmpty(annotation.bundle())) {
final String lbundle = getClass().getPackage().getName() + "." + getConventionalName();
LOGGER.debug("Bundle: {} based on conventional name.", lbundle);
return lbundle;
}
final String lbundle = annotation.bundle();
LOGGER... | java | {
"resource": ""
} |
q159383 | AbstractFxmlView.stripEnding | train | private static String stripEnding(final String clazz) {
if (!clazz.endsWith("view")) {
return clazz;
}
return clazz.substring(0, clazz.lastIndexOf("view"));
} | java | {
"resource": ""
} |
q159384 | AbstractFxmlView.getFxmlPath | train | final String getFxmlPath() {
final String fxmlPath = fxmlRoot + getConventionalName(".fxml");
LOGGER.debug("Determined fxmlPath: " + fxmlPath);
return fxmlPath;
} | java | {
"resource": ""
} |
q159385 | AbstractFxmlView.getResourceBundle | train | private Optional<ResourceBundle> getResourceBundle(final String name) {
try {
LOGGER.debug("Resource bundle: " + name);
return Optional.of(getBundle(name,
new ResourceBundleControl(getResourceBundleCharset())));
} catch (final MissingResourceException ex) {
LOGGER.debug("No resource bundle could be det... | java | {
"resource": ""
} |
q159386 | InterceptorExecutor.execute | train | public Observable<Void> execute(final I request, final O response, C keyEvaluationContext) {
final ExecutionContext context = new ExecutionContext(request, keyEvaluationContext);
InboundInterceptor<I, O> nextIn = context.nextIn(request);
Observable<Void> startingPoint;
if (null != nextI... | java | {
"resource": ""
} |
q159387 | SimpleUriRouter.addUri | train | public SimpleUriRouter<I, O> addUri(String uri, RequestHandler<I, O> handler) {
routes.add(new Route(new ServletStyleUriConstraintKey<I>(uri, ""), handler));
return this;
} | java | {
"resource": ""
} |
q159388 | SimpleUriRouter.addUriRegex | train | public SimpleUriRouter<I, O> addUriRegex(String uriRegEx, RequestHandler<I, O> handler) {
routes.add(new Route(new RegexUriConstraintKey<I>(uriRegEx), handler));
return this;
} | java | {
"resource": ""
} |
q159389 | JmxService.getDomainTree | train | public DynaTreeNode getDomainTree(String domainName) {
DynaTreeNode domainNode = new DynaTreeNode()
.setTitle(domainName)
.setKey(domainName)
.setMode(MODE_DOMAIN);
try {
// List all objects in the domain
ObjectName name = new Objec... | java | {
"resource": ""
} |
q159390 | JmxService.getKeysFromRegex | train | public List<String> getKeysFromRegex(String regex) {
List<String> keys = Lists.newArrayList();
try {
// List all objects in the domain
ObjectName name = new ObjectName(regex);
Set<ObjectName> objs = mBeanServer.queryNames(name, null);
... | java | {
"resource": ""
} |
q159391 | JmxService.getMBeanAttributesByRegex | train | public Map<String, Map<String, String>> getMBeanAttributesByRegex(String regex) throws Exception {
Map<String, Map<String, String>> result = Maps.newLinkedHashMap();
ObjectName name = new ObjectName(regex);
Set<ObjectName> objs = mBeanServer.queryNames(name, null);
// Convert ob... | java | {
"resource": ""
} |
q159392 | JmxService.getMBeanAttributes | train | public Map<String, String> getMBeanAttributes(String key) throws Exception {
return getMBeanAttributes(new ObjectName(key));
} | java | {
"resource": ""
} |
q159393 | JmxService.getMBeanAttributes | train | private Map<String, String> getMBeanAttributes(ObjectName objName) throws Exception {
Map<String, String> response = Maps.newLinkedHashMap();
// Look for the object
MBeanInfo mBeanInfo = mBeanServer.getMBeanInfo(objName);
if (mBeanInfo != null) {
// Does it have... | java | {
"resource": ""
} |
q159394 | JmxService.getMBeanOperations | train | public MBeanOperationInfo[] getMBeanOperations(String name) throws Exception {
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
MBeanInfo mBeanInfo = mBeanServer.getMBeanInfo(new ObjectName(name));
return mBeanInfo.getOperations();
} | java | {
"resource": ""
} |
q159395 | KaryonAbstractInjectorGrapher.getBindings | train | private Iterable<Binding<?>> getBindings(Injector injector, Set<Key<?>> root) {
Set<Key<?>> keys = Sets.newHashSet(root);
Set<Key<?>> visitedKeys = Sets.newHashSet();
List<Binding<?>> bindings = Lists.newArrayList();
TransitiveDependencyVisitor keyVisitor = new TransitiveDependencyVisito... | java | {
"resource": ""
} |
q159396 | JMXResource.getMBeans | train | @GET
public Response getMBeans(
@QueryParam("key") @DefaultValue("root") String key,
@QueryParam("mode") @DefaultValue("") String mode,
@QueryParam("jsonp") @DefaultValue("") String jsonp)
throws Exception {
LOG.info("key" + key);
DynaTreeNode root = ... | java | {
"resource": ""
} |
q159397 | JMXResource.getMBean | train | @GET
@Path("{key}")
public Response getMBean(@PathParam("key") String key,
@QueryParam("jsonp") @DefaultValue("") String jsonp)
throws Exception {
LOG.info("key: " + key);
JSONObject json = new JSONObject();
ObjectName name = new ObjectName(key)... | java | {
"resource": ""
} |
q159398 | JMXResource.invokeMbeanOperation | train | @POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Path("{key}/{op}")
public Response invokeMbeanOperation(
MultivaluedMap<String, String> formParams,
@PathParam("key") String key, @QueryParam("jsonp") String jsonp,
@PathParam("op") String name) throws Exception {
... | java | {
"resource": ""
} |
q159399 | JMXResource.emitAttributes | train | private JSONObject emitAttributes(ObjectName objName) throws Exception {
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
MBeanInfo mBeanInfo = mBeanServer.getMBeanInfo(objName);
JSONObject resp = new JSONObject();
if (mBeanInfo != null) {
MBeanAttributeI... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.