Switch to Objects.requireNonNull
[mdsal.git] / binding2 / mdsal-binding2-dom-codec / src / main / java / org / opendaylight / mdsal / binding / javav2 / dom / codec / impl / context / SchemaRootCodecContext.java
index dd6cb50aad4e82200b19c13842d1ef35bd5af539..5b8bdf8f9ab927852693cb78cd45d1d060f29bfa 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.mdsal.binding.javav2.dom.codec.impl.context;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Throwables;
 import com.google.common.cache.CacheBuilder;
@@ -16,6 +17,7 @@ import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import com.google.common.util.concurrent.UncheckedExecutionException;
 import java.util.Iterator;
+import java.util.Optional;
 import java.util.Set;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -126,8 +128,8 @@ public final class SchemaRootCodecContext<D extends TreeNode> extends DataContai
      * @return operation schema or null, if operation is not present in schema context.
      */
     private ContainerSchemaNode getOperationDataSchema(final SchemaContext schema, final SchemaPath path) {
-        Preconditions.checkNotNull(schema, "Schema context must not be null.");
-        Preconditions.checkNotNull(path, "Schema path must not be null.");
+        requireNonNull(schema, "Schema context must not be null.");
+        requireNonNull(path, "Schema path must not be null.");
         final Iterator<QName> it = path.getPathFromRoot().iterator();
         Preconditions.checkArgument(it.hasNext(), "Operation must have QName.");
         final QName operationName = it.next();
@@ -151,8 +153,8 @@ public final class SchemaRootCodecContext<D extends TreeNode> extends DataContai
     }
 
     private ContainerSchemaNode getOperationDataSchema(final OperationDefinition operation, final QName qname) {
-        Preconditions.checkNotNull(operation, "Operation Schema must not be null.");
-        Preconditions.checkNotNull(qname, "QName must not be null.");
+        requireNonNull(operation, "Operation Schema must not be null.");
+        requireNonNull(qname, "QName must not be null.");
         switch (qname.getLocalName()) {
             case "input":
                 return operation.getInput();
@@ -368,4 +370,4 @@ public final class SchemaRootCodecContext<D extends TreeNode> extends DataContai
             throw e;
         }
     }
-}
\ No newline at end of file
+}