code
stringlengths
146
466k
prompt
stringlengths
54
1.5k
Of course, here is the Java code you requested: ```java public RestTemplateBuilder requestFactory( Class<? extends ClientHttpRequestFactory> requestFactory) { Assert.notNull(requestFactory, "RequestFactory must not be null"); return requestFactory(() -> createRequestFactory(requestFactory)); } ``` Hope this h...
Create a Java method that does the following: "Sets the request factory.".
Of course, here is the Java code you requested: ```java public RestTemplateBuilder uriTemplateHandler(UriTemplateHandler uriTemplateHandler) { Assert.notNull(uriTemplateHandler, "UriTemplateHandler must not be null"); return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, this.messageConverter...
Create a Java method that does the following: "Sets the URI template handler.".
Of course, here is the Java code you requested: ```java public RestTemplateBuilder basicAuthentication(String username, String password) { return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, this.messageConverters, this.requestFactorySupplier, this.uriTemplateHandler, this.errorHandler, ...
Create a Java method that does the following: "Creates a new RestTemplateBuilder with a BasicAuthenticationInterceptor.".
Of course, here is the Java code you requested: ```java public RestTemplateBuilder customizers( Collection<? extends RestTemplateCustomizer> restTemplateCustomizers) { Assert.notNull(restTemplateCustomizers, "RestTemplateCustomizers must not be null"); return new RestTemplateBuilder(this.detectRequestFactor...
Create a Java method that does the following: "Create a new RestTemplateBuilder with the specified customizers.".
Of course, here is the Java code you requested: ```java public RestTemplateBuilder additionalCustomizers( Collection<? extends RestTemplateCustomizer> customizers) { Assert.notNull(customizers, "RestTemplateCustomizers must not be null"); return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, ...
Create a Java method that does the following: "Add additional customizers to the builder.".
Of course, here is the Java code you requested: ```java public RestTemplateBuilder setConnectTimeout(Duration connectTimeout) { return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, this.messageConverters, this.requestFactorySupplier, this.uriTemplateHandler, this.errorHandler, this.basicAu...
Create a Java method that does the following: "Sets the connect timeout.".
Of course, here is the Java code you requested: ```java public RestTemplateBuilder setReadTimeout(Duration readTimeout) { return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, this.messageConverters, this.requestFactorySupplier, this.uriTemplateHandler, this.errorHandler, this.basicAuthenti...
Create a Java method that does the following: "Sets the read timeout.".
Of course, here is the Java code you requested: ```java public <T extends RestTemplate> T build(Class<T> restTemplateClass) { return configure(BeanUtils.instantiateClass(restTemplateClass)); } ``` Hope this helps!
Create a Java method that does the following: "Build a RestTemplate instance from a class.".
Of course, here is the Java code you requested: ```java public static ConfigurationMetadataRepositoryJsonBuilder create( InputStream... inputStreams) throws IOException { ConfigurationMetadataRepositoryJsonBuilder builder = create(); for (InputStream inputStream : inputStreams) { builder = builder.withJsonRe...
Create a Java method that does the following: "Creates a new ConfigurationMetadataRepositoryJsonBuilder with the given input streams.".
Of course, here is the Java code you requested: ```java protected final void addJspServlet(WebAppContext context) { Assert.notNull(context, "Context must not be null"); ServletHolder holder = new ServletHolder(); holder.setName("jsp"); holder.setClassName(getJsp().getClassName()); holder.setInitParameter("fo...
Create a Java method that does the following: "Adds the jsp servlet to the web application context.".
Of course, here is the Java code you requested: ```java private Configuration getErrorPageConfiguration() { return new AbstractConfiguration() { @Override public void configure(WebAppContext context) throws Exception { ErrorHandler errorHandler = context.getErrorHandler(); context.setErrorHandler(new ...
Create a Java method that does the following: "Returns an instance of the configuration object that will be used to configure the error page.".
Of course, here is the Java code you requested: ```java public static Database getDatabase(DataSource dataSource) { if (dataSource == null) { return Database.DEFAULT; } try { String url = JdbcUtils.extractDatabaseMetaData(dataSource, "getURL"); DatabaseDriver driver = DatabaseDriver.fromJdbcUrl(url); ...
Create a Java method that does the following: "Get the database from the given datasource".
Of course, here is the Java code you requested: ```java public String nextString(char quote) throws JSONException { /* * For strings that are free of escape sequences, we can just extract the result * as a substring of the input. But if we encounter an escape sequence, we need to * use a StringBuilder to co...
Create a Java method that does the following: "Returns the next string in the input.".
Of course, here is the Java code you requested: ```java private JSONArray readArray() throws JSONException { JSONArray result = new JSONArray(); /* to cover input that ends with ",]". */ boolean hasTrailingSeparator = false; while (true) { switch (nextCleanInternal()) { case -1: throw syntaxError("...
Create a Java method that does the following: "Reads an array.".
Of course, here is the Java code you requested: ```java protected final RedisClusterConfiguration getClusterConfiguration() { if (this.clusterConfiguration != null) { return this.clusterConfiguration; } if (this.properties.getCluster() == null) { return null; } RedisProperties.Cluster clusterProperties...
Create a Java method that does the following: "Gets the cluster configuration.".
Of course, here is the Java code you requested: ```java private boolean hasLombokPublicAccessor(MetadataGenerationEnvironment env, boolean getter) { String annotation = (getter ? LOMBOK_GETTER_ANNOTATION : LOMBOK_SETTER_ANNOTATION); AnnotationMirror lombokMethodAnnotationOnField = env.getAnnotation(getField...
Create a Java method that does the following: "Checks if the given environment has a public accessor on the LOMBOK_ACCESS_TYPE field.".
Of course, here is the Java code you requested: ```java public static List<RepositoryConfiguration> createDefaultRepositoryConfiguration() { MavenSettings mavenSettings = new MavenSettingsReader().readSettings(); List<RepositoryConfiguration> repositoryConfiguration = new ArrayList<>(); repositoryConfiguration.a...
Create a Java method that does the following: "Creates a default repository configuration.".
Of course, here is the Java code you requested: ```java protected AutoConfigurationEntry getAutoConfigurationEntry( AutoConfigurationMetadata autoConfigurationMetadata, AnnotationMetadata annotationMetadata) { if (!isEnabled(annotationMetadata)) { return EMPTY_ENTRY; } AnnotationAttributes attributes = ...
Create a Java method that does the following: "Gets the AutoConfigurationEntry for the given annotation metadata.".
Of course, here is the Java code you requested: ```java protected AnnotationAttributes getAttributes(AnnotationMetadata metadata) { String name = getAnnotationClass().getName(); AnnotationAttributes attributes = AnnotationAttributes .fromMap(metadata.getAnnotationAttributes(name, true)); Assert.notNull(attri...
Create a Java method that does the following: "Get the attribute map from the annotation metadata.".
Of course, here is the Java code you requested: ```java protected List<String> getCandidateConfigurations(AnnotationMetadata metadata, AnnotationAttributes attributes) { List<String> configurations = SpringFactoriesLoader.loadFactoryNames( getSpringFactoriesLoaderFactoryClass(), getBeanClassLoader()); Asser...
Create a Java method that does the following: "Get the list of configuration classes that are found in META - INF. spring. factories.".
Of course, here is the Java code you requested: ```java protected void handleInvalidExcludes(List<String> invalidExcludes) { StringBuilder message = new StringBuilder(); for (String exclude : invalidExcludes) { message.append("\t- ").append(exclude).append(String.format("%n")); } throw new IllegalStateExcep...
Create a Java method that does the following: "Handle invalid excludes.".
Of course, here is the Java code you requested: ```java protected Set<String> getExclusions(AnnotationMetadata metadata, AnnotationAttributes attributes) { Set<String> excluded = new LinkedHashSet<>(); excluded.addAll(asList(attributes, "exclude")); excluded.addAll(Arrays.asList(attributes.getStringArray("exc...
Create a Java method that does the following: "Returns the set of excluded annotations.".
Of course, here is the Java code you requested: ```java protected Configurations merge(Configurations other) { Set<Class<?>> mergedClasses = new LinkedHashSet<>(getClasses()); mergedClasses.addAll(other.getClasses()); return merge(mergedClasses); } ``` Hope this helps!
Create a Java method that does the following: "Merge two configurations.".
Of course, here is the Java code you requested: ```java public static Class<?>[] getClasses(Collection<Configurations> configurations) { List<Configurations> ordered = new ArrayList<>(configurations); ordered.sort(COMPARATOR); List<Configurations> collated = collate(ordered); LinkedHashSet<Class<?>> classes = ...
Create a Java method that does the following: "Get all classes from a collection of configurations.".
Of course, here is the Java code you requested: ```java public Map<String, Link> resolveLinks(String requestUrl) { String normalizedUrl = normalizeRequestUrl(requestUrl); Map<String, Link> links = new LinkedHashMap<>(); links.put("self", new Link(normalizedUrl)); for (ExposableEndpoint<?> endpoint : this.endpo...
Create a Java method that does the following: "Resolves the links for the given request URL.".
Of course, here is the Java code you requested: ```java static void addToRootFileCache(File sourceFile, JarFile jarFile) { Map<File, JarFile> cache = rootFileCache.get(); if (cache == null) { cache = new ConcurrentHashMap<>(); rootFileCache = new SoftReference<>(cache); } cache.put(sourceFile, jarFile); ...
Create a Java method that does the following: "Add a file to the cache of root files.".
Of course, here is the Java code you requested: ```java protected UndertowServletWebServer getUndertowWebServer(Builder builder, DeploymentManager manager, int port) { return new UndertowServletWebServer(builder, manager, getContextPath(), isUseForwardHeaders(), port >= 0, getCompression(), getServerHeader())...
Create a Java method that does the following: "Get the UndertowServletWebServer instance.".
Of course, here is the Java code you requested: ```java public void write(File file) throws IOException { Assert.state(this.pid != null, "No PID available"); createParentFolder(file); if (file.exists()) { assertCanOverwrite(file); } try (FileWriter writer = new FileWriter(file)) { writer.append(this.pi...
Create a Java method that does the following: "Write the PID to the specified file.".
Of course, here is the Java code you requested: ```java public void addUrls(Collection<URL> urls) { Assert.notNull(urls, "Urls must not be null"); this.urls.addAll(urls); } ``` Hope this helps!
Create a Java method that does the following: "Add a collection of URLs to the list of URLs.".
Of course, here is the Java code you requested: ```java public void restart(FailureHandler failureHandler) { if (!this.enabled) { this.logger.debug("Application restart is disabled"); return; } this.logger.debug("Restarting application"); getLeakSafeThread().call(() -> { Restarter.this.stop(); Rest...
Create a Java method that does the following: "Restart the application.".
Of course, here is the Java code you requested: ```java protected void stop() throws Exception { this.logger.debug("Stopping application"); this.stopLock.lock(); try { for (ConfigurableApplicationContext context : this.rootContexts) { context.close(); this.rootContexts.remove(context); } cleanup...
Create a Java method that does the following: "Stop the application.".
Of course, here is the Java code you requested: ```java void finish() { synchronized (this.monitor) { if (!isFinished()) { this.logger = DeferredLog.replay(this.logger, LogFactory.getLog(getClass())); this.finished = true; } } } ``` Hope this helps!
Create a Java method that does the following: "Finishes the processing of the transaction.".
Of course, here is the Java code you requested: ```java public static void initialize(String[] args, RestartInitializer initializer) { initialize(args, false, initializer, true); } ``` Hope this helps!
Create a Java method that does the following: "Initialize the server with the given arguments.".
Of course, here is the Java code you requested: ```java public static void initialize(String[] args, boolean forceReferenceCleanup, RestartInitializer initializer) { initialize(args, forceReferenceCleanup, initializer, true); } ``` Hope this helps!
Create a Java method that does the following: "Initialize the context.".
Of course, here is the Java code you requested: ```java public static void initialize(String[] args, boolean forceReferenceCleanup, RestartInitializer initializer, boolean restartOnInitialize) { Restarter localInstance = null; synchronized (INSTANCE_MONITOR) { if (instance == null) { localInstance = new ...
Create a Java method that does the following: "Initializes the Restarter.".
Of course, here is the Java code you requested: ```java public HazelcastInstance getHazelcastInstance() { if (StringUtils.hasText(this.config.getInstanceName())) { return Hazelcast.getOrCreateHazelcastInstance(this.config); } return Hazelcast.newHazelcastInstance(this.config); } ``` Hope this helps!
Create a Java method that does the following: "Get the Hazelcast instance.".
Of course, here is the Java code you requested: ```java public WebEndpointResponse<Health> map(Health health, SecurityContext securityContext) { return map(health, securityContext, this.showDetails); } ``` Hope this helps!
Create a Java method that does the following: "Map the health to a response object.".
Of course, here is the Java code you requested: ```java public String getLastElement(Form form) { int size = getNumberOfElements(); return (size != 0) ? getElement(size - 1, form) : EMPTY_STRING; } ``` Hope this helps!
Create a Java method that does the following: "Gets the last element in the list.".
Of course, here is the Java code you requested: ```java public ConfigurationPropertyName append(String elementValue) { if (elementValue == null) { return this; } Elements additionalElements = probablySingleElementOf(elementValue); return new ConfigurationPropertyName(this.elements.append(additionalElements)...
Create a Java method that does the following: "Appends the given element value to this property name.".
Of course, here is the Java code you requested: ```java public boolean isParentOf(ConfigurationPropertyName name) { Assert.notNull(name, "Name must not be null"); if (this.getNumberOfElements() != name.getNumberOfElements() - 1) { return false; } return isAncestorOf(name); } ``` Hope this helps!
Create a Java method that does the following: "Checks if this property name is the parent of the given property name.".
Of course, here is the Java code you requested: ```java public boolean isAncestorOf(ConfigurationPropertyName name) { Assert.notNull(name, "Name must not be null"); if (this.getNumberOfElements() >= name.getNumberOfElements()) { return false; } return elementsEqual(name); } ``` Hope this helps!
Create a Java method that does the following: "Checks if this configuration property name is an ancestor of the given name.".
Of course, here is the Java code you requested: ```java static ConfigurationPropertyName of(CharSequence name, boolean returnNullIfInvalid) { Elements elements = elementsOf(name, returnNullIfInvalid); return (elements != null) ? new ConfigurationPropertyName(elements) : null; } ``` Hope this helps!
Create a Java method that does the following: "Returns a new instance of the class with the specified name.".
Of course, here is the Java code you requested: ```java static ConfigurationPropertyName adapt(CharSequence name, char separator, Function<CharSequence, CharSequence> elementValueProcessor) { Assert.notNull(name, "Name must not be null"); if (name.length() == 0) { return EMPTY; } Elements elements = new ...
Create a Java method that does the following: "Adapt a configuration property name.".
Of course, here is the Java code you requested: ```java public void addCommands(Iterable<Command> commands) { Assert.notNull(commands, "Commands must not be null"); for (Command command : commands) { addCommand(command); } } ``` Hope this helps!
Create a Java method that does the following: "Adds commands to the command list.".
Of course, here is the Java code you requested: ```java public Command findCommand(String name) { for (Command candidate : this.commands) { String candidateName = candidate.getName(); if (candidateName.equals(name) || (isOptionCommand(candidate) && ("--" + candidateName).equals(name))) { return candid...
Create a Java method that does the following: "Find command by name.".
Of course, here is the Java code you requested: ```java public int runAndHandleErrors(String... args) { String[] argsWithoutDebugFlags = removeDebugFlags(args); boolean debug = argsWithoutDebugFlags.length != args.length; if (debug) { System.setProperty("debug", "true"); } try { ExitStatus result = run...
Create a Java method that does the following: "Run the command and handle errors.".
Of course, here is the Java code you requested: ```java protected ExitStatus run(String... args) throws Exception { if (args.length == 0) { throw new NoArgumentsException(); } String commandName = args[0]; String[] commandArguments = Arrays.copyOfRange(args, 1, args.length); Command command = findCommand(...
Create a Java method that does the following: "Run the command.".
Of course, here is the Java code you requested: ```java @SuppressWarnings("unchecked") private Map<String, Object> safeSerialize(ObjectMapper mapper, Object bean, String prefix) { try { return new HashMap<>(mapper.convertValue(bean, Map.class)); } catch (Exception ex) { return new HashMap<>(Collections...
Create a Java method that does the following: "Serialize a bean to a Map.".
Of course, here is the Java code you requested: ```java protected void configureObjectMapper(ObjectMapper mapper) { mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); mapper.configure(MapperFeature.USE_STD_BEAN_NAMING, true); mapper.setSerializationInclusion(Include.NON_NULL); applyConfiguratio...
Create a Java method that does the following: "Configure the given object mapper.".
Of course, here is the Java code you requested: ```java public Object sanitize(String key, Object value) { if (value == null) { return null; } for (Pattern pattern : this.keysToSanitize) { if (pattern.matcher(key).matches()) { return "******"; } } return value; } ``` Hope this helps!
Create a Java method that does the following: "Sanitize the given value.".
Of course, here is the Java code you requested: ```java public static Tag uri(ClientRequest request) { String uri = (String) request.attribute(URI_TEMPLATE_ATTRIBUTE) .orElseGet(() -> request.url().getPath()); return Tag.of("uri", extractPath(uri)); } ``` Hope this helps!
Create a Java method that does the following: "Get the URI of the request.".
Of course, here is the Java code you requested: ```java public static Tag clientName(ClientRequest request) { String host = request.url().getHost(); if (host == null) { return CLIENT_NAME_NONE; } return Tag.of("clientName", host); } ``` Hope this helps!
Create a Java method that does the following: "Gets the client name.".
Of course, here is the Java code you requested: ```java public static Tag outcome(ClientResponse response) { try { if (response != null) { HttpStatus status = response.statusCode(); if (status.is1xxInformational()) { return OUTCOME_INFORMATIONAL; } if (status.is2xxSuccessful()) { return ...
Create a Java method that does the following: "Returns the outcome of the response.".
Of course, here is the Java code you requested: ```java public static SQLDialect getDialect(DataSource dataSource) { if (dataSource == null) { return SQLDialect.DEFAULT; } try { String url = JdbcUtils.extractDatabaseMetaData(dataSource, "getURL"); SQLDialect sqlDialect = JDBCUtils.dialect(url); if (s...
Create a Java method that does the following: "Get the SQL dialect for the given datasource.".
Of course, here is the Java code you requested: ```java public JSONObject accumulate(String name, Object value) throws JSONException { Object current = this.nameValuePairs.get(checkName(name)); if (current == null) { return put(name, value); } // check in accumulate, since array.put(Object) doesn't do any ...
Create a Java method that does the following: "Accumulate a name - value pair into this object.".
Of course, here is the Java code you requested: ```java public boolean optBoolean(String name, boolean fallback) { Object object = opt(name); 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 a name.".
Of course, here is the Java code you requested: ```java public double optDouble(String name, double fallback) { Object object = opt(name); Double result = JSON.toDouble(object); return result != null ? result : fallback; } ``` Hope this helps!
Create a Java method that does the following: "Get the property as a double or fallback if the property is not present or is not a double.".
Of course, here is the Java code you requested: ```java public int optInt(String name, int fallback) { Object object = opt(name); Integer result = JSON.toInteger(object); return result != null ? result : fallback; } ``` Hope this helps!
Create a Java method that does the following: "Get the optional int value associated with the given name.".
Of course, here is the Java code you requested: ```java public long getLong(String name) throws JSONException { Object object = get(name); Long result = JSON.toLong(object); if (result == null) { throw JSON.typeMismatch(name, object, "long"); } return result; } ``` Hope this helps!
Create a Java method that does the following: "Get a long property.".
Of course, here is the Java code you requested: ```java public JSONArray optJSONArray(String name) { Object object = opt(name); return object instanceof JSONArray ? (JSONArray) object : null; } ``` Hope this helps!
Create a Java method that does the following: "Get the optional JSONArray value associated with a name.".
Of course, here is the Java code you requested: ```java public JSONObject getJSONObject(String name) throws JSONException { Object object = get(name); if (object instanceof JSONObject) { return (JSONObject) object; } else { throw JSON.typeMismatch(name, object, "JSONObject"); } } ``` Hope this helps!
Create a Java method that does the following: "Get the named attribute as a JSONObject.".
Of course, here is the Java code you requested: ```java public JSONObject optJSONObject(String name) { Object object = opt(name); return object instanceof JSONObject ? (JSONObject) object : null; } ``` Hope this helps!
Create a Java method that does the following: "Get the optional JSONObject associated with a name.".
Of course, here is the Java code you requested: ```java public static String numberToString(Number number) throws JSONException { if (number == null) { throw new JSONException("Number must be non-null"); } double doubleValue = number.doubleValue(); JSON.checkDouble(doubleValue); // the original returns ...
Create a Java method that does the following: "Convert a number to a string.".
Of course, here is the Java code you requested: ```java public static String quote(String data) { if (data == null) { return "\"\""; } try { JSONStringer stringer = new JSONStringer(); stringer.open(JSONStringer.Scope.NULL, ""); stringer.value(data); stringer.close(JSONStringer.Scope.NULL, JSONStr...
Create a Java method that does the following: "Quote a string.".
Of course, here is the Java code you requested: ```java public TaskExecutorBuilder customizers(TaskExecutorCustomizer... 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 Task Executor Customizers to the builder.".
Of course, here is the Java code you requested: ```java public TaskExecutorBuilder additionalCustomizers( TaskExecutorCustomizer... 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 executor.".
Of course, here is the Java code you requested: ```java public <T extends ThreadPoolTaskExecutor> T build(Class<T> taskExecutorClass) { return configure(BeanUtils.instantiateClass(taskExecutorClass)); } ``` Hope this helps!
Create a Java method that does the following: "Build a new instance of the given class.".
Of course, here is the Java code you requested: ```java public void configure(DefaultJmsListenerContainerFactory factory, ConnectionFactory connectionFactory) { Assert.notNull(factory, "Factory must not be null"); Assert.notNull(connectionFactory, "ConnectionFactory must not be null"); factory.setConnectionFa...
Create a Java method that does the following: "Configures the given container factory with the given connection factory.".
Of course, here is the Java code you requested: ```java public void add(Collection<ConfigurationMetadataSource> sources) { for (ConfigurationMetadataSource source : sources) { String groupId = source.getGroupId(); ConfigurationMetadataGroup group = this.allGroups.get(groupId); if (group == null) { group...
Create a Java method that does the following: "Adds the collection of configuration metadata sources to this configuration metadata.".
Of course, here is the Java code you requested: ```java public void include(ConfigurationMetadataRepository repository) { for (ConfigurationMetadataGroup group : repository.getAllGroups().values()) { ConfigurationMetadataGroup existingGroup = this.allGroups.get(group.getId()); if (existingGroup == null) { ...
Create a Java method that does the following: "Merge all configuration metadata from the given repository into this repository.".
Of course, here is the Java code you requested: ```java protected ServletWebServerFactory getWebServerFactory() { // Use bean names so that we don't consider the hierarchy String[] beanNames = getBeanFactory() .getBeanNamesForType(ServletWebServerFactory.class); if (beanNames.length == 0) { throw new Appl...
Create a Java method that does the following: "Get the ServletWebServerFactory instance.".
Of course, here is the Java code you requested: ```java protected void prepareWebApplicationContext(ServletContext servletContext) { Object rootContext = servletContext.getAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); if (rootContext != null) { if (rootContext == this) { thro...
Create a Java method that does the following: "Prepare the Spring embedded WebApplicationContext.".
Of course, here is the Java code you requested: ```java @Override public void setEnvironment(ConfigurableEnvironment environment) { super.setEnvironment(environment); this.reader.setEnvironment(environment); this.scanner.setEnvironment(environment); } ``` Hope this helps!
Create a Java method that does the following: "Sets the environment.".
Of course, here is the Java code you requested: ```java public void setBeanNameGenerator(BeanNameGenerator beanNameGenerator) { this.reader.setBeanNameGenerator(beanNameGenerator); this.scanner.setBeanNameGenerator(beanNameGenerator); this.getBeanFactory().registerSingleton( AnnotationConfigUtils.CONFIGURATI...
Create a Java method that does the following: "Sets the bean name generator.".
Of course, here is the Java code you requested: ```java @Override public final void register(Class<?>... annotatedClasses) { Assert.notEmpty(annotatedClasses, "At least one annotated class must be specified"); this.annotatedClasses.addAll(Arrays.asList(annotatedClasses)); } ``` Hope this helps!
Create a Java method that does the following: "Registers the specified annotated classes.".
Of course, here is the Java code you requested: ```java protected void configureSsl(SslContextFactory factory, Ssl ssl, SslStoreProvider sslStoreProvider) { factory.setProtocol(ssl.getProtocol()); configureSslClientAuth(factory, ssl); configureSslPasswords(factory, ssl); factory.setCertAlias(ssl.getKeyAlias...
Create a Java method that does the following: "Configure the SSL.".
Of course, here is the Java code you requested: ```java private String getConnectionFactoryName(String beanName) { if (beanName.length() > CONNECTION_FACTORY_SUFFIX.length() && StringUtils.endsWithIgnoreCase(beanName, CONNECTION_FACTORY_SUFFIX)) { return beanName.substring(0, beanName.length() - CONNECTI...
Create a Java method that does the following: "Get the connection factory name.".
Of course, here is the Java code you requested: ```java public void configure( ConcurrentKafkaListenerContainerFactory<Object, Object> listenerFactory, ConsumerFactory<Object, Object> consumerFactory) { listenerFactory.setConsumerFactory(consumerFactory); configureListenerFactory(listenerFactory); configur...
Create a Java method that does the following: "Configure the Kafka listener container factory and consumer factory.".
Of course, here is the Java code you requested: ```java protected Identifier getIdentifier(String name, boolean quoted, JdbcEnvironment jdbcEnvironment) { if (isCaseInsensitive(jdbcEnvironment)) { name = name.toLowerCase(Locale.ROOT); } return new Identifier(name, quoted); } ``` Hope this helps!
Create a Java method that does the following: "Returns an Identifier object for the given name.".
Of course, here is the Java code you requested: ```java public Map<String, OriginTrackedValue> load(boolean expandLists) throws IOException { try (CharacterReader reader = new CharacterReader(this.resource)) { Map<String, OriginTrackedValue> result = new LinkedHashMap<>(); StringBuilder buffer = new StringBuil...
Create a Java method that does the following: "Load the OriginTrackedValue object from the file.".
Of course, here is the Java code you requested: ```java private ArtemisMode deduceMode() { if (this.properties.getEmbedded().isEnabled() && ClassUtils.isPresent(EMBEDDED_JMS_CLASS, null)) { return ArtemisMode.EMBEDDED; } return ArtemisMode.NATIVE; } ``` Hope this helps!
Create a Java method that does the following: "Deduces the ArtemisMode from the properties.".
Of course, here is the Java code you requested: ```java public Map<String, Object> buildProducerProperties() { Map<String, Object> properties = buildCommonProperties(); properties.putAll(this.producer.buildProperties()); return properties; } ``` Hope this helps!
Create a Java method that does the following: "Build the properties for the producer.".
Of course, here is the Java code you requested: ```java public <T> T execute(long wait, int maxAttempts, Callable<T> callback) throws Exception { getLog().debug("Waiting for spring application to start..."); for (int i = 0; i < maxAttempts; i++) { T result = callback.call(); if (result != null) { retu...
Create a Java method that does the following: "Execute the given callable waiting for the application to start before the configured timeout.".
Of course, here is the Java code you requested: ```java public void applyTo(Properties properties) { put(properties, LoggingSystemProperties.LOG_PATH, this.path); put(properties, LoggingSystemProperties.LOG_FILE, toString()); } ``` Hope this helps!
Create a Java method that does the following: "Set the logging properties to the given properties object.".
Of course, here is the Java code you requested: ```java public static LogFile get(PropertyResolver propertyResolver) { String file = getLogFileProperty(propertyResolver, FILE_NAME_PROPERTY, FILE_PROPERTY); String path = getLogFileProperty(propertyResolver, FILE_PATH_PROPERTY, PATH_PROPERTY); if (StringUt...
Create a Java method that does the following: "Get the LogFile object from the properties.".
Of course, here is the Java code you requested: ```java public void setInitParameters(Map<String, String> initParameters) { Assert.notNull(initParameters, "InitParameters must not be null"); this.initParameters = new LinkedHashMap<>(initParameters); } ``` Hope this helps!
Create a Java method that does the following: "Sets the init parameters.".
Of course, here is the Java code you requested: ```java public void addInitParameter(String name, String value) { Assert.notNull(name, "Name must not be null"); this.initParameters.put(name, value); } ``` Hope this helps!
Create a Java method that does the following: "Add an init parameter to the request.".
Of course, here is the Java code you requested: ```java protected final String getOrDeduceName(Object value) { return (this.name != null) ? this.name : Conventions.getVariableName(value); } ``` Hope this helps!
Create a Java method that does the following: "Get the name of the object or deduces it if it is null.".
Of course, here is the Java code you requested: ```java public Map<String, Object> determineHibernateProperties( Map<String, String> jpaProperties, HibernateSettings settings) { Assert.notNull(jpaProperties, "JpaProperties must not be null"); Assert.notNull(settings, "Settings must not be null"); return getAd...
Create a Java method that does the following: "Determine the Hibernate properties for the given JPA properties.".
Of course, here is the Java code you requested: ```java private String getCacheManagerName(String beanName) { if (beanName.length() > CACHE_MANAGER_SUFFIX.length() && StringUtils.endsWithIgnoreCase(beanName, CACHE_MANAGER_SUFFIX)) { return beanName.substring(0, beanName.length() - CACHE_MANAGER_SUFFIX.le...
Create a Java method that does the following: "Returns the cache manager name.".
Of course, here is the Java code you requested: ```java public static void removeDuplicatesFromOutputDirectory(File outputDirectory, File originDirectory) { if (originDirectory.isDirectory()) { for (String name : originDirectory.list()) { File targetFile = new File(outputDirectory, name); if (targetFil...
Create a Java method that does the following: "Removes duplicate files from the originDirectory to the outputDirectory.".
Of course, here is the Java code you requested: ```java public <T> BindResult<T> bind(String name, Class<T> target) { return bind(name, Bindable.of(target)); } ``` Hope this helps!
Create a Java method that does the following: "Binds the given class to the named parameter.".
Of course, here is the Java code you requested: ```java public SQLDialect determineSqlDialect(DataSource dataSource) { if (this.sqlDialect != null) { return this.sqlDialect; } return SqlDialectLookup.getDialect(dataSource); } ``` Hope this helps!
Create a Java method that does the following: "Determine the SQL dialect to use for the given data source.".
Of course, here is the Java code you requested: ```java public static <E> Bindable<List<E>> listOf(Class<E> elementType) { return of(ResolvableType.forClassWithGenerics(List.class, elementType)); } ``` Hope this helps!
Create a Java method that does the following: "Create a Bindable instance for a List type.".
Of course, here is the Java code you requested: ```java public static <E> Bindable<Set<E>> setOf(Class<E> elementType) { return of(ResolvableType.forClassWithGenerics(Set.class, elementType)); } ``` Hope this helps!
Create a Java method that does the following: "Create a set type binding for the given element type.".
Of course, here is the Java code you requested: ```java public static <T> Bindable<T> of(ResolvableType type) { Assert.notNull(type, "Type must not be null"); ResolvableType boxedType = box(type); return new Bindable<>(type, boxedType, null, NO_ANNOTATIONS); } ``` Hope this helps!
Create a Java method that does the following: "Creates a new instance of the specified type.".
Of course, here is the Java code you requested: ```java public static Validator get(ApplicationContext applicationContext, Validator validator) { if (validator != null) { return wrap(validator, false); } return getExistingOrCreate(applicationContext); } ``` Hope this helps!
Create a Java method that does the following: "Returns a new instance of the specified validation class.".
Of course, here is the Java code you requested: ```java public static void register(BeanDefinitionRegistry registry, String... packageNames) { Assert.notNull(registry, "Registry must not be null"); Assert.notNull(packageNames, "PackageNames must not be null"); register(registry, Arrays.asList(packageNames)); } ...
Create a Java method that does the following: "Register bean definitions with the given registry.".
Of course, here is the Java code you requested: ```java protected String[] getSpringConfigLocations() { String[] locations = getStandardConfigLocations(); for (int i = 0; i < locations.length; i++) { String extension = StringUtils.getFilenameExtension(locations[i]); locations[i] = locations[i].substring(0, ...
Create a Java method that does the following: "Get the list of locations for the Spring configuration file.".
Of course, here is the Java code you requested: ```java public String getWarningReport() { Map<String, List<PropertyMigration>> content = getContent( LegacyProperties::getRenamed); if (content.isEmpty()) { return null; } StringBuilder report = new StringBuilder(); report.append(String.format("%nThe us...
Create a Java method that does the following: "Returns a string with a warning report for the configuration keys that have been renamed.".