use preconditions
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java
index 865fb79..d398a85 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java
@@ -6,6 +6,7 @@
 
 import org.jboss.netty.buffer.ChannelBuffer;
 
+import com.google.common.base.Preconditions;
 import com.google.common.hash.PrimitiveSink;
 import com.google.common.primitives.UnsignedInts;
 
@@ -78,19 +79,17 @@
 
     @Override
     public IPv4Address and(IPv4Address other) {
-        if (other == null) {
-            throw new NullPointerException("Other IP Address must not be null");
-        }
-        IPv4Address otherIp = (IPv4Address) other;
+        Preconditions.checkNotNull(other, "other must not be null");
+
+        IPv4Address otherIp = other;
         return IPv4Address.of(rawValue & otherIp.rawValue);
     }
 
     @Override
     public IPv4Address or(IPv4Address other) {
-        if (other == null) {
-            throw new NullPointerException("Other IP Address must not be null");
-        }
-        IPv4Address otherIp = (IPv4Address) other;
+        Preconditions.checkNotNull(other, "other must not be null");
+
+        IPv4Address otherIp = other;
         return IPv4Address.of(rawValue | otherIp.rawValue);
     }
 
@@ -100,9 +99,8 @@
     }
 
     public static IPv4Address of(final byte[] address) {
-        if (address == null) {
-            throw new NullPointerException("Address must not be null");
-        }
+        Preconditions.checkNotNull(address, "address must not be null");
+
         if (address.length != LENGTH) {
             throw new IllegalArgumentException(
                     "Invalid byte array length for IPv4Address address: " + address.length);
@@ -135,9 +133,8 @@
      */
     @Nonnull
     public static IPv4Address of(@Nonnull final String string) throws IllegalArgumentException {
-        if (string == null) {
-            throw new NullPointerException("String must not be null");
-        }
+        Preconditions.checkNotNull(string, "string must not be null");
+
         int start = 0;
         int shift = 24;
 
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java
index 3cb9ae4..2d08e1a 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java
@@ -1,5 +1,7 @@
 package org.projectfloodlight.openflow.types;
 
+import com.google.common.base.Preconditions;
+
 
 public class IPv4AddressWithMask extends IPAddressWithMask<IPv4Address> {
     public final static IPv4AddressWithMask NONE = of(IPv4Address.NONE, IPv4Address.NONE);
@@ -22,19 +24,15 @@
     }
 
     public static IPv4AddressWithMask of(IPv4Address value, IPv4Address mask) {
-        if (value == null) {
-            throw new NullPointerException("Value must not be null");
-        }
-        if (mask == null) {
-            throw new NullPointerException("Mask must not be null");
-        }
+        Preconditions.checkNotNull(value, "value must not be null");
+        Preconditions.checkNotNull(mask, "mask must not be null");
+
         return new IPv4AddressWithMask(value, mask);
     }
 
     public static IPv4AddressWithMask of(final String string) {
-        if (string == null) {
-            throw new NullPointerException("String must not be null");
-        }
+        Preconditions.checkNotNull(string, "string must not be null");
+
         int slashPos;
         String ip = string;
         int maskBits = 32;
@@ -83,9 +81,7 @@
 
     @Override
     public boolean contains(IPAddress<?> ip) {
-        if (ip == null) {
-            throw new NullPointerException("ip must not be null");
-        }
+        Preconditions.checkNotNull(ip, "ip must not be null");
 
         if(ip.getIpVersion() == IPVersion.IPv4) {
             IPv4Address ipv4 = (IPv4Address) ip;
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
index 83fb31a..dbf5a90 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
@@ -8,6 +8,7 @@
 import org.jboss.netty.buffer.ChannelBuffer;
 import org.projectfloodlight.openflow.exceptions.OFParseError;
 
+import com.google.common.base.Preconditions;
 import com.google.common.hash.PrimitiveSink;
 import com.google.common.primitives.Longs;
 
@@ -102,19 +103,17 @@
 
     @Override
     public IPv6Address and(IPv6Address other) {
-        if (other == null) {
-            throw new NullPointerException("Other IP Address must not be null");
-        }
-        IPv6Address otherIp = (IPv6Address) other;
+        Preconditions.checkNotNull(other, "other must not be null");
+
+        IPv6Address otherIp = other;
         return IPv6Address.of((raw1 & otherIp.raw1), (raw2 & otherIp.raw2));
     }
 
     @Override
     public IPv6Address or(IPv6Address other) {
-        if (other == null) {
-            throw new NullPointerException("Other IP Address must not be null");
-        }
-        IPv6Address otherIp = (IPv6Address) other;
+        Preconditions.checkNotNull(other, "other must not be null");
+
+        IPv6Address otherIp = other;
         return IPv6Address.of((raw1 | otherIp.raw1), (raw2 | otherIp.raw2));
     }
 
@@ -124,9 +123,8 @@
     }
 
     public static IPv6Address of(final byte[] address) {
-        if (address == null) {
-            throw new NullPointerException("Address must not be null");
-        }
+        Preconditions.checkNotNull(address, "address must not be null");
+
         if (address.length != LENGTH) {
             throw new IllegalArgumentException(
                     "Invalid byte array length for IPv6 address: " + address.length);
@@ -187,9 +185,8 @@
      */
     @Nonnull
     public static IPv6Address of(@Nonnull final String string) throws IllegalArgumentException {
-        if (string == null) {
-            throw new NullPointerException("String must not be null");
-        }
+        Preconditions.checkNotNull(string, "string must not be null");
+
         IPv6Builder builder = new IPv6Builder();
         String[] parts = colonPattern.split(string, -1);
 
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6AddressWithMask.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6AddressWithMask.java
index 4fd9b1c..f015871 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6AddressWithMask.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6AddressWithMask.java
@@ -3,6 +3,8 @@
 import java.math.BigInteger;
 import java.util.Arrays;
 
+import com.google.common.base.Preconditions;
+
 public class IPv6AddressWithMask extends IPAddressWithMask<IPv6Address> {
     public final static IPv6AddressWithMask NONE = of(IPv6Address.NONE, IPv6Address.NONE);
 
@@ -16,20 +18,15 @@
     }
 
     public static IPv6AddressWithMask of(IPv6Address value, IPv6Address mask) {
-        if (value == null) {
-            throw new NullPointerException("Value must not be null");
-        }
-        if (mask == null) {
-            throw new NullPointerException("Mask must not be null");
-        }
+        Preconditions.checkNotNull(value, "value must not be null");
+        Preconditions.checkNotNull(mask, "mask must not be null");
         return new IPv6AddressWithMask(value, mask);
     }
 
 
     public static IPv6AddressWithMask of(final String string) {
-        if (string == null) {
-            throw new NullPointerException("String must not be null");
-        }
+        Preconditions.checkNotNull(string, "string must not be null");
+
         int slashPos;
         String ip = string;
         int maskBits = 128;
@@ -90,9 +87,7 @@
 
     @Override
     public boolean contains(IPAddress<?> ip) {
-        if (ip == null) {
-            throw new NullPointerException("ip must not be null");
-        }
+        Preconditions.checkNotNull(ip, "ip must not be null");
 
         if(ip.getIpVersion() == IPVersion.IPv6) {
             IPv6Address ipv6 = (IPv6Address) ip;