Remove Implicit Type Parameters
This commit is contained in:
@@ -19,7 +19,7 @@ public class GlobalLockTask extends DefaultTask {
|
||||
throw new IllegalStateException("You just specify --write-locks argument");
|
||||
}
|
||||
writeLocksFor(taskProject);
|
||||
taskProject.getSubprojects().forEach(new Consumer<Project>() {
|
||||
taskProject.getSubprojects().forEach(new Consumer<>() {
|
||||
@Override
|
||||
public void accept(Project subproject) {
|
||||
writeLocksFor(subproject);
|
||||
@@ -28,7 +28,7 @@ public class GlobalLockTask extends DefaultTask {
|
||||
}
|
||||
|
||||
private void writeLocksFor(Project project) {
|
||||
project.getConfigurations().configureEach(new Action<Configuration>() {
|
||||
project.getConfigurations().configureEach(new Action<>() {
|
||||
@Override
|
||||
public void execute(Configuration configuration) {
|
||||
if (configuration.isCanBeResolved()) {
|
||||
|
||||
@@ -13,7 +13,7 @@ public class CheckAntoraVersionPlugin implements Plugin<Project> {
|
||||
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
TaskProvider<CheckAntoraVersionTask> antoraCheckVersion = project.getTasks().register(ANTORA_CHECK_VERSION_TASK_NAME, CheckAntoraVersionTask.class, new Action<CheckAntoraVersionTask>() {
|
||||
TaskProvider<CheckAntoraVersionTask> antoraCheckVersion = project.getTasks().register(ANTORA_CHECK_VERSION_TASK_NAME, CheckAntoraVersionTask.class, new Action<>() {
|
||||
@Override
|
||||
public void execute(CheckAntoraVersionTask antoraCheckVersion) {
|
||||
antoraCheckVersion.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP);
|
||||
@@ -23,10 +23,10 @@ public class CheckAntoraVersionPlugin implements Plugin<Project> {
|
||||
antoraCheckVersion.getAntoraYmlFile().fileProvider(project.provider(() -> project.file("antora.yml")));
|
||||
}
|
||||
});
|
||||
project.getPlugins().withType(LifecycleBasePlugin.class, new Action<LifecycleBasePlugin>() {
|
||||
project.getPlugins().withType(LifecycleBasePlugin.class, new Action<>() {
|
||||
@Override
|
||||
public void execute(LifecycleBasePlugin lifecycleBasePlugin) {
|
||||
project.getTasks().named(LifecycleBasePlugin.CHECK_TASK_NAME).configure(new Action<Task>() {
|
||||
project.getTasks().named(LifecycleBasePlugin.CHECK_TASK_NAME).configure(new Action<>() {
|
||||
@Override
|
||||
public void execute(Task check) {
|
||||
check.dependsOn(antoraCheckVersion);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class GitHubChangelogPlugin implements Plugin<Project> {
|
||||
public void apply(Project project) {
|
||||
createRepository(project);
|
||||
createChangelogGeneratorConfiguration(project);
|
||||
project.getTasks().register("generateChangelog", JavaExec.class, new Action<JavaExec>() {
|
||||
project.getTasks().register("generateChangelog", JavaExec.class, new Action<>() {
|
||||
@Override
|
||||
public void execute(JavaExec generateChangelog) {
|
||||
File outputFile = project.file(Paths.get(project.getBuildDir().getPath(), RELEASE_NOTES_PATH));
|
||||
@@ -49,7 +49,7 @@ public class GitHubChangelogPlugin implements Plugin<Project> {
|
||||
generateChangelog.setDescription("Generates the changelog");
|
||||
generateChangelog.setWorkingDir(project.getRootDir());
|
||||
generateChangelog.classpath(project.getConfigurations().getAt(CHANGELOG_GENERATOR_CONFIGURATION_NAME));
|
||||
generateChangelog.doFirst(new Action<Task>() {
|
||||
generateChangelog.doFirst(new Action<>() {
|
||||
@Override
|
||||
public void execute(Task task) {
|
||||
generateChangelog.args("--spring.config.location=scripts/release/release-notes-sections.yml", project.property("nextVersion"), outputFile.toString());
|
||||
@@ -60,10 +60,10 @@ public class GitHubChangelogPlugin implements Plugin<Project> {
|
||||
}
|
||||
|
||||
private void createChangelogGeneratorConfiguration(Project project) {
|
||||
project.getConfigurations().create(CHANGELOG_GENERATOR_CONFIGURATION_NAME, new Action<Configuration>() {
|
||||
project.getConfigurations().create(CHANGELOG_GENERATOR_CONFIGURATION_NAME, new Action<>() {
|
||||
@Override
|
||||
public void execute(Configuration configuration) {
|
||||
configuration.defaultDependencies(new Action<DependencySet>() {
|
||||
configuration.defaultDependencies(new Action<>() {
|
||||
@Override
|
||||
public void execute(DependencySet dependencies) {
|
||||
dependencies.add(project.getDependencies().create("spring-io:github-changelog-generator:0.0.6"));
|
||||
@@ -74,11 +74,11 @@ public class GitHubChangelogPlugin implements Plugin<Project> {
|
||||
}
|
||||
|
||||
private void createRepository(Project project) {
|
||||
IvyArtifactRepository repository = project.getRepositories().ivy(new Action<IvyArtifactRepository>() {
|
||||
IvyArtifactRepository repository = project.getRepositories().ivy(new Action<>() {
|
||||
@Override
|
||||
public void execute(IvyArtifactRepository repository) {
|
||||
repository.setUrl("https://github.com/");
|
||||
repository.patternLayout(new Action<IvyPatternRepositoryLayout>() {
|
||||
repository.patternLayout(new Action<>() {
|
||||
@Override
|
||||
public void execute(IvyPatternRepositoryLayout layout) {
|
||||
layout.artifact("[organization]/[artifact]/releases/download/v[revision]/[artifact].[ext]");
|
||||
@@ -87,11 +87,11 @@ public class GitHubChangelogPlugin implements Plugin<Project> {
|
||||
repository.getMetadataSources().artifact();
|
||||
}
|
||||
});
|
||||
project.getRepositories().exclusiveContent(new Action<ExclusiveContentRepository>() {
|
||||
project.getRepositories().exclusiveContent(new Action<>() {
|
||||
@Override
|
||||
public void execute(ExclusiveContentRepository exclusiveContentRepository) {
|
||||
exclusiveContentRepository.forRepositories(repository);
|
||||
exclusiveContentRepository.filter(new Action<InclusiveRepositoryContentDescriptor>() {
|
||||
exclusiveContentRepository.filter(new Action<>() {
|
||||
@Override
|
||||
public void execute(InclusiveRepositoryContentDescriptor descriptor) {
|
||||
descriptor.includeGroup("spring-io");
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.gradle.api.Project;
|
||||
public class GitHubMilestonePlugin implements Plugin<Project> {
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
project.getTasks().register("gitHubCheckMilestoneHasNoOpenIssues", GitHubMilestoneHasNoOpenIssuesTask.class, new Action<GitHubMilestoneHasNoOpenIssuesTask>() {
|
||||
project.getTasks().register("gitHubCheckMilestoneHasNoOpenIssues", GitHubMilestoneHasNoOpenIssuesTask.class, new Action<>() {
|
||||
@Override
|
||||
public void execute(GitHubMilestoneHasNoOpenIssuesTask githubCheckMilestoneHasNoOpenIssues) {
|
||||
githubCheckMilestoneHasNoOpenIssues.setGroup("Release");
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.gradle.api.Project;
|
||||
public class GitHubReleasePlugin implements Plugin<Project> {
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
project.getTasks().register("createGitHubRelease", CreateGitHubReleaseTask.class, new Action<CreateGitHubReleaseTask>() {
|
||||
project.getTasks().register("createGitHubRelease", CreateGitHubReleaseTask.class, new Action<>() {
|
||||
@Override
|
||||
public void execute(CreateGitHubReleaseTask createGitHubRelease) {
|
||||
createGitHubRelease.setGroup("Release");
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.gradle.api.publish.maven.plugins.MavenPublishPlugin;
|
||||
public class MavenPublishingConventionsPlugin implements Plugin<Project> {
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
project.getPlugins().withType(MavenPublishPlugin.class).all(new Action<MavenPublishPlugin>() {
|
||||
project.getPlugins().withType(MavenPublishPlugin.class).all(new Action<>() {
|
||||
@Override
|
||||
public void execute(MavenPublishPlugin mavenPublish) {
|
||||
PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class);
|
||||
|
||||
@@ -15,7 +15,7 @@ public class PublishAllJavaComponentsPlugin implements Plugin<Project> {
|
||||
public void apply(Project project) {
|
||||
project.getPlugins().withType(MavenPublishPlugin.class).all((mavenPublish) -> {
|
||||
PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class);
|
||||
publishing.getPublications().create("mavenJava", MavenPublication.class, new Action<MavenPublication>() {
|
||||
publishing.getPublications().create("mavenJava", MavenPublication.class, new Action<>() {
|
||||
@Override
|
||||
public void execute(MavenPublication maven) {
|
||||
project.getPlugins().withType(JavaPlugin.class, (plugin) -> {
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.gradle.api.Task;
|
||||
public class PublishArtifactsPlugin implements Plugin<Project> {
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
project.getTasks().register("publishArtifacts", new Action<Task>() {
|
||||
project.getTasks().register("publishArtifacts", new Action<>() {
|
||||
@Override
|
||||
public void execute(Task publishArtifacts) {
|
||||
publishArtifacts.setGroup("Publishing");
|
||||
|
||||
@@ -12,11 +12,11 @@ import org.gradle.api.publish.maven.plugins.MavenPublishPlugin;
|
||||
public class PublishLocalPlugin implements Plugin<Project> {
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
project.getPlugins().withType(MavenPublishPlugin.class).all(new Action<MavenPublishPlugin>() {
|
||||
project.getPlugins().withType(MavenPublishPlugin.class).all(new Action<>() {
|
||||
@Override
|
||||
public void execute(MavenPublishPlugin mavenPublish) {
|
||||
PublishingExtension publishing = project.getExtensions().getByType(PublishingExtension.class);
|
||||
publishing.getRepositories().maven(new Action<MavenArtifactRepository>() {
|
||||
publishing.getRepositories().maven(new Action<>() {
|
||||
@Override
|
||||
public void execute(MavenArtifactRepository maven) {
|
||||
maven.setName("local");
|
||||
|
||||
@@ -15,7 +15,7 @@ public class SpringNexusPublishPlugin implements Plugin<Project> {
|
||||
public void apply(Project project) {
|
||||
project.getPlugins().apply(NexusPublishPlugin.class);
|
||||
NexusPublishExtension nexusPublishing = project.getExtensions().findByType(NexusPublishExtension.class);
|
||||
nexusPublishing.getRepositories().create("ossrh", new Action<NexusRepository>() {
|
||||
nexusPublishing.getRepositories().create("ossrh", new Action<>() {
|
||||
@Override
|
||||
public void execute(NexusRepository nexusRepository) {
|
||||
nexusRepository.getNexusUrl().set(URI.create("https://s01.oss.sonatype.org/service/local/"));
|
||||
|
||||
@@ -30,7 +30,7 @@ public class SpringSigningPlugin implements Plugin<Project> {
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
project.getPluginManager().apply(SigningPlugin.class);
|
||||
project.getPlugins().withType(SigningPlugin.class).all(new Action<SigningPlugin>() {
|
||||
project.getPlugins().withType(SigningPlugin.class).all(new Action<>() {
|
||||
@Override
|
||||
public void execute(SigningPlugin signingPlugin) {
|
||||
boolean hasSigningKey = project.hasProperty("signing.keyId") || project.hasProperty("signingKey");
|
||||
@@ -50,7 +50,7 @@ public class SpringSigningPlugin implements Plugin<Project> {
|
||||
}
|
||||
});
|
||||
sign(project, signing);
|
||||
project.getPlugins().withType(PublishAllJavaComponentsPlugin.class).all(new Action<PublishAllJavaComponentsPlugin>() {
|
||||
project.getPlugins().withType(PublishAllJavaComponentsPlugin.class).all(new Action<>() {
|
||||
@Override
|
||||
public void execute(PublishAllJavaComponentsPlugin publishingPlugin) {
|
||||
PublishingExtension publishing = project.getExtensions().findByType(PublishingExtension.class);
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.gradle.api.Project;
|
||||
public class SaganPlugin implements Plugin<Project> {
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
project.getTasks().register("saganCreateRelease", SaganCreateReleaseTask.class, new Action<SaganCreateReleaseTask>() {
|
||||
project.getTasks().register("saganCreateRelease", SaganCreateReleaseTask.class, new Action<>() {
|
||||
@Override
|
||||
public void execute(SaganCreateReleaseTask saganCreateVersion) {
|
||||
saganCreateVersion.setGroup("Release");
|
||||
@@ -34,7 +34,7 @@ public class SaganPlugin implements Plugin<Project> {
|
||||
saganCreateVersion.setGitHubAccessToken((String) project.findProperty("gitHubAccessToken"));
|
||||
}
|
||||
});
|
||||
project.getTasks().register("saganDeleteRelease", SaganDeleteReleaseTask.class, new Action<SaganDeleteReleaseTask>() {
|
||||
project.getTasks().register("saganDeleteRelease", SaganDeleteReleaseTask.class, new Action<>() {
|
||||
@Override
|
||||
public void execute(SaganDeleteReleaseTask saganDeleteVersion) {
|
||||
saganDeleteVersion.setGroup("Release");
|
||||
|
||||
@@ -38,7 +38,7 @@ public class GitHubApi {
|
||||
String label = "\"type: dependency-upgrade\"";
|
||||
FindCreateIssueInputQuery findCreateIssueInputQuery = new FindCreateIssueInputQuery(owner, name, Input.optional(label), Input.optional(milestone));
|
||||
return Mono.create( sink -> this.apolloClient.query(findCreateIssueInputQuery)
|
||||
.enqueue(new ApolloCall.Callback<FindCreateIssueInputQuery.Data>() {
|
||||
.enqueue(new ApolloCall.Callback<>() {
|
||||
@Override
|
||||
public void onResponse(@NotNull Response<FindCreateIssueInputQuery.Data> response) {
|
||||
if (response.hasErrors()) {
|
||||
@@ -101,7 +101,7 @@ public class GitHubApi {
|
||||
|
||||
public Mono<RateLimitQuery.RateLimit> findRateLimit() {
|
||||
return Mono.create( sink -> this.apolloClient.query(new RateLimitQuery())
|
||||
.enqueue(new ApolloCall.Callback<RateLimitQuery.Data>() {
|
||||
.enqueue(new ApolloCall.Callback<>() {
|
||||
@Override
|
||||
public void onResponse(@NotNull Response<RateLimitQuery.Data> response) {
|
||||
if (response.hasErrors()) {
|
||||
@@ -126,7 +126,7 @@ public class GitHubApi {
|
||||
.assigneeId(assigneeId)
|
||||
.build();
|
||||
return Mono.create( sink -> this.apolloClient.mutate(createIssue)
|
||||
.enqueue(new ApolloCall.Callback<CreateIssueInputMutation.Data>() {
|
||||
.enqueue(new ApolloCall.Callback<>() {
|
||||
@Override
|
||||
public void onResponse(@NotNull Response<CreateIssueInputMutation.Data> response) {
|
||||
if (response.hasErrors()) {
|
||||
|
||||
@@ -71,7 +71,7 @@ public class UpdateDependenciesPlugin implements Plugin<Project> {
|
||||
String gitHubAccessToken = String.valueOf(project.findProperty("gitHubAccessToken"));
|
||||
updateDependenciesSettings.getGitHub().setAccessToken(gitHubAccessToken);
|
||||
}
|
||||
project.getTasks().register("updateDependencies", DependencyUpdatesTask.class, new Action<DependencyUpdatesTask>() {
|
||||
project.getTasks().register("updateDependencies", DependencyUpdatesTask.class, new Action<>() {
|
||||
@Override
|
||||
public void execute(DependencyUpdatesTask updateDependencies) {
|
||||
updateDependencies.setDescription("Update the dependencies");
|
||||
@@ -88,10 +88,10 @@ public class UpdateDependenciesPlugin implements Plugin<Project> {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
updateDependencies.resolutionStrategy(new Action<ResolutionStrategyWithCurrent>() {
|
||||
updateDependencies.resolutionStrategy(new Action<>() {
|
||||
@Override
|
||||
public void execute(ResolutionStrategyWithCurrent resolution) {
|
||||
resolution.componentSelection(new Action<ComponentSelectionRulesWithCurrent>() {
|
||||
resolution.componentSelection(new Action<>() {
|
||||
@Override
|
||||
public void execute(ComponentSelectionRulesWithCurrent components) {
|
||||
updateDependenciesSettings.getExcludes().getActions().forEach((action) -> {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class SpringMavenPluginITests {
|
||||
@Disabled
|
||||
@Test
|
||||
public void signArchivesWhenInMemory() throws Exception {
|
||||
LinkedHashMap<String, String> map = new LinkedHashMap<String, String>(2);
|
||||
LinkedHashMap<String, String> map = new LinkedHashMap<>(2);
|
||||
map.put("ORG_GRADLE_PROJECT_signingKey", getSigningKey());
|
||||
map.put("ORG_GRADLE_PROJECT_signingPassword", "password");
|
||||
BuildResult result = this.testKit.withProjectResource("samples/maven/signing")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2015 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -327,7 +327,7 @@ public class ContextSourceParser implements BeanDefinitionParser {
|
||||
String nonTransientExceptions = ParserUtils.getString(element, ATT_NON_TRANSIENT_EXCEPTIONS,
|
||||
CommunicationException.class.getName());
|
||||
String[] strings = StringUtils.commaDelimitedListToStringArray(nonTransientExceptions);
|
||||
Set<Class<?>> nonTransientExceptionClasses = new HashSet<Class<?>>();
|
||||
Set<Class<?>> nonTransientExceptionClasses = new HashSet<>();
|
||||
for (String className : strings) {
|
||||
try {
|
||||
nonTransientExceptionClasses.add(ClassUtils.getDefaultClassLoader().loadClass(className));
|
||||
@@ -356,7 +356,7 @@ public class ContextSourceParser implements BeanDefinitionParser {
|
||||
String nonTransientExceptions = ParserUtils.getString(element, ATT_NON_TRANSIENT_EXCEPTIONS,
|
||||
CommunicationException.class.getName());
|
||||
String[] strings = StringUtils.commaDelimitedListToStringArray(nonTransientExceptions);
|
||||
Set<Class<?>> nonTransientExceptionClasses = new HashSet<Class<?>>();
|
||||
Set<Class<?>> nonTransientExceptionClasses = new HashSet<>();
|
||||
for (String className : strings) {
|
||||
try {
|
||||
nonTransientExceptionClasses.add(ClassUtils.getDefaultClassLoader().loadClass(className));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,7 +30,7 @@ import javax.naming.NamingException;
|
||||
*/
|
||||
public abstract class CollectingNameClassPairCallbackHandler<T> implements NameClassPairCallbackHandler {
|
||||
|
||||
private List<T> list = new LinkedList<T>();
|
||||
private List<T> list = new LinkedList<>();
|
||||
|
||||
/**
|
||||
* Get the assembled list.
|
||||
|
||||
@@ -237,7 +237,7 @@ public class DirContextAdapter implements DirContextOperations {
|
||||
@Override
|
||||
public String[] getNamesOfModifiedAttributes() {
|
||||
|
||||
List<String> tmpList = new ArrayList<String>();
|
||||
List<String> tmpList = new ArrayList<>();
|
||||
|
||||
if (isUpdateMode()) {
|
||||
for (NameAwareAttribute attribute : this.updatedAttrs) {
|
||||
@@ -273,7 +273,7 @@ public class DirContextAdapter implements DirContextOperations {
|
||||
return new ModificationItem[0];
|
||||
}
|
||||
|
||||
List<ModificationItem> tmpList = new LinkedList<ModificationItem>();
|
||||
List<ModificationItem> tmpList = new LinkedList<>();
|
||||
for (NameAwareAttribute attribute : this.updatedAttrs) {
|
||||
collectModifications(attribute, tmpList);
|
||||
}
|
||||
@@ -333,7 +333,7 @@ public class DirContextAdapter implements DirContextOperations {
|
||||
else if (changedAttr.size() > 0) {
|
||||
// Change of multivalue Attribute. Collect additions and removals
|
||||
// individually.
|
||||
List<ModificationItem> myModifications = new LinkedList<ModificationItem>();
|
||||
List<ModificationItem> myModifications = new LinkedList<>();
|
||||
collectModifications(currentAttribute, changedAttr, myModifications);
|
||||
|
||||
if (myModifications.isEmpty()) {
|
||||
@@ -715,7 +715,7 @@ public class DirContextAdapter implements DirContextOperations {
|
||||
}
|
||||
|
||||
private <T> List<T> collectAttributeValuesAsList(String name, Class<T> clazz) {
|
||||
List<T> list = new LinkedList<T>();
|
||||
List<T> list = new LinkedList<>();
|
||||
LdapUtils.collectAttributeValues(this.originalAttrs, name, list, clazz);
|
||||
return list;
|
||||
}
|
||||
@@ -726,7 +726,7 @@ public class DirContextAdapter implements DirContextOperations {
|
||||
@Override
|
||||
public SortedSet<String> getAttributeSortedStringSet(String name) {
|
||||
try {
|
||||
TreeSet<String> attrSet = new TreeSet<String>();
|
||||
TreeSet<String> attrSet = new TreeSet<>();
|
||||
LdapUtils.collectAttributeValues(this.originalAttrs, name, attrSet, String.class);
|
||||
return attrSet;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2010 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -40,7 +40,7 @@ public class LdapAttribute extends BasicAttribute {
|
||||
/**
|
||||
* Holds the attributes options.
|
||||
*/
|
||||
protected Set<String> options = new HashSet<String>();
|
||||
protected Set<String> options = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Creates an unordered attribute with the specified ID.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,7 +45,7 @@ public class LdapRdn implements Serializable, Comparable {
|
||||
|
||||
private static final int DEFAULT_BUFFER_SIZE = 100;
|
||||
|
||||
private Map<String, LdapRdnComponent> components = new LinkedHashMap<String, LdapRdnComponent>();
|
||||
private Map<String, LdapRdnComponent> components = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Default constructor. Create an empty, uninitialized LdapRdn.
|
||||
@@ -280,8 +280,7 @@ public class LdapRdn implements Serializable, Comparable {
|
||||
* @since 1.3
|
||||
*/
|
||||
public LdapRdn immutableLdapRdn() {
|
||||
Map<String, LdapRdnComponent> mapWithImmutableRdns = new LinkedHashMap<String, LdapRdnComponent>(
|
||||
this.components.size());
|
||||
Map<String, LdapRdnComponent> mapWithImmutableRdns = new LinkedHashMap<>(this.components.size());
|
||||
for (Iterator iterator = this.components.values().iterator(); iterator.hasNext();) {
|
||||
LdapRdnComponent rdnComponent = (LdapRdnComponent) iterator.next();
|
||||
mapWithImmutableRdns.put(rdnComponent.getKey(), rdnComponent.immutableLdapRdnComponent());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2023 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -583,7 +583,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
|
||||
@Override
|
||||
public <T> List<T> search(String base, String filter, SearchControls controls, AttributesMapper<T> mapper,
|
||||
DirContextProcessor processor) {
|
||||
AttributesMapperCallbackHandler<T> handler = new AttributesMapperCallbackHandler<T>(mapper);
|
||||
AttributesMapperCallbackHandler<T> handler = new AttributesMapperCallbackHandler<>(mapper);
|
||||
search(base, filter, controls, handler, processor);
|
||||
|
||||
return handler.getList();
|
||||
@@ -595,7 +595,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
|
||||
@Override
|
||||
public <T> List<T> search(Name base, String filter, SearchControls controls, AttributesMapper<T> mapper,
|
||||
DirContextProcessor processor) {
|
||||
AttributesMapperCallbackHandler<T> handler = new AttributesMapperCallbackHandler<T>(mapper);
|
||||
AttributesMapperCallbackHandler<T> handler = new AttributesMapperCallbackHandler<>(mapper);
|
||||
search(base, filter, controls, handler, processor);
|
||||
|
||||
return handler.getList();
|
||||
@@ -608,7 +608,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
|
||||
public <T> List<T> search(String base, String filter, SearchControls controls, ContextMapper<T> mapper,
|
||||
DirContextProcessor processor) {
|
||||
assureReturnObjFlagSet(controls);
|
||||
ContextMapperCallbackHandler<T> handler = new ContextMapperCallbackHandler<T>(mapper);
|
||||
ContextMapperCallbackHandler<T> handler = new ContextMapperCallbackHandler<>(mapper);
|
||||
search(base, filter, controls, handler, processor);
|
||||
|
||||
return handler.getList();
|
||||
@@ -621,7 +621,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
|
||||
public <T> List<T> search(Name base, String filter, SearchControls controls, ContextMapper<T> mapper,
|
||||
DirContextProcessor processor) {
|
||||
assureReturnObjFlagSet(controls);
|
||||
ContextMapperCallbackHandler<T> handler = new ContextMapperCallbackHandler<T>(mapper);
|
||||
ContextMapperCallbackHandler<T> handler = new ContextMapperCallbackHandler<>(mapper);
|
||||
search(base, filter, controls, handler, processor);
|
||||
|
||||
return handler.getList();
|
||||
@@ -660,8 +660,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
|
||||
*/
|
||||
@Override
|
||||
public <T> List<T> list(String base, NameClassPairMapper<T> mapper) {
|
||||
CollectingNameClassPairCallbackHandler<T> handler = new MappingCollectingNameClassPairCallbackHandler<T>(
|
||||
mapper);
|
||||
CollectingNameClassPairCallbackHandler<T> handler = new MappingCollectingNameClassPairCallbackHandler<>(mapper);
|
||||
list(base, handler);
|
||||
return handler.getList();
|
||||
}
|
||||
@@ -671,8 +670,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
|
||||
*/
|
||||
@Override
|
||||
public <T> List<T> list(Name base, NameClassPairMapper<T> mapper) {
|
||||
CollectingNameClassPairCallbackHandler<T> handler = new MappingCollectingNameClassPairCallbackHandler<T>(
|
||||
mapper);
|
||||
CollectingNameClassPairCallbackHandler<T> handler = new MappingCollectingNameClassPairCallbackHandler<>(mapper);
|
||||
list(base, handler);
|
||||
return handler.getList();
|
||||
}
|
||||
@@ -726,8 +724,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
|
||||
*/
|
||||
@Override
|
||||
public <T> List<T> listBindings(String base, NameClassPairMapper<T> mapper) {
|
||||
CollectingNameClassPairCallbackHandler<T> handler = new MappingCollectingNameClassPairCallbackHandler<T>(
|
||||
mapper);
|
||||
CollectingNameClassPairCallbackHandler<T> handler = new MappingCollectingNameClassPairCallbackHandler<>(mapper);
|
||||
listBindings(base, handler);
|
||||
return handler.getList();
|
||||
}
|
||||
@@ -737,8 +734,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
|
||||
*/
|
||||
@Override
|
||||
public <T> List<T> listBindings(Name base, NameClassPairMapper<T> mapper) {
|
||||
CollectingNameClassPairCallbackHandler<T> handler = new MappingCollectingNameClassPairCallbackHandler<T>(
|
||||
mapper);
|
||||
CollectingNameClassPairCallbackHandler<T> handler = new MappingCollectingNameClassPairCallbackHandler<>(mapper);
|
||||
listBindings(base, handler);
|
||||
return handler.getList();
|
||||
}
|
||||
@@ -764,7 +760,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
|
||||
*/
|
||||
@Override
|
||||
public <T> List<T> listBindings(String base, ContextMapper<T> mapper) {
|
||||
ContextMapperCallbackHandler<T> handler = new ContextMapperCallbackHandler<T>(mapper);
|
||||
ContextMapperCallbackHandler<T> handler = new ContextMapperCallbackHandler<>(mapper);
|
||||
listBindings(base, handler);
|
||||
|
||||
return handler.getList();
|
||||
@@ -775,7 +771,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
|
||||
*/
|
||||
@Override
|
||||
public <T> List<T> listBindings(Name base, ContextMapper<T> mapper) {
|
||||
ContextMapperCallbackHandler<T> handler = new ContextMapperCallbackHandler<T>(mapper);
|
||||
ContextMapperCallbackHandler<T> handler = new ContextMapperCallbackHandler<>(mapper);
|
||||
listBindings(base, handler);
|
||||
|
||||
return handler.getList();
|
||||
@@ -1356,7 +1352,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
|
||||
|
||||
try {
|
||||
DirContext ctx = this.contextSource.getContext(entryIdentification.getAbsoluteName().toString(), password);
|
||||
executeWithContext(new ContextExecutor<Object>() {
|
||||
executeWithContext(new ContextExecutor<>() {
|
||||
public Object executeWithContext(DirContext ctx) throws javax.naming.NamingException {
|
||||
callback.executeWithContext(ctx, entryIdentification);
|
||||
return null;
|
||||
@@ -1377,8 +1373,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
|
||||
@Override
|
||||
public <T> T authenticate(LdapQuery query, String password, AuthenticatedLdapEntryContextMapper<T> mapper) {
|
||||
SearchControls searchControls = searchControlsForQuery(query, RETURN_OBJ_FLAG);
|
||||
ReturningAuthenticatedLdapEntryContext<T> mapperCallback = new ReturningAuthenticatedLdapEntryContext<T>(
|
||||
mapper);
|
||||
ReturningAuthenticatedLdapEntryContext<T> mapperCallback = new ReturningAuthenticatedLdapEntryContext<>(mapper);
|
||||
CollectingAuthenticationErrorCallback errorCallback = new CollectingAuthenticationErrorCallback();
|
||||
|
||||
AuthenticationStatus authenticationStatus = authenticate(query.base(), query.filter().encode(), password,
|
||||
@@ -1507,7 +1502,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
|
||||
*/
|
||||
@Override
|
||||
public DirContextOperations searchForContext(LdapQuery query) {
|
||||
return searchForObject(query, new ContextMapper<DirContextOperations>() {
|
||||
return searchForObject(query, new ContextMapper<>() {
|
||||
@Override
|
||||
public DirContextOperations mapFromContext(Object ctx) throws javax.naming.NamingException {
|
||||
return (DirContextOperations) ctx;
|
||||
@@ -1591,7 +1586,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
|
||||
// Make sure the class is OK before doing the lookup
|
||||
String[] attributes = this.odm.manageClass(clazz);
|
||||
|
||||
T result = lookup(dn, attributes, new ContextMapper<T>() {
|
||||
T result = lookup(dn, attributes, new ContextMapper<>() {
|
||||
@Override
|
||||
public T mapFromContext(Object ctx) throws javax.naming.NamingException {
|
||||
return LdapTemplate.this.odm.mapFromLdapDataEntry((DirContextOperations) ctx, clazz);
|
||||
@@ -1746,7 +1741,7 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
|
||||
searchControls));
|
||||
}
|
||||
|
||||
List<T> result = search(localBase, finalFilter.encode(), searchControls, new ContextMapper<T>() {
|
||||
List<T> result = search(localBase, finalFilter.encode(), searchControls, new ContextMapper<>() {
|
||||
@Override
|
||||
public T mapFromContext(Object ctx) throws javax.naming.NamingException {
|
||||
return LdapTemplate.this.odm.mapFromLdapDataEntry((DirContextOperations) ctx, clazz);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,9 +47,9 @@ public final class NameAwareAttribute implements Attribute, Iterable<Object> {
|
||||
|
||||
private final boolean orderMatters;
|
||||
|
||||
private final Set<Object> values = new LinkedHashSet<Object>();
|
||||
private final Set<Object> values = new LinkedHashSet<>();
|
||||
|
||||
private Map<Name, String> valuesAsNames = new HashMap<Name, String>();
|
||||
private Map<Name, String> valuesAsNames = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Construct a new instance with the specified id and one value.
|
||||
@@ -104,7 +104,7 @@ public final class NameAwareAttribute implements Attribute, Iterable<Object> {
|
||||
|
||||
@Override
|
||||
public NamingEnumeration<?> getAll() {
|
||||
return new IterableNamingEnumeration<Object>(this.values);
|
||||
return new IterableNamingEnumeration<>(this.values);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -162,7 +162,7 @@ public final class NameAwareAttribute implements Attribute, Iterable<Object> {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<Name, String> newValuesAsNames = new HashMap<Name, String>();
|
||||
Map<Name, String> newValuesAsNames = new HashMap<>();
|
||||
for (Object value : this.values) {
|
||||
if (value instanceof String) {
|
||||
String s = (String) value;
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public final class NameAwareAttributes implements Attributes, Iterable<NameAwareAttribute> {
|
||||
|
||||
private Map<String, NameAwareAttribute> attributes = new HashMap<String, NameAwareAttribute>();
|
||||
private Map<String, NameAwareAttribute> attributes = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Create an empty instance
|
||||
@@ -75,12 +75,12 @@ public final class NameAwareAttributes implements Attributes, Iterable<NameAware
|
||||
|
||||
@Override
|
||||
public NamingEnumeration<NameAwareAttribute> getAll() {
|
||||
return new IterableNamingEnumeration<NameAwareAttribute>(this.attributes.values());
|
||||
return new IterableNamingEnumeration<>(this.attributes.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamingEnumeration<String> getIDs() {
|
||||
return new IterableNamingEnumeration<String>(this.attributes.keySet());
|
||||
return new IterableNamingEnumeration<>(this.attributes.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2024 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -103,7 +103,7 @@ public abstract class AbstractContextSource implements BaseLdapPathContextSource
|
||||
|
||||
private boolean pooled = false;
|
||||
|
||||
private Hashtable<String, Object> baseEnv = new Hashtable<String, Object>();
|
||||
private Hashtable<String, Object> baseEnv = new Hashtable<>();
|
||||
|
||||
private Hashtable<String, Object> anonymousEnv;
|
||||
|
||||
@@ -447,7 +447,7 @@ public abstract class AbstractContextSource implements BaseLdapPathContextSource
|
||||
LOG.debug("Not using LDAP pooling");
|
||||
}
|
||||
|
||||
Hashtable<String, Object> env = new Hashtable<String, Object>(this.baseEnv);
|
||||
Hashtable<String, Object> env = new Hashtable<>(this.baseEnv);
|
||||
|
||||
env.put(Context.INITIAL_CONTEXT_FACTORY, this.contextFactory.getName());
|
||||
env.put(Context.PROVIDER_URL, assembleProviderUrlString(this.urls));
|
||||
@@ -563,7 +563,7 @@ public abstract class AbstractContextSource implements BaseLdapPathContextSource
|
||||
* be used when creating new Context instances.
|
||||
*/
|
||||
public void setBaseEnvironmentProperties(Map<String, Object> baseEnvironmentProperties) {
|
||||
this.baseEnv = new Hashtable<String, Object>(baseEnvironmentProperties);
|
||||
this.baseEnv = new Hashtable<>(baseEnvironmentProperties);
|
||||
}
|
||||
|
||||
protected Hashtable<String, Object> getAnonymousEnv() {
|
||||
@@ -577,7 +577,7 @@ public abstract class AbstractContextSource implements BaseLdapPathContextSource
|
||||
|
||||
protected Hashtable<String, Object> getAuthenticatedEnv(String principal, String credentials) {
|
||||
// The authenticated environment should always be rebuilt.
|
||||
Hashtable<String, Object> env = new Hashtable<String, Object>(getAnonymousEnv());
|
||||
Hashtable<String, Object> env = new Hashtable<>(getAnonymousEnv());
|
||||
setupAuthenticatedEnvironment(env, principal, credentials);
|
||||
return env;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,7 +35,7 @@ import org.springframework.ldap.core.DirContextProcessor;
|
||||
*/
|
||||
public class AggregateDirContextProcessor implements DirContextProcessor {
|
||||
|
||||
private List<DirContextProcessor> dirContextProcessors = new LinkedList<DirContextProcessor>();
|
||||
private List<DirContextProcessor> dirContextProcessors = new LinkedList<>();
|
||||
|
||||
/**
|
||||
* Add the supplied DirContextProcessor to the list of managed objects.
|
||||
@@ -59,7 +59,7 @@ public class AggregateDirContextProcessor implements DirContextProcessor {
|
||||
* set.
|
||||
*/
|
||||
public void setDirContextProcessors(List<DirContextProcessor> dirContextProcessors) {
|
||||
this.dirContextProcessors = new ArrayList<DirContextProcessor>(dirContextProcessors);
|
||||
this.dirContextProcessors = new ArrayList<>(dirContextProcessors);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -81,9 +81,9 @@ public class DefaultIncrementalAttributesMapper
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DefaultIncrementalAttributesMapper.class);
|
||||
|
||||
private Map<String, IncrementalAttributeState> stateMap = new LinkedHashMap<String, IncrementalAttributeState>();
|
||||
private Map<String, IncrementalAttributeState> stateMap = new LinkedHashMap<>();
|
||||
|
||||
private Set<String> rangedAttributesInNextIteration = new LinkedHashSet<String>();
|
||||
private Set<String> rangedAttributesInNextIteration = new LinkedHashSet<>();
|
||||
|
||||
/**
|
||||
* This guy will be used when an unmapped attribute is encountered. This really should
|
||||
@@ -171,7 +171,7 @@ public class DefaultIncrementalAttributesMapper
|
||||
}
|
||||
|
||||
// Reset the affected attributes.
|
||||
this.rangedAttributesInNextIteration = new HashSet<String>();
|
||||
this.rangedAttributesInNextIteration = new HashSet<>();
|
||||
|
||||
NamingEnumeration<String> attributeNameEnum = attributes.getIDs();
|
||||
while (attributeNameEnum.hasMore()) {
|
||||
@@ -417,14 +417,14 @@ public class DefaultIncrementalAttributesMapper
|
||||
|
||||
private void initValuesIfApplicable() {
|
||||
if (this.values == null) {
|
||||
this.values = new LinkedList<Object>();
|
||||
this.values = new LinkedList<>();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Object> getValues() {
|
||||
if (this.values != null) {
|
||||
return new ArrayList<Object>(this.values);
|
||||
return new ArrayList<>(this.values);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,7 +28,7 @@ import java.util.List;
|
||||
*/
|
||||
public abstract class BinaryLogicalFilter extends AbstractFilter {
|
||||
|
||||
private List<Filter> queryList = new LinkedList<Filter>();
|
||||
private List<Filter> queryList = new LinkedList<>();
|
||||
|
||||
public StringBuffer encode(StringBuffer buff) {
|
||||
if (this.queryList.size() <= 0) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -101,7 +101,7 @@ import org.springframework.ldap.odm.annotations.Transient;
|
||||
// Grab the @Attribute annotation
|
||||
Attribute attribute = field.getAnnotation(Attribute.class);
|
||||
|
||||
List<String> attrList = new ArrayList<String>();
|
||||
List<String> attrList = new ArrayList<>();
|
||||
// Did we find the annotation?
|
||||
if (attribute != null) {
|
||||
// Pull attribute name, syntax and whether attribute is binary
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -96,7 +96,7 @@ public class DefaultObjectDirectoryMapper implements ObjectDirectoryMapper {
|
||||
}
|
||||
|
||||
// A map of managed classes to to meta data about those classes
|
||||
private final ConcurrentMap<Class<?>, EntityData> metaDataMap = new ConcurrentHashMap<Class<?>, EntityData>();
|
||||
private final ConcurrentMap<Class<?>, EntityData> metaDataMap = new ConcurrentHashMap<>();
|
||||
|
||||
private EntityData getEntityData(Class<?> managedClass) {
|
||||
EntityData result = this.metaDataMap.get(managedClass);
|
||||
@@ -110,7 +110,7 @@ public class DefaultObjectDirectoryMapper implements ObjectDirectoryMapper {
|
||||
public String[] manageClass(Class<?> clazz) {
|
||||
// This throws exception if data is invalid
|
||||
EntityData entityData = getEntityData(clazz);
|
||||
Set<String> managedAttributeNames = new HashSet<String>();
|
||||
Set<String> managedAttributeNames = new HashSet<>();
|
||||
// extract all relevant attributes
|
||||
for (Field field : entityData.metaData) {
|
||||
AttributeMetaData attributeMetaData = entityData.metaData.getAttribute(field);
|
||||
@@ -253,7 +253,7 @@ public class DefaultObjectDirectoryMapper implements ObjectDirectoryMapper {
|
||||
private void populateMultiValueAttribute(Object entry, LdapDataEntry context, Field field,
|
||||
AttributeMetaData attributeInfo, Class<?> targetClass) throws IllegalAccessException {
|
||||
// We need to build up a list of of the values
|
||||
List<Object> attributeValues = new ArrayList<Object>();
|
||||
List<Object> attributeValues = new ArrayList<>();
|
||||
// Get the list of values
|
||||
Collection<?> fieldValues = (Collection<?>) field.get(entry);
|
||||
// Ignore null lists
|
||||
@@ -300,7 +300,7 @@ public class DefaultObjectDirectoryMapper implements ObjectDirectoryMapper {
|
||||
result = clazz.newInstance();
|
||||
|
||||
// Build a map of JNDI attribute names to values
|
||||
Map<CaseIgnoreString, Attribute> attributeValueMap = new HashMap<CaseIgnoreString, Attribute>();
|
||||
Map<CaseIgnoreString, Attribute> attributeValueMap = new HashMap<>();
|
||||
// Get a NamingEnumeration to loop through the JNDI attributes in the entry
|
||||
Attributes attributes = context.getAttributes();
|
||||
NamingEnumeration<? extends Attribute> attributesEnumeration = attributes.getAll();
|
||||
@@ -318,7 +318,7 @@ public class DefaultObjectDirectoryMapper implements ObjectDirectoryMapper {
|
||||
Attribute ocAttribute = attributeValueMap.get(OBJECT_CLASS_ATTRIBUTE_CI);
|
||||
if (ocAttribute != null) {
|
||||
// Get all object class values from the JNDI attribute
|
||||
Set<CaseIgnoreString> objectClassesFromJndi = new HashSet<CaseIgnoreString>();
|
||||
Set<CaseIgnoreString> objectClassesFromJndi = new HashSet<>();
|
||||
NamingEnumeration<?> objectClassesFromJndiEnum = ocAttribute.getAll();
|
||||
while (objectClassesFromJndiEnum.hasMoreElements()) {
|
||||
objectClassesFromJndi.add(new CaseIgnoreString((String) objectClassesFromJndiEnum.nextElement()));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,9 +47,9 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
private AttributeMetaData idAttribute;
|
||||
|
||||
private Map<Field, AttributeMetaData> fieldToAttribute = new HashMap<Field, AttributeMetaData>();
|
||||
private Map<Field, AttributeMetaData> fieldToAttribute = new HashMap<>();
|
||||
|
||||
private Set<AttributeMetaData> dnAttributes = new TreeSet<AttributeMetaData>(new Comparator<AttributeMetaData>() {
|
||||
private Set<AttributeMetaData> dnAttributes = new TreeSet<>(new Comparator<>() {
|
||||
@Override
|
||||
public int compare(AttributeMetaData a1, AttributeMetaData a2) {
|
||||
if (!a1.isDnAttribute() || !a2.isDnAttribute()) {
|
||||
@@ -63,7 +63,7 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
private boolean indexedDnAttributes = false;
|
||||
|
||||
private Set<CaseIgnoreString> objectClasses = new LinkedHashSet<CaseIgnoreString>();
|
||||
private Set<CaseIgnoreString> objectClasses = new LinkedHashSet<>();
|
||||
|
||||
private Name base = LdapUtils.emptyLdapName();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -166,13 +166,13 @@ public final class ConverterManagerFactoryBean implements FactoryBean {
|
||||
public static final class ConverterConfig {
|
||||
|
||||
// The set of classes the Converter will convert from.
|
||||
private Set<Class<?>> fromClasses = new HashSet<Class<?>>();
|
||||
private Set<Class<?>> fromClasses = new HashSet<>();
|
||||
|
||||
// The (optional) LDAP syntax.
|
||||
private String syntax = null;
|
||||
|
||||
// The set of classes the Converter will convert to.
|
||||
private Set<Class<?>> toClasses = new HashSet<Class<?>>();
|
||||
private Set<Class<?>> toClasses = new HashSet<>();
|
||||
|
||||
// The Converter to use.
|
||||
private Converter converter = null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,7 +51,7 @@ public final class ConverterManagerImpl implements ConverterManager {
|
||||
/**
|
||||
* Map of keys created via makeConverterKey to Converter instances.
|
||||
*/
|
||||
private final Map<String, Converter> converters = new HashMap<String, Converter>();
|
||||
private final Map<String, Converter> converters = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Make a key into the converters map - the keys is formed from the
|
||||
@@ -80,7 +80,7 @@ public final class ConverterManagerImpl implements ConverterManager {
|
||||
* Used to help in the process of dealing with primitive types by mapping them to
|
||||
* their equivalent boxed class.
|
||||
*/
|
||||
private static Map<Class<?>, Class<?>> primitiveTypeMap = new HashMap<Class<?>, Class<?>>();
|
||||
private static Map<Class<?>, Class<?>> primitiveTypeMap = new HashMap<>();
|
||||
static {
|
||||
primitiveTypeMap.put(Byte.TYPE, Byte.class);
|
||||
primitiveTypeMap.put(Short.TYPE, Short.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -82,7 +82,7 @@ class DirContextPoolableObjectFactory extends BaseKeyedPoolableObjectFactory {
|
||||
*/
|
||||
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
private static final Set<Class<? extends Throwable>> DEFAULT_NONTRANSIENT_EXCEPTIONS = new HashSet<Class<? extends Throwable>>() {
|
||||
private static final Set<Class<? extends Throwable>> DEFAULT_NONTRANSIENT_EXCEPTIONS = new HashSet<>() {
|
||||
{
|
||||
add(CommunicationException.class);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ class DirContextPoolableObjectFactory extends BaseKeyedPoolableObjectFactory {
|
||||
private Set<Class<? extends Throwable>> nonTransientExceptions = DEFAULT_NONTRANSIENT_EXCEPTIONS;
|
||||
|
||||
void setNonTransientExceptions(Collection<Class<? extends Throwable>> nonTransientExceptions) {
|
||||
this.nonTransientExceptions = new HashSet<Class<? extends Throwable>>(nonTransientExceptions);
|
||||
this.nonTransientExceptions = new HashSet<>(nonTransientExceptions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2015 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -87,7 +87,7 @@ class DirContextPooledObjectFactory extends BaseKeyedPooledObjectFactory<Object,
|
||||
*/
|
||||
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
private static final Set<Class<? extends Throwable>> DEFAULT_NONTRANSIENT_EXCEPTIONS = new HashSet<Class<? extends Throwable>>();
|
||||
private static final Set<Class<? extends Throwable>> DEFAULT_NONTRANSIENT_EXCEPTIONS = new HashSet<>();
|
||||
|
||||
static {
|
||||
DEFAULT_NONTRANSIENT_EXCEPTIONS.add(CommunicationException.class);
|
||||
@@ -100,7 +100,7 @@ class DirContextPooledObjectFactory extends BaseKeyedPooledObjectFactory<Object,
|
||||
private Set<Class<? extends Throwable>> nonTransientExceptions = DEFAULT_NONTRANSIENT_EXCEPTIONS;
|
||||
|
||||
void setNonTransientExceptions(Collection<Class<? extends Throwable>> nonTransientExceptions) {
|
||||
this.nonTransientExceptions = new HashSet<Class<? extends Throwable>>(nonTransientExceptions);
|
||||
this.nonTransientExceptions = new HashSet<>(nonTransientExceptions);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -239,7 +239,7 @@ class DirContextPooledObjectFactory extends BaseKeyedPooledObjectFactory<Object,
|
||||
*/
|
||||
@Override
|
||||
public PooledObject<Object> wrap(Object value) {
|
||||
return new DefaultPooledObject<Object>(value);
|
||||
return new DefaultPooledObject<>(value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2015 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -105,7 +105,7 @@ public class PooledContextSource extends DelegatingBaseLdapPathContextSourceSupp
|
||||
objectPoolConfig);
|
||||
}
|
||||
else {
|
||||
this.keyedObjectPool = new GenericKeyedObjectPool<Object, Object>(this.dirContextPooledObjectFactory);
|
||||
this.keyedObjectPool = new GenericKeyedObjectPool<>(this.dirContextPooledObjectFactory);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,7 +29,7 @@ import org.springframework.ldap.filter.Filter;
|
||||
*/
|
||||
class DefaultContainerCriteria implements AppendableContainerCriteria {
|
||||
|
||||
private final Set<Filter> filters = new LinkedHashSet<Filter>();
|
||||
private final Set<Filter> filters = new LinkedHashSet<>();
|
||||
|
||||
private final LdapQuery topQuery;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -280,7 +280,7 @@ public final class LdapUtils {
|
||||
throw new NoSuchAttributeException("No attribute with name '" + name + "'");
|
||||
}
|
||||
|
||||
iterateAttributeValues(attribute, new CollectingAttributeValueCallbackHandler<T>(collection, clazz));
|
||||
iterateAttributeValues(attribute, new CollectingAttributeValueCallbackHandler<>(collection, clazz));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -63,7 +63,7 @@ public class ModifyAttributesOperationRecorder implements CompensatingTransactio
|
||||
|
||||
ModificationItem[] incomingModifications = (ModificationItem[]) args[1];
|
||||
|
||||
Set<String> set = new HashSet<String>();
|
||||
Set<String> set = new HashSet<>();
|
||||
for (ModificationItem incomingModification : incomingModifications) {
|
||||
set.add(incomingModification.getAttribute().getID());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,7 +39,7 @@ public class DefaultCompensatingTransactionOperationManager implements Compensat
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(DefaultCompensatingTransactionOperationManager.class);
|
||||
|
||||
private Stack<CompensatingTransactionOperationExecutor> operationExecutors = new Stack<CompensatingTransactionOperationExecutor>();
|
||||
private Stack<CompensatingTransactionOperationExecutor> operationExecutors = new Stack<>();
|
||||
|
||||
private CompensatingTransactionOperationFactory operationFactory;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2016 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -126,7 +126,7 @@ public class BaseLdapPathBeanPostProcessorTests {
|
||||
.willReturn(new String[] { "contextSource" });
|
||||
final LdapContextSource expectedContextSource = new LdapContextSource();
|
||||
|
||||
HashMap<String, BaseLdapPathSource> expectedBeans = new HashMap<String, BaseLdapPathSource>() {
|
||||
HashMap<String, BaseLdapPathSource> expectedBeans = new HashMap<>() {
|
||||
{
|
||||
put("dummy", expectedContextSource);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2016 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -49,7 +49,7 @@ public class ContextMapperCallbackHandlerWithControlsTests {
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testConstructorWithEmptyArgument() {
|
||||
new ContextMapperCallbackHandlerWithControls<Object>(null);
|
||||
new ContextMapperCallbackHandlerWithControls<>(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2016 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -55,10 +55,10 @@ public class SingleContextSourceTests {
|
||||
given(this.contextSourceMock.getReadWriteContext()).willReturn(this.dirContextMock);
|
||||
verifyNoMoreInteractions(this.contextSourceMock);
|
||||
|
||||
SingleContextSource.doWithSingleContext(this.contextSourceMock, new LdapOperationsCallback<Object>() {
|
||||
SingleContextSource.doWithSingleContext(this.contextSourceMock, new LdapOperationsCallback<>() {
|
||||
@Override
|
||||
public Object doWithLdapOperations(LdapOperations operations) {
|
||||
operations.executeReadOnly(new ContextExecutor<Object>() {
|
||||
operations.executeReadOnly(new ContextExecutor<>() {
|
||||
@Override
|
||||
public Object executeWithContext(DirContext ctx) throws NamingException {
|
||||
Object targetContex = getInternalState(Proxy.getInvocationHandler(ctx), "target");
|
||||
@@ -70,7 +70,7 @@ public class SingleContextSourceTests {
|
||||
// Second operation will have retrieved new DirContext from the
|
||||
// SingleContextSource.
|
||||
// It should be the same instance.
|
||||
operations.executeReadOnly(new ContextExecutor<Object>() {
|
||||
operations.executeReadOnly(new ContextExecutor<>() {
|
||||
@Override
|
||||
public Object executeWithContext(DirContext ctx) throws NamingException {
|
||||
Object targetContex = getInternalState(Proxy.getInvocationHandler(ctx), "target");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,11 +29,11 @@ import java.util.Set;
|
||||
*/
|
||||
public final class ObjectSchema {
|
||||
|
||||
private final Set<AttributeSchema> must = new HashSet<AttributeSchema>();
|
||||
private final Set<AttributeSchema> must = new HashSet<>();
|
||||
|
||||
private final Set<AttributeSchema> may = new HashSet<AttributeSchema>();
|
||||
private final Set<AttributeSchema> may = new HashSet<>();
|
||||
|
||||
private final Set<String> objectClass = new HashSet<String>();
|
||||
private final Set<String> objectClass = new HashSet<>();
|
||||
|
||||
public void addMust(AttributeSchema must) {
|
||||
// if may attributes contain must attribute, remove from may and add to must
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -141,7 +141,7 @@ import org.springframework.ldap.odm.tools.SyntaxToJavaClass.ClassInfo;
|
||||
throws NamingException, ClassNotFoundException {
|
||||
|
||||
// Super classes
|
||||
Set<String> supList = new HashSet<String>();
|
||||
Set<String> supList = new HashSet<>();
|
||||
|
||||
// For each of the given object classes
|
||||
for (String objectClass : objectClasses) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -179,7 +179,7 @@ public final class SchemaToJava {
|
||||
// Read list of LDAP syntaxes that are returned as byte[]
|
||||
private static Set<String> readBinarySet(File binarySetFile) throws IOException {
|
||||
|
||||
Set<String> result = new HashSet<String>();
|
||||
Set<String> result = new HashSet<>();
|
||||
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
@@ -209,7 +209,7 @@ public final class SchemaToJava {
|
||||
// Read mappings of LDAP syntaxes to Java classes.
|
||||
private static Map<String, String> readSyntaxMap(File syntaxMapFile) throws IOException {
|
||||
|
||||
Map<String, String> result = new HashMap<String, String>();
|
||||
Map<String, String> result = new HashMap<>();
|
||||
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
@@ -247,7 +247,7 @@ public final class SchemaToJava {
|
||||
Set<String> binarySet, Set<String> objectClasses) throws NamingException, ClassNotFoundException {
|
||||
|
||||
// Set up environment
|
||||
Hashtable<String, String> env = new Hashtable<String, String>();
|
||||
Hashtable<String, String> env = new Hashtable<>();
|
||||
env.put(Context.PROVIDER_URL, url);
|
||||
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
|
||||
if (user != null) {
|
||||
@@ -279,7 +279,7 @@ public final class SchemaToJava {
|
||||
freeMarkerConfiguration.setObjectWrapper(new DefaultObjectWrapper());
|
||||
|
||||
// Build the model for FreeMarker
|
||||
Map<String, Object> model = new HashMap<String, Object>();
|
||||
Map<String, Object> model = new HashMap<>();
|
||||
model.put("package", packageName);
|
||||
model.put("class", className);
|
||||
model.put("schema", schema);
|
||||
@@ -337,7 +337,7 @@ public final class SchemaToJava {
|
||||
}
|
||||
|
||||
private static Set<String> parseObjectClassesFlag(String objectClassesFlag) {
|
||||
Set<String> objectClasses = new HashSet<String>();
|
||||
Set<String> objectClasses = new HashSet<>();
|
||||
|
||||
for (String objectClassFlag : objectClassesFlag.split(",")) {
|
||||
if (objectClassFlag.length() > 0) {
|
||||
@@ -412,7 +412,7 @@ public final class SchemaToJava {
|
||||
|
||||
// Look for the optional syntax to Java class mapping file
|
||||
String syntaxMapFileName = cmd.getOptionValue(Flag.SYNTAX_MAP.getShort(), null);
|
||||
SyntaxToJavaClass syntaxToJavaClass = new SyntaxToJavaClass(new HashMap<String, String>());
|
||||
SyntaxToJavaClass syntaxToJavaClass = new SyntaxToJavaClass(new HashMap<>());
|
||||
if (syntaxMapFileName != null) {
|
||||
File syntaxMapFile = new File(syntaxMapFileName);
|
||||
if (syntaxMapFile.canRead()) {
|
||||
@@ -459,7 +459,7 @@ public final class SchemaToJava {
|
||||
}
|
||||
|
||||
// Work out what imports we need
|
||||
Set<SyntaxToJavaClass.ClassInfo> imports = new HashSet<SyntaxToJavaClass.ClassInfo>();
|
||||
Set<SyntaxToJavaClass.ClassInfo> imports = new HashSet<>();
|
||||
for (AttributeSchema attributeSchema : schema.getMay()) {
|
||||
SyntaxToJavaClass.ClassInfo classInfo = syntaxToJavaClass.getClassInfo(attributeSchema.getSyntax());
|
||||
if (classInfo != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2023 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -220,7 +220,7 @@ public final class SchemaViewer {
|
||||
String user = cmd.getOptionValue(Flag.USERNAME.getShort(), "");
|
||||
String pass = cmd.getOptionValue(Flag.PASSWORD.getShort(), "");
|
||||
|
||||
Hashtable<String, String> env = new Hashtable<String, String>();
|
||||
Hashtable<String, String> env = new Hashtable<>();
|
||||
env.put(Context.PROVIDER_URL, url);
|
||||
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
|
||||
if (user != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2023 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,7 +27,7 @@ import java.util.Map.Entry;
|
||||
*/
|
||||
/* package */ final class SyntaxToJavaClass {
|
||||
|
||||
private final Map<String, ClassInfo> mapSyntaxToClassInfo = new HashMap<String, ClassInfo>();
|
||||
private final Map<String, ClassInfo> mapSyntaxToClassInfo = new HashMap<>();
|
||||
|
||||
SyntaxToJavaClass(Map<String, String> mapSyntaxToClass) {
|
||||
for (Entry<String, String> syntaxAndClass : mapSyntaxToClass.entrySet()) {
|
||||
|
||||
@@ -131,7 +131,7 @@ public class ArrayMarshaller<E> implements Marshaller<ArrayTree<E>> {
|
||||
|
||||
if ((data.length == 1) && (data[0] == 0)) {
|
||||
E[] array = (E[]) new Object[] {};
|
||||
ArrayTree<E> tree = new ArrayTree<E>(this.comparator, array);
|
||||
ArrayTree<E> tree = new ArrayTree<>(this.comparator, array);
|
||||
return tree;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class ArrayMarshaller<E> implements Marshaller<ArrayTree<E>> {
|
||||
}
|
||||
}
|
||||
|
||||
ArrayTree<E> arrayTree = new ArrayTree<E>(this.comparator, nodes);
|
||||
ArrayTree<E> arrayTree = new ArrayTree<>(this.comparator, nodes);
|
||||
|
||||
return arrayTree;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2023 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -52,19 +52,19 @@ public class ConverterFactoryTests {
|
||||
@Test
|
||||
public void testConverterFactory() throws Exception {
|
||||
ConverterManagerFactoryBean converterManagerFactory = new ConverterManagerFactoryBean();
|
||||
Set<ConverterManagerFactoryBean.ConverterConfig> configList = new HashSet<ConverterManagerFactoryBean.ConverterConfig>();
|
||||
Set<ConverterManagerFactoryBean.ConverterConfig> configList = new HashSet<>();
|
||||
for (ConverterConfigTestData config : converterConfigTestData) {
|
||||
ConverterManagerFactoryBean.ConverterConfig converterConfig = new ConverterManagerFactoryBean.ConverterConfig();
|
||||
converterConfig.setFromClasses(new HashSet<Class<?>>(Arrays.asList(config.fromClasses)));
|
||||
converterConfig.setFromClasses(new HashSet<>(Arrays.asList(config.fromClasses)));
|
||||
converterConfig.setSyntax(config.syntax);
|
||||
converterConfig.setToClasses(new HashSet<Class<?>>(Arrays.asList(config.toClasses)));
|
||||
converterConfig.setToClasses(new HashSet<>(Arrays.asList(config.toClasses)));
|
||||
converterConfig.setConverter(nullConverter);
|
||||
configList.add(converterConfig);
|
||||
}
|
||||
converterManagerFactory.setConverterConfig(configList);
|
||||
final ConverterManager converterManager = (ConverterManager) converterManagerFactory.getObject();
|
||||
|
||||
new ExecuteRunnable<ConverterTestData>().runTests(new RunnableTests<ConverterTestData>() {
|
||||
new ExecuteRunnable<ConverterTestData>().runTests(new RunnableTests<>() {
|
||||
public void runTest(ConverterTestData testData) {
|
||||
assertThat(testData.canConvert)
|
||||
.isEqualTo(converterManager.canConvert(testData.fromClass, testData.syntax, testData.toClass));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2023 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -73,33 +73,33 @@ public final class ConverterManagerTests {
|
||||
@Test
|
||||
public void basicTypeConverion() throws Exception {
|
||||
final ConverterTestData<?>[] primitiveTypeTests = new ConverterTestData<?>[] {
|
||||
new ConverterTestData<Byte>("33", Byte.class, Byte.valueOf((byte) 33)),
|
||||
new ConverterTestData<Byte>("-88", Byte.class, Byte.valueOf((byte) -88)),
|
||||
new ConverterTestData<Short>("666", Short.class, Short.valueOf((short) 666)),
|
||||
new ConverterTestData<Short>("-123", Short.class, Short.valueOf((short) -123)),
|
||||
new ConverterTestData<Integer>("123", Integer.class, Integer.valueOf(123)),
|
||||
new ConverterTestData<Integer>("-500", Integer.class, Integer.valueOf(-500)),
|
||||
new ConverterTestData<Long>("123456", Long.class, Long.valueOf(123456)),
|
||||
new ConverterTestData<Long>("-654321", Long.class, Long.valueOf(-654321)),
|
||||
new ConverterTestData<Double>("2", Double.class, Double.valueOf(2)),
|
||||
new ConverterTestData<Double>("-0.4", Double.class, Double.valueOf(-0.4)),
|
||||
new ConverterTestData<Float>("666", Float.class, Float.valueOf(666)),
|
||||
new ConverterTestData<Float>("-0.75", Float.class, Float.valueOf(-0.75F)),
|
||||
new ConverterTestData<Boolean>("false", Boolean.class, Boolean.FALSE),
|
||||
new ConverterTestData<Boolean>("TRUE", Boolean.class, Boolean.TRUE),
|
||||
new ConverterTestData<String>("This is a string", String.class, "This is a string"),
|
||||
new ConverterTestData<String>("This is another String", String.class, "This is another String"),
|
||||
new ConverterTestData<String>((byte) 66, String.class, "66"),
|
||||
new ConverterTestData<String>((int) 1234, String.class, "1234"),
|
||||
new ConverterTestData<String>((int) -9876, String.class, "-9876"),
|
||||
new ConverterTestData<URI>("https://google.com/", URI.class, new URI("https://google.com/")),
|
||||
new ConverterTestData<URI>("https://apache.org/index.html", URI.class,
|
||||
new ConverterTestData<>("33", Byte.class, Byte.valueOf((byte) 33)),
|
||||
new ConverterTestData<>("-88", Byte.class, Byte.valueOf((byte) -88)),
|
||||
new ConverterTestData<>("666", Short.class, Short.valueOf((short) 666)),
|
||||
new ConverterTestData<>("-123", Short.class, Short.valueOf((short) -123)),
|
||||
new ConverterTestData<>("123", Integer.class, Integer.valueOf(123)),
|
||||
new ConverterTestData<>("-500", Integer.class, Integer.valueOf(-500)),
|
||||
new ConverterTestData<>("123456", Long.class, Long.valueOf(123456)),
|
||||
new ConverterTestData<>("-654321", Long.class, Long.valueOf(-654321)),
|
||||
new ConverterTestData<>("2", Double.class, Double.valueOf(2)),
|
||||
new ConverterTestData<>("-0.4", Double.class, Double.valueOf(-0.4)),
|
||||
new ConverterTestData<>("666", Float.class, Float.valueOf(666)),
|
||||
new ConverterTestData<>("-0.75", Float.class, Float.valueOf(-0.75F)),
|
||||
new ConverterTestData<>("false", Boolean.class, Boolean.FALSE),
|
||||
new ConverterTestData<>("TRUE", Boolean.class, Boolean.TRUE),
|
||||
new ConverterTestData<>("This is a string", String.class, "This is a string"),
|
||||
new ConverterTestData<>("This is another String", String.class, "This is another String"),
|
||||
new ConverterTestData<>((byte) 66, String.class, "66"),
|
||||
new ConverterTestData<>((int) 1234, String.class, "1234"),
|
||||
new ConverterTestData<>((int) -9876, String.class, "-9876"),
|
||||
new ConverterTestData<>("https://google.com/", URI.class, new URI("https://google.com/")),
|
||||
new ConverterTestData<>("https://apache.org/index.html", URI.class,
|
||||
new URI("https://apache.org/index.html")),
|
||||
new ConverterTestData<String>(new URI("https://google.com/"), String.class, "https://google.com/"),
|
||||
new ConverterTestData<String>(new URI("https://apache.org/index.html"), String.class,
|
||||
new ConverterTestData<>(new URI("https://google.com/"), String.class, "https://google.com/"),
|
||||
new ConverterTestData<>(new URI("https://apache.org/index.html"), String.class,
|
||||
"https://apache.org/index.html") };
|
||||
|
||||
new ExecuteRunnable<ConverterTestData<?>>().runTests(new RunnableTests<ConverterTestData<?>>() {
|
||||
new ExecuteRunnable<ConverterTestData<?>>().runTests(new RunnableTests<>() {
|
||||
public void runTest(ConverterTestData<?> testData) {
|
||||
assertThat(testData.expectedValue).isEqualTo(ConverterManagerTests.this.converterManager
|
||||
.convert(testData.sourceData, "", testData.destClass));
|
||||
@@ -118,20 +118,20 @@ public final class ConverterManagerTests {
|
||||
this.converterManager.addConverter(Integer.class, "3", Integer.class, cubedConverter);
|
||||
|
||||
final ConverterTestData<?>[] syntaxTests = new ConverterTestData<?>[] {
|
||||
new ConverterTestData<Integer>("3", "", Integer.class, Integer.valueOf(3)),
|
||||
new ConverterTestData<Integer>("4", "", Integer.class, Integer.valueOf(4)),
|
||||
new ConverterTestData<Integer>(5, "", Integer.class, Integer.valueOf(5)),
|
||||
new ConverterTestData<Integer>(6, "", Integer.class, Integer.valueOf(6)),
|
||||
new ConverterTestData<Integer>("3", "1", Integer.class, Integer.valueOf(9)),
|
||||
new ConverterTestData<Integer>("4", "1", Integer.class, Integer.valueOf(16)),
|
||||
new ConverterTestData<Integer>(5, "1", Integer.class, Integer.valueOf(25)),
|
||||
new ConverterTestData<Integer>(6, "1", Integer.class, Integer.valueOf(36)),
|
||||
new ConverterTestData<Integer>("3", "2", Integer.class, Integer.valueOf(27)),
|
||||
new ConverterTestData<Integer>("4", "2", Integer.class, Integer.valueOf(64)),
|
||||
new ConverterTestData<Integer>(5, "3", Integer.class, Integer.valueOf(125)),
|
||||
new ConverterTestData<Integer>(6, "3", Integer.class, Integer.valueOf(216)), };
|
||||
new ConverterTestData<>("3", "", Integer.class, Integer.valueOf(3)),
|
||||
new ConverterTestData<>("4", "", Integer.class, Integer.valueOf(4)),
|
||||
new ConverterTestData<>(5, "", Integer.class, Integer.valueOf(5)),
|
||||
new ConverterTestData<>(6, "", Integer.class, Integer.valueOf(6)),
|
||||
new ConverterTestData<>("3", "1", Integer.class, Integer.valueOf(9)),
|
||||
new ConverterTestData<>("4", "1", Integer.class, Integer.valueOf(16)),
|
||||
new ConverterTestData<>(5, "1", Integer.class, Integer.valueOf(25)),
|
||||
new ConverterTestData<>(6, "1", Integer.class, Integer.valueOf(36)),
|
||||
new ConverterTestData<>("3", "2", Integer.class, Integer.valueOf(27)),
|
||||
new ConverterTestData<>("4", "2", Integer.class, Integer.valueOf(64)),
|
||||
new ConverterTestData<>(5, "3", Integer.class, Integer.valueOf(125)),
|
||||
new ConverterTestData<>(6, "3", Integer.class, Integer.valueOf(216)), };
|
||||
|
||||
new ExecuteRunnable<ConverterTestData<?>>().runTests(new RunnableTests<ConverterTestData<?>>() {
|
||||
new ExecuteRunnable<ConverterTestData<?>>().runTests(new RunnableTests<>() {
|
||||
public void runTest(ConverterTestData<?> testData) {
|
||||
assertThat(testData.expectedValue).isEqualTo(ConverterManagerTests.this.converterManager
|
||||
.convert(testData.sourceData, testData.syntax, testData.destClass));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -185,7 +185,7 @@ public final class LdapTests {
|
||||
LdapTestUtils.cleanAndSetup(this.contextSource, baseName, new ClassPathResource("testdata.ldif"));
|
||||
|
||||
// Create our OdmManager
|
||||
Set<Class<?>> managedClasses = new HashSet<Class<?>>();
|
||||
Set<Class<?>> managedClasses = new HashSet<>();
|
||||
managedClasses.add(Person.class);
|
||||
managedClasses.add(PlainPerson.class);
|
||||
managedClasses.add(OrganizationalUnit.class);
|
||||
@@ -243,7 +243,7 @@ public final class LdapTests {
|
||||
// Read various entries from the sample data set and check they are what we'd expect.
|
||||
@Test
|
||||
public void read() throws Exception {
|
||||
new ExecuteRunnable<Person>().runTests(new RunnableTests<Person>() {
|
||||
new ExecuteRunnable<Person>().runTests(new RunnableTests<>() {
|
||||
public void runTest(Person testData) {
|
||||
Name dn = testData.getDn();
|
||||
LOG.debug(String.format("reading - %1$s", dn));
|
||||
@@ -269,14 +269,14 @@ public final class LdapTests {
|
||||
// we'd expect.
|
||||
@Test
|
||||
public void search() throws Exception {
|
||||
new ExecuteRunnable<SearchTestData>().runTests(new RunnableTests<SearchTestData>() {
|
||||
new ExecuteRunnable<SearchTestData>().runTests(new RunnableTests<>() {
|
||||
public void runTest(SearchTestData testData) {
|
||||
String search = testData.search;
|
||||
LOG.debug(String.format("searching - %1$s", search));
|
||||
List<Person> results = LdapTests.this.odmManager.search(Person.class, baseName, testData.search,
|
||||
testData.searchScope);
|
||||
LOG.debug(String.format("found - %1$s", results));
|
||||
assertThat(new HashSet<Person>(Arrays.asList(testData.people))).isEqualTo(new HashSet<Person>(results));
|
||||
assertThat(new HashSet<>(Arrays.asList(testData.people))).isEqualTo(new HashSet<>(results));
|
||||
}
|
||||
}, this.searchTestData);
|
||||
}
|
||||
@@ -311,8 +311,7 @@ public final class LdapTests {
|
||||
List<OrganizationalUnit> allOus = this.odmManager.findAll(OrganizationalUnit.class, baseName,
|
||||
this.searchControls);
|
||||
LOG.debug(String.format("Found - %1$s", allOus));
|
||||
assertThat(new HashSet<OrganizationalUnit>(Arrays.asList(ouTestData)))
|
||||
.isEqualTo(new HashSet<OrganizationalUnit>(allOus));
|
||||
assertThat(new HashSet<>(Arrays.asList(ouTestData))).isEqualTo(new HashSet<>(allOus));
|
||||
|
||||
OrganizationalUnit testOu = ouTestData[OrganizationalName.ASSISTANTS.getIndex()];
|
||||
LOG.debug(String.format("Reading - %1$s", testOu.getDn()));
|
||||
@@ -328,7 +327,7 @@ public final class LdapTests {
|
||||
LOG.debug("finding all people");
|
||||
List<Person> allPeople = this.odmManager.findAll(Person.class, baseName, this.searchControls);
|
||||
LOG.debug(String.format("found %1$s", allPeople));
|
||||
assertThat(new HashSet<Person>(Arrays.asList(this.personTestData))).isEqualTo(new HashSet<Person>(allPeople));
|
||||
assertThat(new HashSet<>(Arrays.asList(this.personTestData))).isEqualTo(new HashSet<>(allPeople));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -394,7 +393,7 @@ public final class LdapTests {
|
||||
this.odmManager.create(person);
|
||||
}
|
||||
LOG.debug("Created all, reading back");
|
||||
new ExecuteRunnable<Person>().runTests(new RunnableTests<Person>() {
|
||||
new ExecuteRunnable<Person>().runTests(new RunnableTests<>() {
|
||||
public void runTest(Person testData) {
|
||||
Name dn = testData.getDn();
|
||||
LOG.debug(String.format("reading - %1$s", dn));
|
||||
@@ -434,7 +433,7 @@ public final class LdapTests {
|
||||
}
|
||||
|
||||
List<Person> allPeople = this.odmManager.findAll(Person.class, baseName, this.searchControls);
|
||||
assertThat(new HashSet<Person>(Arrays.asList(this.whatsLeft))).isEqualTo(new HashSet<Person>(allPeople));
|
||||
assertThat(new HashSet<>(Arrays.asList(this.whatsLeft))).isEqualTo(new HashSet<>(allPeople));
|
||||
}
|
||||
|
||||
// Trying to read a non-existant entry should be flagged as an error
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,7 +38,7 @@ public final class OrganizationalUnit {
|
||||
private Name dn;
|
||||
|
||||
@Attribute(name = "objectClass", syntax = "1.3.6.1.4.1.1466.115.121.1.38")
|
||||
private List<String> objectClass = new ArrayList<String>();
|
||||
private List<String> objectClass = new ArrayList<>();
|
||||
|
||||
@Attribute(name = "ou", syntax = "1.3.6.1.4.1.1466.115.121.1.15")
|
||||
private String ou;
|
||||
@@ -132,7 +132,7 @@ public final class OrganizationalUnit {
|
||||
}
|
||||
}
|
||||
else if (this.objectClass.size() != other.objectClass.size()
|
||||
|| !(new HashSet<String>(this.objectClass)).equals(new HashSet<String>(other.objectClass))) {
|
||||
|| !(new HashSet<>(this.objectClass)).equals(new HashSet<>(other.objectClass))) {
|
||||
return false;
|
||||
}
|
||||
if (this.ou == null) {
|
||||
@@ -160,7 +160,7 @@ public final class OrganizationalUnit {
|
||||
int result = 1;
|
||||
result = prime * result + ((this.description == null) ? 0 : this.description.hashCode());
|
||||
result = prime * result + ((this.dn == null) ? 0 : this.dn.hashCode());
|
||||
result = prime * result + ((this.objectClass == null) ? 0 : new HashSet<String>(this.objectClass).hashCode());
|
||||
result = prime * result + ((this.objectClass == null) ? 0 : new HashSet<>(this.objectClass).hashCode());
|
||||
result = prime * result + ((this.ou == null) ? 0 : this.ou.hashCode());
|
||||
result = prime * result + ((this.street == null) ? 0 : this.street.hashCode());
|
||||
return result;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,7 +42,7 @@ public final class Person {
|
||||
this.desc = desc;
|
||||
this.telephoneNumber = telephoneNumber;
|
||||
this.jpegPhoto = jpegPhoto;
|
||||
this.objectClasses = new ArrayList<String>();
|
||||
this.objectClasses = new ArrayList<>();
|
||||
this.objectClasses.add("inetOrgPerson");
|
||||
this.objectClasses.add("organizationalPerson");
|
||||
this.objectClasses.add("person");
|
||||
@@ -60,7 +60,7 @@ public final class Person {
|
||||
private String someRandomField = null;
|
||||
|
||||
@Transient
|
||||
private List<String> someRandomList = new ArrayList<String>();
|
||||
private List<String> someRandomList = new ArrayList<>();
|
||||
|
||||
@Attribute(name = "objectClass")
|
||||
private List<String> objectClasses;
|
||||
@@ -163,7 +163,7 @@ public final class Person {
|
||||
}
|
||||
}
|
||||
else if (this.desc.size() != other.desc.size()
|
||||
|| !(new HashSet<String>(this.desc)).equals(new HashSet<String>(other.desc))) {
|
||||
|| !(new HashSet<>(this.desc)).equals(new HashSet<>(other.desc))) {
|
||||
return false;
|
||||
}
|
||||
if (this.dn == null) {
|
||||
@@ -183,7 +183,7 @@ public final class Person {
|
||||
}
|
||||
}
|
||||
else if (this.objectClasses.size() != other.objectClasses.size()
|
||||
|| !(new HashSet<String>(this.objectClasses)).equals(new HashSet<String>(other.objectClasses))) {
|
||||
|| !(new HashSet<>(this.objectClasses)).equals(new HashSet<>(other.objectClasses))) {
|
||||
return false;
|
||||
}
|
||||
if (this.someRandomField == null) {
|
||||
@@ -221,11 +221,10 @@ public final class Person {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((this.cn == null) ? 0 : this.cn.hashCode());
|
||||
result = prime * result + ((this.desc == null) ? 0 : new HashSet<String>(this.desc).hashCode());
|
||||
result = prime * result + ((this.desc == null) ? 0 : new HashSet<>(this.desc).hashCode());
|
||||
result = prime * result + ((this.dn == null) ? 0 : this.dn.hashCode());
|
||||
result = prime * result + Arrays.hashCode(this.jpegPhoto);
|
||||
result = prime * result
|
||||
+ ((this.objectClasses == null) ? 0 : new HashSet<String>(this.objectClasses).hashCode());
|
||||
result = prime * result + ((this.objectClasses == null) ? 0 : new HashSet<>(this.objectClasses).hashCode());
|
||||
result = prime * result + ((this.someRandomField == null) ? 0 : this.someRandomField.hashCode());
|
||||
result = prime * result + ((this.someRandomList == null) ? 0 : this.someRandomList.hashCode());
|
||||
result = prime * result + ((this.surname == null) ? 0 : this.surname.hashCode());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,7 +35,7 @@ public final class PlainPerson {
|
||||
public PlainPerson(Name dn, String commonName, String surname) {
|
||||
this.dn = dn;
|
||||
this.surname = surname;
|
||||
this.objectClasses = new ArrayList<String>();
|
||||
this.objectClasses = new ArrayList<>();
|
||||
this.objectClasses.add("top");
|
||||
this.objectClasses.add("person");
|
||||
this.cn = commonName;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -83,7 +83,7 @@ public final class SchemaViewerTests {
|
||||
try {
|
||||
System.setErr(new PrintStream(output));
|
||||
|
||||
List<String> commandFlags = new ArrayList<String>(Arrays.asList(commonFlags));
|
||||
List<String> commandFlags = new ArrayList<>(Arrays.asList(commonFlags));
|
||||
commandFlags.addAll(Arrays.asList(flags));
|
||||
|
||||
SchemaViewer.main(commandFlags.toArray(new String[0]));
|
||||
@@ -114,7 +114,7 @@ public final class SchemaViewerTests {
|
||||
// ensure we get representative test coverage
|
||||
@Test
|
||||
public void testSchemaViewer() throws Exception {
|
||||
new ExecuteRunnable<TestData>().runTests(new RunnableTests<TestData>() {
|
||||
new ExecuteRunnable<TestData>().runTests(new RunnableTests<>() {
|
||||
public void runTest(TestData testData) {
|
||||
String result = runSchemaViewer(testData.flag, testData.value);
|
||||
assertThat(testData.result).isEqualTo(result);
|
||||
|
||||
@@ -131,7 +131,7 @@ public class ArrayMarshaller<E> implements Marshaller<ArrayTree<E>> {
|
||||
|
||||
if ((data.length == 1) && (data[0] == 0)) {
|
||||
E[] array = (E[]) new Object[] {};
|
||||
ArrayTree<E> tree = new ArrayTree<E>(this.comparator, array);
|
||||
ArrayTree<E> tree = new ArrayTree<>(this.comparator, array);
|
||||
return tree;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class ArrayMarshaller<E> implements Marshaller<ArrayTree<E>> {
|
||||
}
|
||||
}
|
||||
|
||||
ArrayTree<E> arrayTree = new ArrayTree<E>(this.comparator, nodes);
|
||||
ArrayTree<E> arrayTree = new ArrayTree<>(this.comparator, nodes);
|
||||
|
||||
return arrayTree;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2023 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,7 +39,7 @@ public class EmbeddedLdapServerFactoryBeanTests {
|
||||
assertThat(ldapTemplate).isNotNull();
|
||||
|
||||
List<String> list = ldapTemplate.search(LdapQueryBuilder.query().where("objectclass").is("person"),
|
||||
new AttributesMapper<String>() {
|
||||
new AttributesMapper<>() {
|
||||
public String mapFromAttributes(Attributes attrs) throws NamingException {
|
||||
return (String) attrs.get("cn").get();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2016 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -49,7 +49,7 @@ public class EmbeddedLdapServerFactoryBeanTests {
|
||||
assertThat(ldapTemplate).isNotNull();
|
||||
|
||||
List<String> list = ldapTemplate.search(LdapQueryBuilder.query().where("objectclass").is("person"),
|
||||
new AttributesMapper<String>() {
|
||||
new AttributesMapper<>() {
|
||||
public String mapFromAttributes(Attributes attrs) throws NamingException {
|
||||
return (String) attrs.get("cn").get();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2016 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -49,7 +49,7 @@ public class TestContextSourceFactoryBeanTests {
|
||||
assertThat(ldapTemplate).isNotNull();
|
||||
|
||||
List<String> list = ldapTemplate.search(LdapQueryBuilder.query().where("objectclass").is("person"),
|
||||
new AttributesMapper<String>() {
|
||||
new AttributesMapper<>() {
|
||||
public String mapFromAttributes(Attributes attrs) throws NamingException {
|
||||
return (String) attrs.get("cn").get();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2016 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -203,7 +203,7 @@ public class IncrementalAttributeMapperITests extends AbstractJUnit4SpringContex
|
||||
TransactionTemplate transactionTemplate = new TransactionTemplate(this.transactionManager);
|
||||
|
||||
try {
|
||||
transactionTemplate.execute(new TransactionCallback<Object>() {
|
||||
transactionTemplate.execute(new TransactionCallback<>() {
|
||||
@Override
|
||||
public Object doInTransaction(TransactionStatus status) {
|
||||
ModificationItem modificationItem = new ModificationItem(DirContext.ADD_ATTRIBUTE,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2016 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -100,7 +100,7 @@ public final class SchemaToJavaAdITests {
|
||||
this.contextSource.setPassword(PASSWORD);
|
||||
this.contextSource.setPooled(false);
|
||||
this.contextSource.setBase("dc=261consulting,dc=local");
|
||||
HashMap<String, Object> baseEnvironment = new HashMap<String, Object>() {
|
||||
HashMap<String, Object> baseEnvironment = new HashMap<>() {
|
||||
{
|
||||
put("java.naming.ldap.attributes.binary",
|
||||
"thumbnailLogo replPropertyMetaData partialAttributeSet registeredAddress userPassword telexNumber partialAttributeDeletionList mS-DS-ConsistencyGuid attributeCertificateAttribute thumbnailPhoto teletexTerminalIdentifier replUpToDateVector dSASignature objectGUID");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2016 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,7 +51,7 @@ public class PagedSearchITests extends AbstractJUnit4SpringContextTests {
|
||||
@Autowired
|
||||
private ContextSource contextSource;
|
||||
|
||||
private static final AttributesMapper<String> CN_ATTRIBUTES_MAPPER = new AttributesMapper<String>() {
|
||||
private static final AttributesMapper<String> CN_ATTRIBUTES_MAPPER = new AttributesMapper<>() {
|
||||
@Override
|
||||
public String mapFromAttributes(Attributes attributes) throws NamingException {
|
||||
return attributes.get("cn").get().toString();
|
||||
@@ -77,7 +77,7 @@ public class PagedSearchITests extends AbstractJUnit4SpringContextTests {
|
||||
// There should be three pages of three entries, and one final page with one entry
|
||||
final PagedResultsDirContextProcessor processor = new PagedResultsDirContextProcessor(3);
|
||||
|
||||
SingleContextSource.doWithSingleContext(this.contextSource, new LdapOperationsCallback<Object>() {
|
||||
SingleContextSource.doWithSingleContext(this.contextSource, new LdapOperationsCallback<>() {
|
||||
@Override
|
||||
public Object doWithLdapOperations(LdapOperations operations) {
|
||||
List<String> result = operations.search("ou=People", "(&(objectclass=person))", searchControls,
|
||||
|
||||
@@ -131,7 +131,7 @@ public class ArrayMarshaller<E> implements Marshaller<ArrayTree<E>> {
|
||||
|
||||
if ((data.length == 1) && (data[0] == 0)) {
|
||||
E[] array = (E[]) new Object[] {};
|
||||
ArrayTree<E> tree = new ArrayTree<E>(this.comparator, array);
|
||||
ArrayTree<E> tree = new ArrayTree<>(this.comparator, array);
|
||||
return tree;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class ArrayMarshaller<E> implements Marshaller<ArrayTree<E>> {
|
||||
}
|
||||
}
|
||||
|
||||
ArrayTree<E> arrayTree = new ArrayTree<E>(this.comparator, nodes);
|
||||
ArrayTree<E> arrayTree = new ArrayTree<>(this.comparator, nodes);
|
||||
|
||||
return arrayTree;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2016 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -102,7 +102,7 @@ public class LdapTemplateListITests extends AbstractLdapTemplateIntegrationTests
|
||||
}
|
||||
|
||||
private void verifyBindings(List<String> list) {
|
||||
LinkedList<LdapName> transformed = new LinkedList<LdapName>();
|
||||
LinkedList<LdapName> transformed = new LinkedList<>();
|
||||
|
||||
for (String s : list) {
|
||||
transformed.add(LdapUtils.newLdapName(s));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2022 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -554,13 +554,13 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
|
||||
|
||||
@Test
|
||||
public void verifyThatSearchWithCountLimitReturnsTheEntriesFoundSoFar() {
|
||||
List<Object> result = this.tested.search(
|
||||
LdapQueryBuilder.query().countLimit(3).where("objectclass").is("person"), new ContextMapper<Object>() {
|
||||
@Override
|
||||
public Object mapFromContext(Object ctx) throws NamingException {
|
||||
return new Object();
|
||||
}
|
||||
});
|
||||
List<Object> result = this.tested
|
||||
.search(LdapQueryBuilder.query().countLimit(3).where("objectclass").is("person"), new ContextMapper<>() {
|
||||
@Override
|
||||
public Object mapFromContext(Object ctx) throws NamingException {
|
||||
return new Object();
|
||||
}
|
||||
});
|
||||
|
||||
assertThat(result).hasSize(3);
|
||||
}
|
||||
@@ -569,7 +569,7 @@ public class LdapTemplateSearchResultITests extends AbstractLdapTemplateIntegrat
|
||||
public void verifyThatSearchWithCountLimitWithFlagToFalseThrowsException() {
|
||||
this.tested.setIgnoreSizeLimitExceededException(false);
|
||||
this.tested.search(LdapQueryBuilder.query().countLimit(3).where("objectclass").is("person"),
|
||||
new ContextMapper<Object>() {
|
||||
new ContextMapper<>() {
|
||||
@Override
|
||||
public Object mapFromContext(Object ctx) throws NamingException {
|
||||
return new Object();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2016 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -72,7 +72,7 @@ public class SupportedControlsITests extends AbstractLdapTemplateIntegrationTest
|
||||
String[] controls = (String[]) this.tested.lookup("", new String[] { SUPPORTED_CONTROL }, mapper);
|
||||
System.out.println(Arrays.toString(controls));
|
||||
|
||||
HashSet<String> controlsSet = new HashSet<String>(Arrays.asList(controls));
|
||||
HashSet<String> controlsSet = new HashSet<>(Arrays.asList(controls));
|
||||
|
||||
assertThat(controlsSet.contains("1.3.6.1.4.1.4203.1.10.1")).as("Entry Change Notification LDAPv3 control,")
|
||||
.isTrue();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2013 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -129,7 +129,7 @@ public class SimpleLdapTemplateITests extends AbstractLdapTemplateIntegrationTes
|
||||
this.ldapTemplate.modifyAttributes(ctx);
|
||||
|
||||
// verify that the data was properly updated.
|
||||
this.ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new ContextMapper<Object>() {
|
||||
this.ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new ContextMapper<>() {
|
||||
public Object mapFromContext(Object ctx) {
|
||||
DirContextAdapter adapter = (DirContextAdapter) ctx;
|
||||
assertThat(adapter.getStringAttribute("description")).isEqualTo("updated description");
|
||||
@@ -150,7 +150,7 @@ public class SimpleLdapTemplateITests extends AbstractLdapTemplateIntegrationTes
|
||||
this.ldapTemplate.modifyAttributes(ctx);
|
||||
|
||||
// verify that the data was properly updated.
|
||||
this.ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new ContextMapper<Object>() {
|
||||
this.ldapTemplate.lookup("cn=Some Person,ou=company1,ou=Sweden", new ContextMapper<>() {
|
||||
public Object mapFromContext(Object ctx) {
|
||||
DirContextAdapter adapter = (DirContextAdapter) ctx;
|
||||
assertThat(adapter.getStringAttribute("description")).isEqualTo("updated description");
|
||||
|
||||
@@ -28,7 +28,7 @@ public class RoleRepo {
|
||||
|
||||
@Transactional
|
||||
public Map<String, String> queryRoleMap() {
|
||||
return new HashMap<String, String>();
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2016 the original author or authors.
|
||||
* Copyright 2005-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -130,7 +130,7 @@ public class LdapTemplateOdmGroupManipulationITests extends AbstractLdapTemplate
|
||||
public void testSetMembersSyntacticallyEqual() {
|
||||
Group group = this.tested.findOne(LdapQueryBuilder.query().where("cn").is("ROLE_USER"), Group.class);
|
||||
|
||||
group.setMembers(new HashSet<Name>() {
|
||||
group.setMembers(new HashSet<>() {
|
||||
{
|
||||
add(LdapUtils.newLdapName("CN=Some Person,OU=company1, ou=Sweden, " + base));
|
||||
add(LdapUtils.newLdapName("CN=Some Person2, OU=company1,ou=Sweden," + base));
|
||||
|
||||
Reference in New Issue
Block a user