Replace explicit type with diamond operator in infrastructure module
This commit is contained in:
committed by
Mahmoud Ben Hassine
parent
3902837c3c
commit
424514a17b
@@ -29,6 +29,6 @@ public class SpELMappingGemfireItemWriter<K, V> extends GemfireItemWriter<K, V>
|
||||
SpELMappingGemfireItemWriter(String keyExpression) {
|
||||
super();
|
||||
Assert.hasText(keyExpression, "a valid keyExpression is required.");
|
||||
setItemKeyMapper(new SpELItemKeyMapper<K, V>(keyExpression));
|
||||
setItemKeyMapper(new SpELItemKeyMapper<>(keyExpression));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class HibernatePagingItemReader<T> extends AbstractPagingItemReader<T>
|
||||
protected void doReadPage() {
|
||||
|
||||
if (results == null) {
|
||||
results = new CopyOnWriteArrayList<T>();
|
||||
results = new CopyOnWriteArrayList<>();
|
||||
}
|
||||
else {
|
||||
results.clear();
|
||||
|
||||
@@ -55,7 +55,7 @@ public class JdbcParameterUtils {
|
||||
|
||||
char[] statement = sql.toCharArray();
|
||||
boolean withinQuotes = false;
|
||||
Map<String, StringBuilder> namedParameters = new HashMap<String, StringBuilder>();
|
||||
Map<String, StringBuilder> namedParameters = new HashMap<>();
|
||||
char currentQuote = '-';
|
||||
int parameterCount = 0;
|
||||
int i = 0;
|
||||
|
||||
@@ -60,7 +60,7 @@ public abstract class AbstractSqlPagingQueryProvider implements PagingQueryProvi
|
||||
|
||||
private String whereClause;
|
||||
|
||||
private Map<String, Order> sortKeys = new LinkedHashMap<String, Order>();
|
||||
private Map<String, Order> sortKeys = new LinkedHashMap<>();
|
||||
|
||||
private String groupClause;
|
||||
|
||||
@@ -198,7 +198,7 @@ public abstract class AbstractSqlPagingQueryProvider implements PagingQueryProvi
|
||||
if(groupClause != null) {
|
||||
sql.append(" GROUP BY ").append(groupClause);
|
||||
}
|
||||
List<String> namedParameters = new ArrayList<String>();
|
||||
List<String> namedParameters = new ArrayList<>();
|
||||
parameterCount = JdbcParameterUtils.countParameterPlaceholders(sql.toString(), namedParameters);
|
||||
if (namedParameters.size() > 0) {
|
||||
if (parameterCount != namedParameters.size()) {
|
||||
@@ -257,7 +257,7 @@ public abstract class AbstractSqlPagingQueryProvider implements PagingQueryProvi
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Order> getSortKeysWithoutAliases() {
|
||||
Map<String, Order> sortKeysWithoutAliases = new LinkedHashMap<String, Order>();
|
||||
Map<String, Order> sortKeysWithoutAliases = new LinkedHashMap<>();
|
||||
|
||||
for (Map.Entry<String, Order> sortKeyEntry : sortKeys.entrySet()) {
|
||||
String key = sortKeyEntry.getKey();
|
||||
|
||||
@@ -67,7 +67,7 @@ public class SqlPagingQueryProviderFactoryBean implements FactoryBean<PagingQuer
|
||||
|
||||
private Map<String, Order> sortKeys;
|
||||
|
||||
private Map<DatabaseType, AbstractSqlPagingQueryProvider> providers = new HashMap<DatabaseType, AbstractSqlPagingQueryProvider>();
|
||||
private Map<DatabaseType, AbstractSqlPagingQueryProvider> providers = new HashMap<>();
|
||||
|
||||
|
||||
{
|
||||
@@ -138,7 +138,7 @@ public class SqlPagingQueryProviderFactoryBean implements FactoryBean<PagingQuer
|
||||
public void setSortKey(String key) {
|
||||
Assert.doesNotContain(key, ",", "String setter is valid for a single ASC key only");
|
||||
|
||||
Map<String, Order> keys = new LinkedHashMap<String, Order>();
|
||||
Map<String, Order> keys = new LinkedHashMap<>();
|
||||
keys.put(key, Order.ASCENDING);
|
||||
|
||||
this.sortKeys = keys;
|
||||
|
||||
@@ -290,8 +290,8 @@ public class SqlPagingQueryUtils {
|
||||
*/
|
||||
public static void buildSortConditions(
|
||||
AbstractSqlPagingQueryProvider provider, StringBuilder sql) {
|
||||
List<Map.Entry<String, Order>> keys = new ArrayList<Map.Entry<String,Order>>(provider.getSortKeys().entrySet());
|
||||
List<String> clauses = new ArrayList<String>();
|
||||
List<Map.Entry<String, Order>> keys = new ArrayList<>(provider.getSortKeys().entrySet());
|
||||
List<String> clauses = new ArrayList<>();
|
||||
|
||||
for(int i = 0; i < keys.size(); i++) {
|
||||
StringBuilder clause = new StringBuilder();
|
||||
|
||||
@@ -123,7 +123,7 @@ public class SqlWindowingPagingQueryProvider extends AbstractSqlPagingQueryProvi
|
||||
|
||||
private Map<String, Order> getSortKeysReplaced(Object qualifierReplacement) {
|
||||
final String newQualifier = "" + qualifierReplacement;
|
||||
final Map<String, Order> sortKeys = new LinkedHashMap<String, Order>();
|
||||
final Map<String, Order> sortKeys = new LinkedHashMap<>();
|
||||
for (Map.Entry<String, Order> sortKey : getSortKeys().entrySet()) {
|
||||
sortKeys.put(sortKey.getKey().replaceFirst("^.*\\.", newQualifier), sortKey.getValue());
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class BeanWrapperFieldSetMapper<T> extends DefaultPropertyEditorRegistrar
|
||||
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
private ConcurrentMap<DistanceHolder, ConcurrentMap<String, String>> propertiesMatched = new ConcurrentHashMap<DistanceHolder, ConcurrentMap<String, String>>();
|
||||
private ConcurrentMap<DistanceHolder, ConcurrentMap<String, String>> propertiesMatched = new ConcurrentHashMap<>();
|
||||
|
||||
private int distanceLimit = 5;
|
||||
|
||||
|
||||
@@ -80,6 +80,6 @@ public class PatternMatchingCompositeLineMapper<T> implements LineMapper<T>, Ini
|
||||
|
||||
public void setFieldSetMappers(Map<String, FieldSetMapper<T>> fieldSetMappers) {
|
||||
Assert.isTrue(!fieldSetMappers.isEmpty(), "The 'fieldSetMappers' property must be non-empty");
|
||||
this.patternMatcher = new PatternMatcher<FieldSetMapper<T>>(fieldSetMappers);
|
||||
this.patternMatcher = new PatternMatcher<>(fieldSetMappers);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ final class PropertyMatches {
|
||||
* @param maxDistance the maximum distance to accept
|
||||
*/
|
||||
private String[] calculateMatches(PropertyDescriptor[] propertyDescriptors, int maxDistance) {
|
||||
List<String> candidates = new ArrayList<String>();
|
||||
List<String> candidates = new ArrayList<>();
|
||||
for (int i = 0; i < propertyDescriptors.length; i++) {
|
||||
if (propertyDescriptors[i].getWriteMethod() != null) {
|
||||
String possibleAlternative = propertyDescriptors[i].getName();
|
||||
|
||||
@@ -126,7 +126,7 @@ public abstract class AbstractLineTokenizer implements LineTokenizer {
|
||||
line = "";
|
||||
}
|
||||
|
||||
List<String> tokens = new ArrayList<String>(doTokenize(line));
|
||||
List<String> tokens = new ArrayList<>(doTokenize(line));
|
||||
|
||||
// if names are set and strict flag is false
|
||||
if ( ( names.length != 0 ) && ( ! strict ) ) {
|
||||
|
||||
@@ -50,7 +50,7 @@ public class BeanWrapperFieldExtractor<T> implements FieldExtractor<T>, Initiali
|
||||
*/
|
||||
@Override
|
||||
public Object[] extract(T item) {
|
||||
List<Object> values = new ArrayList<Object>();
|
||||
List<Object> values = new ArrayList<>();
|
||||
|
||||
BeanWrapper bw = new BeanWrapperImpl(item);
|
||||
for (String propertyName : this.names) {
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public abstract class ExtractorLineAggregator<T> implements LineAggregator<T> {
|
||||
|
||||
private FieldExtractor<T> fieldExtractor = new PassThroughFieldExtractor<T>();
|
||||
private FieldExtractor<T> fieldExtractor = new PassThroughFieldExtractor<>();
|
||||
|
||||
/**
|
||||
* Public setter for the field extractor responsible for splitting an input
|
||||
|
||||
@@ -99,7 +99,7 @@ public class FixedLengthTokenizer extends AbstractLineTokenizer {
|
||||
*/
|
||||
@Override
|
||||
protected List<String> doTokenize(String line) {
|
||||
List<String> tokens = new ArrayList<String>(ranges.length);
|
||||
List<String> tokens = new ArrayList<>(ranges.length);
|
||||
int lineLength;
|
||||
String token;
|
||||
|
||||
|
||||
@@ -63,6 +63,6 @@ public class PatternMatchingCompositeLineTokenizer implements LineTokenizer, Ini
|
||||
|
||||
public void setTokenizers(Map<String, LineTokenizer> tokenizers) {
|
||||
Assert.isTrue(!tokenizers.isEmpty(), "The 'tokenizers' property must be non-empty");
|
||||
this.tokenizers = new PatternMatcher<LineTokenizer>(tokenizers);
|
||||
this.tokenizers = new PatternMatcher<>(tokenizers);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class RegexLineTokenizer extends AbstractLineTokenizer {
|
||||
boolean matchFound = matcher.find();
|
||||
|
||||
if (matchFound) {
|
||||
List<String> tokens = new ArrayList<String>(matcher.groupCount());
|
||||
List<String> tokens = new ArrayList<>(matcher.groupCount());
|
||||
for (int i = 1; i <= matcher.groupCount(); i++) {
|
||||
tokens.add(matcher.group(i));
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.classify.ClassifierSupport;
|
||||
public class ClassifierCompositeItemProcessor<I,O> implements ItemProcessor<I, O> {
|
||||
|
||||
private Classifier<? super I, ItemProcessor<?, ? extends O>> classifier =
|
||||
new ClassifierSupport<I, ItemProcessor<?, ? extends O>> (null);
|
||||
new ClassifierSupport<> (null);
|
||||
|
||||
/**
|
||||
* Establishes the classifier that will determine which {@link ItemProcessor} to use.
|
||||
|
||||
@@ -38,7 +38,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class ClassifierCompositeItemWriter<T> implements ItemWriter<T> {
|
||||
|
||||
private Classifier<T, ItemWriter<? super T>> classifier = new ClassifierSupport<T, ItemWriter<? super T>>(null);
|
||||
private Classifier<T, ItemWriter<? super T>> classifier = new ClassifierSupport<>(null);
|
||||
|
||||
/**
|
||||
* @param classifier the classifier to set
|
||||
@@ -55,12 +55,12 @@ public class ClassifierCompositeItemWriter<T> implements ItemWriter<T> {
|
||||
@Override
|
||||
public void write(List<? extends T> items) throws Exception {
|
||||
|
||||
Map<ItemWriter<? super T>, List<T>> map = new LinkedHashMap<ItemWriter<? super T>, List<T>>();
|
||||
Map<ItemWriter<? super T>, List<T>> map = new LinkedHashMap<>();
|
||||
|
||||
for (T item : items) {
|
||||
ItemWriter<? super T> key = classifier.classify(item);
|
||||
if (!map.containsKey(key)) {
|
||||
map.put(key, new ArrayList<T>());
|
||||
map.put(key, new ArrayList<>());
|
||||
}
|
||||
map.get(key).add(item);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.springframework.batch.item.ItemStreamException;
|
||||
*/
|
||||
public class CompositeItemStream implements ItemStream {
|
||||
|
||||
private List<ItemStream> streams = new ArrayList<ItemStream>();
|
||||
private List<ItemStream> streams = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Public setter for the {@link ItemStream}s.
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ListItemReader<T> implements ItemReader<T> {
|
||||
this.list = list;
|
||||
}
|
||||
else {
|
||||
this.list = new ArrayList<T>(list);
|
||||
this.list = new ArrayList<>(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
*/
|
||||
public class ListItemWriter<T> implements ItemWriter<T> {
|
||||
|
||||
private List<T> writtenItems = new ArrayList<T>();
|
||||
private List<T> writtenItems = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void write(List<? extends T> items) throws Exception {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ScriptItemProcessor<I, O> implements ItemProcessor<I, O>, Initializ
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public O process(I item) throws Exception {
|
||||
Map<String, Object> arguments = new HashMap<String, Object>();
|
||||
Map<String, Object> arguments = new HashMap<>();
|
||||
arguments.put(itemBindingVariableName, item);
|
||||
|
||||
return (O) scriptEvaluator.evaluate(getScriptSource(), arguments);
|
||||
|
||||
@@ -112,7 +112,7 @@ ResourceAwareItemReaderItemStream<T>, InitializingBean {
|
||||
* @param fragmentRootElementNames list of the names of the root element of the fragment
|
||||
*/
|
||||
public void setFragmentRootElementNames(String[] fragmentRootElementNames) {
|
||||
this.fragmentRootElementNames = new ArrayList<QName>();
|
||||
this.fragmentRootElementNames = new ArrayList<>();
|
||||
for (String fragmentRootElementName : fragmentRootElementNames) {
|
||||
this.fragmentRootElementNames.add(parseFragmentRootElementName(fragmentRootElementName));
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import javax.xml.stream.events.XMLEvent;
|
||||
*/
|
||||
public class UnclosedElementCollectingEventWriter extends AbstractEventWriterWrapper {
|
||||
|
||||
private LinkedList<QName> unclosedElements = new LinkedList<QName>();
|
||||
private LinkedList<QName> unclosedElements = new LinkedList<>();
|
||||
|
||||
public UnclosedElementCollectingEventWriter(XMLEventWriter wrappedEventWriter) {
|
||||
super(wrappedEventWriter);
|
||||
|
||||
@@ -44,7 +44,7 @@ public class UnopenedElementClosingEventWriter extends AbstractEventWriterWrappe
|
||||
|
||||
public UnopenedElementClosingEventWriter(XMLEventWriter wrappedEventWriter, Writer ioWriter, List<QName> unopenedElements) {
|
||||
super(wrappedEventWriter);
|
||||
this.unopenedElements = new LinkedList<QName>(unopenedElements);
|
||||
this.unopenedElements = new LinkedList<>(unopenedElements);
|
||||
this.ioWriter = ioWriter;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class DirectPoller<S> implements Poller<S> {
|
||||
*/
|
||||
@Override
|
||||
public Future<S> poll(Callable<S> callable) throws Exception {
|
||||
return new DirectPollingFuture<S>(interval, callable);
|
||||
return new DirectPollingFuture<>(interval, callable);
|
||||
}
|
||||
|
||||
private static class DirectPollingFuture<S> implements Future<S> {
|
||||
|
||||
@@ -35,7 +35,7 @@ public class RepeatContextSupport extends SynchronizedAttributeAccessor implemen
|
||||
|
||||
private volatile boolean terminateOnly;
|
||||
|
||||
private Map<String, Set<Runnable>> callbacks = new HashMap<String, Set<Runnable>>();
|
||||
private Map<String, Set<Runnable>> callbacks = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Constructor for {@link RepeatContextSupport}. The parent can be null, but
|
||||
@@ -128,7 +128,7 @@ public class RepeatContextSupport extends SynchronizedAttributeAccessor implemen
|
||||
synchronized (callbacks) {
|
||||
Set<Runnable> set = callbacks.get(name);
|
||||
if (set == null) {
|
||||
set = new HashSet<Runnable>();
|
||||
set = new HashSet<>();
|
||||
callbacks.put(name, set);
|
||||
}
|
||||
set.add(callback);
|
||||
@@ -143,12 +143,12 @@ public class RepeatContextSupport extends SynchronizedAttributeAccessor implemen
|
||||
@Override
|
||||
public void close() {
|
||||
|
||||
List<RuntimeException> errors = new ArrayList<RuntimeException>();
|
||||
List<RuntimeException> errors = new ArrayList<>();
|
||||
|
||||
Set<Map.Entry<String, Set<Runnable>>> copy;
|
||||
|
||||
synchronized (callbacks) {
|
||||
copy = new HashSet<Map.Entry<String, Set<Runnable>>>(callbacks.entrySet());
|
||||
copy = new HashSet<>(callbacks.entrySet());
|
||||
}
|
||||
|
||||
for (Map.Entry<String, Set<Runnable>> entry : copy) {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class LogOrRethrowExceptionHandler implements ExceptionHandler {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(LogOrRethrowExceptionHandler.class);
|
||||
|
||||
private Classifier<Throwable, Level> exceptionClassifier = new ClassifierSupport<Throwable, Level>(Level.RETHROW);
|
||||
private Classifier<Throwable, Level> exceptionClassifier = new ClassifierSupport<>(Level.RETHROW);
|
||||
|
||||
/**
|
||||
* Setter for the {@link Classifier} used by this handler. The default is to
|
||||
|
||||
@@ -73,7 +73,7 @@ public class RethrowOnThresholdExceptionHandler implements ExceptionHandler {
|
||||
* @param thresholds the threshold value map.
|
||||
*/
|
||||
public void setThresholds(Map<Class<? extends Throwable>, Integer> thresholds) {
|
||||
Map<Class<? extends Throwable>, IntegerHolder> typeMap = new HashMap<Class<? extends Throwable>, IntegerHolder>();
|
||||
Map<Class<? extends Throwable>, IntegerHolder> typeMap = new HashMap<>();
|
||||
for (Entry<Class<? extends Throwable>, Integer> entry : thresholds.entrySet()) {
|
||||
typeMap.put(entry.getKey(), new IntegerHolder(entry.getValue()));
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class SimpleLimitExceptionHandler implements ExceptionHandler, Initializi
|
||||
if (limit <= 0) {
|
||||
return;
|
||||
}
|
||||
Map<Class<? extends Throwable>, Integer> thresholds = new HashMap<Class<? extends Throwable>, Integer>();
|
||||
Map<Class<? extends Throwable>, Integer> thresholds = new HashMap<>();
|
||||
for (Class<? extends Throwable> type : exceptionClasses) {
|
||||
thresholds.put(type, limit);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.springframework.batch.repeat.RepeatListener;
|
||||
*/
|
||||
public class CompositeRepeatListener implements RepeatListener {
|
||||
|
||||
private List<RepeatListener> listeners = new ArrayList<RepeatListener>();
|
||||
private List<RepeatListener> listeners = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Public setter for the listeners.
|
||||
|
||||
@@ -88,7 +88,7 @@ public class CompositeCompletionPolicy implements CompletionPolicy {
|
||||
*/
|
||||
@Override
|
||||
public RepeatContext start(RepeatContext context) {
|
||||
List<RepeatContext> list = new ArrayList<RepeatContext>();
|
||||
List<RepeatContext> list = new ArrayList<>();
|
||||
for (int i = 0; i < policies.length; i++) {
|
||||
list.add(policies[i].start(context));
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Set;
|
||||
public class RepeatInternalStateSupport implements RepeatInternalState {
|
||||
|
||||
// Accumulation of failed results.
|
||||
private final Set<Throwable> throwables = new HashSet<Throwable>();
|
||||
private final Set<Throwable> throwables = new HashSet<>();
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.repeat.support.BatchInternalState#getThrowables()
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.batch.repeat.RepeatOperations;
|
||||
*/
|
||||
public final class RepeatSynchronizationManager {
|
||||
|
||||
private static final ThreadLocal<RepeatContext> contextHolder = new ThreadLocal<RepeatContext>();
|
||||
private static final ThreadLocal<RepeatContext> contextHolder = new ThreadLocal<>();
|
||||
|
||||
private RepeatSynchronizationManager() {
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ResultHolderResultQueue implements ResultQueue<ResultHolder> {
|
||||
* at any given time.
|
||||
*/
|
||||
public ResultHolderResultQueue(int throttleLimit) {
|
||||
results = new PriorityBlockingQueue<ResultHolder>(throttleLimit, new ResultHolderComparator());
|
||||
results = new PriorityBlockingQueue<>(throttleLimit, new ResultHolderComparator());
|
||||
waits = new Semaphore(throttleLimit);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ThrottleLimitResultQueue<T> implements ResultQueue<T> {
|
||||
* at any given time.
|
||||
*/
|
||||
public ThrottleLimitResultQueue(int throttleLimit) {
|
||||
results = new LinkedBlockingQueue<T>();
|
||||
results = new LinkedBlockingQueue<>();
|
||||
waits = new Semaphore(throttleLimit);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ public class AnnotationMethodResolver implements MethodResolver {
|
||||
@Override
|
||||
public Method findMethod(final Class<?> clazz) {
|
||||
Assert.notNull(clazz, "class must not be null");
|
||||
final AtomicReference<Method> annotatedMethod = new AtomicReference<Method>();
|
||||
final AtomicReference<Method> annotatedMethod = new AtomicReference<>();
|
||||
ReflectionUtils.doWithMethods(clazz, new ReflectionUtils.MethodCallback() {
|
||||
@Override
|
||||
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
|
||||
|
||||
@@ -52,7 +52,7 @@ public enum DatabaseType {
|
||||
private static final Map<String, DatabaseType> nameMap;
|
||||
|
||||
static{
|
||||
nameMap = new HashMap<String, DatabaseType>();
|
||||
nameMap = new HashMap<>();
|
||||
for(DatabaseType type: values()){
|
||||
nameMap.put(type.getProductName(), type);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class DefaultPropertyEditorRegistrar implements PropertyEditorRegistrar {
|
||||
* @see CustomEditorConfigurer#setCustomEditors(Map)
|
||||
*/
|
||||
public void setCustomEditors(Map<? extends Object, ? extends PropertyEditor> customEditors) {
|
||||
this.customEditors = new HashMap<Class<?>, PropertyEditor>();
|
||||
this.customEditors = new HashMap<>();
|
||||
for (Entry<? extends Object, ? extends PropertyEditor> entry : customEditors.entrySet()) {
|
||||
Object key = entry.getKey();
|
||||
Class<?> requiredType = null;
|
||||
|
||||
@@ -30,8 +30,8 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class PatternMatcher<S> {
|
||||
|
||||
private Map<String, S> map = new HashMap<String, S>();
|
||||
private List<String> sorted = new ArrayList<String>();
|
||||
private Map<String, S> map = new HashMap<>();
|
||||
private List<String> sorted = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Initialize a new {@link PatternMatcher} with a map of patterns to values
|
||||
@@ -41,7 +41,7 @@ public class PatternMatcher<S> {
|
||||
super();
|
||||
this.map = map;
|
||||
// Sort keys to start with the most specific
|
||||
sorted = new ArrayList<String>(map.keySet());
|
||||
sorted = new ArrayList<>(map.keySet());
|
||||
Collections.sort(sorted, new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(String o1, String o2) {
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ResourcelessTransactionManager extends AbstractPlatformTransactionM
|
||||
Object transaction = new ResourcelessTransaction();
|
||||
List<Object> resources;
|
||||
if (!TransactionSynchronizationManager.hasResource(this)) {
|
||||
resources = new ArrayList<Object>();
|
||||
resources = new ArrayList<>();
|
||||
TransactionSynchronizationManager.bindResource(this, resources);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -159,39 +159,39 @@ public class TransactionAwareProxyFactory<T> {
|
||||
}
|
||||
|
||||
public static <K, V> Map<K, V> createTransactionalMap() {
|
||||
return new TransactionAwareProxyFactory<ConcurrentHashMap<K, V>>(new ConcurrentHashMap<K, V>()).createInstance();
|
||||
return new TransactionAwareProxyFactory<>(new ConcurrentHashMap<K, V>()).createInstance();
|
||||
}
|
||||
|
||||
public static <K, V> Map<K, V> createTransactionalMap(Map<K, V> map) {
|
||||
return new TransactionAwareProxyFactory<ConcurrentHashMap<K, V>>(new ConcurrentHashMap<K, V>(map)).createInstance();
|
||||
return new TransactionAwareProxyFactory<>(new ConcurrentHashMap<>(map)).createInstance();
|
||||
}
|
||||
|
||||
public static <K, V> ConcurrentMap<K, V> createAppendOnlyTransactionalMap() {
|
||||
return new TransactionAwareProxyFactory<ConcurrentHashMap<K, V>>(new ConcurrentHashMap<K, V>(), true).createInstance();
|
||||
return new TransactionAwareProxyFactory<>(new ConcurrentHashMap<K, V>(), true).createInstance();
|
||||
}
|
||||
|
||||
public static <T> Set<T> createAppendOnlyTransactionalSet() {
|
||||
return new TransactionAwareProxyFactory<CopyOnWriteArraySet<T>>(new CopyOnWriteArraySet<T>(), true).createInstance();
|
||||
return new TransactionAwareProxyFactory<>(new CopyOnWriteArraySet<T>(), true).createInstance();
|
||||
}
|
||||
|
||||
public static <T> Set<T> createTransactionalSet() {
|
||||
return new TransactionAwareProxyFactory<CopyOnWriteArraySet<T>>(new CopyOnWriteArraySet<T>()).createInstance();
|
||||
return new TransactionAwareProxyFactory<>(new CopyOnWriteArraySet<T>()).createInstance();
|
||||
}
|
||||
|
||||
public static <T> Set<T> createTransactionalSet(Set<T> set) {
|
||||
return new TransactionAwareProxyFactory<CopyOnWriteArraySet<T>>(new CopyOnWriteArraySet<T>(set)).createInstance();
|
||||
return new TransactionAwareProxyFactory<>(new CopyOnWriteArraySet<>(set)).createInstance();
|
||||
}
|
||||
|
||||
public static <T> List<T> createAppendOnlyTransactionalList() {
|
||||
return new TransactionAwareProxyFactory<CopyOnWriteArrayList<T>>(new CopyOnWriteArrayList<T>(), true).createInstance();
|
||||
return new TransactionAwareProxyFactory<>(new CopyOnWriteArrayList<T>(), true).createInstance();
|
||||
}
|
||||
|
||||
public static <T> List<T> createTransactionalList() {
|
||||
return new TransactionAwareProxyFactory<CopyOnWriteArrayList<T>>(new CopyOnWriteArrayList<T>()).createInstance();
|
||||
return new TransactionAwareProxyFactory<>(new CopyOnWriteArrayList<T>()).createInstance();
|
||||
}
|
||||
|
||||
public static <T> List<T> createTransactionalList(List<T> list) {
|
||||
return new TransactionAwareProxyFactory<CopyOnWriteArrayList<T>>(new CopyOnWriteArrayList<T>(list)).createInstance();
|
||||
return new TransactionAwareProxyFactory<>(new CopyOnWriteArrayList<>(list)).createInstance();
|
||||
}
|
||||
|
||||
private class TargetSynchronization extends TransactionSynchronizationAdapter {
|
||||
@@ -252,7 +252,7 @@ public class TransactionAwareProxyFactory<T> {
|
||||
return invocation.proceed();
|
||||
}
|
||||
if (result instanceof Collection<?>) {
|
||||
HashSet<Object> set = new HashSet<Object>((Collection<?>) result);
|
||||
HashSet<Object> set = new HashSet<>((Collection<?>) result);
|
||||
set.addAll((Collection<?>) invocation.proceed());
|
||||
result = set;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user