Use Objects.requireNonNull() directly. (#1022)
This commit is contained in:
parent
5971023a9a
commit
89bc92278a
|
@ -822,7 +822,7 @@ public class ObjectUtils {
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
*/
|
*/
|
||||||
public static void identityToString(final Appendable appendable, final Object object) throws IOException {
|
public static void identityToString(final Appendable appendable, final Object object) throws IOException {
|
||||||
Validate.notNull(object, "object");
|
Objects.requireNonNull(object, "object");
|
||||||
appendable.append(object.getClass().getName())
|
appendable.append(object.getClass().getName())
|
||||||
.append(AT_SIGN)
|
.append(AT_SIGN)
|
||||||
.append(identityHashCodeHex(object));
|
.append(identityHashCodeHex(object));
|
||||||
|
@ -878,7 +878,7 @@ public class ObjectUtils {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void identityToString(final StrBuilder builder, final Object object) {
|
public static void identityToString(final StrBuilder builder, final Object object) {
|
||||||
Validate.notNull(object, "object");
|
Objects.requireNonNull(object, "object");
|
||||||
final String name = object.getClass().getName();
|
final String name = object.getClass().getName();
|
||||||
final String hexString = identityHashCodeHex(object);
|
final String hexString = identityHashCodeHex(object);
|
||||||
builder.ensureCapacity(builder.length() + name.length() + 1 + hexString.length());
|
builder.ensureCapacity(builder.length() + name.length() + 1 + hexString.length());
|
||||||
|
@ -903,7 +903,7 @@ public class ObjectUtils {
|
||||||
* @since 2.4
|
* @since 2.4
|
||||||
*/
|
*/
|
||||||
public static void identityToString(final StringBuffer buffer, final Object object) {
|
public static void identityToString(final StringBuffer buffer, final Object object) {
|
||||||
Validate.notNull(object, "object");
|
Objects.requireNonNull(object, "object");
|
||||||
final String name = object.getClass().getName();
|
final String name = object.getClass().getName();
|
||||||
final String hexString = identityHashCodeHex(object);
|
final String hexString = identityHashCodeHex(object);
|
||||||
buffer.ensureCapacity(buffer.length() + name.length() + 1 + hexString.length());
|
buffer.ensureCapacity(buffer.length() + name.length() + 1 + hexString.length());
|
||||||
|
@ -928,7 +928,7 @@ public class ObjectUtils {
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
*/
|
*/
|
||||||
public static void identityToString(final StringBuilder builder, final Object object) {
|
public static void identityToString(final StringBuilder builder, final Object object) {
|
||||||
Validate.notNull(object, "object");
|
Objects.requireNonNull(object, "object");
|
||||||
final String name = object.getClass().getName();
|
final String name = object.getClass().getName();
|
||||||
final String hexString = identityHashCodeHex(object);
|
final String hexString = identityHashCodeHex(object);
|
||||||
builder.ensureCapacity(builder.length() + name.length() + 1 + hexString.length());
|
builder.ensureCapacity(builder.length() + name.length() + 1 + hexString.length());
|
||||||
|
@ -1108,7 +1108,7 @@ public class ObjectUtils {
|
||||||
public static <T> T median(final Comparator<T> comparator, final T... items) {
|
public static <T> T median(final Comparator<T> comparator, final T... items) {
|
||||||
Validate.notEmpty(items, "null/empty items");
|
Validate.notEmpty(items, "null/empty items");
|
||||||
Validate.noNullElements(items);
|
Validate.noNullElements(items);
|
||||||
Validate.notNull(comparator, "comparator");
|
Objects.requireNonNull(comparator, "comparator");
|
||||||
final TreeSet<T> treeSet = new TreeSet<>(comparator);
|
final TreeSet<T> treeSet = new TreeSet<>(comparator);
|
||||||
Collections.addAll(treeSet, items);
|
Collections.addAll(treeSet, items);
|
||||||
@SuppressWarnings("unchecked") //we know all items added were T instances
|
@SuppressWarnings("unchecked") //we know all items added were T instances
|
||||||
|
|
|
@ -906,7 +906,7 @@ public class MethodUtils {
|
||||||
final boolean searchSupers, final boolean ignoreAccess) {
|
final boolean searchSupers, final boolean ignoreAccess) {
|
||||||
|
|
||||||
Objects.requireNonNull(cls, "cls");
|
Objects.requireNonNull(cls, "cls");
|
||||||
Validate.notNull(annotationCls, "annotationCls");
|
Objects.requireNonNull(annotationCls, "annotationCls");
|
||||||
final List<Class<?>> classes = searchSupers ? getAllSuperclassesAndInterfaces(cls) : new ArrayList<>();
|
final List<Class<?>> classes = searchSupers ? getAllSuperclassesAndInterfaces(cls) : new ArrayList<>();
|
||||||
classes.add(0, cls);
|
classes.add(0, cls);
|
||||||
final List<Method> annotatedMethods = new ArrayList<>();
|
final List<Method> annotatedMethods = new ArrayList<>();
|
||||||
|
|
Loading…
Reference in New Issue