code stringlengths 146 466k | prompt stringlengths 54 1.5k |
|---|---|
Of course, here is the Java code you requested:
```java
AnsiString append(String text, Code... codes) {
if (codes.length == 0 || !isAnsiSupported()) {
this.value.append(text);
return this;
}
Ansi ansi = Ansi.ansi();
for (Code code : codes) {
ansi = applyCode(ansi, code);
}
this.value.append(ansi.a... | Create a Java method that does the following: "Append the text to this ANSI string using the specified codes.". |
Of course, here is the Java code you requested:
```java
protected void logDisabledFork() {
if (getLog().isWarnEnabled()) {
if (hasAgent()) {
getLog().warn("Fork mode disabled, ignoring agent");
}
if (hasJvmArgs()) {
RunArguments runArguments = resolveJvmArguments();
getLog().warn("Fork mode disa... | Create a Java method that does the following: "Logs a warning message if the fork mode is disabled.". |
Of course, here is the Java code you requested:
```java
protected ConditionOutcome getResourceOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) {
List<String> found = new ArrayList<>();
for (String location : this.resourceLocations) {
Resource resource = context.getResourceLoader().getResourc... | Create a Java method that does the following: "Gets the resource outcome.". |
Of course, here is the Java code you requested:
```java
public WebServiceTemplateBuilder messageSenders(
WebServiceMessageSender... messageSenders) {
Assert.notNull(messageSenders, "MessageSenders must not be null");
return messageSenders(Arrays.asList(messageSenders));
}
```
Hope this helps! | Create a Java method that does the following: "Sets the message senders to use.". |
Of course, here is the Java code you requested:
```java
public WebServiceTemplateBuilder additionalMessageSenders(
WebServiceMessageSender... messageSenders) {
Assert.notNull(messageSenders, "MessageSenders must not be null");
return additionalMessageSenders(Arrays.asList(messageSenders));
}
```
Hope this hel... | Create a Java method that does the following: "Add additional message senders to the template.". |
Of course, here is the Java code you requested:
```java
public WebServiceTemplateBuilder interceptors(
Collection<? extends ClientInterceptor> interceptors) {
Assert.notNull(interceptors, "Interceptors must not be null");
return new WebServiceTemplateBuilder(this.detectHttpMessageSender,
append(Collections.... | Create a Java method that does the following: "Create a new WebServiceTemplateBuilder with the specified interceptors.". |
Of course, here is the Java code you requested:
```java
public WebServiceTemplateBuilder customizers(
WebServiceTemplateCustomizer... 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 customizers to the template.". |
Of course, here is the Java code you requested:
```java
public WebServiceTemplateBuilder additionalCustomizers(
WebServiceTemplateCustomizer... 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 template.". |
Of course, here is the Java code you requested:
```java
public WebServiceTemplateBuilder setCheckConnectionForFault(
boolean checkConnectionForFault) {
return new WebServiceTemplateBuilder(this.detectHttpMessageSender,
this.interceptors,
append(this.internalCustomizers,
new CheckConnectionFaultCusto... | Create a Java method that does the following: "Sets whether the checkConnectionForFault parameter is true.". |
Of course, here is the Java code you requested:
```java
public WebServiceTemplateBuilder setTransformerFactoryClass(
Class<? extends TransformerFactory> transformerFactoryClass) {
return new WebServiceTemplateBuilder(this.detectHttpMessageSender,
this.interceptors, this.internalCustomizers, this.customizers,
... | Create a Java method that does the following: "Sets the transformerFactoryClass.". |
Of course, here is the Java code you requested:
```java
public WebServiceTemplateBuilder setDefaultUri(String defaultUri) {
Assert.hasText(defaultUri, "DefaultUri must not be empty");
return setDestinationProvider(() -> URI.create(defaultUri));
}
```
Hope this helps! | Create a Java method that does the following: "Sets the default URI to use.". |
Of course, here is the Java code you requested:
```java
public WebServiceTemplateBuilder setDestinationProvider(
DestinationProvider destinationProvider) {
Assert.notNull(destinationProvider, "DestinationProvider must not be null");
return new WebServiceTemplateBuilder(this.detectHttpMessageSender,
this.int... | Create a Java method that does the following: "Sets the destination provider.". |
Of course, here is the Java code you requested:
```java
public <T extends WebServiceTemplate> T build(Class<T> webServiceTemplateClass) {
Assert.notNull(webServiceTemplateClass,
"WebServiceTemplateClass must not be null");
return configure(BeanUtils.instantiateClass(webServiceTemplateClass));
}
```
Hope this... | Create a Java method that does the following: "Build a WebServiceTemplate instance from a class.". |
Of course, here is the Java code you requested:
```java
public <T extends WebServiceTemplate> T configure(T webServiceTemplate) {
Assert.notNull(webServiceTemplate, "WebServiceTemplate must not be null");
configureMessageSenders(webServiceTemplate);
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNon... | Create a Java method that does the following: "Configure the given web service template.". |
Of course, here is the Java code you requested:
```java
public static List<String> get(BeanFactory beanFactory) {
try {
return beanFactory.getBean(BEAN, BasePackages.class).get();
}
catch (NoSuchBeanDefinitionException ex) {
throw new IllegalStateException(
"Unable to retrieve @EnableAutoConfiguration... | Create a Java method that does the following: "Get the base packages from the bean factory.". |
Of course, here is the Java code you requested:
```java
public static void register(BeanDefinitionRegistry registry, String... packageNames) {
if (registry.containsBeanDefinition(BEAN)) {
BeanDefinition beanDefinition = registry.getBeanDefinition(BEAN);
ConstructorArgumentValues constructorArguments = beanDefi... | Create a Java method that does the following: "Register a BeanDefinition in the given BeanDefinitionRegistry.". |
Of course, here is the Java code you requested:
```java
public void setBuilderCustomizers(
Collection<? extends UndertowBuilderCustomizer> customizers) {
Assert.notNull(customizers, "Customizers must not be null");
this.builderCustomizers = new ArrayList<>(customizers);
}
```
Hope this helps! | Create a Java method that does the following: "Sets the customizers to be used for building the underlying builder.". |
Of course, here is the Java code you requested:
```java
@Override
public void addBuilderCustomizers(UndertowBuilderCustomizer... customizers) {
Assert.notNull(customizers, "Customizers must not be null");
this.builderCustomizers.addAll(Arrays.asList(customizers));
}
```
Hope this helps! | Create a Java method that does the following: "Add customizers to the builder.". |
Of course, here is the Java code you requested:
```java
private void definePackageIfNecessary(String className) {
int lastDot = className.lastIndexOf('.');
if (lastDot >= 0) {
String packageName = className.substring(0, lastDot);
if (getPackage(packageName) == null) {
try {
definePackage(className, ... | Create a Java method that does the following: "Define the package if it doesn t already exist.". |
Of course, here is the Java code you requested:
```java
public int start() throws IOException {
synchronized (this.monitor) {
Assert.state(this.serverThread == null, "Server already started");
ServerSocketChannel serverSocketChannel = ServerSocketChannel.open();
serverSocketChannel.socket().bind(new InetSoc... | Create a Java method that does the following: "Starts the server.". |
Of course, here is the Java code you requested:
```java
protected final File createTempDir(String prefix) {
try {
File tempDir = File.createTempFile(prefix + ".", "." + getPort());
tempDir.delete();
tempDir.mkdir();
tempDir.deleteOnExit();
return tempDir;
}
catch (IOException ex) {
throw new We... | Create a Java method that does the following: "Creates a temp directory.". |
Of course, here is the Java code you requested:
```java
@Override
public void writeEntry(String entryName, InputStream inputStream) throws IOException {
JarArchiveEntry entry = new JarArchiveEntry(entryName);
writeEntry(entry, new InputStreamEntryWriter(inputStream, true));
}
```
Hope this helps! | Create a Java method that does the following: "Write an entry to the jar archive.". |
Of course, here is the Java code you requested:
```java
@Override
public void writeLoaderClasses(String loaderJarResourceName) throws IOException {
URL loaderJar = getClass().getClassLoader().getResource(loaderJarResourceName);
try (JarInputStream inputStream = new JarInputStream(
new BufferedInputStream(load... | Create a Java method that does the following: "Writes the loader classes to the output.". |
Of course, here is the Java code you requested:
```java
private void writeEntry(JarArchiveEntry entry, EntryWriter entryWriter,
UnpackHandler unpackHandler) throws IOException {
String parent = entry.getName();
if (parent.endsWith("/")) {
parent = parent.substring(0, parent.length() - 1);
entry.setUnixMod... | Create a Java method that does the following: "Write a single entry to the output.". |
Of course, here is the Java code you requested:
```java
private Scope peek() throws JSONException {
if (this.stack.isEmpty()) {
throw new JSONException("Nesting problem");
}
return this.stack.get(this.stack.size() - 1);
}
```
Hope this helps! | Create a Java method that does the following: "Peek the top of the stack.". |
Of course, here is the Java code you requested:
```java
public JSONStringer value(Object value) throws JSONException {
if (this.stack.isEmpty()) {
throw new JSONException("Nesting problem");
}
if (value instanceof JSONArray) {
((JSONArray) value).writeTo(this);
return this;
}
else if (value instan... | Create a Java method that does the following: "Write a value to this stringer.". |
Of course, here is the Java code you requested:
```java
public JSONStringer value(boolean value) throws JSONException {
if (this.stack.isEmpty()) {
throw new JSONException("Nesting problem");
}
beforeValue();
this.out.append(value);
return this;
}
```
Hope this helps! | Create a Java method that does the following: "Write a boolean value.". |
Of course, here is the Java code you requested:
```java
public JSONStringer key(String name) throws JSONException {
if (name == null) {
throw new JSONException("Names must be non-null");
}
beforeKey();
string(name);
return this;
}
```
Hope this helps! | Create a Java method that does the following: "Add a name to this stringer.". |
Of course, here is the Java code you requested:
```java
protected DefaultCouchbaseEnvironment.Builder initializeEnvironmentBuilder(
CouchbaseProperties properties) {
CouchbaseProperties.Endpoints endpoints = properties.getEnv().getEndpoints();
CouchbaseProperties.Timeouts timeouts = properties.getEnv().getTimeo... | Create a Java method that does the following: "Initialize the environment builder.". |
Of course, here is the Java code you requested:
```java
static <T> T doWithMainClasses(File rootFolder, MainClassCallback<T> callback)
throws IOException {
if (!rootFolder.exists()) {
return null; // nothing to do
}
if (!rootFolder.isDirectory()) {
throw new IllegalArgumentException(
"Invalid root ... | Create a Java method that does the following: "Do with main classes in the given folder.". |
Of course, here is the Java code you requested:
```java
public static String findSingleMainClass(JarFile jarFile, String classesLocation)
throws IOException {
return findSingleMainClass(jarFile, classesLocation, null);
}
```
Hope this helps! | Create a Java method that does the following: "Find the single main class in the given jar file.". |
Of course, here is the Java code you requested:
```java
static <T> T doWithMainClasses(JarFile jarFile, String classesLocation,
MainClassCallback<T> callback) throws IOException {
List<JarEntry> classEntries = getClassEntries(jarFile, classesLocation);
classEntries.sort(new ClassEntryComparator());
for (JarEn... | Create a Java method that does the following: "Performs a callback on all main classes in the given jar file.". |
Of course, here is the Java code you requested:
```java
public static void attach(Environment environment) {
Assert.isInstanceOf(ConfigurableEnvironment.class, environment);
MutablePropertySources sources = ((ConfigurableEnvironment) environment)
.getPropertySources();
PropertySource<?> attached = sources.ge... | Create a Java method that does the following: "Attaches the configuration property sources to the environment.". |
Of course, here is the Java code you requested:
```java
public static Iterable<ConfigurationPropertySource> get(Environment environment) {
Assert.isInstanceOf(ConfigurableEnvironment.class, environment);
MutablePropertySources sources = ((ConfigurableEnvironment) environment)
.getPropertySources();
Configura... | Create a Java method that does the following: "Gets the configuration property sources from the given environment.". |
Of course, here is the Java code you requested:
```java
public static Iterable<ConfigurationPropertySource> from(PropertySource<?> source) {
return Collections.singleton(SpringConfigurationPropertySource.from(source));
}
```
Hope this helps! | Create a Java method that does the following: "Creates an iterable of configuration property sources from the given property source.". |
Of course, here is the Java code you requested:
```java
public PrimitiveType getPrimitiveType(TypeMirror typeMirror) {
if (getPrimitiveFor(typeMirror) != null) {
return this.types.unboxedType(typeMirror);
}
return null;
}
```
Hope this helps! | Create a Java method that does the following: "Get the primitive type for the given type mirror.". |
Of course, here is the Java code you requested:
```java
public static List<String> getUrls(String path, ClassLoader classLoader) {
if (classLoader == null) {
classLoader = ClassUtils.getDefaultClassLoader();
}
path = StringUtils.cleanPath(path);
try {
return getUrlsFromWildcardPath(path, classLoader);
... | Create a Java method that does the following: "Gets the URLs from a path.". |
Of course, here is the Java code you requested:
```java
protected HttpHandler getHttpHandler() {
// Use bean names so that we don't consider the hierarchy
String[] beanNames = getBeanFactory().getBeanNamesForType(HttpHandler.class);
if (beanNames.length == 0) {
throw new ApplicationContextException(
"Una... | Create a Java method that does the following: "Get the HttpHandler instance.". |
Of course, here is the Java code you requested:
```java
public void repackage(File destination, Libraries libraries,
LaunchScript launchScript) throws IOException {
if (destination == null || destination.isDirectory()) {
throw new IllegalArgumentException("Invalid destination");
}
if (libraries == null) {
... | Create a Java method that does the following: "Repackage the source file to the destination file.". |
Of course, here is the Java code you requested:
```java
public static Tag uri(HttpRequest request) {
return Tag.of("uri", ensureLeadingSlash(stripUri(request.getURI().toString())));
}
```
Hope this helps! | Create a Java method that does the following: "Returns a tag that represents the URI of the given request.". |
Of course, here is the Java code you requested:
```java
public static Tag outcome(ClientHttpResponse response) {
try {
if (response != null) {
HttpStatus statusCode = response.getStatusCode();
if (statusCode.is1xxInformational()) {
return OUTCOME_INFORMATIONAL;
}
if (statusCode.is2xxSuccessfu... | Create a Java method that does the following: "Returns the outcome of the HTTP response.". |
Of course, here is the Java code you requested:
```java
public void setListener(T listener) {
Assert.notNull(listener, "Listener must not be null");
Assert.isTrue(isSupportedType(listener), "Listener is not of a supported type");
this.listener = listener;
}
```
Hope this helps! | Create a Java method that does the following: "Sets the listener.". |
Of course, here is the Java code you requested:
```java
public int determinePort() {
if (CollectionUtils.isEmpty(this.parsedAddresses)) {
return getPort();
}
Address address = this.parsedAddresses.get(0);
return address.port;
}
```
Hope this helps! | Create a Java method that does the following: "Determine the port number from the address.". |
Of course, here is the Java code you requested:
```java
public String determineAddresses() {
if (CollectionUtils.isEmpty(this.parsedAddresses)) {
return this.host + ":" + this.port;
}
List<String> addressStrings = new ArrayList<>();
for (Address parsedAddress : this.parsedAddresses) {
addressStrings.add(... | Create a Java method that does the following: "Determine the addresses of the connection.". |
Of course, here is the Java code you requested:
```java
public String determineUsername() {
if (CollectionUtils.isEmpty(this.parsedAddresses)) {
return this.username;
}
Address address = this.parsedAddresses.get(0);
return (address.username != null) ? address.username : this.username;
}
```
Hope this help... | Create a Java method that does the following: "Determine the username of the user.". |
Of course, here is the Java code you requested:
```java
public void setStatusOrder(Status... statusOrder) {
String[] order = new String[statusOrder.length];
for (int i = 0; i < statusOrder.length; i++) {
order[i] = statusOrder[i].getCode();
}
setStatusOrder(Arrays.asList(order));
}
```
Hope this helps! | Create a Java method that does the following: "Sets the status order.". |
Of course, here is the Java code you requested:
```java
public static Tag uri(HttpServletRequest request, HttpServletResponse response) {
if (request != null) {
String pattern = getMatchingPattern(request);
if (pattern != null) {
return Tag.of("uri", pattern);
}
if (response != null) {
HttpStatus... | Create a Java method that does the following: "Returns the URI tag for the given request and response.". |
Of course, here is the Java code you requested:
```java
protected void configureEnvironment(ConfigurableEnvironment environment,
String[] args) {
if (this.addConversionService) {
ConversionService conversionService = ApplicationConversionService
.getSharedInstance();
environment.setConversionService(
... | Create a Java method that does the following: "Configure the environment.". |
Of course, here is the Java code you requested:
```java
protected void configureProfiles(ConfigurableEnvironment environment, String[] args) {
environment.getActiveProfiles(); // ensure they are initialized
// But these ones should go first (last wins in a property key clash)
Set<String> profiles = new LinkedHas... | Create a Java method that does the following: "Configure the active profiles.". |
Of course, here is the Java code you requested:
```java
protected void bindToSpringApplication(ConfigurableEnvironment environment) {
try {
Binder.get(environment).bind("spring.main", Bindable.ofInstance(this));
}
catch (Exception ex) {
throw new IllegalStateException("Cannot bind to SpringApplication", ex... | Create a Java method that does the following: "Binds this instance to the Spring Application.". |
Of course, here is the Java code you requested:
```java
protected ConfigurableApplicationContext createApplicationContext() {
Class<?> contextClass = this.applicationContextClass;
if (contextClass == null) {
try {
switch (this.webApplicationType) {
case SERVLET:
contextClass = Class.forName(DEFAULT... | Create a Java method that does the following: "Creates the ApplicationContext.". |
Of course, here is the Java code you requested:
```java
protected void postProcessApplicationContext(ConfigurableApplicationContext context) {
if (this.beanNameGenerator != null) {
context.getBeanFactory().registerSingleton(
AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR,
this.beanNameGenerator... | Create a Java method that does the following: "Post process the application context.". |
Of course, here is the Java code you requested:
```java
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void applyInitializers(ConfigurableApplicationContext context) {
for (ApplicationContextInitializer initializer : getInitializers()) {
Class<?> requiredType = GenericTypeResolver.resolveTypeArgument(
... | Create a Java method that does the following: "Apply initializers to the given application context.". |
Of course, here is the Java code you requested:
```java
protected void logStartupProfileInfo(ConfigurableApplicationContext context) {
Log log = getApplicationLog();
if (log.isInfoEnabled()) {
String[] activeProfiles = context.getEnvironment().getActiveProfiles();
if (ObjectUtils.isEmpty(activeProfiles)) {
... | Create a Java method that does the following: "Log the startup profile info.". |
Of course, here is the Java code you requested:
```java
public void setDefaultProperties(Properties defaultProperties) {
this.defaultProperties = new HashMap<>();
for (Object key : Collections.list(defaultProperties.propertyNames())) {
this.defaultProperties.put((String) key, defaultProperties.get(key));
}
}... | Create a Java method that does the following: "Sets the default properties.". |
Of course, here is the Java code you requested:
```java
public Set<Object> getAllSources() {
Set<Object> allSources = new LinkedHashSet<>();
if (!CollectionUtils.isEmpty(this.primarySources)) {
allSources.addAll(this.primarySources);
}
if (!CollectionUtils.isEmpty(this.sources)) {
allSources.addAll(this.... | Create a Java method that does the following: "Returns a set of all sources contained in this object.". |
Of course, here is the Java code you requested:
```java
public static int exit(ApplicationContext context,
ExitCodeGenerator... exitCodeGenerators) {
Assert.notNull(context, "Context must not be null");
int exitCode = 0;
try {
try {
ExitCodeGenerators generators = new ExitCodeGenerators();
Collecti... | Create a Java method that does the following: "Exit the application with the specified exit code generators.". |
Of course, here is the Java code you requested:
```java
@Bean
public TomcatServletWebServerFactory servletWebServerFactory() {
return new TomcatServletWebServerFactory() {
@Override
protected void prepareContext(Host host,
ServletContextInitializer[] initializers) {
super.prepareContext(host, initia... | Create a Java method that does the following: "Creates a TomcatServletWebServerFactory.". |
Of course, here is the Java code you requested:
```java
public CompositeReactiveHealthIndicator timeoutStrategy(long timeout,
Health timeoutHealth) {
this.timeout = timeout;
this.timeoutHealth = (timeoutHealth != null) ? timeoutHealth
: Health.unknown().build();
return this;
}
```
Hope this helps! | Create a Java method that does the following: "Sets the timeout strategy for this CompositeReactiveHealthIndicator.". |
Of course, here is the Java code you requested:
```java
public static ConditionMessage of(String message, Object... args) {
if (ObjectUtils.isEmpty(args)) {
return new ConditionMessage(message);
}
return new ConditionMessage(String.format(message, args));
}
```
Hope this helps! | Create a Java method that does the following: "Create a new condition message with the given message and arguments.". |
Of course, here is the Java code you requested:
```java
public static ConditionMessage of(Collection<? extends ConditionMessage> messages) {
ConditionMessage result = new ConditionMessage();
if (messages != null) {
for (ConditionMessage message : messages) {
result = new ConditionMessage(result, message.toS... | Create a Java method that does the following: "Creates a new condition message from a collection of condition messages.". |
Of course, here is the Java code you requested:
```java
public static Builder forCondition(String condition, Object... details) {
return new ConditionMessage().andCondition(condition, details);
}
```
Hope this helps! | Create a Java method that does the following: "Creates a builder for a condition message.". |
Of course, here is the Java code you requested:
```java
public String add(String extension, String mimeType) {
Mapping previous = this.map.put(extension, new Mapping(extension, mimeType));
return (previous != null) ? previous.getMimeType() : null;
}
```
Hope this helps! | Create a Java method that does the following: "Add a new mapping to the map.". |
Of course, here is the Java code you requested:
```java
public String get(String extension) {
Mapping mapping = this.map.get(extension);
return (mapping != null) ? mapping.getMimeType() : null;
}
```
Hope this helps! | Create a Java method that does the following: "Get mime type for the given extension.". |
Of course, here is the Java code you requested:
```java
public void setResourceLoader(ResourceLoader resourceLoader) {
this.resourceLoader = resourceLoader;
this.xmlReader.setResourceLoader(resourceLoader);
this.scanner.setResourceLoader(resourceLoader);
}
```
Hope this helps! | Create a Java method that does the following: "Sets the resource loader.". |
Of course, here is the Java code you requested:
```java
public void put(Object name, Object value) {
this.source.put((name != null) ? name.toString() : null, value);
}
```
Hope this helps! | Create a Java method that does the following: "Sets the value of the specified property.". |
Of course, here is the Java code you requested:
```java
public static boolean hasAtLeastOneFieldOrMethod(ClassNode node, String... types) {
Set<String> typesSet = new HashSet<>(Arrays.asList(types));
for (FieldNode field : node.getFields()) {
if (typesSet.contains(field.getType().getName())) {
return true;
... | Create a Java method that does the following: "Checks if the given class node has at least one field or method with the given types.". |
Of course, here is the Java code you requested:
```java
public static boolean subclasses(ClassNode node, String... types) {
for (String type : types) {
if (node.getSuperClass().getName().equals(type)) {
return true;
}
}
return false;
}
```
Hope this helps! | Create a Java method that does the following: "Checks if the class node is subclasses of the given types.". |
Of course, here is the Java code you requested:
```java
public void merge(ConfigurationMetadata metadata) {
for (ItemMetadata additionalItem : metadata.getItems()) {
mergeItemMetadata(additionalItem);
}
for (ItemHint itemHint : metadata.getHints()) {
add(itemHint);
}
}
```
Hope this helps! | Create a Java method that does the following: "Merge the given configuration metadata into this one.". |
Of course, here is the Java code you requested:
```java
protected void handle(HttpConnection httpConnection) throws IOException {
try {
getServerThread().handleIncomingHttp(httpConnection);
httpConnection.waitForResponse();
}
catch (ConnectException ex) {
httpConnection.respond(HttpStatus.GONE);
}
}
... | Create a Java method that does the following: "Handle incoming HTTP connection.". |
Of course, here is the Java code you requested:
```java
public Mono<AccessLevel> getAccessLevel(String token, String applicationId)
throws CloudFoundryAuthorizationException {
String uri = getPermissionsUri(applicationId);
return this.webClient.get().uri(uri).header("Authorization", "bearer " + token)
.retr... | Create a Java method that does the following: "Get the access level for the given token.". |
Of course, here is the Java code you requested:
```java
public Mono<String> getUaaUrl() {
this.uaaUrl = this.webClient.get().uri(this.cloudControllerUrl + "/info")
.retrieve().bodyToMono(Map.class)
.map((response) -> (String) response.get("token_endpoint")).cache()
.onErrorMap((ex) -> new CloudFoundryAut... | Create a Java method that does the following: "Get the UAA URL". |
Of course, here is the Java code you requested:
```java
protected final FilterArtifacts getFilters(ArtifactsFilter... additionalFilters) {
FilterArtifacts filters = new FilterArtifacts();
for (ArtifactsFilter additionalFilter : additionalFilters) {
filters.addFilter(additionalFilter);
}
filters.addFilter(
... | Create a Java method that does the following: "Gets the filters.". |
Of course, here is the Java code you requested:
```java
public static RootUriTemplateHandler addTo(RestTemplate restTemplate,
String rootUri) {
Assert.notNull(restTemplate, "RestTemplate must not be null");
RootUriTemplateHandler handler = new RootUriTemplateHandler(rootUri,
restTemplate.getUriTemplateHandl... | Create a Java method that does the following: "Add a RootUriTemplateHandler to the RestTemplate.". |
Of course, here is the Java code you requested:
```java
protected ModelAndView resolveErrorView(HttpServletRequest request,
HttpServletResponse response, HttpStatus status, Map<String, Object> model) {
for (ErrorViewResolver resolver : this.errorViewResolvers) {
ModelAndView modelAndView = resolver.resolveErro... | Create a Java method that does the following: "Resolves the error view.". |
Of course, here is the Java code you requested:
```java
public StaticResourceRequestMatcher at(Set<StaticResourceLocation> locations) {
Assert.notNull(locations, "Locations must not be null");
return new StaticResourceRequestMatcher(new LinkedHashSet<>(locations));
}
```
Hope this helps! | Create a Java method that does the following: "Returns a new matcher that matches static resource resources at the given locations.". |
Of course, here is the Java code you requested:
```java
public void addAll(ClassLoaderFiles files) {
Assert.notNull(files, "Files must not be null");
for (SourceFolder folder : files.getSourceFolders()) {
for (Map.Entry<String, ClassLoaderFile> entry : folder.getFilesEntrySet()) {
addFile(folder.getName(), ... | Create a Java method that does the following: "Adds all the class loader files to this class loader.". |
Of course, here is the Java code you requested:
```java
public void addFile(String sourceFolder, String name, ClassLoaderFile file) {
Assert.notNull(sourceFolder, "SourceFolder must not be null");
Assert.notNull(name, "Name must not be null");
Assert.notNull(file, "File must not be null");
removeAll(name);
g... | Create a Java method that does the following: "Add a file to the given source folder.". |
Of course, here is the Java code you requested:
```java
public int size() {
int size = 0;
for (SourceFolder sourceFolder : this.sourceFolders.values()) {
size += sourceFolder.getFiles().size();
}
return size;
}
```
Hope this helps! | Create a Java method that does the following: "Returns the number of files in this source folder.". |
Of course, here is the Java code you requested:
```java
public int getExitCode() {
int exitCode = 0;
for (ExitCodeGenerator generator : this.generators) {
try {
int value = generator.getExitCode();
if (value > 0 && value > exitCode || value < 0 && value < exitCode) {
exitCode = value;
}
}
... | Create a Java method that does the following: "Gets the exit code.". |
Of course, here is the Java code you requested:
```java
public final File getValidDirectory() {
File file = this.directory;
file = (file != null) ? file : getWarFileDocumentRoot();
file = (file != null) ? file : getExplodedWarFileDocumentRoot();
file = (file != null) ? file : getCommonDocumentRoot();
if (fil... | Create a Java method that does the following: "Returns the directory of the WAR file or the WAR file document root.". |
Of course, here is the Java code you requested:
```java
public void handle(ServerHttpRequest request, ServerHttpResponse response)
throws IOException {
try {
Assert.state(request.getHeaders().getContentLength() > 0, "No content");
ObjectInputStream objectInputStream = new ObjectInputStream(
request.get... | Create a Java method that does the following: "Handle a server HTTP request.". |
Of course, here is the Java code you requested:
```java
public boolean exists(ResourcePatternResolver resolver) {
Assert.notNull(resolver, "Resolver must not be null");
if (resolver.getResource(this.path).exists()) {
return true;
}
try {
return anyExists(resolver);
}
catch (IOException ex) {
retur... | Create a Java method that does the following: "Checks if the resource exists in the given resolver.". |
Of course, here is the Java code you requested:
```java
protected File getPortFile(ApplicationContext applicationContext) {
String namespace = getServerNamespace(applicationContext);
if (StringUtils.isEmpty(namespace)) {
return this.file;
}
String name = this.file.getName();
String extension = StringUtils... | Create a Java method that does the following: "Get the port file.". |
Of course, here is the Java code you requested:
```java
public static OperationInvoker apply(OperationInvoker invoker, long timeToLive) {
if (timeToLive > 0) {
return new CachingOperationInvoker(invoker, timeToLive);
}
return invoker;
}
```
Hope this helps! | Create a Java method that does the following: "Apply the given time to the given operation invoker.". |
Of course, here is the Java code you requested:
```java
public Object launch(Class<?>[] sources, String[] args) throws Exception {
Map<String, Object> defaultProperties = new HashMap<>();
defaultProperties.put("spring.groovy.template.check-template-location", "false");
Class<?> applicationClass = this.classLoade... | Create a Java method that does the following: "Launches the application with the given class and arguments.". |
Of course, here is the Java code you requested:
```java
public static ByteBuffer getPayloadData(ReadableByteChannel channel)
throws IOException {
ByteBuffer buffer = ByteBuffer.allocate(BUFFER_SIZE);
try {
int amountRead = channel.read(buffer);
Assert.state(amountRead != -1, "Target server connection clos... | Create a Java method that does the following: "Reads the payload data from the given channel.". |
Of course, here is the Java code you requested:
```java
public String toHexString() {
byte[] bytes = this.data.array();
char[] hex = new char[this.data.remaining() * 2];
for (int i = this.data.position(); i < this.data.remaining(); i++) {
int b = bytes[i] & 0xFF;
hex[i * 2] = HEX_CHARS[b >>> 4];
hex[i *... | Create a Java method that does the following: "Converts the data in this buffer to a hex string.". |
Of course, here is the Java code you requested:
```java
protected boolean isMain(Thread thread) {
return thread.getName().equals("main") && thread.getContextClassLoader()
.getClass().getName().contains("AppClassLoader");
}
```
Hope this helps! | Create a Java method that does the following: "Checks if the thread is the main thread.". |
Of course, here is the Java code you requested:
```java
public AccessLevel getAccessLevel(String token, String applicationId)
throws CloudFoundryAuthorizationException {
try {
URI uri = getPermissionsUri(applicationId);
RequestEntity<?> request = RequestEntity.get(uri)
.header("Authorization", "bearer ... | Create a Java method that does the following: "Get the access level for the given token and application id". |
Of course, here is the Java code you requested:
```java
public Map<String, String> fetchTokenKeys() {
try {
return extractTokenKeys(this.restTemplate
.getForObject(getUaaUrl() + "/token_keys", Map.class));
}
catch (HttpStatusCodeException ex) {
throw new CloudFoundryAuthorizationException(Reason.SERVI... | Create a Java method that does the following: "Fetch token keys from the UAA.". |
Of course, here is the Java code you requested:
```java
public static Log getLog(Class<?> source) {
synchronized (logs) {
Log log = new DeferredLog();
logs.put(log, source);
return log;
}
}
```
Hope this helps! | Create a Java method that does the following: "Get a log object for the given class.". |
Of course, here is the Java code you requested:
```java
public void setUrlMappings(Collection<String> urlMappings) {
Assert.notNull(urlMappings, "UrlMappings must not be null");
this.urlMappings = new LinkedHashSet<>(urlMappings);
}
```
Hope this helps! | Create a Java method that does the following: "Sets the url mappings.". |
Of course, here is the Java code you requested:
```java
public ProcessBuilder processBuilder(String... arguments) {
ProcessBuilder processBuilder = new ProcessBuilder(toString());
processBuilder.command().addAll(Arrays.asList(arguments));
return processBuilder;
}
```
Hope this helps! | Create a Java method that does the following: "Create a process builder with the specified arguments.". |
Of course, here is the Java code you requested:
```java
protected void initialize(ConfigurableEnvironment environment,
ClassLoader classLoader) {
new LoggingSystemProperties(environment).apply();
LogFile logFile = LogFile.get(environment);
if (logFile != null) {
logFile.applyToSystemProperties();
}
ini... | Create a Java method that does the following: "Initialize the logging system.". |
Of course, here is the Java code you requested:
```java
public RestTemplateBuilder messageConverters(
HttpMessageConverter<?>... messageConverters) {
Assert.notNull(messageConverters, "MessageConverters must not be null");
return messageConverters(Arrays.asList(messageConverters));
}
```
Hope this helps! | Create a Java method that does the following: "Sets the message converters to use.". |
Of course, here is the Java code you requested:
```java
public RestTemplateBuilder messageConverters(
Collection<? extends HttpMessageConverter<?>> messageConverters) {
Assert.notNull(messageConverters, "MessageConverters must not be null");
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri... | Create a Java method that does the following: "Create a new RestTemplateBuilder with the specified message converters.". |
Of course, here is the Java code you requested:
```java
public RestTemplateBuilder additionalMessageConverters(
Collection<? extends HttpMessageConverter<?>> messageConverters) {
Assert.notNull(messageConverters, "MessageConverters must not be null");
return new RestTemplateBuilder(this.detectRequestFactory, th... | Create a Java method that does the following: "Add additional message converters to the builder.". |
Of course, here is the Java code you requested:
```java
public RestTemplateBuilder additionalInterceptors(
ClientHttpRequestInterceptor... interceptors) {
Assert.notNull(interceptors, "interceptors must not be null");
return additionalInterceptors(Arrays.asList(interceptors));
}
```
Hope this helps! | Create a Java method that does the following: "Add additional interceptors to the rest template.". |
Of course, here is the Java code you requested:
```java
public RestTemplateBuilder additionalInterceptors(
Collection<? extends ClientHttpRequestInterceptor> interceptors) {
Assert.notNull(interceptors, "interceptors must not be null");
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
... | Create a Java method that does the following: "Add additional interceptors to the builder.". |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.