orderedOptionNames) {
- this.options = options;
- this.params = params;
- this.orderedOptionNames = orderedOptionNames;
- }
-
- /**
- * Determine if the option with the given name was used on the command line.
- *
- * The supplied option name is trimmed before matching against the command line arguments. Note that any special characters
- * such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name.
- *
- * @param name the name for the option (e.g., "-v" or "--verbose")
- * @return true if the exact option was used, or false otherwise or if the supplied option name is null
- * @see #hasOption(String, String)
- */
- public boolean hasOption(String name) {
- return hasOption(name, null);
- }
-
- /**
- * Determine if the option with one of the given names was used on the command line.
- *
- * The supplied option name and alternative names are trimmed before matching against the command line arguments. Note that
- * any special characters such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name.
- *
- * @param name the name for the option (e.g., "-v" or "--verbose")
- * @param alternativeName an alternative name for the option; may be null
- * @return true if the exact option was used, or false otherwise or if both the supplied option name and alternative name are
- * null
- * @see #hasOption(String)
- */
- public boolean hasOption(String name, String alternativeName) {
- return getOption(name, alternativeName, null) != null;
- }
-
- /**
- * Obtain the value associated with the named option.
- *
- * The supplied option name is trimmed before matching against the command line arguments. Note that any special characters
- * such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name.
- *
- * @param name the name for the option (e.g., "-v" or "--verbose")
- * @return the value associated with the option, or null if no option was found or the name is null
- * @see #getOption(String, String)
- * @see #getOption(String, String, String)
- */
- public String getOption(String name) {
- return getOption(name, null);
- }
-
- /**
- * Obtain the value associated with the named option, using the supplied default value if none is found.
- *
- * The supplied option name is trimmed before matching against the command line arguments. Note that any special characters
- * such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name.
- *
- * @param name the name for the option (e.g., "-v" or "--verbose")
- * @param defaultValue the value that should be returned no named option was found
- * @return the value associated with the option, or the default value if none was found or the name is null
- * @see #getOption(String)
- * @see #getOption(String, String, String)
- */
- public String getOption(String name, String defaultValue) {
- return getOption(name, null, defaultValue);
- }
-
- /**
- * Obtain the value associated with the option given the name and alternative name of the option, using the supplied default
- * value if none is found.
- *
- * The supplied option name and alternative names are trimmed before matching against the command line arguments. Note that
- * any special characters such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name.
- *
- * @param name the name for the option (e.g., "-v" or "--verbose")
- * @param alternativeName an alternative name for the option; may be null
- * @param defaultValue the value that should be returned no named option was found
- * @return the value associated with the option, or the default value if none was found or if both the name and alternative
- * name are null
- * @see #getOption(String)
- * @see #getOption(String, String)
- */
- public String getOption(String name, String alternativeName, String defaultValue) {
- recordOptionUsed(name, alternativeName);
- String result = options.get(name.trim());
- if (result == null && alternativeName != null) result = options.get(alternativeName.trim());
- return result != null ? result : defaultValue;
- }
-
- protected void recordOptionUsed(String name, String alternativeName) {
- orderedOptionNames.remove(name.trim());
- if (alternativeName != null) orderedOptionNames.remove(alternativeName.trim());
- }
-
- /**
- * Obtain the long value associated with the named option, using the supplied default value if none is found or if the value
- * cannot be parsed as a long value.
- *
- * The supplied option name is trimmed before matching against the command line arguments. Note that any special characters
- * such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name.
- *
- * @param name the name for the option (e.g., "-v" or "--verbose")
- * @param defaultValue the value that should be returned no named option was found
- * @return the value associated with the option, or the default value if none was found or the name is null
- * @see #getOption(String, String, long)
- */
- public long getOption(String name, long defaultValue) {
- return getOption(name, null, defaultValue);
- }
-
- /**
- * Obtain the long value associated with the option given the name and alternative name of the option, using the supplied
- * default value if none is found or if the value cannot be parsed as a long value.
- *
- * The supplied option name and alternative names are trimmed before matching against the command line arguments. Note that
- * any special characters such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name.
- *
- * @param name the name for the option (e.g., "-v" or "--verbose")
- * @param alternativeName an alternative name for the option; may be null
- * @param defaultValue the value that should be returned no named option was found
- * @return the value associated with the option, or the default value if none was found or if both the name and alternative
- * name are null
- * @see #getOption(String, long)
- */
- public long getOption(String name, String alternativeName, long defaultValue) {
- return Strings.asLong(getOption(name, alternativeName, null), defaultValue);
- }
-
- /**
- * Obtain the integer value associated with the named option, using the supplied default value if none is found or if the
- * value
- * cannot be parsed as an integer value.
- *
- * The supplied option name is trimmed before matching against the command line arguments. Note that any special characters
- * such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name.
- *
- * @param name the name for the option (e.g., "-v" or "--verbose")
- * @param defaultValue the value that should be returned no named option was found
- * @return the value associated with the option, or the default value if none was found or the name is null
- * @see #getOption(String, String, int)
- */
- public int getOption(String name, int defaultValue) {
- return getOption(name, null, defaultValue);
- }
-
- /**
- * Obtain the integer value associated with the option given the name and alternative name of the option, using the supplied
- * default value if none is found or if the value cannot be parsed as an integer value.
- *
- * The supplied option name and alternative names are trimmed before matching against the command line arguments. Note that
- * any special characters such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name.
- *
- * @param name the name for the option (e.g., "-v" or "--verbose")
- * @param alternativeName an alternative name for the option; may be null
- * @param defaultValue the value that should be returned no named option was found
- * @return the value associated with the option, or the default value if none was found or if both the name and alternative
- * name are null
- * @see #getOption(String, int)
- */
- public int getOption(String name, String alternativeName, int defaultValue) {
- return Strings.asInt(getOption(name, alternativeName, null), defaultValue);
- }
-
- /**
- * Obtain the boolean value associated with the named option, using the supplied default value if none is found or if the
- * value
- * cannot be parsed as a boolean value.
- *
- * The supplied option name is trimmed before matching against the command line arguments. Note that any special characters
- * such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name.
- *
- * @param name the name for the option (e.g., "-v" or "--verbose")
- * @param defaultValue the value that should be returned no named option was found
- * @return the value associated with the option, or the default value if none was found or the name is null
- * @see #getOption(String, String, boolean)
- */
- public boolean getOption(String name, boolean defaultValue) {
- return getOption(name, null, defaultValue);
- }
-
- /**
- * Obtain the boolean value associated with the option given the name and alternative name of the option, using the supplied
- * default value if none is found or if the value cannot be parsed as a boolean value.
- *
- * The supplied option name and alternative names are trimmed before matching against the command line arguments. Note that
- * any special characters such as prefixes (e.g., '{@code -}' or '{@code --}') must be included in the name.
- *
- * @param name the name for the option (e.g., "-v" or "--verbose")
- * @param alternativeName an alternative name for the option; may be null
- * @param defaultValue the value that should be returned no named option was found
- * @return the value associated with the option, or the default value if none was found or if both the name and alternative
- * name are null
- * @see #getOption(String, boolean)
- */
- public boolean getOption(String name, String alternativeName, boolean defaultValue) {
- return Strings.asBoolean(getOption(name, alternativeName, null), defaultValue);
- }
-
- /**
- * Obtain the parameter at the given index. Parameters are those arguments that are not preceded by an option name.
- *
- * @param index the index of the parameter
- * @return the parameter value, or null if there was no parameter at the given index
- */
- public String getParameter(int index) {
- return index < 0 || index >= params.size() ? null : params.get(index);
- }
-
- /**
- * Determine whether the specified value matches one of the parameters.
- *
- * @param value the parameter value to match
- * @return true if one of the parameter matches the value, or false otherwise
- */
- public boolean hasParameter(String value) {
- return value == null || params.isEmpty() ? false : params.contains(value);
- }
-
- /**
- * Determine whether there were any unknown option names after all possible options have been checked via one of the
- * {@code getOption(String,...)} methods.
- *
- * @return true if there was at least one option (e.g., beginning with '{@code -}') that was not checked, or false
- * if there were no unknown options on the command line
- * @see #getFirstUnknownOptionName()
- * @see #hasUnknowns()
- */
- public boolean hasUnknowns() {
- return !orderedOptionNames.isEmpty();
- }
-
- /**
- * Get the list of unknown option names after all possible options have been checked via one of the
- * {@code getOption(String,...)} methods.
- *
- * @return the list of options (e.g., beginning with '{@code -}') that were not checked; never null but possible empty
- * @see #getFirstUnknownOptionName()
- * @see #hasUnknowns()
- */
- public List getUnknownOptionNames() {
- return Collections.unmodifiableList(orderedOptionNames);
- }
-
- /**
- * If there were {@link #hasUnknowns() unknown options}, return the first one that appeared on the command line.
- * @return the first unknown option, or null if there were no {@link #hasUnknowns() unknown options}
- * @see #getUnknownOptionNames()
- * @see #getFirstUnknownOptionName()
- */
- public String getFirstUnknownOptionName() {
- return orderedOptionNames.isEmpty() ? null : orderedOptionNames.get(0);
- }
-
- @Override
- public String toString() {
- StringJoiner joiner = new StringJoiner(" ");
- options.forEach((opt, val) -> {
- joiner.add("-" + opt).add(val);
- });
- params.forEach(joiner::add);
- return joiner.toString();
- }
-
-}
diff --git a/debezium-core/src/main/java/io/debezium/util/FunctionalReadWriteLock.java b/debezium-core/src/main/java/io/debezium/util/FunctionalReadWriteLock.java
index 9fcfbf149..e4fb9884c 100644
--- a/debezium-core/src/main/java/io/debezium/util/FunctionalReadWriteLock.java
+++ b/debezium-core/src/main/java/io/debezium/util/FunctionalReadWriteLock.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-core/src/main/java/io/debezium/util/HashCode.java b/debezium-core/src/main/java/io/debezium/util/HashCode.java
index 753f55a69..36bbd66fb 100644
--- a/debezium-core/src/main/java/io/debezium/util/HashCode.java
+++ b/debezium-core/src/main/java/io/debezium/util/HashCode.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@@ -15,10 +15,10 @@
*/
@Immutable
public class HashCode {
-
+
// Prime number used in improving distribution
private static final int PRIME = 103;
-
+
/**
* Compute a combined hash code from the supplied objects. This method always returns 0 if no objects are supplied.
*
@@ -26,9 +26,9 @@ public class HashCode {
* @return the hash code
*/
public static int compute(Object... objects) {
- return _compute(0, objects);
+ return computeHashCode(0, objects);
}
-
+
/**
* Compute a combined hash code from the supplied objects using the supplied seed.
*
@@ -36,8 +36,8 @@ public static int compute(Object... objects) {
* @param objects the objects that should be used to compute the hash code
* @return the hash code
*/
- private static int _compute(int seed,
- Object... objects) {
+ private static int computeHashCode(int seed,
+ Object... objects) {
if (objects == null || objects.length == 0) {
return seed * HashCode.PRIME;
}
@@ -69,8 +69,8 @@ private static int _compute(int seed,
}
return hc;
}
-
+
private HashCode() {
}
-
+
}
\ No newline at end of file
diff --git a/debezium-core/src/main/java/io/debezium/util/IoUtil.java b/debezium-core/src/main/java/io/debezium/util/IoUtil.java
index 432f0edb9..377c91366 100644
--- a/debezium-core/src/main/java/io/debezium/util/IoUtil.java
+++ b/debezium-core/src/main/java/io/debezium/util/IoUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@@ -164,7 +164,7 @@ public static String read(InputStream stream) throws IOException {
* reading.
*
* @param stream the streamed contents; may be null
- * @param charset charset of the stream data; may not be null
+ * @param charset character set of the stream data; may not be null
* @return the contents, or an empty string if the supplied stream is null
* @throws IOException if there is an error reading the content
*/
diff --git a/debezium-core/src/main/java/io/debezium/util/Iterators.java b/debezium-core/src/main/java/io/debezium/util/Iterators.java
deleted file mode 100644
index 097e883f8..000000000
--- a/debezium-core/src/main/java/io/debezium/util/Iterators.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Copyright 2015 Debezium Authors.
- *
- * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
- */
-package io.debezium.util;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-import java.util.function.BiFunction;
-import java.util.function.Function;
-
-import io.debezium.annotation.Immutable;
-
-/**
- * A utility for creating iterators.
- *
- * @author Randall Hauch
- */
-@Immutable
-public class Iterators {
-
- public static Iterator empty() {
- return new Iterator() {
- @Override
- public boolean hasNext() {
- return false;
- }
-
- @Override
- public T next() {
- throw new NoSuchElementException();
- }
- };
- }
-
- public static Iterator with(final T value) {
- return new Iterator() {
- private boolean finished = false;
-
- @Override
- public boolean hasNext() {
- return !finished;
- }
-
- @Override
- public T next() {
- if (finished) {
- throw new NoSuchElementException();
- }
- finished = true;
- return value;
- }
- };
- }
-
- public static Iterator with(T value1, T value2) {
- return new Iterator() {
- private int remaining = 2;
-
- @Override
- public boolean hasNext() {
- return remaining > 0;
- }
-
- @Override
- public T next() {
- if (remaining == 2) {
- --remaining;
- return value1;
- }
- if (remaining == 1) {
- --remaining;
- return value2;
- }
- throw new NoSuchElementException();
- }
- };
- }
-
- public static Iterator with(T value1, T value2, T value3) {
- return new Iterator() {
- private int remaining = 3;
-
- @Override
- public boolean hasNext() {
- return remaining > 0;
- }
-
- @Override
- public T next() {
- if (remaining == 3) {
- --remaining;
- return value1;
- }
- if (remaining == 2) {
- --remaining;
- return value2;
- }
- if (remaining == 1) {
- --remaining;
- return value3;
- }
- throw new NoSuchElementException();
- }
- };
- }
-
- @SafeVarargs
- public static Iterator with(T value1, T value2, T value3, T... additional) {
- return new Iterator() {
- private int index = 0;
-
- @Override
- public boolean hasNext() {
- return index < additional.length + 3;
- }
-
- @Override
- public T next() {
- try {
- if (index == 0) return value1;
- if (index == 1) return value2;
- if (index == 2) return value3;
- if (index < additional.length + 3) return additional[index - 3];
- --index;
- throw new NoSuchElementException();
- } finally {
- ++index;
- }
- }
- };
- }
-
- public static Iterator with(T[] values) {
- return new Iterator() {
- private int index = 0;
-
- @Override
- public boolean hasNext() {
- return index < values.length;
- }
-
- @Override
- public T next() {
- try {
- if (index < values.length) return values[index];
- --index;
- throw new NoSuchElementException();
- } finally {
- ++index;
- }
- }
- };
- }
-
- public static Iterator around(Iterable extends T> first,
- Iterable extends U> second,
- BiFunction conversion) {
- return around(first.iterator(), second.iterator(), conversion);
- }
-
- public static Iterator around(final Iterator extends T> first,
- final Iterator extends U> second,
- final BiFunction combineFirstAndSecond) {
- return new Iterator() {
- @Override
- public boolean hasNext() {
- return second.hasNext();
- }
-
- @Override
- public V next() {
- return combineFirstAndSecond.apply(first.next(), second.next());
- }
- };
- }
-
- public static Iterator around(final Iterable extends V> iterable, Function conversion) {
- return around(iterable.iterator(), conversion);
- }
-
- public static Iterator around(final Iterator extends V> iterator, Function conversion) {
- return new Iterator() {
- @Override
- public boolean hasNext() {
- return iterator.hasNext();
- }
-
- @Override
- public T next() {
- return conversion.apply(iterator.next());
- }
-
- @Override
- public void remove() {
- iterator.remove();
- }
- };
- }
-
- public static Iterable around(final Iterator iterator) {
- return new Iterable() {
- @Override
- public Iterator iterator() {
- return iterator;
- }
- };
- }
-
- public static Iterator readOnly(final Iterator iterator) {
- return new Iterator() {
- @Override
- public boolean hasNext() {
- return iterator.hasNext();
- }
-
- @Override
- public T next() {
- return iterator.next();
- }
- };
- }
-
- public static Iterator readOnly(final Iterator extends V> iterator, Function conversion) {
- return new Iterator() {
- @Override
- public boolean hasNext() {
- return iterator.hasNext();
- }
-
- @Override
- public T next() {
- return conversion.apply(iterator.next());
- }
- };
- }
-
- public static Iterator readOnly(final Iterable iterable) {
- return readOnly(iterable.iterator());
- }
-
- public static Iterator readOnly(final Iterable iterable, Function conversion) {
- return readOnly(iterable.iterator(), conversion);
- }
-
- public static Iterable readOnlyIterable(final Iterable iterable) {
- return new Iterable() {
- @Override
- public Iterator iterator() {
- return readOnly(iterable.iterator());
- }
- };
- }
-
- public static Iterable readOnlyIterable(final Iterable extends V> iterable, Function conversion) {
- return new Iterable() {
- @Override
- public Iterator iterator() {
- return readOnly(iterable.iterator(), conversion);
- }
- };
- }
-
- public static Iterator join(Iterable first, T last) {
- return join(first.iterator(), with(last));
- }
-
- public static Iterator join(Iterable first, T last1, T last2) {
- return join(first.iterator(), with(last1, last2));
- }
-
- public static Iterator join(Iterable first, T last1, T last2, T last3) {
- return join(first.iterator(), with(last1, last2, last3));
- }
-
- public static Iterator join(Iterable first, T last1, T last2, T last3, T last4) {
- return join(first.iterator(), with(last1, last2, last3, last4));
- }
-
- public static Iterator join(Iterable first, Iterable second) {
- return join(first.iterator(), second.iterator());
- }
-
- public static Iterator join(Iterator first, Iterator second) {
- return new Iterator() {
- private boolean completedFirst = false;
-
- @Override
- public boolean hasNext() {
- if (!completedFirst) {
- if (first.hasNext()) return true;
- completedFirst = true;
- }
- return second.hasNext();
- }
-
- @Override
- public T next() {
- if (!completedFirst) {
- if (first.hasNext()) return first.next();
- completedFirst = true;
- }
- return second.next();
- }
-
- @Override
- public void remove() {
- if (!completedFirst) {
- first.remove();
- }
- second.remove();
- }
- };
- }
-}
diff --git a/debezium-core/src/main/java/io/debezium/util/Joiner.java b/debezium-core/src/main/java/io/debezium/util/Joiner.java
deleted file mode 100644
index ae96de0a8..000000000
--- a/debezium-core/src/main/java/io/debezium/util/Joiner.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright 2015 Debezium Authors.
- *
- * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
- */
-package io.debezium.util;
-
-import java.util.Iterator;
-import java.util.StringJoiner;
-
-import io.debezium.annotation.Immutable;
-
-/**
- * A utility for joining multiple {@link CharSequence character sequences} together.
- *
- * @author Randall Hauch
- */
-@Immutable
-public final class Joiner {
-
- public static Joiner on(CharSequence delimiter) {
- return new Joiner(new StringJoiner(delimiter));
- }
-
- public static Joiner on(CharSequence prefix, CharSequence delimiter) {
- return new Joiner(new StringJoiner(delimiter, prefix, ""));
- }
-
- public static Joiner on(CharSequence prefix, CharSequence delimiter, CharSequence suffix) {
- return new Joiner(new StringJoiner(delimiter, prefix, suffix));
- }
-
- private final StringJoiner joiner;
-
- private Joiner(StringJoiner joiner) {
- this.joiner = joiner;
- }
-
- public String join(Object[] values) {
- for (Object value : values) {
- if (value != null) joiner.add(value.toString());
- }
- return joiner.toString();
- }
-
- public String join(CharSequence firstValue, CharSequence... additionalValues) {
- if (firstValue != null) joiner.add(firstValue);
- for (CharSequence value : additionalValues) {
- if (value != null) joiner.add(value);
- }
- return joiner.toString();
- }
-
- public String join(Iterable> values) {
- for (Object value : values) {
- if (value != null) joiner.add(value.toString());
- }
- return joiner.toString();
- }
-
- public String join(Iterable> values, CharSequence nextValue, CharSequence... additionalValues) {
- for (Object value : values) {
- if (value != null) joiner.add(value.toString());
- }
- if (nextValue != null) joiner.add(nextValue);
- for (CharSequence value : additionalValues) {
- if (value != null) joiner.add(value);
- }
- return joiner.toString();
- }
-
- public String join(Iterator> values) {
- while (values.hasNext()) {
- Object value = values.next();
- if (value != null) joiner.add(value.toString());
- }
- return joiner.toString();
- }
-
-}
diff --git a/debezium-core/src/main/java/io/debezium/util/LazyReference.java b/debezium-core/src/main/java/io/debezium/util/LazyReference.java
deleted file mode 100644
index 161b487f8..000000000
--- a/debezium-core/src/main/java/io/debezium/util/LazyReference.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2015 Debezium Authors.
- *
- * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
- */
-package io.debezium.util;
-
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.function.Consumer;
-import java.util.function.Supplier;
-
-import io.debezium.annotation.ThreadSafe;
-
-/**
- * An atomic reference that atomically uses a supplier to lazily accesses the referenced object the first time it is needed.
- *
- * @author Randall Hauch
- * @param the type of referenced object
- */
-@ThreadSafe
-public final class LazyReference {
-
- public static LazyReference create(Supplier supplier) {
- return new LazyReference(supplier);
- }
-
- private final AtomicReference ref = new AtomicReference<>();
- private final Supplier supplier;
-
- private LazyReference(Supplier supplier) {
- this.supplier = supplier;
- }
-
- /**
- * Determine if the referenced object has been created and accessed.
- *
- * @return {@code true} if the object has been created, or false otherwise
- */
- public boolean isInitialized() {
- return ref.get() != null;
- }
-
- /**
- * If the referenced object has been {@link #isInitialized() initialized}, then release it.
- * This method does nothing if the reference has not yet been accessed or {@link #isInitialized() initialized}.
- */
- public void release() {
- release(null);
- }
-
- /**
- * If the referenced object has been {@link #isInitialized() initialized}, then release it and call the supplied function with
- * the reference. This method does nothing if the reference has not yet been accessed or {@link #isInitialized() initialized}.
- *
- * @param finalizer the function that should be called when the previously-{@link #isInitialized() initialized} referenced
- * object is released; may be null
- */
- public void release(Consumer finalizer) {
- ref.updateAndGet(existing->{
- if ( existing != null && finalizer != null ) finalizer.accept(existing);
- return null;
- });
- }
-
- /**
- * Get the referenced value (creating it if required) and call the supplied function.
- *
- * @param consumer the function that operates on the value; may not be null
- * @return true if the function was called on the referenced value, or false if there is no referenced value
- */
- public boolean execute(Consumer consumer) {
- T value = get();
- if (value == null) return false;
- consumer.accept(value);
- return true;
- }
-
- public T get() {
- return ref.updateAndGet(existing->existing != null ? existing : supplier.get());
- }
-}
diff --git a/debezium-core/src/main/java/io/debezium/util/MathOps.java b/debezium-core/src/main/java/io/debezium/util/MathOps.java
deleted file mode 100644
index dde50a93b..000000000
--- a/debezium-core/src/main/java/io/debezium/util/MathOps.java
+++ /dev/null
@@ -1,721 +0,0 @@
-/*
- * Copyright 2010 Debezium Authors.
- *
- * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
- */
-package io.debezium.util;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
-import io.debezium.annotation.Immutable;
-
-/**
- * Utilities for performing math operations with mixed native and advanced numeric types.
- *
- * @author Randall Hauch
- */
-@Immutable
-public final class MathOps {
-
- public static Number add(Number first, Number second) {
- if (second == null)
- return first;
- else if (first == null) return second;
- if (first instanceof Short) return add((Short) first, second);
- if (first instanceof Integer) return add((Integer) first, second);
- if (first instanceof Long) return add((Long) first, second);
- if (first instanceof Float) return add((Float) first, second);
- if (first instanceof Double) return add((Double) first, second);
- if (first instanceof BigInteger) return add((BigInteger) first, second);
- if (first instanceof BigDecimal) return add((BigDecimal) first, second);
- if (first instanceof AtomicLong) return add((AtomicLong) first, second);
- if (first instanceof AtomicInteger) return add((AtomicInteger) first, second);
- throw new IllegalArgumentException();
- }
-
- public static Number add(Short first, Number second) {
- if (second instanceof Short) return add(first, (Short) second);
- if (second instanceof Integer) return add(first, (Integer) second);
- if (second instanceof Long) return add(first, (Long) second);
- if (second instanceof Float) return add(first, (Float) second);
- if (second instanceof Double) return add(first, (Double) second);
- if (second instanceof BigInteger) return add(first, (BigInteger) second);
- if (second instanceof BigDecimal) return add(first, (BigDecimal) second);
- if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second);
- if (second instanceof AtomicLong) return add(first, (AtomicLong) second);
- throw new IllegalArgumentException();
- }
-
- public static Number add(Short first, short second) {
- int sum = first.shortValue() + second;
- if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum);
- return new Integer(sum);
- }
-
- public static Number add(Short first, int second) {
- long sum = first.longValue() + second;
- if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum);
- if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return new Integer((int) sum);
- return new Long(sum);
- }
-
- public static Number add(Short first, long second) {
- long sum = first.longValue() + second;
- if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum);
- if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return new Integer((int) sum);
- return new Long(sum);
- }
-
- public static Number add(Short first, float second) {
- double sum = first.floatValue() + second;
- if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum);
- return new Double(sum);
- }
-
- public static Number add(Short first, double second) {
- double sum = first.doubleValue() + second;
- if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum);
- return new Double(sum);
- }
-
- public static Number add(Short first, Short second) {
- return add(first, second.shortValue());
- }
-
- public static Number add(Short first, Integer second) {
- return add(first, second.intValue());
- }
-
- public static Number add(Short first, Long second) {
- return add(first, second.longValue());
- }
-
- public static Number add(Short first, Float second) {
- return add(first, second.floatValue());
- }
-
- public static Number add(Short first, Double second) {
- return add(first, second.doubleValue());
- }
-
- public static Number add(Short first, BigDecimal second) {
- return second.add(BigDecimal.valueOf(first.longValue()));
- }
-
- public static Number add(Short first, BigInteger second) {
- return second.add(BigInteger.valueOf(first.longValue()));
- }
-
- public static Number add(Short first, AtomicInteger second) {
- return add(first, second.intValue());
- }
-
- public static Number add(Short first, AtomicLong second) {
- return add(first, second.longValue());
- }
-
- public static Number add(Integer first, Number second) {
- if (second instanceof Short) return add(first, (Short) second);
- if (second instanceof Integer) return add(first, (Integer) second);
- if (second instanceof Long) return add(first, (Long) second);
- if (second instanceof Float) return add(first, (Float) second);
- if (second instanceof Double) return add(first, (Double) second);
- if (second instanceof BigInteger) return add(first, (BigInteger) second);
- if (second instanceof BigDecimal) return add(first, (BigDecimal) second);
- if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second);
- if (second instanceof AtomicLong) return add(first, (AtomicLong) second);
- throw new IllegalArgumentException();
- }
-
- public static Number add(Integer first, short second) {
- long sum = first.longValue() + second;
- if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum);
- if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return new Integer((int) sum);
- return new Long(sum);
- }
-
- public static Number add(Integer first, int second) {
- long sum = first.longValue() + second;
- if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum);
- if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return new Integer((int) sum);
- return new Long(sum);
- }
-
- public static Number add(Integer first, long second) {
- long sum = first.longValue() + second;
- if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum);
- if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return new Integer((int) sum);
- return new Long(sum);
- }
-
- public static Number add(Integer first, float second) {
- double sum = first.floatValue() + second;
- if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum);
- return new Double(sum);
- }
-
- public static Number add(Integer first, double second) {
- double sum = first.doubleValue() + second;
- if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum);
- return new Double(sum);
- }
-
- public static Number add(Integer first, Short second) {
- return add(first, second.shortValue());
- }
-
- public static Number add(Integer first, Integer second) {
- return add(first, second.intValue());
- }
-
- public static Number add(Integer first, Long second) {
- return add(first, second.longValue());
- }
-
- public static Number add(Integer first, Float second) {
- return add(first, second.floatValue());
- }
-
- public static Number add(Integer first, Double second) {
- return add(first, second.doubleValue());
- }
-
- public static Number add(Integer first, BigDecimal second) {
- return second.add(BigDecimal.valueOf(first.longValue()));
- }
-
- public static Number add(Integer first, BigInteger second) {
- return second.add(BigInteger.valueOf(first.longValue()));
- }
-
- public static Number add(Integer first, AtomicInteger second) {
- return add(first, second.intValue());
- }
-
- public static Number add(Integer first, AtomicLong second) {
- return add(first, second.longValue());
- }
-
- public static Number add(Long first, Number second) {
- if (second instanceof Short) return add(first, (Short) second);
- if (second instanceof Integer) return add(first, (Integer) second);
- if (second instanceof Long) return add(first, (Long) second);
- if (second instanceof Float) return add(first, (Float) second);
- if (second instanceof Double) return add(first, (Double) second);
- if (second instanceof BigInteger) return add(first, (BigInteger) second);
- if (second instanceof BigDecimal) return add(first, (BigDecimal) second);
- if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second);
- if (second instanceof AtomicLong) return add(first, (AtomicLong) second);
- throw new IllegalArgumentException();
- }
-
- public static Number add(Long first, short second) {
- long sum = first.longValue() + second;
- if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum);
- if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return new Integer((int) sum);
- return new Long(sum);
- }
-
- public static Number add(Long first, int second) {
- long sum = first.longValue() + second;
- if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum);
- if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return new Integer((int) sum);
- return new Long(sum);
- }
-
- public static Number add(Long first, long second) {
- long sum = first.longValue() + second;
- if (Short.MAX_VALUE >= sum && Short.MIN_VALUE <= sum) return new Short((short) sum);
- if (Integer.MAX_VALUE >= sum && Integer.MIN_VALUE <= sum) return new Integer((int) sum);
- return new Long(sum);
- }
-
- public static Number add(Long first, float second) {
- double sum = first.doubleValue() + second;
- if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum);
- return new Double(sum);
- }
-
- public static Number add(Long first, double second) {
- double sum = first.doubleValue() + second;
- if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum);
- return new Double(sum);
- }
-
- public static Number add(Long first, Short second) {
- return add(first, second.shortValue());
- }
-
- public static Number add(Long first, Integer second) {
- return add(first, second.intValue());
- }
-
- public static Number add(Long first, Long second) {
- return add(first, second.longValue());
- }
-
- public static Number add(Long first, Float second) {
- return add(first, second.floatValue());
- }
-
- public static Number add(Long first, Double second) {
- return add(first, second.doubleValue());
- }
-
- public static Number add(Long first, BigDecimal second) {
- return second.add(BigDecimal.valueOf(first.longValue()));
- }
-
- public static Number add(Long first, BigInteger second) {
- return second.add(BigInteger.valueOf(first.longValue()));
- }
-
- public static Number add(Long first, AtomicInteger second) {
- return add(first, second.intValue());
- }
-
- public static Number add(Long first, AtomicLong second) {
- return add(first, second.longValue());
- }
-
- public static Number add(Float first, Number second) {
- if (second instanceof Short) return add(first, (Short) second);
- if (second instanceof Integer) return add(first, (Integer) second);
- if (second instanceof Long) return add(first, (Long) second);
- if (second instanceof Float) return add(first, (Float) second);
- if (second instanceof Double) return add(first, (Double) second);
- if (second instanceof BigInteger) return add(first, (BigInteger) second);
- if (second instanceof BigDecimal) return add(first, (BigDecimal) second);
- if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second);
- if (second instanceof AtomicLong) return add(first, (AtomicLong) second);
- throw new IllegalArgumentException();
- }
-
- public static Number add(Float first, short second) {
- double sum = first.floatValue() + second;
- if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum);
- return new Double(sum);
- }
-
- public static Number add(Float first, int second) {
- double sum = first.floatValue() + second;
- if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum);
- return new Double(sum);
- }
-
- public static Number add(Float first, long second) {
- double sum = first.floatValue() + second;
- if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum);
- return new Double(sum);
- }
-
- public static Number add(Float first, float second) {
- double sum = first.floatValue() + second;
- if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum);
- return new Double(sum);
- }
-
- public static Number add(Float first, double second) {
- double sum = first.floatValue() + second;
- if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum);
- return new Double(sum);
- }
-
- public static Number add(Float first, Short second) {
- return add(first, second.shortValue());
- }
-
- public static Number add(Float first, Integer second) {
- return add(first, second.intValue());
- }
-
- public static Number add(Float first, Long second) {
- return add(first, second.longValue());
- }
-
- public static Number add(Float first, Float second) {
- return add(first, second.floatValue());
- }
-
- public static Number add(Float first, Double second) {
- return add(first, second.doubleValue());
- }
-
- public static Number add(Float first, BigDecimal second) {
- return second.add(BigDecimal.valueOf(first.longValue()));
- }
-
- public static Number add(Float first, BigInteger second) {
- return second.add(BigInteger.valueOf(first.longValue()));
- }
-
- public static Number add(Float first, AtomicInteger second) {
- return add(first, second.intValue());
- }
-
- public static Number add(Float first, AtomicLong second) {
- return add(first, second.longValue());
- }
-
- public static Number add(Double first, Number second) {
- if (second instanceof Short) return add(first, (Short) second);
- if (second instanceof Integer) return add(first, (Integer) second);
- if (second instanceof Long) return add(first, (Long) second);
- if (second instanceof Float) return add(first, (Float) second);
- if (second instanceof Double) return add(first, (Double) second);
- if (second instanceof BigInteger) return add(first, (BigInteger) second);
- if (second instanceof BigDecimal) return add(first, (BigDecimal) second);
- if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second);
- if (second instanceof AtomicLong) return add(first, (AtomicLong) second);
- throw new IllegalArgumentException();
- }
-
- public static Number add(Double first, short second) {
- double sum = first.floatValue() + second;
- if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum);
- return new Double(sum);
- }
-
- public static Number add(Double first, int second) {
- double sum = first.floatValue() + second;
- if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum);
- return new Double(sum);
- }
-
- public static Number add(Double first, long second) {
- double sum = first.floatValue() + second;
- if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum);
- return new Double(sum);
- }
-
- public static Number add(Double first, float second) {
- double sum = first.floatValue() + second;
- if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum);
- return new Double(sum);
- }
-
- public static Number add(Double first, double second) {
- double sum = first.floatValue() + second;
- if (Float.MAX_VALUE >= sum && Float.MIN_VALUE <= sum) return new Float((float) sum);
- return new Double(sum);
- }
-
- public static Number add(Double first, Short second) {
- return add(first, second.shortValue());
- }
-
- public static Number add(Double first, Integer second) {
- return add(first, second.intValue());
- }
-
- public static Number add(Double first, Long second) {
- return add(first, second.longValue());
- }
-
- public static Number add(Double first, Float second) {
- return add(first, second.floatValue());
- }
-
- public static Number add(Double first, Double second) {
- return add(first, second.doubleValue());
- }
-
- public static Number add(Double first, BigDecimal second) {
- return second.add(BigDecimal.valueOf(first.longValue()));
- }
-
- public static Number add(Double first, BigInteger second) {
- return second.add(BigInteger.valueOf(first.longValue()));
- }
-
- public static Number add(Double first, AtomicInteger second) {
- return add(first, second.intValue());
- }
-
- public static Number add(Double first, AtomicLong second) {
- return add(first, second.longValue());
- }
-
- public static Number add(BigInteger first, Number second) {
- if (second instanceof Short) return add(first, (Short) second);
- if (second instanceof Integer) return add(first, (Integer) second);
- if (second instanceof Long) return add(first, (Long) second);
- if (second instanceof Float) return add(first, (Float) second);
- if (second instanceof Double) return add(first, (Double) second);
- if (second instanceof BigInteger) return add(first, (BigInteger) second);
- if (second instanceof BigDecimal) return add(first, (BigDecimal) second);
- if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second);
- if (second instanceof AtomicLong) return add(first, (AtomicLong) second);
- throw new IllegalArgumentException();
- }
-
- public static Number add(BigInteger first, short second) {
- return first.add(BigInteger.valueOf(second));
- }
-
- public static Number add(BigInteger first, int second) {
- return first.add(BigInteger.valueOf(second));
- }
-
- public static Number add(BigInteger first, long second) {
- return first.add(BigInteger.valueOf(second));
- }
-
- public static Number add(BigInteger first, float second) {
- return new BigDecimal(first).add(BigDecimal.valueOf(second));
- }
-
- public static Number add(BigInteger first, double second) {
- return new BigDecimal(first).add(BigDecimal.valueOf(second));
- }
-
- public static Number add(BigInteger first, Short second) {
- return add(first, second.shortValue());
- }
-
- public static Number add(BigInteger first, Integer second) {
- return add(first, second.intValue());
- }
-
- public static Number add(BigInteger first, Long second) {
- return add(first, second.longValue());
- }
-
- public static Number add(BigInteger first, Float second) {
- return add(first, second.floatValue());
- }
-
- public static Number add(BigInteger first, Double second) {
- return add(first, second.doubleValue());
- }
-
- public static Number add(BigInteger first, BigDecimal second) {
- return second.add(new BigDecimal(first));
- }
-
- public static Number add(BigInteger first, BigInteger second) {
- return second.add(second);
- }
-
- public static Number add(BigInteger first, AtomicInteger second) {
- return add(first, second.intValue());
- }
-
- public static Number add(BigInteger first, AtomicLong second) {
- return add(first, second.longValue());
- }
-
- public static Number add(BigDecimal first, Number second) {
- if (second instanceof Short) return add(first, (Short) second);
- if (second instanceof Integer) return add(first, (Integer) second);
- if (second instanceof Long) return add(first, (Long) second);
- if (second instanceof Float) return add(first, (Float) second);
- if (second instanceof Double) return add(first, (Double) second);
- if (second instanceof BigInteger) return add(first, (BigInteger) second);
- if (second instanceof BigDecimal) return add(first, (BigDecimal) second);
- if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second);
- if (second instanceof AtomicLong) return add(first, (AtomicLong) second);
- throw new IllegalArgumentException();
- }
-
- public static Number add(BigDecimal first, short second) {
- return first.add(BigDecimal.valueOf(second));
- }
-
- public static Number add(BigDecimal first, int second) {
- return first.add(BigDecimal.valueOf(second));
- }
-
- public static Number add(BigDecimal first, long second) {
- return first.add(BigDecimal.valueOf(second));
- }
-
- public static Number add(BigDecimal first, float second) {
- return first.add(BigDecimal.valueOf(second));
- }
-
- public static Number add(BigDecimal first, double second) {
- return first.add(BigDecimal.valueOf(second));
- }
-
- public static Number add(BigDecimal first, Short second) {
- return add(first, second.shortValue());
- }
-
- public static Number add(BigDecimal first, Integer second) {
- return add(first, second.intValue());
- }
-
- public static Number add(BigDecimal first, Long second) {
- return add(first, second.longValue());
- }
-
- public static Number add(BigDecimal first, Float second) {
- return add(first, second.floatValue());
- }
-
- public static Number add(BigDecimal first, Double second) {
- return add(first, second.doubleValue());
- }
-
- public static Number add(BigDecimal first, BigDecimal second) {
- return second.add(first);
- }
-
- public static Number add(BigDecimal first, BigInteger second) {
- return second.add(second);
- }
-
- public static Number add(BigDecimal first, AtomicInteger second) {
- return add(first, second.intValue());
- }
-
- public static Number add(BigDecimal first, AtomicLong second) {
- return add(first, second.longValue());
- }
-
- public static Number add(AtomicInteger first, Number second) {
- if (second instanceof Short) return add(first, (Short) second);
- if (second instanceof Integer) return add(first, (Integer) second);
- if (second instanceof Long) return add(first, (Long) second);
- if (second instanceof Float) return add(first, (Float) second);
- if (second instanceof Double) return add(first, (Double) second);
- if (second instanceof BigInteger) return add(first, (BigInteger) second);
- if (second instanceof BigDecimal) return add(first, (BigDecimal) second);
- if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second);
- if (second instanceof AtomicLong) return add(first, (AtomicLong) second);
- throw new IllegalArgumentException();
- }
-
- public static Number add(AtomicInteger first, short second) {
- return add(new Integer(first.intValue()), second);
- }
-
- public static Number add(AtomicInteger first, int second) {
- return add(new Integer(first.intValue()), second);
- }
-
- public static Number add(AtomicInteger first, long second) {
- return add(new Integer(first.intValue()), second);
- }
-
- public static Number add(AtomicInteger first, float second) {
- return add(new Integer(first.intValue()), second);
- }
-
- public static Number add(AtomicInteger first, double second) {
- return add(new Integer(first.intValue()), second);
- }
-
- public static Number add(AtomicInteger first, Short second) {
- return add(first, second.shortValue());
- }
-
- public static Number add(AtomicInteger first, Integer second) {
- return add(first, second.intValue());
- }
-
- public static Number add(AtomicInteger first, Long second) {
- return add(first, second.longValue());
- }
-
- public static Number add(AtomicInteger first, Float second) {
- return add(first, second.floatValue());
- }
-
- public static Number add(AtomicInteger first, Double second) {
- return add(first, second.doubleValue());
- }
-
- public static Number add(AtomicInteger first, BigDecimal second) {
- return add(second, first);
- }
-
- public static Number add(AtomicInteger first, BigInteger second) {
- return add(second, first);
- }
-
- public static Number add(AtomicInteger first, AtomicInteger second) {
- return add(first, second.intValue());
- }
-
- public static Number add(AtomicInteger first, AtomicLong second) {
- return add(first, second.longValue());
- }
-
- public static Number add(AtomicLong first, Number second) {
- if (second instanceof Short) return add(first, (Short) second);
- if (second instanceof Integer) return add(first, (Integer) second);
- if (second instanceof Long) return add(first, (Long) second);
- if (second instanceof Float) return add(first, (Float) second);
- if (second instanceof Double) return add(first, (Double) second);
- if (second instanceof BigInteger) return add(first, (BigInteger) second);
- if (second instanceof BigDecimal) return add(first, (BigDecimal) second);
- if (second instanceof AtomicInteger) return add(first, (AtomicInteger) second);
- if (second instanceof AtomicLong) return add(first, (AtomicLong) second);
- throw new IllegalArgumentException();
- }
-
- public static Number add(AtomicLong first, short second) {
- return add(new Long(first.longValue()), second);
- }
-
- public static Number add(AtomicLong first, int second) {
- return add(new Long(first.longValue()), second);
- }
-
- public static Number add(AtomicLong first, long second) {
- return add(new Long(first.longValue()), second);
- }
-
- public static Number add(AtomicLong first, float second) {
- return add(new Long(first.longValue()), second);
- }
-
- public static Number add(AtomicLong first, double second) {
- return add(new Long(first.longValue()), second);
- }
-
- public static Number add(AtomicLong first, Short second) {
- return add(first, second.shortValue());
- }
-
- public static Number add(AtomicLong first, Integer second) {
- return add(first, second.intValue());
- }
-
- public static Number add(AtomicLong first, Long second) {
- return add(first, second.longValue());
- }
-
- public static Number add(AtomicLong first, Float second) {
- return add(first, second.floatValue());
- }
-
- public static Number add(AtomicLong first, Double second) {
- return add(first, second.doubleValue());
- }
-
- public static Number add(AtomicLong first, BigDecimal second) {
- return add(second, first);
- }
-
- public static Number add(AtomicLong first, BigInteger second) {
- return add(second, first);
- }
-
- public static Number add(AtomicLong first, AtomicInteger second) {
- return add(first, second.intValue());
- }
-
- public static Number add(AtomicLong first, AtomicLong second) {
- return add(first, second.longValue());
- }
-
- private MathOps() {
- }
-
-}
diff --git a/debezium-core/src/main/java/io/debezium/util/NamedThreadFactory.java b/debezium-core/src/main/java/io/debezium/util/NamedThreadFactory.java
deleted file mode 100644
index 8d5ed3cfc..000000000
--- a/debezium-core/src/main/java/io/debezium/util/NamedThreadFactory.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2010 Debezium Authors.
- *
- * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
- */
-package io.debezium.util;
-
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.function.Consumer;
-
-import io.debezium.annotation.ThreadSafe;
-
-/**
- * A simple named thread factory that creates threads named "{@code $PREFIX$-$NAME$-thread-$NUMBER$}".
- *
- * @author Randall Hauch
- */
-@ThreadSafe
-public final class NamedThreadFactory implements ThreadFactory {
-
- private static final boolean DEFAULT_DAEMON_THREAD = true;
- private static final int DEFAULT_STACK_SIZE = 0;
-
- private final boolean daemonThreads;
- private final ThreadGroup group;
- private final AtomicInteger threadNumber = new AtomicInteger(1);
- private final String namePrefix;
- private final int stackSize;
- private final Consumer afterThreadCreation;
-
- public NamedThreadFactory(String prefix) {
- this(prefix, DEFAULT_DAEMON_THREAD, DEFAULT_STACK_SIZE);
- }
-
- public NamedThreadFactory(String prefix, boolean daemonThreads) {
- this(prefix, daemonThreads, DEFAULT_STACK_SIZE);
- }
-
- public NamedThreadFactory(String prefix, boolean daemonThreads, int stackSize) {
- this(prefix, daemonThreads, stackSize, null);
- }
-
- public NamedThreadFactory(String prefix, boolean daemonThreads, int stackSize, Consumer afterThreadCreation) {
- if ( prefix == null ) throw new IllegalArgumentException("The thread prefix may not be null");
- final SecurityManager s = System.getSecurityManager();
- this.group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
- this.namePrefix = prefix;
- this.daemonThreads = daemonThreads;
- this.stackSize = stackSize;
- this.afterThreadCreation = afterThreadCreation;
- }
-
- @Override
- public Thread newThread(final Runnable runnable) {
- String threadName = namePrefix + threadNumber.getAndIncrement();
- final Thread t = new Thread(group, runnable, threadName, stackSize);
- t.setDaemon(daemonThreads);
- if (t.getPriority() != Thread.NORM_PRIORITY) {
- t.setPriority(Thread.NORM_PRIORITY);
- }
- if (afterThreadCreation != null) {
- try {
- afterThreadCreation.accept(threadName);
- } catch (Throwable e) {
- // do nothing
- }
- }
- return t;
- }
-}
diff --git a/debezium-core/src/main/java/io/debezium/util/Sequences.java b/debezium-core/src/main/java/io/debezium/util/Sequences.java
deleted file mode 100644
index fb4e71853..000000000
--- a/debezium-core/src/main/java/io/debezium/util/Sequences.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2015 Debezium Authors.
- *
- * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
- */
-package io.debezium.util;
-
-import java.util.Iterator;
-import java.util.Random;
-import java.util.function.Supplier;
-import java.util.stream.IntStream;
-
-import io.debezium.annotation.Immutable;
-
-/**
- * Utility methods for obtaining streams of integers.
- *
- * @author Randall Hauch
- */
-@Immutable
-public class Sequences {
-
- /**
- * Create a stream of number monotonically increasing numbers starting at 0, useful when performing an operation
- * number times.
- *
- * @param number the number of values to include in the stream; must be positive
- * @return the sequence; never null
- */
- public static IntStream times(int number) {
- return IntStream.range(0, number);
- }
-
- /**
- * Create an iterator over an infinite number of monotonically increasing numbers starting at 0, useful when performing an
- * operation an unknown number of times.
- *
- * @return the sequence; never null
- */
- public static Iterable infiniteIntegers() {
- return infiniteIntegers(0);
- }
-
- /**
- * Create an iterator over an infinite number monotonically increasing numbers starting at the given number, useful when
- * performing an operation an unknown number of times.
- *
- * @param startingAt the first number to include in the resulting stream
- * @return the sequence; never null
- */
- public static Iterable infiniteIntegers(int startingAt) {
- return Iterators.around(new Iterator() {
- private int counter = startingAt;
-
- @Override
- public boolean hasNext() {
- return true;
- }
-
- @Override
- public Integer next() {
- return Integer.valueOf(counter++);
- }
- });
- }
-
- /**
- * Obtain a supplier function that randomly selects from the given values. If the supplied values contain nulls, then
- * the resulting supplier function may return null values.
- *
- * @param first the first value that may be randomly picked
- * @param additional the additional values to randomly pick from; may be null or empty
- * @return the supplier function; never null
- */
- @SafeVarargs
- public static Supplier randomlySelect(T first, T... additional) {
- if (additional == null || additional.length == 0) return () -> first;
- Random rng = new Random(System.currentTimeMillis());
- int max = additional.length + 1;
- return () -> {
- int index = rng.nextInt(max);
- return index == 0 ? first : additional[index-1];
- };
- }
-
- /**
- * Obtain a supplier function that randomly selects from the given values. If the supplied values contain nulls, then
- * the resulting supplier function may return null values.
- *
- * @param values the values to randomly pick from; may not be null, should not be empty
- * @return the supplier function; never null
- */
- @SafeVarargs
- public static Supplier randomlySelect(T... values) {
- if (values == null || values.length == 0) throw new IllegalArgumentException("The values array may not be null or empty");
- Random rng = new Random(System.currentTimeMillis());
- return () -> values[rng.nextInt(values.length)];
- }
-}
diff --git a/debezium-core/src/main/java/io/debezium/util/Stopwatch.java b/debezium-core/src/main/java/io/debezium/util/Stopwatch.java
index 61e1c04be..9ee8c043f 100644
--- a/debezium-core/src/main/java/io/debezium/util/Stopwatch.java
+++ b/debezium-core/src/main/java/io/debezium/util/Stopwatch.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@@ -65,9 +65,6 @@ public static interface Durations {
/**
* The timing statistics for a recorded set of samples.
- *
- * @author Randall Hauch
- *
*/
public static interface Statistics {
/**
@@ -255,8 +252,6 @@ public static Stopwatch accumulating() {
* This set is threadsafe, meaning that multiple threads can {@link #create()} new stopwatches concurrently, and each
* stopwatch's duration is measured separately. Additionally, all of the other methods of this interface are also threadsafe.
*
- *
- * @author Randall Hauch
*/
@ThreadSafe
public static interface StopwatchSet extends Durations {
@@ -464,8 +459,6 @@ protected static String asString(Duration duration) {
/**
* Abstract base class for {@link Durations} implementations.
- *
- * @author Randall Hauch
*/
@ThreadSafe
protected static abstract class BaseDurations implements Durations {
@@ -479,8 +472,6 @@ public String toString() {
/**
* A {@link Durations} implementation that only remembers the most recently {@link #add(Duration) added} duration.
- *
- * @author Randall Hauch
*/
@ThreadSafe
private static final class SingleDuration extends BaseDurations {
@@ -501,8 +492,6 @@ public void add(Duration duration) {
/**
* A {@link Durations} implementation that accumulates all {@link #add(Duration) added} durations.
- *
- * @author Randall Hauch
*/
@ThreadSafe
private static final class MultipleDurations extends BaseDurations {
diff --git a/debezium-core/src/main/java/io/debezium/util/Stringifiable.java b/debezium-core/src/main/java/io/debezium/util/Stringifiable.java
deleted file mode 100644
index 790aadbbf..000000000
--- a/debezium-core/src/main/java/io/debezium/util/Stringifiable.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright 2015 Debezium Authors.
- *
- * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
- */
-package io.debezium.util;
-
-import java.util.StringJoiner;
-
-/**
- * Interface that allows a class to more efficiently generate a string that is to be added to other strings via a
- * {@link StringJoiner}.
- *
- * @author Randall Hauch
- */
-@FunctionalInterface
-public interface Stringifiable {
-
- /**
- * Used the supplied {@link StringJoiner} to record string representations of this object. The supplied joiner may concatenate
- * these strings together using custom delimiter strings.
- *
- * @param joiner the string joiner instance that will accumulate the
- */
- void asString(StringJoiner joiner);
-
-}
diff --git a/debezium-core/src/main/java/io/debezium/util/Strings.java b/debezium-core/src/main/java/io/debezium/util/Strings.java
index 50461ff48..e5b48da04 100644
--- a/debezium-core/src/main/java/io/debezium/util/Strings.java
+++ b/debezium-core/src/main/java/io/debezium/util/Strings.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@@ -18,6 +18,7 @@
* String-related utility methods.
*
* @author Randall Hauch
+ * @author Horia Chiorean
*/
@ThreadSafe
public final class Strings {
diff --git a/debezium-core/src/test/java/io/debezium/jdbc/TestDatabase.java b/debezium-core/src/test/java/io/debezium/jdbc/TestDatabase.java
index cdd1287b6..b1998d6fb 100644
--- a/debezium-core/src/test/java/io/debezium/jdbc/TestDatabase.java
+++ b/debezium-core/src/test/java/io/debezium/jdbc/TestDatabase.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-core/src/test/java/io/debezium/relational/ColumnEditorTest.java b/debezium-core/src/test/java/io/debezium/relational/ColumnEditorTest.java
index cc9d1f015..c84a457f3 100644
--- a/debezium-core/src/test/java/io/debezium/relational/ColumnEditorTest.java
+++ b/debezium-core/src/test/java/io/debezium/relational/ColumnEditorTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-core/src/test/java/io/debezium/relational/TableEditorTest.java b/debezium-core/src/test/java/io/debezium/relational/TableEditorTest.java
index c59e51a43..52cd36db3 100644
--- a/debezium-core/src/test/java/io/debezium/relational/TableEditorTest.java
+++ b/debezium-core/src/test/java/io/debezium/relational/TableEditorTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-core/src/test/java/io/debezium/relational/TableSchemaBuilderTest.java b/debezium-core/src/test/java/io/debezium/relational/TableSchemaBuilderTest.java
index 54e977585..d050ad0fc 100644
--- a/debezium-core/src/test/java/io/debezium/relational/TableSchemaBuilderTest.java
+++ b/debezium-core/src/test/java/io/debezium/relational/TableSchemaBuilderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-core/src/test/java/io/debezium/relational/TableTest.java b/debezium-core/src/test/java/io/debezium/relational/TableTest.java
index d785da890..66751e5d8 100644
--- a/debezium-core/src/test/java/io/debezium/relational/TableTest.java
+++ b/debezium-core/src/test/java/io/debezium/relational/TableTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-core/src/test/java/io/debezium/relational/ddl/DataTypeGrammarParserTest.java b/debezium-core/src/test/java/io/debezium/relational/ddl/DataTypeGrammarParserTest.java
index 295e0466a..6f1778097 100644
--- a/debezium-core/src/test/java/io/debezium/relational/ddl/DataTypeGrammarParserTest.java
+++ b/debezium-core/src/test/java/io/debezium/relational/ddl/DataTypeGrammarParserTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-core/src/test/java/io/debezium/relational/ddl/DataTypeParserTest.java b/debezium-core/src/test/java/io/debezium/relational/ddl/DataTypeParserTest.java
index 2a6f3206d..9521464c6 100644
--- a/debezium-core/src/test/java/io/debezium/relational/ddl/DataTypeParserTest.java
+++ b/debezium-core/src/test/java/io/debezium/relational/ddl/DataTypeParserTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-core/src/test/java/io/debezium/relational/ddl/DdlParserSql2003Test.java b/debezium-core/src/test/java/io/debezium/relational/ddl/DdlParserSql2003Test.java
index ec28bae5c..c86c3bf10 100644
--- a/debezium-core/src/test/java/io/debezium/relational/ddl/DdlParserSql2003Test.java
+++ b/debezium-core/src/test/java/io/debezium/relational/ddl/DdlParserSql2003Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-core/src/test/java/io/debezium/text/PositionTest.java b/debezium-core/src/test/java/io/debezium/text/PositionTest.java
index ee66c2bfe..c2af73e33 100644
--- a/debezium-core/src/test/java/io/debezium/text/PositionTest.java
+++ b/debezium-core/src/test/java/io/debezium/text/PositionTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@@ -9,6 +9,9 @@
import static org.fest.assertions.Assertions.assertThat;
+/**
+ * @author Randall Hauch
+ */
public class PositionTest {
private int combinedIndex(int firstIndex,
diff --git a/debezium-core/src/test/java/io/debezium/text/TokenStreamTest.java b/debezium-core/src/test/java/io/debezium/text/TokenStreamTest.java
index e566ad619..1c829951b 100644
--- a/debezium-core/src/test/java/io/debezium/text/TokenStreamTest.java
+++ b/debezium-core/src/test/java/io/debezium/text/TokenStreamTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@@ -15,6 +15,10 @@
import io.debezium.text.TokenStream.BasicTokenizer;
import io.debezium.text.TokenStream.Tokenizer;
+/**
+ * @author Randall Hauch
+ * @author Daniel Kelleher
+ */
public class TokenStreamTest {
public static final int WORD = TokenStream.BasicTokenizer.WORD;
public static final int SYMBOL = TokenStream.BasicTokenizer.SYMBOL;
@@ -44,25 +48,25 @@ public void makeCaseInsensitive() {
tokens.start();
}
- @Test( expected = IllegalStateException.class )
+ @Test(expected = IllegalStateException.class)
public void shouldNotAllowConsumeBeforeStartIsCalled() {
tokens = new TokenStream(content, TokenStream.basicTokenizer(false), false);
tokens.consume("Select");
}
- @Test( expected = IllegalStateException.class )
+ @Test(expected = IllegalStateException.class)
public void shouldNotAllowHasNextBeforeStartIsCalled() {
tokens = new TokenStream(content, TokenStream.basicTokenizer(false), false);
tokens.hasNext();
}
- @Test( expected = IllegalStateException.class )
+ @Test(expected = IllegalStateException.class)
public void shouldNotAllowMatchesBeforeStartIsCalled() {
tokens = new TokenStream(content, TokenStream.basicTokenizer(false), false);
tokens.matches("Select");
}
- @Test( expected = IllegalStateException.class )
+ @Test(expected = IllegalStateException.class)
public void shouldNotAllowCanConsumeBeforeStartIsCalled() {
tokens = new TokenStream(content, TokenStream.basicTokenizer(false), false);
tokens.canConsume("Select");
@@ -88,7 +92,7 @@ public void shouldConsumeInCaseSensitiveMannerWithExpectedValuesWhenMatchingExac
assertThat(tokens.hasNext()).isFalse();
}
- @Test( expected = ParsingException.class )
+ @Test(expected = ParsingException.class)
public void shouldFailToConsumeInCaseSensitiveMannerWithExpectedValuesWhenMatchingIncorrectCase() {
makeCaseSensitive();
tokens.consume("Select");
@@ -108,7 +112,7 @@ public void shouldConsumeInCaseInsensitiveMannerWithExpectedValuesWhenMatchingNo
assertThat(tokens.hasNext()).isFalse();
}
- @Test( expected = ParsingException.class )
+ @Test(expected = ParsingException.class)
public void shouldFailToConsumeInCaseInsensitiveMannerWithExpectedValuesWhenMatchingStringIsInLowerCase() {
makeCaseInsensitive();
tokens.consume("SELECT");
@@ -311,7 +315,7 @@ public void shouldConsumeMultipleTokensIfTheyMatch() {
assertThat(tokens.hasNext()).isFalse();
}
- @Test( expected = ParsingException.class )
+ @Test(expected = ParsingException.class)
public void shouldFailToConsumeMultipleTokensIfTheyDoNotMatch() {
makeCaseInsensitive();
tokens.consume("SELECT", "ALL", "COLUMNS", "FROM", "TABLE");
@@ -327,8 +331,8 @@ public void shouldReturnTrueFromCanConsumeMultipleTokensIfTheyAllMatch() {
@Test
public void shouldReturnTrueFromCanConsumeArrayOfTokensIfTheyAllMatch() {
makeCaseInsensitive();
- assertThat(tokens.matches(new String[] {"SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE"})).isTrue();
- assertThat(tokens.canConsume(new String[] {"SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE"})).isTrue();
+ assertThat(tokens.matches(new String[] { "SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE" })).isTrue();
+ assertThat(tokens.canConsume(new String[] { "SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE" })).isTrue();
assertThat(tokens.hasNext()).isFalse();
}
@@ -417,7 +421,7 @@ public void shouldCanConsumeSingleAfterTokensCompleteFromCanConsumeStringList()
public void shouldCanConsumeStringAfterTokensCompleteFromCanConsumeStringArray() {
makeCaseInsensitive();
// consume ALL the tokens using canConsume()
- tokens.canConsume(new String[] {"SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE"});
+ tokens.canConsume(new String[] { "SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE" });
// try to canConsume() single word
assertThat(tokens.canConsume("SELECT")).isFalse();
assertThat(tokens.canConsume(TokenStream.ANY_VALUE)).isFalse();
@@ -428,7 +432,7 @@ public void shouldCanConsumeStringAfterTokensCompleteFromCanConsumeStringArray()
public void shouldCanConsumeStringAfterTokensCompleteFromCanConsumeStringIterator() {
makeCaseInsensitive();
// consume ALL the tokens using canConsume()
- tokens.canConsume(Arrays.asList(new String[] {"SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE"}));
+ tokens.canConsume(Arrays.asList(new String[] { "SELECT", "ALL", "COLUMNS", "FROM", "THIS", "TABLE" }));
// try to canConsume() single word
assertThat(tokens.canConsume("SELECT")).isFalse();
assertThat(tokens.canConsume(TokenStream.ANY_VALUE)).isFalse();
diff --git a/debezium-core/src/test/java/io/debezium/text/XmlCharactersTest.java b/debezium-core/src/test/java/io/debezium/text/XmlCharactersTest.java
index 6816d812f..e2c83f370 100644
--- a/debezium-core/src/test/java/io/debezium/text/XmlCharactersTest.java
+++ b/debezium-core/src/test/java/io/debezium/text/XmlCharactersTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@@ -9,6 +9,9 @@
import static org.fest.assertions.Assertions.assertThat;
+/**
+ * @author Randall Hauch
+ */
public class XmlCharactersTest {
@Test
diff --git a/debezium-core/src/test/java/io/debezium/util/HashCodeTest.java b/debezium-core/src/test/java/io/debezium/util/HashCodeTest.java
index 015b1aad7..bcf306a78 100644
--- a/debezium-core/src/test/java/io/debezium/util/HashCodeTest.java
+++ b/debezium-core/src/test/java/io/debezium/util/HashCodeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@@ -11,6 +11,9 @@
import org.junit.Test;
+/**
+ * @author Randall Hauch
+ */
public class HashCodeTest {
@Test
diff --git a/debezium-core/src/test/java/io/debezium/util/StringsTest.java b/debezium-core/src/test/java/io/debezium/util/StringsTest.java
index e47c22a51..630db6b55 100644
--- a/debezium-core/src/test/java/io/debezium/util/StringsTest.java
+++ b/debezium-core/src/test/java/io/debezium/util/StringsTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@@ -14,6 +14,10 @@
import org.junit.Test;
+/**
+ * @author Randall Hauch
+ * @author Horia Chiorean
+ */
public class StringsTest {
public void compareSeparatedLines( Object... lines ) {
diff --git a/debezium-ingest-jdbc/src/test/java/io/debezium/injest/jdbc/util/TestDatabase.java b/debezium-ingest-jdbc/src/test/java/io/debezium/injest/jdbc/util/TestDatabase.java
index 90302d51c..95f2f86bc 100644
--- a/debezium-ingest-jdbc/src/test/java/io/debezium/injest/jdbc/util/TestDatabase.java
+++ b/debezium-ingest-jdbc/src/test/java/io/debezium/injest/jdbc/util/TestDatabase.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/MySqlConfiguration.java b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/MySqlConfiguration.java
index 76d560fac..4427cf743 100644
--- a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/MySqlConfiguration.java
+++ b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/MySqlConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/MySqlDdlParser.java b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/MySqlDdlParser.java
index 87242135c..71ab2a67a 100644
--- a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/MySqlDdlParser.java
+++ b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/MySqlDdlParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/Module.java b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/Module.java
index 1568c3f48..80e47372b 100644
--- a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/Module.java
+++ b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/Module.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/MySqlChangeDetector.java b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/MySqlChangeDetector.java
index 5d62f3ba0..7a354b5b9 100644
--- a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/MySqlChangeDetector.java
+++ b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/MySqlChangeDetector.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/MySqlConnector.java b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/MySqlConnector.java
index 847087b03..b5211723a 100644
--- a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/MySqlConnector.java
+++ b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/MySqlConnector.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/SourceInfo.java b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/SourceInfo.java
index bc4b1982c..1c3cc510a 100644
--- a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/SourceInfo.java
+++ b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/SourceInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/TableConverters.java b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/TableConverters.java
index 77f120942..4e68e294c 100644
--- a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/TableConverters.java
+++ b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/TableConverters.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/TopicSelector.java b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/TopicSelector.java
index b6d25ebf0..e8f5c3f90 100644
--- a/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/TopicSelector.java
+++ b/debezium-ingest-mysql/src/main/java/io/debezium/mysql/ingest/TopicSelector.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ConnectionIT.java b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ConnectionIT.java
index 3fafb1d10..72a72904b 100644
--- a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ConnectionIT.java
+++ b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ConnectionIT.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/MySQLConnection.java b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/MySQLConnection.java
index 4b373c792..b8cadebdc 100644
--- a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/MySQLConnection.java
+++ b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/MySQLConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/MySqlDdlParserTest.java b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/MySqlDdlParserTest.java
index 5a4c733e3..1b036e9de 100644
--- a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/MySqlDdlParserTest.java
+++ b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/MySqlDdlParserTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ingest/MetadataIT.java b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ingest/MetadataIT.java
index 5387cc45e..c4541f5b0 100644
--- a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ingest/MetadataIT.java
+++ b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ingest/MetadataIT.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ingest/ReadBinLogIT.java b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ingest/ReadBinLogIT.java
index 4018b04bd..024ec8e07 100644
--- a/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ingest/ReadBinLogIT.java
+++ b/debezium-ingest-mysql/src/test/java/io/debezium/mysql/ingest/ReadBinLogIT.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-ingest-postgres/src/main/java/io/debezium/ingest/postgres/PostgresConnection.java b/debezium-ingest-postgres/src/main/java/io/debezium/ingest/postgres/PostgresConnection.java
index ec183d9bc..577bd6e86 100644
--- a/debezium-ingest-postgres/src/main/java/io/debezium/ingest/postgres/PostgresConnection.java
+++ b/debezium-ingest-postgres/src/main/java/io/debezium/ingest/postgres/PostgresConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/debezium-ingest-postgres/src/test/java/io/debezium/ingest/postgresql/ConnectionIT.java b/debezium-ingest-postgres/src/test/java/io/debezium/ingest/postgresql/ConnectionIT.java
index b39d8565c..4cd80a814 100644
--- a/debezium-ingest-postgres/src/test/java/io/debezium/ingest/postgresql/ConnectionIT.java
+++ b/debezium-ingest-postgres/src/test/java/io/debezium/ingest/postgresql/ConnectionIT.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/support/checkstyle/src/main/java/io/debezium/checkstyle/ExcludeTestPackages.java b/support/checkstyle/src/main/java/io/debezium/checkstyle/ExcludeTestPackages.java
index d6a5aae68..5145d6f69 100644
--- a/support/checkstyle/src/main/java/io/debezium/checkstyle/ExcludeTestPackages.java
+++ b/support/checkstyle/src/main/java/io/debezium/checkstyle/ExcludeTestPackages.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/support/checkstyle/src/main/java/io/debezium/checkstyle/Header.java b/support/checkstyle/src/main/java/io/debezium/checkstyle/Header.java
index c1ae46aa9..f7a1c1612 100644
--- a/support/checkstyle/src/main/java/io/debezium/checkstyle/Header.java
+++ b/support/checkstyle/src/main/java/io/debezium/checkstyle/Header.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
@@ -13,19 +13,15 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.function.Predicate;
import java.util.regex.Pattern;
public class Header extends com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck {
- private static final String YEAR_MATCHING_PATTERN = "${YYYY}";
-
private Set excludedFileSet;
private String excludedFilesRegex;
private Pattern excludedFilesPattern;
private final String workingDirPath = new File(".").getAbsoluteFile().getParentFile().getAbsolutePath();
private final int workingDirPathLength = workingDirPath.length();
- private Predicate yearLineMatcher;
public Header() {
}
@@ -63,11 +59,6 @@ public void setHeaderFile( String aFileName ) {
if (l == null) {
break;
}
- if (l.contains(YEAR_MATCHING_PATTERN)) {
- String prefix = l.substring(0, l.indexOf(YEAR_MATCHING_PATTERN));
- String suffix = l.substring(l.indexOf(YEAR_MATCHING_PATTERN)+YEAR_MATCHING_PATTERN.length());
- yearLineMatcher = (line)->line.startsWith(prefix) && line.endsWith(suffix);
- }
sb.append(l).append("\\n");
}
super.setHeader(sb.toString());
@@ -100,19 +91,4 @@ protected void processFiltered( File aFile,
if (isExcluded(aFile)) return;
super.processFiltered(aFile, aLines);
}
-
- /**
- * Checks if a code line matches the required header line.
- * @param lineNumber the line number to check against the header
- * @param line the line contents
- * @return true if and only if the line matches the required header line
- */
- @Override
- protected boolean isMatch(int lineNumber, String line) {
- if ( super.isMatch(lineNumber, line)) return true;
- // Otherwise it does not match, so see if the line contain our "${year}" string
- if ( yearLineMatcher != null && yearLineMatcher.test(line) ) return true;
- return false;
- }
-
}
\ No newline at end of file
diff --git a/support/checkstyle/src/main/java/io/debezium/checkstyle/IllegalImport.java b/support/checkstyle/src/main/java/io/debezium/checkstyle/IllegalImport.java
index 990bc2d7e..6afe3d73c 100644
--- a/support/checkstyle/src/main/java/io/debezium/checkstyle/IllegalImport.java
+++ b/support/checkstyle/src/main/java/io/debezium/checkstyle/IllegalImport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/support/checkstyle/src/main/java/io/debezium/checkstyle/JavaDocUtil.java b/support/checkstyle/src/main/java/io/debezium/checkstyle/JavaDocUtil.java
index 24ea38611..cf59d3e58 100644
--- a/support/checkstyle/src/main/java/io/debezium/checkstyle/JavaDocUtil.java
+++ b/support/checkstyle/src/main/java/io/debezium/checkstyle/JavaDocUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/support/checkstyle/src/main/java/io/debezium/checkstyle/UnusedImports.java b/support/checkstyle/src/main/java/io/debezium/checkstyle/UnusedImports.java
index 816b609fb..fc30a5b46 100644
--- a/support/checkstyle/src/main/java/io/debezium/checkstyle/UnusedImports.java
+++ b/support/checkstyle/src/main/java/io/debezium/checkstyle/UnusedImports.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/support/checkstyle/src/main/resources/debezium.header b/support/checkstyle/src/main/resources/debezium.header
index db8ced55b..9421e0aa4 100644
--- a/support/checkstyle/src/main/resources/debezium.header
+++ b/support/checkstyle/src/main/resources/debezium.header
@@ -1,5 +1,5 @@
/*
- * Copyright ${YYYY} Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/
diff --git a/support/ide-configs/eclipse/debezium-templates.xml b/support/ide-configs/eclipse/debezium-templates.xml
index e80a9c67a..c50f7457e 100644
--- a/support/ide-configs/eclipse/debezium-templates.xml
+++ b/support/ide-configs/eclipse/debezium-templates.xml
@@ -7,7 +7,7 @@
id="org.eclipse.jdt.ui.text.codetemplates.filecomment"
name="filecomment">
/*
- * Copyright 2016 Debezium Authors.
+ * Copyright Debezium Authors.
*
* Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
*/