
com.linkedin.dagli.util.function.DefaultOnNullArgument4 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of util-function Show documentation
Show all versions of util-function Show documentation
DAG-oriented machine learning framework for bug-resistant, readable, efficient, maintainable and trivially deployable models in Java and other JVM languages
// AUTOGENERATED CODE. DO NOT MODIFY DIRECTLY! Instead, please modify the util/function/DefaultOnNullArgument.ftl file.
// See the README in the module's src/template directory for details.
package com.linkedin.dagli.util.function;
import java.util.Objects;
/**
* A function class implementing Function4.Serializable that returns null if any of
* the function's inputs are null.
*/
class DefaultOnNullArgument4 implements Function4.Serializable {
private static final long serialVersionUID = 1;
private static final int CLASS_HASH = DefaultOnNullArgument4.class.hashCode();
private final Function4 _wrapped;
DefaultOnNullArgument4(Function4 wrapped) {
// stacking this wrapper multiple times should be idempotent:
if (wrapped instanceof DefaultOnNullArgument4) {
_wrapped = ((DefaultOnNullArgument4) wrapped)._wrapped;
} else {
_wrapped = Objects.requireNonNull(wrapped);
}
}
@Override
public DefaultOnNullArgument4 safelySerializable() {
return new DefaultOnNullArgument4<>(((Function4.Serializable) _wrapped).safelySerializable());
}
@Override
public R apply(A value1, B value2, C value3, D value4) {
if (value1 == null || value2 == null || value3 == null || value4 == null) {
return null;
}
return _wrapped.apply(value1, value2, value3, value4);
}
@Override
public int hashCode() {
return CLASS_HASH + _wrapped.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj instanceof DefaultOnNullArgument4) {
return this._wrapped.equals(((DefaultOnNullArgument4) obj)._wrapped);
}
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy