Since we are using a fixed string, we can easily offload the call
to a centralized place in CodeHelpers, thus providing some minor
class size improvements.
Change-Id: I25991e7020bafc535dab6731063e39e92de03d95
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
import java.util.Collections
import java.util.List
import java.util.Map
-import java.util.Objects
import java.util.regex.Pattern
import org.opendaylight.mdsal.binding.model.api.ConcreteType
import org.opendaylight.mdsal.binding.model.api.Constant
* consequence of how this code is structured.
*/
IF genTO.typedef && !allProperties.empty && allProperties.size == 1 && allProperties.get(0).name.equals("value")»
- «Objects.importedName».requireNonNull(_value, "Supplied value may not be null");
+ «CodeHelpers.importedName».requireValue(_value);
«genPatternEnforcer("_value")»
«ENDIF»
return value;
}
+ /**
+ * A shortcut for {@code Objects.requireNonNull(value, "Supplied value may not be null")}.
+ *
+ * @param value Value itself
+ * @throws NullPointerException if value is null
+ */
+ public static void requireValue(@Nullable final Object value) {
+ requireNonNull(value, "Supplied value may not be null");
+ }
+
/**
* Append a named value to a ToStringHelper. If the value is null, this method does nothing.
*