Dataset Viewer
Auto-converted to Parquet Duplicate
code
stringlengths
146
466k
prompt
stringlengths
54
1.5k
Of course, here is the Java code you requested: ```java protected final void bindIndexed(ConfigurationPropertyName name, Bindable<?> target, AggregateElementBinder elementBinder, ResolvableType aggregateType, ResolvableType elementType, IndexedCollectionSupplier result) { for (ConfigurationPropertySource sourc...
Create a Java method that does the following: "Binds the indexed elements of the configuration property.".
Of course, here is the Java code you requested: ```java public void setServletRegistrationBeans( Collection<? extends ServletRegistrationBean<?>> servletRegistrationBeans) { Assert.notNull(servletRegistrationBeans, "ServletRegistrationBeans must not be null"); this.servletRegistrationBeans = new LinkedHashS...
Create a Java method that does the following: "Sets the servlet registration beans.".
Of course, here is the Java code you requested: ```java public void setUrlPatterns(Collection<String> urlPatterns) { Assert.notNull(urlPatterns, "UrlPatterns must not be null"); this.urlPatterns = new LinkedHashSet<>(urlPatterns); } ``` Hope this helps!
Create a Java method that does the following: "Sets the URL patterns to be used in the URL.".
Of course, here is the Java code you requested: ```java public void setDispatcherTypes(DispatcherType first, DispatcherType... rest) { this.dispatcherTypes = EnumSet.of(first, rest); } ``` Hope this helps!
Create a Java method that does the following: "Sets the dispatcher types.".
Of course, here is the Java code you requested: ```java public DependencyCustomizer ifAnyMissingClasses(String... classNames) { return new DependencyCustomizer(this) { @Override protected boolean canAdd() { for (String className : classNames) { try { DependencyCustomizer.this.loader.loadClass(cl...
Create a Java method that does the following: "Creates a dependency customizer that will add classes that are missing from the classpath.".
Of course, here is the Java code you requested: ```java public DependencyCustomizer ifAllMissingClasses(String... classNames) { return new DependencyCustomizer(this) { @Override protected boolean canAdd() { for (String className : classNames) { try { DependencyCustomizer.this.loader.loadClass(cl...
Create a Java method that does the following: "If all missing classes are found in the classpath return a DependencyCustomizer that will add the class to the classpath.".
Of course, here is the Java code you requested: ```java public DependencyCustomizer ifAllResourcesPresent(String... paths) { return new DependencyCustomizer(this) { @Override protected boolean canAdd() { for (String path : paths) { try { if (DependencyCustomizer.this.loader.getResource(path) == ...
Create a Java method that does the following: "If all resources present in the paths are present in the classpath return a DependencyCustomizer that will add the dependency to the classpath.".
Of course, here is the Java code you requested: ```java public DependencyCustomizer add(String... modules) { for (String module : modules) { add(module, null, null, true); } return this; } ``` Hope this helps!
Create a Java method that does the following: "Add a list of modules to the customizer.".
Of course, here is the Java code you requested: ```java public DependencyCustomizer add(String module, boolean transitive) { return add(module, null, null, transitive); } ``` Hope this helps!
Create a Java method that does the following: "Add a module to the list of dependencies.".
Of course, here is the Java code you requested: ```java public DependencyCustomizer add(String module, String classifier, String type, boolean transitive) { if (canAdd()) { ArtifactCoordinatesResolver artifactCoordinatesResolver = this.dependencyResolutionContext .getArtifactCoordinatesResolver(); this...
Create a Java method that does the following: "Add a new annotation to the class node.".
Of course, here is the Java code you requested: ```java public ReactiveHealthIndicatorRegistry createReactiveHealthIndicatorRegistry( Map<String, ReactiveHealthIndicator> reactiveHealthIndicators, Map<String, HealthIndicator> healthIndicators) { Assert.notNull(reactiveHealthIndicators, "ReactiveHealthIndic...
Create a Java method that does the following: "Creates a ReactiveHealthIndicatorRegistry with the given health indicators.".
Of course, here is the Java code you requested: ```java public RandomAccessData parse(RandomAccessData data, boolean skipPrefixBytes) throws IOException { CentralDirectoryEndRecord endRecord = new CentralDirectoryEndRecord(data); if (skipPrefixBytes) { data = getArchiveData(endRecord, data); } RandomAcce...
Create a Java method that does the following: "Parse the data.".
Of course, here is the Java code you requested: ```java protected final <V> V get(Function<T, V> getter, Supplier<V> fallback) { V value = getter.apply(this.properties); return (value != null) ? value : fallback.get(); } ``` Hope this helps!
Create a Java method that does the following: "Get the value of the property using the given getter.".
Of course, here is the Java code you requested: ```java public File getDir() { if (this.dir == null) { synchronized (this) { byte[] hash = generateHash(this.sourceClass); this.dir = new File(getTempDirectory(), toHexString(hash)); this.dir.mkdirs(); Assert.state(this.dir.exists(), () -> "Una...
Create a Java method that does the following: "Gets the directory for the generated source class.".
Of course, here is the Java code you requested: ```java protected Map<String, Object> generateContent() { Map<String, Object> content = extractContent(toPropertySource()); postProcessContent(content); return content; } ``` Hope this helps!
Create a Java method that does the following: "Generate the content map.".
Of course, here is the Java code you requested: ```java protected void copyIfSet(Properties target, String key) { String value = this.properties.get(key); if (StringUtils.hasText(value)) { target.put(key, value); } } ``` Hope this helps!
Create a Java method that does the following: "Copy the value of the property if it is set to the target properties.".
Of course, here is the Java code you requested: ```java @SuppressWarnings("unchecked") protected Map<String, Object> getNestedMap(Map<String, Object> map, String key) { Object value = map.get(key); if (value == null) { return Collections.emptyMap(); } return (Map<String, Object>) value; } ``` Hope this h...
Create a Java method that does the following: "Get a nested map.".
Of course, here is the Java code you requested: ```java @ReadOperation public Health healthForComponent(@Selector String component) { HealthIndicator indicator = getNestedHealthIndicator(this.healthIndicator, component); return (indicator != null) ? indicator.health() : null; } ``` Hope this helps!
Create a Java method that does the following: "Get the health for the specified component.".
Of course, here is the Java code you requested: ```java public static <C, A> Callback<C, A> callback(Class<C> callbackType, C callbackInstance, A argument, Object... additionalArguments) { Assert.notNull(callbackType, "CallbackType must not be null"); Assert.notNull(callbackInstance, "CallbackInstance must not ...
Create a Java method that does the following: "Create a callback instance.".
Of course, here is the Java code you requested: ```java public static <C, A> Callbacks<C, A> callbacks(Class<C> callbackType, Collection<? extends C> callbackInstances, A argument, Object... additionalArguments) { Assert.notNull(callbackType, "CallbackType must not be null"); Assert.notNull(callbackInstances...
Create a Java method that does the following: "Create a new callbacks instance.".
Of course, here is the Java code you requested: ```java public ConfigurableApplicationContext run(String... args) { if (this.running.get()) { // If already created we just return the existing context return this.context; } configureAsChildIfNecessary(args); if (this.running.compareAndSet(false, true)) { ...
Create a Java method that does the following: "Run the application.".
Of course, here is the Java code you requested: ```java public SpringApplicationBuilder child(Class<?>... sources) { SpringApplicationBuilder child = new SpringApplicationBuilder(); child.sources(sources); // Copy environment stuff from parent to child child.properties(this.defaultProperties).environment(this...
Create a Java method that does the following: "Create a child application builder.".
Of course, here is the Java code you requested: ```java public SpringApplicationBuilder parent(Class<?>... sources) { if (this.parent == null) { this.parent = new SpringApplicationBuilder(sources) .web(WebApplicationType.NONE).properties(this.defaultProperties) .environment(this.environment); } else...
Create a Java method that does the following: "Creates a parent application.".
Of course, here is the Java code you requested: ```java public SpringApplicationBuilder sources(Class<?>... sources) { this.sources.addAll(new LinkedHashSet<>(Arrays.asList(sources))); return this; } ``` Hope this helps!
Create a Java method that does the following: "Add the sources to be built.".
Of course, here is the Java code you requested: ```java public SpringApplicationBuilder profiles(String... profiles) { this.additionalProfiles.addAll(Arrays.asList(profiles)); this.application.setAdditionalProfiles( StringUtils.toStringArray(this.additionalProfiles)); return this; } ``` Hope this helps!
Create a Java method that does the following: "Add additional profiles to the application.".
Of course, here is the Java code you requested: ```java public static void addDelimitedStringConverters(ConverterRegistry registry) { ConversionService service = (ConversionService) registry; registry.addConverter(new ArrayToDelimitedStringConverter(service)); registry.addConverter(new CollectionToDelimitedStrin...
Create a Java method that does the following: "Add all the converters to the given registry.".
Of course, here is the Java code you requested: ```java public void setServerCustomizers( Collection<? extends ServerRSocketFactoryCustomizer> serverCustomizers) { Assert.notNull(serverCustomizers, "ServerCustomizers must not be null"); this.serverCustomizers = new ArrayList<>(serverCustomizers); } ``` Hope t...
Create a Java method that does the following: "Sets the server customizers.".
Of course, here is the Java code you requested: ```java public void addServerCustomizers( ServerRSocketFactoryCustomizer... serverCustomizers) { Assert.notNull(serverCustomizers, "ServerCustomizer must not be null"); this.serverCustomizers.addAll(Arrays.asList(serverCustomizers)); } ``` Hope this helps!
Create a Java method that does the following: "Add server customizers.".
Of course, here is the Java code you requested: ```java public String determineDriverClassName() { if (StringUtils.hasText(this.driverClassName)) { Assert.state(driverClassIsLoadable(), () -> "Cannot load driver class: " + this.driverClassName); return this.driverClassName; } String driverClassName = ...
Create a Java method that does the following: "Determine the driver class name.".
Of course, here is the Java code you requested: ```java public String determineDatabaseName() { if (this.generateUniqueName) { if (this.uniqueName == null) { this.uniqueName = UUID.randomUUID().toString(); } return this.uniqueName; } if (StringUtils.hasLength(this.name)) { return this.name; } ...
Create a Java method that does the following: "Determine the name of the database.".
Of course, here is the Java code you requested: ```java public String determineUsername() { if (StringUtils.hasText(this.username)) { return this.username; } if (EmbeddedDatabaseConnection.isEmbedded(determineDriverClassName())) { return "sa"; } return null; } ``` Hope this helps!
Create a Java method that does the following: "Determine the username to use for the database connection.".
Of course, here is the Java code you requested: ```java @SuppressWarnings({ "unchecked" }) protected final <D> D nullSafeValue(JsonNode jsonNode, Class<D> type) { Assert.notNull(type, "Type must not be null"); if (jsonNode == null) { return null; } if (type == String.class) { return (D) jsonNode.textVal...
Create a Java method that does the following: "Returns the value of the given JSON node as the given type.".
Of course, here is the Java code you requested: ```java protected final JsonNode getRequiredNode(JsonNode tree, String fieldName) { Assert.notNull(tree, "Tree must not be null"); JsonNode node = tree.get(fieldName); Assert.state(node != null && !(node instanceof NullNode), () -> "Missing JSON field '" + fiel...
Create a Java method that does the following: "Gets the required node.".
Of course, here is the Java code you requested: ```java public JmsPoolConnectionFactory createPooledConnectionFactory( ConnectionFactory connectionFactory) { JmsPoolConnectionFactory pooledConnectionFactory = new JmsPoolConnectionFactory(); pooledConnectionFactory.setConnectionFactory(connectionFactory); poo...
Create a Java method that does the following: "Creates a new pooled connection factory.".
Of course, here is the Java code you requested: ```java public ProjectGenerationResponse generate(ProjectGenerationRequest request) throws IOException { Log.info("Using service at " + request.getServiceUrl()); InitializrServiceMetadata metadata = loadMetadata(request.getServiceUrl()); URI url = request.genera...
Create a Java method that does the following: "Generate a project from the specified request.".
Of course, here is the Java code you requested: ```java public StaticResourceServerWebExchange at(StaticResourceLocation first, StaticResourceLocation... rest) { return at(EnumSet.of(first, rest)); } ``` Hope this helps!
Create a Java method that does the following: "Create a new StaticResourceServerWebExchange at the given locations.".
Of course, here is the Java code you requested: ```java public Set<String> getNamesForType(Class<?> type, TypeExtractor typeExtractor) { updateTypesIfNecessary(); return this.beanTypes.entrySet().stream().filter((entry) -> { Class<?> beanType = extractType(entry.getValue(), typeExtractor); return beanType !=...
Create a Java method that does the following: "Returns the names of the bean types that are assignable to the given type.".
Of course, here is the Java code you requested: ```java public void compileAndRun() throws Exception { synchronized (this.monitor) { try { stop(); Class<?>[] compiledSources = compile(); monitorForChanges(); // Run in new thread to ensure that the context classloader is setup this.runThread = ...
Create a Java method that does the following: "Compile and run the compiler.".
Of course, here is the Java code you requested: ```java URI generateUrl(InitializrServiceMetadata metadata) { try { URIBuilder builder = new URIBuilder(this.serviceUrl); StringBuilder sb = new StringBuilder(); if (builder.getPath() != null) { sb.append(builder.getPath()); } ProjectType projectTyp...
Create a Java method that does the following: "Generate the service URL.".
Of course, here is the Java code you requested: ```java protected String resolveArtifactId() { if (this.artifactId != null) { return this.artifactId; } if (this.output != null) { int i = this.output.lastIndexOf('.'); return (i != -1) ? this.output.substring(0, i) : this.output; } return null; } ```...
Create a Java method that does the following: "Resolve the artifact id.".
Of course, here is the Java code you requested: ```java public TaskSchedulerBuilder awaitTerminationPeriod(Duration awaitTerminationPeriod) { return new TaskSchedulerBuilder(this.poolSize, this.awaitTermination, awaitTerminationPeriod, this.threadNamePrefix, this.customizers); } ``` Hope this helps!
Create a Java method that does the following: "Sets the await termination period.".
Of course, here is the Java code you requested: ```java public TaskSchedulerBuilder customizers(TaskSchedulerCustomizer... customizers) { Assert.notNull(customizers, "Customizers must not be null"); return customizers(Arrays.asList(customizers)); } ``` Hope this helps!
Create a Java method that does the following: "Add custom TaskSchedulerCustomizers to the builder.".
Of course, here is the Java code you requested: ```java public TaskSchedulerBuilder customizers( Iterable<TaskSchedulerCustomizer> customizers) { Assert.notNull(customizers, "Customizers must not be null"); return new TaskSchedulerBuilder(this.poolSize, this.awaitTermination, this.awaitTerminationPeriod, th...
Create a Java method that does the following: "Create a new TaskSchedulerBuilder with customizers.".
Of course, here is the Java code you requested: ```java public TaskSchedulerBuilder additionalCustomizers( TaskSchedulerCustomizer... customizers) { Assert.notNull(customizers, "Customizers must not be null"); return additionalCustomizers(Arrays.asList(customizers)); } ``` Hope this helps!
Create a Java method that does the following: "Add additional customizers to the task scheduler.".
Of course, here is the Java code you requested: ```java public <T extends ThreadPoolTaskScheduler> T configure(T taskScheduler) { PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull(); map.from(this.poolSize).to(taskScheduler::setPoolSize); map.from(this.awaitTermination) .to(taskScheduler::s...
Create a Java method that does the following: "Configure the given task scheduler.".
Of course, here is the Java code you requested: ```java public static LoggingSystem get(ClassLoader classLoader) { String loggingSystem = System.getProperty(SYSTEM_PROPERTY); if (StringUtils.hasLength(loggingSystem)) { if (NONE.equals(loggingSystem)) { return new NoOpLoggingSystem(); } return get(clas...
Create a Java method that does the following: "Get the logging system for the given class loader".
Of course, here is the Java code you requested: ```java public void addSourceFolder(File folder) { Assert.notNull(folder, "Folder must not be null"); Assert.isTrue(!folder.isFile(), "Folder '" + folder + "' must not be a file"); synchronized (this.monitor) { checkNotStarted(); this.folders.put(folder, null...
Create a Java method that does the following: "Add a source folder to the list of folders to be scanned.".
Of course, here is the Java code you requested: ```java public void start() { synchronized (this.monitor) { saveInitialSnapshots(); if (this.watchThread == null) { Map<File, FolderSnapshot> localFolders = new HashMap<>(); localFolders.putAll(this.folders); this.watchThread = new Thread(new Watcher(...
Create a Java method that does the following: "Starts the watch thread.".
Of course, here is the Java code you requested: ```java void stopAfter(int remainingScans) { Thread thread; synchronized (this.monitor) { thread = this.watchThread; if (thread != null) { this.remainingScans.set(remainingScans); if (remainingScans <= 0) { thread.interrupt(); } } this.wa...
Create a Java method that does the following: "Stop the watch thread after the number of scans have been exhausted.".
Of course, here is the Java code you requested: ```java protected Mono<ServerResponse> renderDefaultErrorView( ServerResponse.BodyBuilder responseBody, Map<String, Object> error) { StringBuilder builder = new StringBuilder(); Date timestamp = (Date) error.get("timestamp"); Object message = error.get("message"...
Create a Java method that does the following: "Render the error view.".
Of course, here is the Java code you requested: ```java private String getEntityManagerFactoryName(String beanName) { if (beanName.length() > ENTITY_MANAGER_FACTORY_SUFFIX.length() && StringUtils .endsWithIgnoreCase(beanName, ENTITY_MANAGER_FACTORY_SUFFIX)) { return beanName.substring(0, beanName.length(...
Create a Java method that does the following: "Gets the entity manager factory name.".
Of course, here is the Java code you requested: ```java public static JMXConnector connect(int port) throws IOException { String url = "service:jmx:rmi:///jndi/rmi://127.0.0.1:" + port + "/jmxrmi"; JMXServiceURL serviceUrl = new JMXServiceURL(url); return JMXConnectorFactory.connect(serviceUrl, null); } ``` Ho...
Create a Java method that does the following: "Connect to the specified port.".
Of course, here is the Java code you requested: ```java private void doWithThreadContextClassLoader(ClassLoader classLoader, Runnable code) { ClassLoader existingLoader = (classLoader != null) ? ClassUtils.overrideThreadContextClassLoader(classLoader) : null; try { code.run(); } finally { if (existin...
Create a Java method that does the following: "Do with thread context classloader.".
Of course, here is the Java code you requested: ```java public TemplateAvailabilityProvider getProvider(String view, Environment environment, ClassLoader classLoader, ResourceLoader resourceLoader) { Assert.notNull(view, "View must not be null"); Assert.notNull(environment, "Environment must not be null"); As...
Create a Java method that does the following: "Get the provider for the given view.".
Of course, here is the Java code you requested: ```java @Override public List<ForeignKey<Record, ?>> getReferences() { return Arrays.<ForeignKey<Record, ?>>asList(Keys.FK_BOOK_AUTHOR, Keys.FK_BOOK_LANGUAGE); } ``` Hope this helps!
Create a Java method that does the following: "Returns an array of foreign keys of the record.".
Of course, here is the Java code you requested: ```java public String generate(String url) throws IOException { Object content = this.initializrService.loadServiceCapabilities(url); if (content instanceof InitializrServiceMetadata) { return generateHelp(url, (InitializrServiceMetadata) content); } return co...
Create a Java method that does the following: "Generate a help page for the given URL.".
Of course, here is the Java code you requested: ```java protected boolean isIncludeStackTrace(ServerRequest request, MediaType produces) { ErrorProperties.IncludeStacktrace include = this.errorProperties .getIncludeStacktrace(); if (include == ErrorProperties.IncludeStacktrace.ALWAYS) { return true; } i...
Create a Java method that does the following: "Returns true if the stack trace should be included in the response.".
Of course, here is the Java code you requested: ```java protected HttpStatus getHttpStatus(Map<String, Object> errorAttributes) { int statusCode = (int) errorAttributes.get("status"); return HttpStatus.valueOf(statusCode); } ``` Hope this helps!
Create a Java method that does the following: "Get the http status from the error attributes.".
Of course, here is the Java code you requested: ```java private boolean shouldExtract(ProjectGenerationRequest request, ProjectGenerationResponse response) { if (request.isExtract()) { return true; } // explicit name hasn't been provided for an archive and there is no extension if (isZipArchive(response)...
Create a Java method that does the following: "Determines if the extract request should be performed.".
Of course, here is the Java code you requested: ```java public static HttpHandler configureCompression(Compression compression, HttpHandler httpHandler) { if (compression == null || !compression.getEnabled()) { return httpHandler; } ContentEncodingRepository repository = new ContentEncodingRepository(); ...
Create a Java method that does the following: "Configure the compression.".
Of course, here is the Java code you requested: ```java @SafeVarargs public final Set<Class<?>> scan(Class<? extends Annotation>... annotationTypes) throws ClassNotFoundException { List<String> packages = getPackages(); if (packages.isEmpty()) { return Collections.emptySet(); } ClassPathScanningCandidat...
Create a Java method that does the following: "Scans the classpath for classes that are annotated with the given annotation types.".
Of course, here is the Java code you requested: ```java public static Tag status(ServerWebExchange exchange) { HttpStatus status = exchange.getResponse().getStatusCode(); if (status == null) { status = HttpStatus.OK; } return Tag.of("status", String.valueOf(status.value())); } ``` Hope this helps!
Create a Java method that does the following: "Get the status code from the response".
Of course, here is the Java code you requested: ```java public static Tag uri(ServerWebExchange exchange) { PathPattern pathPattern = exchange .getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE); if (pathPattern != null) { return Tag.of("uri", pathPattern.getPatternString()); } HttpStatus stat...
Create a Java method that does the following: "Returns the URI of the request.".
Of course, here is the Java code you requested: ```java public static Tag exception(Throwable exception) { if (exception != null) { String simpleName = exception.getClass().getSimpleName(); return Tag.of("exception", StringUtils.hasText(simpleName) ? simpleName : exception.getClass().getName()); } ret...
Create a Java method that does the following: "Creates a tag that represents an exception.".
Of course, here is the Java code you requested: ```java public static Tag outcome(ServerWebExchange exchange) { HttpStatus status = exchange.getResponse().getStatusCode(); if (status != null) { if (status.is1xxInformational()) { return OUTCOME_INFORMATIONAL; } if (status.is2xxSuccessful()) { retur...
Create a Java method that does the following: "Returns the outcome of the request.".
Of course, here is the Java code you requested: ```java protected boolean isIncludeStackTrace(HttpServletRequest request, MediaType produces) { IncludeStacktrace include = getErrorProperties().getIncludeStacktrace(); if (include == IncludeStacktrace.ALWAYS) { return true; } if (include == IncludeStacktra...
Create a Java method that does the following: "Returns true if the stacktrace should be included in the error message.".
Of course, here is the Java code you requested: ```java private void resolveName(ConfigurationMetadataItem item) { item.setName(item.getId()); // fallback ConfigurationMetadataSource source = getSource(item); if (source != null) { String groupId = source.getGroupId(); String dottedPrefix = groupId + "."; ...
Create a Java method that does the following: "Resolve the name of the item.".
Of course, here is the Java code you requested: ```java protected void restart(Set<URL> urls, ClassLoaderFiles files) { Restarter restarter = Restarter.getInstance(); restarter.addUrls(urls); restarter.addClassLoaderFiles(files); restarter.restart(); } ``` Hope this helps!
Create a Java method that does the following: "Restart the server.".
Of course, here is the Java code you requested: ```java public final void load(Class<?> relativeClass, String... resourceNames) { Resource[] resources = new Resource[resourceNames.length]; for (int i = 0; i < resourceNames.length; i++) { resources[i] = new ClassPathResource(resourceNames[i], relativeClass); }...
Create a Java method that does the following: "Load the beans from the given class.".
Of course, here is the Java code you requested: ```java public boolean isNull(int index) { Object value = opt(index); return value == null || value == JSONObject.NULL; } ``` Hope this helps!
Create a Java method that does the following: "Returns true if the value at the given index is null.".
Of course, here is the Java code you requested: ```java public boolean getBoolean(int index) throws JSONException { Object object = get(index); Boolean result = JSON.toBoolean(object); if (result == null) { throw JSON.typeMismatch(index, object, "boolean"); } return result; } ``` Hope this helps!
Create a Java method that does the following: "Get the boolean value at the given index.".
Of course, here is the Java code you requested: ```java public boolean optBoolean(int index, boolean fallback) { Object object = opt(index); Boolean result = JSON.toBoolean(object); return result != null ? result : fallback; } ``` Hope this helps!
Create a Java method that does the following: "Get the optional boolean value associated with an index.".
Of course, here is the Java code you requested: ```java public int getInt(int index) throws JSONException { Object object = get(index); Integer result = JSON.toInteger(object); if (result == null) { throw JSON.typeMismatch(index, object, "int"); } return result; } ``` Hope this helps!
Create a Java method that does the following: "Get the int value associated with an index.".
Of course, here is the Java code you requested: ```java public long optLong(int index, long fallback) { Object object = opt(index); Long result = JSON.toLong(object); return result != null ? result : fallback; } ``` Hope this helps!
Create a Java method that does the following: "Get the optional long value associated with an index.".
Of course, here is the Java code you requested: ```java public JSONObject getJSONObject(int index) throws JSONException { Object object = get(index); if (object instanceof JSONObject) { return (JSONObject) object; } else { throw JSON.typeMismatch(index, object, "JSONObject"); } } ``` Hope this helps!
Create a Java method that does the following: "Gets the JSONObject at the given index.".
Of course, here is the Java code you requested: ```java public JSONObject optJSONObject(int index) { Object object = opt(index); return object instanceof JSONObject ? (JSONObject) object : null; } ``` Hope this helps!
Create a Java method that does the following: "Get the optional JSONObject associated with an index.".
Of course, here is the Java code you requested: ```java public void ifBound(Consumer<? super T> consumer) { Assert.notNull(consumer, "Consumer must not be null"); if (this.value != null) { consumer.accept(this.value); } } ``` Hope this helps!
Create a Java method that does the following: "Applies the specified consumer to the bound value.".
Of course, here is the Java code you requested: ```java public <U> BindResult<U> map(Function<? super T, ? extends U> mapper) { Assert.notNull(mapper, "Mapper must not be null"); return of((this.value != null) ? mapper.apply(this.value) : null); } ``` Hope this helps!
Create a Java method that does the following: "Maps this BindResult to the result of applying the given function to the result.".
Of course, here is the Java code you requested: ```java private long decodeMsDosFormatDateTime(long datetime) { LocalDateTime localDateTime = LocalDateTime.of( (int) (((datetime >> 25) & 0x7f) + 1980), (int) ((datetime >> 21) & 0x0f), (int) ((datetime >> 16) & 0x1f), (int) ((datetime >> 11) & 0x1f), (int...
Create a Java method that does the following: "Decodes the MS - DOS format datetime value.".
Of course, here is the Java code you requested: ```java protected void launch(String[] args) throws Exception { JarFile.registerUrlProtocolHandler(); ClassLoader classLoader = createClassLoader(getClassPathArchives()); launch(args, getMainClass(), classLoader); } ``` Hope this helps!
Create a Java method that does the following: "Launch the application.".
Of course, here is the Java code you requested: ```java protected void configureSsl(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl, SslStoreProvider sslStoreProvider) { protocol.setSSLEnabled(true); protocol.setSslProtocol(ssl.getProtocol()); configureSslClientAuth(protocol, ssl); protocol.setKeystorePass(...
Create a Java method that does the following: "Configure the Ssl.".
Of course, here is the Java code you requested: ```java public static String toDashedForm(String name, int start) { StringBuilder result = new StringBuilder(); String replaced = name.replace('_', '-'); for (int i = start; i < replaced.length(); i++) { char ch = replaced.charAt(i); if (Character.isUpperCase...
Create a Java method that does the following: "Converts a name in a dashed form.".
Of course, here is the Java code you requested: ```java public void replayTo(Log destination) { synchronized (this.lines) { for (Line line : this.lines) { logTo(destination, line.getLevel(), line.getMessage(), line.getThrowable()); } this.lines.clear(); } } ``` Hope this helps!
Create a Java method that does the following: "Replay the log to the specified destination.".
Of course, here is the Java code you requested: ```java public static Log replay(Log source, Class<?> destination) { return replay(source, LogFactory.getLog(destination)); } ``` Hope this helps!
Create a Java method that does the following: "Replay the source log to the destination log.".
Of course, here is the Java code you requested: ```java public static Log replay(Log source, Log destination) { if (source instanceof DeferredLog) { ((DeferredLog) source).replayTo(destination); } return destination; } ``` Hope this helps!
Create a Java method that does the following: "Replays the source log to the destination log.".
Of course, here is the Java code you requested: ```java public MongoClient createMongoClient(MongoClientSettings settings) { Integer embeddedPort = getEmbeddedPort(); if (embeddedPort != null) { return createEmbeddedMongoClient(settings, embeddedPort); } return createNetworkMongoClient(settings); } ``` Ho...
Create a Java method that does the following: "Creates a MongoClient based on the settings.".
Of course, here is the Java code you requested: ```java public static ColorConverter newInstance(Configuration config, String[] options) { if (options.length < 1) { LOGGER.error("Incorrect number of options on style. " + "Expected at least 1, received {}", options.length); return null; } if (options[0...
Create a Java method that does the following: "Creates a new instance of the color converter.".
Of course, here is the Java code you requested: ```java @SuppressWarnings("unchecked") public final Object bind(ConfigurationPropertyName name, Bindable<?> target, AggregateElementBinder elementBinder) { Object result = bindAggregate(name, target, elementBinder); Supplier<?> value = target.getValue(); if (re...
Create a Java method that does the following: "Binds the given target object to the given aggregate element.".
Of course, here is the Java code you requested: ```java public static String getProperty(String key, String defaultValue, String text) { try { String propVal = System.getProperty(key); if (propVal == null) { // Fall back to searching the system environment. propVal = System.getenv(key); } if (pro...
Create a Java method that does the following: "Get a property from the system or environment.".
Of course, here is the Java code you requested: ```java protected void configureContext(Context context) { this.contextLifecycleListeners.forEach(context::addLifecycleListener); new DisableReferenceClearingContextCustomizer().customize(context); this.tomcatContextCustomizers .forEach((customizer) -> customiz...
Create a Java method that does the following: "Configure the context.".
Of course, here is the Java code you requested: ```java @Override public void addContextCustomizers( TomcatContextCustomizer... tomcatContextCustomizers) { Assert.notNull(tomcatContextCustomizers, "TomcatContextCustomizers must not be null"); this.tomcatContextCustomizers.addAll(Arrays.asList(tomcatContext...
Create a Java method that does the following: "Add a list of TomcatContextCustomizers to the list of TomcatContextCustomizers.".
Of course, here is the Java code you requested: ```java @Override public void addProtocolHandlerCustomizers( TomcatProtocolHandlerCustomizer<?>... tomcatProtocolHandlerCustomizers) { Assert.notNull(tomcatProtocolHandlerCustomizers, "TomcatProtocolHandlerCustomizers must not be null"); this.tomcatProtocolHa...
Create a Java method that does the following: "Add a list of Tomcat protocol handler customizers to the list.".
Of course, here is the Java code you requested: ```java public void setContextLifecycleListeners( Collection<? extends LifecycleListener> contextLifecycleListeners) { Assert.notNull(contextLifecycleListeners, "ContextLifecycleListeners must not be null"); this.contextLifecycleListeners = new ArrayList<>(con...
Create a Java method that does the following: "Sets the collection of lifecycle listeners to be notified of context lifecycle events.".
Of course, here is the Java code you requested: ```java public void addContextLifecycleListeners( LifecycleListener... contextLifecycleListeners) { Assert.notNull(contextLifecycleListeners, "ContextLifecycleListeners must not be null"); this.contextLifecycleListeners.addAll(Arrays.asList(contextLifecycleLis...
Create a Java method that does the following: "Add a list of context lifecycle listeners to the context.".
Of course, here is the Java code you requested: ```java protected void addPropertySources(ConfigurableEnvironment environment, ResourceLoader resourceLoader) { RandomValuePropertySource.addToEnvironment(environment); new Loader(environment, resourceLoader).load(); } ``` Hope this helps!
Create a Java method that does the following: "Add property sources to the environment.".
Of course, here is the Java code you requested: ```java protected void handleSigInt() { if (this.commandRunner.handleSigInt()) { return; } System.out.println(String.format("%nThanks for using Spring Boot")); System.exit(1); } ``` Hope this helps!
Create a Java method that does the following: "Handle the sigint.".
Of course, here is the Java code you requested: ```java public void addStatusMapping(Map<String, Integer> statusMapping) { Assert.notNull(statusMapping, "StatusMapping must not be null"); this.statusMapping.putAll(statusMapping); } ``` Hope this helps!
Create a Java method that does the following: "Add a status mapping to the status table.".
Of course, here is the Java code you requested: ```java public void addStatusMapping(Status status, Integer httpStatus) { Assert.notNull(status, "Status must not be null"); Assert.notNull(httpStatus, "HttpStatus must not be null"); addStatusMapping(status.getCode(), httpStatus); } ``` Hope this helps!
Create a Java method that does the following: "Add a status mapping to the response.".
Of course, here is the Java code you requested: ```java public <T> Source<T> from(Supplier<T> supplier) { Assert.notNull(supplier, "Supplier must not be null"); Source<T> source = getSource(supplier); if (this.sourceOperator != null) { source = this.sourceOperator.apply(source); } return source; } ``` H...
Create a Java method that does the following: "Returns a source from the given supplier.".
Of course, here is the Java code you requested: ```java public String getRelativeName() { File folder = this.sourceFolder.getAbsoluteFile(); File file = this.file.getAbsoluteFile(); String folderName = StringUtils.cleanPath(folder.getPath()); String fileName = StringUtils.cleanPath(file.getPath()); Assert.st...
Create a Java method that does the following: "Gets the relative name of the file.".
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
9