geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pivotalsa...@apache.org
Subject [geode] branch develop updated: GEODE-4518: Replace DSCODE with an enumeration. (#1738)
Date Fri, 06 Apr 2018 18:52:14 GMT
This is an automated email from the ASF dual-hosted git repository.

pivotalsarge pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 804c053  GEODE-4518: Replace DSCODE with an enumeration. (#1738)
804c053 is described below

commit 804c053fdfbce4b7f1f810b1019f778c02f50020
Author: Michael "Sarge" Dodge <mdodge@pivotal.io>
AuthorDate: Fri Apr 6 11:52:09 2018 -0700

    GEODE-4518: Replace DSCODE with an enumeration. (#1738)
    
    * GEODE-4518: Replace DSCODE with an enumeration.
    - Deprecate DSCODE interface.
    - Introduce HeaderByte enum.
    - Replace explicit references to DSCODE with
      explicit references to HeaderByte.
    
    * GEODE-4518: Update analysis files.
    
    * GEODE-4518: Add unit test for value uniqueness.
    
    * GEODE-4518: Convert DSCODE into enum that replaces HeaderByte.
---
 .../main/java/org/apache/geode/DataSerializer.java |  20 +-
 .../java/org/apache/geode/internal/DSCODE.java     | 160 ++---
 .../geode/internal/InternalDataSerializer.java     | 655 ++++++++++++---------
 .../internal/cache/CacheDistributionAdvisor.java   |   2 +-
 .../cache/CachedDeserializableFactory.java         |   2 +-
 .../geode/internal/cache/GemFireCacheImpl.java     |   2 +-
 .../org/apache/geode/internal/cache/Token.java     |   2 +-
 .../cache/snapshot/RegionSnapshotServiceImpl.java  |   2 +-
 .../cache/tier/sockets/ChunkedMessage.java         |   4 +-
 .../tier/sockets/ClientUpdateMessageImpl.java      |   4 +-
 .../cache/tier/sockets/HAEventWrapper.java         |   4 +-
 .../geode/internal/cache/tier/sockets/Part.java    |   2 +-
 .../internal/offheap/AbstractStoredObject.java     |   3 +-
 .../apache/geode/internal/offheap/DataType.java    | 403 +++++++------
 .../internal/offheap/OffHeapRegionEntryHelper.java |   4 +-
 .../internal/offheap/OffHeapStoredObject.java      |   2 +-
 .../org/apache/geode/internal/util/BlobHelper.java |   2 +-
 .../main/java/org/apache/geode/pdx/FieldType.java  |   4 +-
 .../org/apache/geode/pdx/internal/EnumInfo.java    |   2 -
 .../apache/geode/pdx/internal/PdxInstanceEnum.java |   2 +-
 .../apache/geode/pdx/internal/PdxInstanceImpl.java |   4 +-
 .../apache/geode/pdx/internal/PdxReaderImpl.java   |   7 +-
 .../org/apache/geode/pdx/internal/PdxString.java   |  18 +-
 .../apache/geode/pdx/internal/PdxWriterImpl.java   |   6 +-
 .../java/org/apache/geode/internal/DSCODETest.java |  39 ++
 .../geode/internal/offheap/DataTypeJUnitTest.java  |  40 +-
 .../internal/offheap/MemoryBlockNodeJUnitTest.java |   2 +-
 .../offheap/OffHeapRegionEntryHelperJUnitTest.java |   2 +-
 .../offheap/OffHeapStoredObjectJUnitTest.java      |   8 +-
 .../offheap/TinyStoredObjectJUnitTest.java         |   3 +-
 .../apache/geode/pdx/PdxSerializableJUnitTest.java |  20 +-
 .../apache/geode/codeAnalysis/excludedClasses.txt  |   3 +-
 .../codeAnalysis/sanctionedDataSerializables.txt   |   2 +-
 33 files changed, 799 insertions(+), 636 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/DataSerializer.java b/geode-core/src/main/java/org/apache/geode/DataSerializer.java
index 5627b68..c974287 100644
--- a/geode-core/src/main/java/org/apache/geode/DataSerializer.java
+++ b/geode-core/src/main/java/org/apache/geode/DataSerializer.java
@@ -220,7 +220,7 @@ public abstract class DataSerializer {
       // if readObject/writeObject is called:
       // the first CLASS byte indicates it's a Class, the second
       // one indicates it's a non-primitive Class
-      out.writeByte(DSCODE.CLASS);
+      out.writeByte(DSCODE.CLASS.toByte());
       String cname = c.getName();
       cname = InternalDataSerializer.processOutgoingClassName(cname, out);
       writeString(cname, out);
@@ -260,7 +260,7 @@ public abstract class DataSerializer {
     InternalDataSerializer.checkIn(in);
 
     byte typeCode = in.readByte();
-    if (typeCode == DSCODE.CLASS) {
+    if (typeCode == DSCODE.CLASS.toByte()) {
       String className = readString(in);
       Class<?> c = InternalDataSerializer.getCachedClass(className); // fix for bug 41206
       return c;
@@ -505,7 +505,7 @@ public abstract class DataSerializer {
       if (isTraceSerialzerVerbose) {
         logger.trace(LogMarker.SERIALIZER_VERBOSE, "Writing NULL_STRING");
       }
-      out.writeByte(DSCODE.NULL_STRING);
+      out.writeByte(DSCODE.NULL_STRING.toByte());
 
     } else {
       // writeUTF is expensive - it creates a char[] to fetch
@@ -538,14 +538,14 @@ public abstract class DataSerializer {
           if (isTraceSerialzerVerbose) {
             logger.trace(LogMarker.SERIALIZER_VERBOSE, "Writing utf HUGE_STRING of len={}", len);
           }
-          out.writeByte(DSCODE.HUGE_STRING);
+          out.writeByte(DSCODE.HUGE_STRING.toByte());
           out.writeInt(len);
           out.writeChars(value);
         } else {
           if (isTraceSerialzerVerbose) {
             logger.trace(LogMarker.SERIALIZER_VERBOSE, "Writing utf STRING of len={}", len);
           }
-          out.writeByte(DSCODE.STRING);
+          out.writeByte(DSCODE.STRING.toByte());
           out.writeUTF(value);
         }
       } else {
@@ -553,14 +553,14 @@ public abstract class DataSerializer {
           if (isTraceSerialzerVerbose) {
             logger.trace(LogMarker.SERIALIZER_VERBOSE, "Writing HUGE_STRING_BYTES of len={}", len);
           }
-          out.writeByte(DSCODE.HUGE_STRING_BYTES);
+          out.writeByte(DSCODE.HUGE_STRING_BYTES.toByte());
           out.writeInt(len);
           out.writeBytes(value);
         } else {
           if (isTraceSerialzerVerbose) {
             logger.trace(LogMarker.SERIALIZER_VERBOSE, "Writing STRING_BYTES of len={}", len);
           }
-          out.writeByte(DSCODE.STRING_BYTES);
+          out.writeByte(DSCODE.STRING_BYTES.toByte());
           out.writeShort(len);
           out.writeBytes(value);
         }
@@ -1833,14 +1833,14 @@ public abstract class DataSerializer {
       Class<?> c = null;
       byte typeCode = in.readByte();
       String typeString = null;
-      if (typeCode == DSCODE.CLASS) {
+      if (typeCode == DSCODE.CLASS.toByte()) {
         typeString = readString(in);
       }
 
       InternalCache cache = GemFireCacheImpl.getInstance();
       boolean lookForPdxInstance = false;
       ClassNotFoundException cnfEx = null;
-      if (typeCode == DSCODE.CLASS && cache != null
+      if (typeCode == DSCODE.CLASS.toByte() && cache != null
           && cache.getPdxReadSerializedByAnyGemFireServices()) {
         try {
           c = InternalDataSerializer.getCachedClass(typeString);
@@ -1850,7 +1850,7 @@ public abstract class DataSerializer {
           cnfEx = ignore;
         }
       } else {
-        if (typeCode == DSCODE.CLASS) {
+        if (typeCode == DSCODE.CLASS.toByte()) {
           c = InternalDataSerializer.getCachedClass(typeString);
         } else {
           c = InternalDataSerializer.decodePrimitiveClass(typeCode);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/DSCODE.java b/geode-core/src/main/java/org/apache/geode/internal/DSCODE.java
index b918c4d..e4762d3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/DSCODE.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/DSCODE.java
@@ -17,20 +17,20 @@ package org.apache.geode.internal;
 import org.apache.geode.DataSerializer;
 
 /**
- * An interface that contains a bunch of static final values used for the implementation of
- * {@link DataSerializer}. It is basically an Enum and could be changed to one once we drop 1.4. The
- * allowed range of these codes is -128..127 inclusive (i.e. byte).
+ * An enumeration that contains a bunch of pre-defined values for use in the implementation of
+ * {@link DataSerializer}.
+ * The allowed range of these values is -128..127 inclusive (i.e., one byte).
  *
  * @since GemFire 5.7
  */
-public interface DSCODE {
+public enum DSCODE {
   /**
    * This byte value, -128, has never been used in any GemFire release so far. It might get used in
    * the future to introduce DataSerializer versioning.
    */
-  byte RESERVED_FOR_FUTURE_USE = -128;
+  RESERVED_FOR_FUTURE_USE(-128),
 
-  byte ILLEGAL = -127;
+  ILLEGAL(-127),
 
   // -126..0 unused
 
@@ -40,28 +40,28 @@ public interface DSCODE {
    *
    * @since GemFire 5.7
    */
-  byte DS_FIXED_ID_BYTE = 1;
+  DS_FIXED_ID_BYTE(1),
   /**
    * A header byte meaning that the next element in the stream is a {@link DataSerializableFixedID}
    * whose id is a single signed short.
    *
    * @since GemFire 5.7
    */
-  byte DS_FIXED_ID_SHORT = 2;
+  DS_FIXED_ID_SHORT(2),
   /**
    * A header byte meaning that the next element in the stream is a {@link DataSerializableFixedID}
    * whose id is a single signed int.
    *
    * @since GemFire 5.7
    */
-  byte DS_FIXED_ID_INT = 3;
+  DS_FIXED_ID_INT(3),
   /**
    * A header byte meaning that the next element in the stream is a {@link DataSerializableFixedID}
    * whose id is <code>NO_FIXED_ID</code>.
    *
    * @since GemFire 5.7
    */
-  byte DS_NO_FIXED_ID = 4;
+  DS_NO_FIXED_ID(4),
 
   /**
    * A header byte meaning that the object was serialized by a user's <code>DataSerializer</code>
@@ -69,7 +69,7 @@ public interface DSCODE {
    *
    * @since GemFire 5.7
    */
-  byte USER_CLASS_2 = 5;
+  USER_CLASS_2(5),
 
   /**
    * A header byte meaning that the object was serialized by a user's <code>DataSerializer</code>
@@ -77,7 +77,7 @@ public interface DSCODE {
    *
    * @since GemFire 5.7
    */
-  byte USER_CLASS_4 = 6;
+  USER_CLASS_4(6),
 
   // TypeIds 7 and 8 reserved for use by C# Serializable and XmlSerializable.
 
@@ -86,14 +86,14 @@ public interface DSCODE {
   /**
    * A header byte meaning that the next element in the stream is a <code>LinkedList</code>.
    */
-  byte LINKED_LIST = 10;
+  LINKED_LIST(10),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>Properties</code>.
    *
    * @since GemFire 5.7
    */
-  byte PROPERTIES = 11;
+  PROPERTIES(11),
 
   // 12..16 unused
 
@@ -101,24 +101,16 @@ public interface DSCODE {
    * Codes for the primitive classes, which cannot be recreated with
    * <code>Class.forName(String,boolean,ClassLoader)</code> like other classes
    */
-  byte BOOLEAN_TYPE = 17;
-  byte CHARACTER_TYPE = 18;
-  byte BYTE_TYPE = 19;
-  byte SHORT_TYPE = 20;
-  byte INTEGER_TYPE = 21;
-  byte LONG_TYPE = 22;
-  byte FLOAT_TYPE = 23;
-  byte DOUBLE_TYPE = 24;
-  byte VOID_TYPE = 25;
+  BOOLEAN_TYPE(17), CHARACTER_TYPE(18), BYTE_TYPE(19), SHORT_TYPE(20), INTEGER_TYPE(21), LONG_TYPE(22), FLOAT_TYPE(23), DOUBLE_TYPE(24), VOID_TYPE(25),
 
   /**
    * @since GemFire 5.7
    */
-  byte BOOLEAN_ARRAY = 26;
+  BOOLEAN_ARRAY(26),
   /**
    * @since GemFire 5.7
    */
-  byte CHAR_ARRAY = 27;
+  CHAR_ARRAY(27),
 
   // 28..36 unused
 
@@ -128,7 +120,7 @@ public interface DSCODE {
    *
    * @since GemFire 5.7
    */
-  byte USER_DATA_SERIALIZABLE_4 = 37;
+  USER_DATA_SERIALIZABLE_4(37),
 
   /**
    * A header byte meaning that a DataSerializable that was registered with the Instantiator was
@@ -136,213 +128,213 @@ public interface DSCODE {
    *
    * @since GemFire 5.7
    */
-  byte USER_DATA_SERIALIZABLE_2 = 38;
+  USER_DATA_SERIALIZABLE_2(38),
 
   /**
    * A header byte meaning that a DataSerializable that was registered with the Instantiator was
    * data serialized using a single byte for its ID.
    */
-  byte USER_DATA_SERIALIZABLE = 39;
+  USER_DATA_SERIALIZABLE(39),
 
   /**
    * A header byte meaning that the object was serialized by a user's <code>DataSerializer</code>.
    */
-  byte USER_CLASS = 40;
+  USER_CLASS(40),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>null</code>
    */
-  byte NULL = 41;
+  NULL(41),
 
   /**
    * A header byte meaning that the next element in the stream is a String
    */
-  byte STRING = 42;
+  STRING(42),
 
   /**
    * A header byte meaning that the next element in the stream is a (non-primitive) Class
    */
-  byte CLASS = 43;
+  CLASS(43),
 
   /**
    * A header byte meaning that the next element in the stream is a serialized object
    */
-  byte SERIALIZABLE = 44;
+  SERIALIZABLE(44),
 
   /**
    * A header byte meaning that the next element in the stream is a DataSerializable object
    */
-  byte DATA_SERIALIZABLE = 45;
+  DATA_SERIALIZABLE(45),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>byte</code> array.
    */
-  byte BYTE_ARRAY = 46;
+  BYTE_ARRAY(46),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>short</code> array.
    */
-  byte SHORT_ARRAY = 47;
+  SHORT_ARRAY(47),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>int</code> array.
    */
-  byte INT_ARRAY = 48;
+  INT_ARRAY(48),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>long</code> array.
    */
-  byte LONG_ARRAY = 49;
+  LONG_ARRAY(49),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>float</code> array.
    */
-  byte FLOAT_ARRAY = 50;
+  FLOAT_ARRAY(50),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>double</code> array.
    */
-  byte DOUBLE_ARRAY = 51;
+  DOUBLE_ARRAY(51),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>Object</code> array.
    */
-  byte OBJECT_ARRAY = 52;
+  OBJECT_ARRAY(52),
 
   /**
    * A header boolean meaning that the next element in the stream is a <code>Boolean</code>.
    */
-  byte BOOLEAN = 53;
+  BOOLEAN(53),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>Character</code>.
    */
-  byte CHARACTER = 54;
+  CHARACTER(54),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>Byte</code>.
    */
-  byte BYTE = 55;
+  BYTE(55),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>Short</code>.
    */
-  byte SHORT = 56;
+  SHORT(56),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>Integer</code>.
    */
-  byte INTEGER = 57;
+  INTEGER(57),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>Long</code>.
    */
-  byte LONG = 58;
+  LONG(58),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>Float</code>.
    */
-  byte FLOAT = 59;
+  FLOAT(59),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>Double</code>.
    */
-  byte DOUBLE = 60;
+  DOUBLE(60),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>Date</code>.
    */
-  byte DATE = 61;
+  DATE(61),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>InetAddress</code>.
    */
-  byte INET_ADDRESS = 62;
+  INET_ADDRESS(62),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>File</code>.
    */
-  byte FILE = 63;
+  FILE(63),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>String</code> array.
    */
-  byte STRING_ARRAY = 64;
+  STRING_ARRAY(64),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>ArrayList</code>.
    */
-  byte ARRAY_LIST = 65;
+  ARRAY_LIST(65),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>HashSet</code>.
    */
-  byte HASH_SET = 66;
+  HASH_SET(66),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>HashMap</code>.
    */
-  byte HASH_MAP = 67;
+  HASH_MAP(67),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>TimeUnit</code>.
    */
-  byte TIME_UNIT = 68;
+  TIME_UNIT(68),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>null</code>
    * <code>String</code>.
    */
-  byte NULL_STRING = 69;
+  NULL_STRING(69),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>Hashtable</code>.
    *
    * @since GemFire 5.7
    */
-  byte HASH_TABLE = 70;
+  HASH_TABLE(70),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>Vector</code>.
    *
    * @since GemFire 5.7
    */
-  byte VECTOR = 71;
+  VECTOR(71),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>IdentityHashMap</code>.
    *
    * @since GemFire 5.7
    */
-  byte IDENTITY_HASH_MAP = 72;
+  IDENTITY_HASH_MAP(72),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>LinkedHashSet</code>.
    *
    * @since GemFire 5.7
    */
-  byte LINKED_HASH_SET = 73;
+  LINKED_HASH_SET(73),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>Stack</code>.
    *
    * @since GemFire 5.7
    */
-  byte STACK = 74;
+  STACK(74),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>TreeMap</code>.
    *
    * @since GemFire 5.7
    */
-  byte TREE_MAP = 75;
+  TREE_MAP(75),
 
   /**
    * A header byte meaning that the next element in the stream is a <code>TreeSet</code>.
    *
    * @since GemFire 5.7
    */
-  byte TREE_SET = 76;
+  TREE_SET(76),
 
   // 75..86 unused
 
@@ -350,7 +342,7 @@ public interface DSCODE {
    * A header byte meaning that the next element in the stream is a buffer of 1-byte characters to
    * turn into a String whose length is <= 0xFFFF
    */
-  byte STRING_BYTES = 87;
+  STRING_BYTES(87),
 
   /**
    * A header byte meaning that the next element in the stream is a buffer of 1-byte characters to
@@ -358,7 +350,7 @@ public interface DSCODE {
    *
    * @since GemFire 5.7
    */
-  byte HUGE_STRING_BYTES = 88;
+  HUGE_STRING_BYTES(88),
 
   /**
    * A header byte meaning that the next element in the stream is a buffer of 2-byte characters to
@@ -366,14 +358,14 @@ public interface DSCODE {
    *
    * @since GemFire 5.7
    */
-  byte HUGE_STRING = 89;
+  HUGE_STRING(89),
 
   // 90 unused
 
   /**
    * A header byte meaning that the next element in the stream is a <code>byte[][]</code>.
    */
-  byte ARRAY_OF_BYTE_ARRAYS = 91;
+  ARRAY_OF_BYTE_ARRAYS(91),
 
   // 92 unused
 
@@ -382,7 +374,7 @@ public interface DSCODE {
    *
    * @since GemFire 6.6
    */
-  byte PDX = 93;
+  PDX(93),
 
   /**
    * A header byte meaning that the next element in the stream is an enum whose type is defined in
@@ -390,20 +382,20 @@ public interface DSCODE {
    *
    * @since GemFire 6.6.2
    */
-  byte PDX_ENUM = 94;
+  PDX_ENUM(94),
 
   /**
    * java.math.BigInteger
    *
    * @since GemFire 6.6.2
    */
-  byte BIG_INTEGER = 95;
+  BIG_INTEGER(95),
   /**
    * java.math.BigDecimal
    *
    * @since GemFire 6.6.2
    */
-  byte BIG_DECIMAL = 96;
+  BIG_DECIMAL(96),
 
   /**
    * This code can only be used by PDX. It can't be used for normal DataSerializer writeObject
@@ -412,43 +404,53 @@ public interface DSCODE {
    *
    * @since GemFire 6.6
    */
-  byte CONCURRENT_HASH_MAP = 97;
+  CONCURRENT_HASH_MAP(97),
 
   /**
    * java.util.UUID
    *
    * @since GemFire 6.6.2
    */
-  byte UUID = 98;
+  UUID(98),
   /**
    * java.sql.Timestamp
    *
    * @since GemFire 6.6.2
    */
-  byte TIMESTAMP = 99;
+  TIMESTAMP(99),
 
   /**
    * Used for enums that need to always be deserialized into their enum domain class.
    *
    * @since GemFire 6.6.2
    */
-  byte GEMFIRE_ENUM = 100;
+  GEMFIRE_ENUM(100),
   /**
    * Used for enums that need to be encoded inline because the pdx registry may not be available.
    * During deserialization this type of enum may be deserialized as a PdxInstance.
    *
    * @since GemFire 6.6.2
    */
-  byte PDX_INLINE_ENUM = 101;
+  PDX_INLINE_ENUM(101),
 
   /**
    * Used for wildcard searches in soplogs with composite keys.
    *
    * @since GemFire 8.0
    */
-  byte WILDCARD = 102;
+  WILDCARD(102);
 
   // 103..127 unused
 
   // DO NOT USE CODES > 127. They are not "byte".
+
+  private byte value;
+
+  DSCODE(int value) {
+    this.value = (byte) value;
+  }
+
+  public byte toByte() {
+    return value;
+  }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
index 993c2d5..334c058 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/InternalDataSerializer.java
@@ -130,7 +130,7 @@ import org.apache.geode.pdx.internal.TypeRegistry;
  *
  * @since GemFire 3.5
  */
-public abstract class InternalDataSerializer extends DataSerializer implements DSCODE {
+public abstract class InternalDataSerializer extends DataSerializer {
   private static final Logger logger = LogService.getLogger();
 
   /**
@@ -386,7 +386,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         InetAddress address = (InetAddress) o;
-        out.writeByte(INET_ADDRESS);
+        out.writeByte(DSCODE.INET_ADDRESS.toByte());
         writeInetAddress(address, out);
         return true;
       }
@@ -395,7 +395,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         InetAddress address = (InetAddress) o;
-        out.writeByte(INET_ADDRESS);
+        out.writeByte(DSCODE.INET_ADDRESS.toByte());
         writeInetAddress(address, out);
         return true;
       }
@@ -404,7 +404,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         InetAddress address = (InetAddress) o;
-        out.writeByte(INET_ADDRESS);
+        out.writeByte(DSCODE.INET_ADDRESS.toByte());
         writeInetAddress(address, out);
         return true;
       }
@@ -416,7 +416,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
         if (c.isPrimitive()) {
           writePrimitiveClass(c, out);
         } else {
-          out.writeByte(CLASS);
+          out.writeByte(DSCODE.CLASS.toByte());
           writeClass(c, out);
         }
         return true;
@@ -426,7 +426,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         Boolean value = (Boolean) o;
-        out.writeByte(BOOLEAN);
+        out.writeByte(DSCODE.BOOLEAN.toByte());
         writeBoolean(value, out);
         return true;
       }
@@ -435,7 +435,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         Character value = (Character) o;
-        out.writeByte(CHARACTER);
+        out.writeByte(DSCODE.CHARACTER.toByte());
         writeCharacter(value, out);
         return true;
       }
@@ -444,7 +444,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         Byte value = (Byte) o;
-        out.writeByte(BYTE);
+        out.writeByte(DSCODE.BYTE.toByte());
         writeByte(value, out);
         return true;
       }
@@ -453,7 +453,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         Short value = (Short) o;
-        out.writeByte(SHORT);
+        out.writeByte(DSCODE.SHORT.toByte());
         writeShort(value, out);
         return true;
       }
@@ -462,7 +462,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         Integer value = (Integer) o;
-        out.writeByte(INTEGER);
+        out.writeByte(DSCODE.INTEGER.toByte());
         writeInteger(value, out);
         return true;
       }
@@ -471,7 +471,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         Long value = (Long) o;
-        out.writeByte(LONG);
+        out.writeByte(DSCODE.LONG.toByte());
         writeLong(value, out);
         return true;
       }
@@ -480,7 +480,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         Float value = (Float) o;
-        out.writeByte(FLOAT);
+        out.writeByte(DSCODE.FLOAT.toByte());
         writeFloat(value, out);
         return true;
       }
@@ -489,7 +489,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         Double value = (Double) o;
-        out.writeByte(DOUBLE);
+        out.writeByte(DSCODE.DOUBLE.toByte());
         writeDouble(value, out);
         return true;
       }
@@ -498,7 +498,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
         new WellKnownPdxDS() {
           @Override
           public boolean toData(Object o, DataOutput out) throws IOException {
-            out.writeByte(BOOLEAN_ARRAY);
+            out.writeByte(DSCODE.BOOLEAN_ARRAY.toByte());
             writeBooleanArray((boolean[]) o, out);
             return true;
           }
@@ -508,7 +508,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
           @Override
           public boolean toData(Object o, DataOutput out) throws IOException {
             byte[] array = (byte[]) o;
-            out.writeByte(BYTE_ARRAY);
+            out.writeByte(DSCODE.BYTE_ARRAY.toByte());
             writeByteArray(array, out);
             return true;
           }
@@ -517,7 +517,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
         new WellKnownPdxDS() {
           @Override
           public boolean toData(Object o, DataOutput out) throws IOException {
-            out.writeByte(CHAR_ARRAY);
+            out.writeByte(DSCODE.CHAR_ARRAY.toByte());
             writeCharArray((char[]) o, out);
             return true;
           }
@@ -527,7 +527,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
           @Override
           public boolean toData(Object o, DataOutput out) throws IOException {
             double[] array = (double[]) o;
-            out.writeByte(DOUBLE_ARRAY);
+            out.writeByte(DSCODE.DOUBLE_ARRAY.toByte());
             writeDoubleArray(array, out);
             return true;
           }
@@ -537,7 +537,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
           @Override
           public boolean toData(Object o, DataOutput out) throws IOException {
             float[] array = (float[]) o;
-            out.writeByte(FLOAT_ARRAY);
+            out.writeByte(DSCODE.FLOAT_ARRAY.toByte());
             writeFloatArray(array, out);
             return true;
           }
@@ -547,7 +547,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
           @Override
           public boolean toData(Object o, DataOutput out) throws IOException {
             int[] array = (int[]) o;
-            out.writeByte(INT_ARRAY);
+            out.writeByte(DSCODE.INT_ARRAY.toByte());
             writeIntArray(array, out);
             return true;
           }
@@ -557,7 +557,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
           @Override
           public boolean toData(Object o, DataOutput out) throws IOException {
             long[] array = (long[]) o;
-            out.writeByte(LONG_ARRAY);
+            out.writeByte(DSCODE.LONG_ARRAY.toByte());
             writeLongArray(array, out);
             return true;
           }
@@ -567,7 +567,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
           @Override
           public boolean toData(Object o, DataOutput out) throws IOException {
             short[] array = (short[]) o;
-            out.writeByte(SHORT_ARRAY);
+            out.writeByte(DSCODE.SHORT_ARRAY.toByte());
             writeShortArray(array, out);
             return true;
           }
@@ -577,7 +577,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
           @Override
           public boolean toData(Object o, DataOutput out) throws IOException {
             String[] array = (String[]) o;
-            out.writeByte(STRING_ARRAY);
+            out.writeByte(DSCODE.STRING_ARRAY.toByte());
             writeStringArray(array, out);
             return true;
           }
@@ -585,7 +585,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
     classesToSerializers.put(TimeUnit.NANOSECONDS.getClass().getName(), new WellKnownDS() {
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
-        out.writeByte(TIME_UNIT);
+        out.writeByte(DSCODE.TIME_UNIT.toByte());
         out.writeByte(TIME_UNIT_NANOSECONDS);
         return true;
       }
@@ -593,7 +593,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
     classesToSerializers.put(TimeUnit.MICROSECONDS.getClass().getName(), new WellKnownDS() {
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
-        out.writeByte(TIME_UNIT);
+        out.writeByte(DSCODE.TIME_UNIT.toByte());
         out.writeByte(TIME_UNIT_MICROSECONDS);
         return true;
       }
@@ -601,7 +601,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
     classesToSerializers.put(TimeUnit.MILLISECONDS.getClass().getName(), new WellKnownDS() {
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
-        out.writeByte(TIME_UNIT);
+        out.writeByte(DSCODE.TIME_UNIT.toByte());
         out.writeByte(TIME_UNIT_MILLISECONDS);
         return true;
       }
@@ -609,7 +609,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
     classesToSerializers.put(TimeUnit.SECONDS.getClass().getName(), new WellKnownDS() {
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
-        out.writeByte(TIME_UNIT);
+        out.writeByte(DSCODE.TIME_UNIT.toByte());
         out.writeByte(TIME_UNIT_SECONDS);
         return true;
       }
@@ -618,7 +618,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         Date date = (Date) o;
-        out.writeByte(DATE);
+        out.writeByte(DSCODE.DATE.toByte());
         writeDate(date, out);
         return true;
       }
@@ -627,7 +627,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         File file = (File) o;
-        out.writeByte(FILE);
+        out.writeByte(DSCODE.FILE.toByte());
         writeFile(file, out);
         return true;
       }
@@ -636,7 +636,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         ArrayList list = (ArrayList) o;
-        out.writeByte(ARRAY_LIST);
+        out.writeByte(DSCODE.ARRAY_LIST.toByte());
         writeArrayList(list, out);
         return true;
       }
@@ -645,7 +645,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         LinkedList list = (LinkedList) o;
-        out.writeByte(LINKED_LIST);
+        out.writeByte(DSCODE.LINKED_LIST.toByte());
         writeLinkedList(list, out);
         return true;
       }
@@ -653,7 +653,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
     classesToSerializers.put("java.util.Vector", new WellKnownPdxDS() {
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
-        out.writeByte(VECTOR);
+        out.writeByte(DSCODE.VECTOR.toByte());
         writeVector((Vector) o, out);
         return true;
       }
@@ -661,7 +661,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
     classesToSerializers.put("java.util.Stack", new WellKnownDS() {
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
-        out.writeByte(STACK);
+        out.writeByte(DSCODE.STACK.toByte());
         writeStack((Stack) o, out);
         return true;
       }
@@ -670,7 +670,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         HashSet list = (HashSet) o;
-        out.writeByte(HASH_SET);
+        out.writeByte(DSCODE.HASH_SET.toByte());
         writeHashSet(list, out);
         return true;
       }
@@ -678,7 +678,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
     classesToSerializers.put("java.util.LinkedHashSet", new WellKnownPdxDS() {
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
-        out.writeByte(LINKED_HASH_SET);
+        out.writeByte(DSCODE.LINKED_HASH_SET.toByte());
         writeLinkedHashSet((LinkedHashSet) o, out);
         return true;
       }
@@ -687,7 +687,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         HashMap list = (HashMap) o;
-        out.writeByte(HASH_MAP);
+        out.writeByte(DSCODE.HASH_MAP.toByte());
         writeHashMap(list, out);
         return true;
       }
@@ -695,7 +695,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
     classesToSerializers.put("java.util.IdentityHashMap", new WellKnownDS() {
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
-        out.writeByte(IDENTITY_HASH_MAP);
+        out.writeByte(DSCODE.IDENTITY_HASH_MAP.toByte());
         writeIdentityHashMap((IdentityHashMap) o, out);
         return true;
       }
@@ -703,7 +703,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
     classesToSerializers.put("java.util.Hashtable", new WellKnownPdxDS() {
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
-        out.writeByte(HASH_TABLE);
+        out.writeByte(DSCODE.HASH_TABLE.toByte());
         writeHashtable((Hashtable) o, out);
         return true;
       }
@@ -712,7 +712,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
         Properties props = (Properties) o;
-        out.writeByte(PROPERTIES);
+        out.writeByte(DSCODE.PROPERTIES.toByte());
         writeProperties(props, out);
         return true;
       }
@@ -720,7 +720,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
     classesToSerializers.put("java.util.TreeMap", new WellKnownDS() {
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
-        out.writeByte(TREE_MAP);
+        out.writeByte(DSCODE.TREE_MAP.toByte());
         writeTreeMap((TreeMap) o, out);
         return true;
       }
@@ -728,7 +728,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
     classesToSerializers.put("java.util.TreeSet", new WellKnownDS() {
       @Override
       public boolean toData(Object o, DataOutput out) throws IOException {
-        out.writeByte(TREE_SET);
+        out.writeByte(DSCODE.TREE_SET.toByte());
         writeTreeSet((TreeSet) o, out);
         return true;
       }
@@ -737,7 +737,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       classesToSerializers.put("java.math.BigInteger", new WellKnownDS() {
         @Override
         public boolean toData(Object o, DataOutput out) throws IOException {
-          out.writeByte(BIG_INTEGER);
+          out.writeByte(DSCODE.BIG_INTEGER.toByte());
           writeBigInteger((BigInteger) o, out);
           return true;
         }
@@ -745,7 +745,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       classesToSerializers.put("java.math.BigDecimal", new WellKnownDS() {
         @Override
         public boolean toData(Object o, DataOutput out) throws IOException {
-          out.writeByte(BIG_DECIMAL);
+          out.writeByte(DSCODE.BIG_DECIMAL.toByte());
           writeBigDecimal((BigDecimal) o, out);
           return true;
         }
@@ -753,7 +753,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       classesToSerializers.put("java.util.UUID", new WellKnownDS() {
         @Override
         public boolean toData(Object o, DataOutput out) throws IOException {
-          out.writeByte(UUID);
+          out.writeByte(DSCODE.UUID.toByte());
           writeUUID((UUID) o, out);
           return true;
         }
@@ -761,7 +761,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       classesToSerializers.put("java.sql.Timestamp", new WellKnownDS() {
         @Override
         public boolean toData(Object o, DataOutput out) throws IOException {
-          out.writeByte(TIMESTAMP);
+          out.writeByte(DSCODE.TIMESTAMP.toByte());
           writeTimestamp((Timestamp) o, out);
           return true;
         }
@@ -1497,13 +1497,13 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
               .toLocalizedString());
     }
     if (dsfid <= Byte.MAX_VALUE && dsfid >= Byte.MIN_VALUE) {
-      out.writeByte(DS_FIXED_ID_BYTE);
+      out.writeByte(DSCODE.DS_FIXED_ID_BYTE.toByte());
       out.writeByte(dsfid);
     } else if (dsfid <= Short.MAX_VALUE && dsfid >= Short.MIN_VALUE) {
-      out.writeByte(DS_FIXED_ID_SHORT);
+      out.writeByte(DSCODE.DS_FIXED_ID_SHORT.toByte());
       out.writeShort(dsfid);
     } else {
-      out.writeByte(DS_FIXED_ID_INT);
+      out.writeByte(DSCODE.DS_FIXED_ID_INT.toByte());
       out.writeInt(dsfid);
     }
   }
@@ -1527,7 +1527,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       }
     }
     if (dsfid == DataSerializableFixedID.NO_FIXED_ID) {
-      out.writeByte(DS_NO_FIXED_ID);
+      out.writeByte(DSCODE.DS_NO_FIXED_ID.toByte());
       DataSerializer.writeClass(o.getClass(), out);
     } else {
       writeDSFIDHeader(dsfid, out);
@@ -1584,13 +1584,13 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
         checkPdxCompatible(o, ensurePdxCompatibility);
         // id will be 0 if it is a WellKnowDS
         if (id <= Byte.MAX_VALUE && id >= Byte.MIN_VALUE) {
-          out.writeByte(USER_CLASS);
+          out.writeByte(DSCODE.USER_CLASS.toByte());
           out.writeByte((byte) id);
         } else if (id <= Short.MAX_VALUE && id >= Short.MIN_VALUE) {
-          out.writeByte(USER_CLASS_2);
+          out.writeByte(DSCODE.USER_CLASS_2.toByte());
           out.writeShort(id);
         } else {
-          out.writeByte(USER_CLASS_4);
+          out.writeByte(DSCODE.USER_CLASS_4.toByte());
           out.writeInt(id);
         }
       } else {
@@ -1644,12 +1644,12 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       // Do byte[][] and Object[] here to fix bug 44060
     } else if (o instanceof byte[][]) {
       byte[][] byteArrays = (byte[][]) o;
-      out.writeByte(ARRAY_OF_BYTE_ARRAYS);
+      out.writeByte(DSCODE.ARRAY_OF_BYTE_ARRAYS.toByte());
       writeArrayOfByteArrays(byteArrays, out);
       return true;
     } else if (o instanceof Object[]) {
       Object[] array = (Object[]) o;
-      out.writeByte(OBJECT_ARRAY);
+      out.writeByte(DSCODE.OBJECT_ARRAY.toByte());
       writeObjectArray(array, out, ensurePdxCompatibility);
       return true;
     } else if (is662SerializationEnabled()
@@ -1956,25 +1956,25 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
    */
   public static void writePrimitiveClass(Class c, DataOutput out) throws IOException {
     if (c == Boolean.TYPE) {
-      out.writeByte(BOOLEAN_TYPE);
+      out.writeByte(DSCODE.BOOLEAN_TYPE.toByte());
     } else if (c == Character.TYPE) {
-      out.writeByte(CHARACTER_TYPE);
+      out.writeByte(DSCODE.CHARACTER_TYPE.toByte());
     } else if (c == Byte.TYPE) {
-      out.writeByte(BYTE_TYPE);
+      out.writeByte(DSCODE.BYTE_TYPE.toByte());
     } else if (c == Short.TYPE) {
-      out.writeByte(SHORT_TYPE);
+      out.writeByte(DSCODE.SHORT_TYPE.toByte());
     } else if (c == Integer.TYPE) {
-      out.writeByte(INTEGER_TYPE);
+      out.writeByte(DSCODE.INTEGER_TYPE.toByte());
     } else if (c == Long.TYPE) {
-      out.writeByte(LONG_TYPE);
+      out.writeByte(DSCODE.LONG_TYPE.toByte());
     } else if (c == Float.TYPE) {
-      out.writeByte(FLOAT_TYPE);
+      out.writeByte(DSCODE.FLOAT_TYPE.toByte());
     } else if (c == Double.TYPE) {
-      out.writeByte(DOUBLE_TYPE);
+      out.writeByte(DSCODE.DOUBLE_TYPE.toByte());
     } else if (c == Void.TYPE) {
-      out.writeByte(VOID_TYPE);
+      out.writeByte(DSCODE.VOID_TYPE.toByte());
     } else if (c == null) {
-      out.writeByte(NULL);
+      out.writeByte(DSCODE.NULL.toByte());
     } else {
       throw new InternalGemFireError(
           LocalizedStrings.InternalDataSerializer_UNKNOWN_PRIMITIVE_TYPE_0
@@ -1983,31 +1983,38 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
   }
 
   public static Class decodePrimitiveClass(byte typeCode) {
-    switch (typeCode) {
-      case BOOLEAN_TYPE:
-        return Boolean.TYPE;
-      case CHARACTER_TYPE:
-        return Character.TYPE;
-      case BYTE_TYPE:
-        return Byte.TYPE;
-      case SHORT_TYPE:
-        return Short.TYPE;
-      case INTEGER_TYPE:
-        return Integer.TYPE;
-      case LONG_TYPE:
-        return Long.TYPE;
-      case FLOAT_TYPE:
-        return Float.TYPE;
-      case DOUBLE_TYPE:
-        return Double.TYPE;
-      case VOID_TYPE:
-        return Void.TYPE;
-      case NULL:
-        return null;
-      default:
-        throw new InternalGemFireError(LocalizedStrings.InternalDataSerializer_UNEXPECTED_TYPECODE_0
-            .toLocalizedString(typeCode));
+    if (typeCode == DSCODE.BOOLEAN_TYPE.toByte()) {
+      return Boolean.TYPE;
+    }
+    if (typeCode == DSCODE.CHARACTER_TYPE.toByte()) {
+      return Character.TYPE;
+    }
+    if (typeCode == DSCODE.BYTE_TYPE.toByte()) {
+      return Byte.TYPE;
+    }
+    if (typeCode == DSCODE.SHORT_TYPE.toByte()) {
+      return Short.TYPE;
+    }
+    if (typeCode == DSCODE.INTEGER_TYPE.toByte()) {
+      return Integer.TYPE;
+    }
+    if (typeCode == DSCODE.LONG_TYPE.toByte()) {
+      return Long.TYPE;
+    }
+    if (typeCode == DSCODE.FLOAT_TYPE.toByte()) {
+      return Float.TYPE;
     }
+    if (typeCode == DSCODE.DOUBLE_TYPE.toByte()) {
+      return Double.TYPE;
+    }
+    if (typeCode == DSCODE.VOID_TYPE.toByte()) {
+      return Void.TYPE;
+    }
+    if (typeCode == DSCODE.NULL.toByte()) {
+      return null;
+    }
+    throw new InternalGemFireError(
+        LocalizedStrings.InternalDataSerializer_UNEXPECTED_TYPECODE_0.toLocalizedString(typeCode));
   }
 
   private static final byte TIME_UNIT_NANOSECONDS = -1;
@@ -2133,13 +2140,13 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
   public static void writeUserDataSerializableHeader(int classId, DataOutput out)
       throws IOException {
     if (classId <= Byte.MAX_VALUE && classId >= Byte.MIN_VALUE) {
-      out.writeByte(USER_DATA_SERIALIZABLE);
+      out.writeByte(DSCODE.USER_DATA_SERIALIZABLE.toByte());
       out.writeByte(classId);
     } else if (classId <= Short.MAX_VALUE && classId >= Short.MIN_VALUE) {
-      out.writeByte(USER_DATA_SERIALIZABLE_2);
+      out.writeByte(DSCODE.USER_DATA_SERIALIZABLE_2.toByte());
       out.writeShort(classId);
     } else {
-      out.writeByte(USER_DATA_SERIALIZABLE_4);
+      out.writeByte(DSCODE.USER_DATA_SERIALIZABLE_4.toByte());
       out.writeInt(classId);
     }
   }
@@ -2175,7 +2182,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
    * @param serializedForm the serialized byte array
    */
   public static boolean isSerializedNull(byte[] serializedForm) {
-    return serializedForm.length == 1 && serializedForm[0] == NULL;
+    return serializedForm.length == 1 && serializedForm[0] == DSCODE.NULL.toByte();
   }
 
   public static void basicWriteObject(Object o, DataOutput out, boolean ensurePdxCompatibility)
@@ -2189,7 +2196,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
 
     // Handle special objects first
     if (o == null) {
-      out.writeByte(NULL);
+      out.writeByte(DSCODE.NULL.toByte());
 
     } else if (o instanceof DataSerializableFixedID) {
       checkPdxCompatible(o, ensurePdxCompatibility);
@@ -2218,7 +2225,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       if (classId != 0) {
         writeUserDataSerializableHeader(classId, out);
       } else {
-        out.writeByte(DATA_SERIALIZABLE);
+        out.writeByte(DSCODE.DATA_SERIALIZABLE.toByte());
         DataSerializer.writeClass(c, out);
       }
       DataSerializable ds = (DataSerializable) o;
@@ -2274,7 +2281,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
   }
 
   public static void writePdxEnumId(int eId, DataOutput out) throws IOException {
-    out.writeByte(PDX_ENUM);
+    out.writeByte(DSCODE.PDX_ENUM.toByte());
     out.writeByte(eId >> 24);
     writeArrayLength(eId & 0xFFFFFF, out);
   }
@@ -2302,7 +2309,8 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
 
   private static void writeGemFireEnum(Enum<?> e, DataOutput out) throws IOException {
     boolean isGemFireObject = isGemfireObject(e);
-    DataSerializer.writePrimitiveByte(isGemFireObject ? GEMFIRE_ENUM : PDX_INLINE_ENUM, out);
+    DataSerializer.writePrimitiveByte(
+        isGemFireObject ? DSCODE.GEMFIRE_ENUM.toByte() : DSCODE.PDX_INLINE_ENUM.toByte(), out);
     DataSerializer.writeString(e.getDeclaringClass().getName(), out);
     DataSerializer.writeString(e.name(), out);
     if (!isGemFireObject) {
@@ -2342,7 +2350,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
    * @param out the data output to serialize to
    */
   public static void writeSerializableObject(Object o, DataOutput out) throws IOException {
-    out.writeByte(SERIALIZABLE);
+    out.writeByte(DSCODE.SERIALIZABLE.toByte());
     if (out instanceof ObjectOutputStream) {
       ((ObjectOutputStream) out).writeObject(o);
     } else {
@@ -2699,13 +2707,13 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
     if (logger.isTraceEnabled(LogMarker.SERIALIZER_VERBOSE)) {
       logger.trace(LogMarker.SERIALIZER_VERBOSE, "readDSFID: header={}", header);
     }
-    if (header == DS_FIXED_ID_BYTE) {
+    if (header == DSCODE.DS_FIXED_ID_BYTE.toByte()) {
       return DSFIDFactory.create(in.readByte(), in);
-    } else if (header == DS_FIXED_ID_SHORT) {
+    } else if (header == DSCODE.DS_FIXED_ID_SHORT.toByte()) {
       return DSFIDFactory.create(in.readShort(), in);
-    } else if (header == DS_NO_FIXED_ID) {
+    } else if (header == DSCODE.DS_NO_FIXED_ID.toByte()) {
       return readDataSerializableFixedID(in);
-    } else if (header == DS_FIXED_ID_INT) {
+    } else if (header == DSCODE.DS_FIXED_ID_INT.toByte()) {
       return DSFIDFactory.create(in.readInt(), in);
     } else {
       throw new IllegalStateException("unexpected byte: " + header + " while reading dsfid");
@@ -2715,14 +2723,14 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
   public static int readDSFIDHeader(final DataInput in) throws IOException {
     checkIn(in);
     byte header = in.readByte();
-    if (header == DS_FIXED_ID_BYTE) {
+    if (header == DSCODE.DS_FIXED_ID_BYTE.toByte()) {
       return in.readByte();
-    } else if (header == DS_FIXED_ID_SHORT) {
+    } else if (header == DSCODE.DS_FIXED_ID_SHORT.toByte()) {
       return in.readShort();
-    } else if (header == DS_NO_FIXED_ID) {
+    } else if (header == DSCODE.DS_NO_FIXED_ID.toByte()) {
       // is that correct??
       return Integer.MAX_VALUE;
-    } else if (header == DS_FIXED_ID_INT) {
+    } else if (header == DSCODE.DS_FIXED_ID_INT.toByte()) {
       return in.readInt();
     } else {
       throw new IllegalStateException("unexpected byte: " + header + " while reading dsfid");
@@ -2738,7 +2746,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
    * @since GemFire 5.7
    */
   public static String readString(DataInput in, byte header) throws IOException {
-    if (header == DSCODE.STRING_BYTES) {
+    if (header == DSCODE.STRING_BYTES.toByte()) {
       int len = in.readUnsignedShort();
       if (logger.isTraceEnabled(LogMarker.SERIALIZER_VERBOSE)) {
         logger.trace(LogMarker.SERIALIZER_VERBOSE, "Reading STRING_BYTES of len={}", len);
@@ -2746,17 +2754,17 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       byte[] buf = new byte[len];
       in.readFully(buf, 0, len);
       return new String(buf, 0); // intentionally using deprecated constructor
-    } else if (header == DSCODE.STRING) {
+    } else if (header == DSCODE.STRING.toByte()) {
       if (logger.isTraceEnabled(LogMarker.SERIALIZER_VERBOSE)) {
         logger.trace(LogMarker.SERIALIZER_VERBOSE, "Reading utf STRING");
       }
       return in.readUTF();
-    } else if (header == DSCODE.NULL_STRING) {
+    } else if (header == DSCODE.NULL_STRING.toByte()) {
       if (logger.isTraceEnabled(LogMarker.SERIALIZER_VERBOSE)) {
         logger.trace(LogMarker.SERIALIZER_VERBOSE, "Reading NULL_STRING");
       }
       return null;
-    } else if (header == DSCODE.HUGE_STRING_BYTES) {
+    } else if (header == DSCODE.HUGE_STRING_BYTES.toByte()) {
       int len = in.readInt();
       if (logger.isTraceEnabled(LogMarker.SERIALIZER_VERBOSE)) {
         logger.trace(LogMarker.SERIALIZER_VERBOSE, "Reading HUGE_STRING_BYTES of len={}", len);
@@ -2764,7 +2772,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
       byte[] buf = new byte[len];
       in.readFully(buf, 0, len);
       return new String(buf, 0); // intentionally using deprecated constructor
-    } else if (header == DSCODE.HUGE_STRING) {
+    } else if (header == DSCODE.HUGE_STRING.toByte()) {
       int len = in.readInt();
       if (logger.isTraceEnabled(LogMarker.SERIALIZER_VERBOSE)) {
         logger.trace(LogMarker.SERIALIZER_VERBOSE, "Reading HUGE_STRING of len={}", len);
@@ -2816,198 +2824,257 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
     if (logger.isTraceEnabled(LogMarker.SERIALIZER_VERBOSE)) {
       logger.trace(LogMarker.SERIALIZER_VERBOSE, "basicReadObject: header={}", header);
     }
-    switch (header) {
-      case DS_FIXED_ID_BYTE:
-        return DSFIDFactory.create(in.readByte(), in);
-      case DS_FIXED_ID_SHORT:
-        return DSFIDFactory.create(in.readShort(), in);
-      case DS_FIXED_ID_INT:
-        return DSFIDFactory.create(in.readInt(), in);
-      case DS_NO_FIXED_ID:
-        return readDataSerializableFixedID(in);
-      case NULL:
-        return null;
-      case NULL_STRING:
-      case STRING:
-      case HUGE_STRING:
-      case STRING_BYTES:
-      case HUGE_STRING_BYTES:
-        return readString(in, header);
-      case CLASS:
-        return readClass(in);
-      case DATE:
-        return readDate(in);
-      case FILE:
-        return readFile(in);
-      case INET_ADDRESS:
-        return readInetAddress(in);
-      case BOOLEAN:
-        return readBoolean(in);
-      case CHARACTER:
-        return readCharacter(in);
-      case BYTE:
-        return readByte(in);
-      case SHORT:
-        return readShort(in);
-      case INTEGER:
-        return readInteger(in);
-      case LONG:
-        return readLong(in);
-      case FLOAT:
-        return readFloat(in);
-      case DOUBLE:
-        return readDouble(in);
-      case BYTE_ARRAY:
-        return readByteArray(in);
-      case ARRAY_OF_BYTE_ARRAYS:
-        return readArrayOfByteArrays(in);
-      case SHORT_ARRAY:
-        return readShortArray(in);
-      case STRING_ARRAY:
-        return readStringArray(in);
-      case INT_ARRAY:
-        return readIntArray(in);
-      case LONG_ARRAY:
-        return readLongArray(in);
-      case FLOAT_ARRAY:
-        return readFloatArray(in);
-      case DOUBLE_ARRAY:
-        return readDoubleArray(in);
-      case BOOLEAN_ARRAY:
-        return readBooleanArray(in);
-      case CHAR_ARRAY:
-        return readCharArray(in);
-      case OBJECT_ARRAY:
-        return readObjectArray(in);
-      case ARRAY_LIST:
-        return readArrayList(in);
-      case LINKED_LIST:
-        return readLinkedList(in);
-      case HASH_SET:
-        return readHashSet(in);
-      case LINKED_HASH_SET:
-        return readLinkedHashSet(in);
-      case HASH_MAP:
-        return readHashMap(in);
-      case IDENTITY_HASH_MAP:
-        return readIdentityHashMap(in);
-      case HASH_TABLE:
-        return readHashtable(in);
-      case CONCURRENT_HASH_MAP:
-        return readConcurrentHashMap(in);
-      case PROPERTIES:
-        return readProperties(in);
-      case TIME_UNIT:
-        return readTimeUnit(in);
-      case USER_CLASS:
-        return readUserObject(in, in.readByte());
-      case USER_CLASS_2:
-        return readUserObject(in, in.readShort());
-      case USER_CLASS_4:
-        return readUserObject(in, in.readInt());
-      case VECTOR:
-        return readVector(in);
-      case STACK:
-        return readStack(in);
-      case TREE_MAP:
-        return readTreeMap(in);
-      case TREE_SET:
-        return readTreeSet(in);
-      case BOOLEAN_TYPE:
-        return Boolean.TYPE;
-      case CHARACTER_TYPE:
-        return Character.TYPE;
-      case BYTE_TYPE:
-        return Byte.TYPE;
-      case SHORT_TYPE:
-        return Short.TYPE;
-      case INTEGER_TYPE:
-        return Integer.TYPE;
-      case LONG_TYPE:
-        return Long.TYPE;
-      case FLOAT_TYPE:
-        return Float.TYPE;
-      case DOUBLE_TYPE:
-        return Double.TYPE;
-      case VOID_TYPE:
-        return Void.TYPE;
-
-      case USER_DATA_SERIALIZABLE:
-        return readUserDataSerializable(in, in.readByte());
-      case USER_DATA_SERIALIZABLE_2:
-        return readUserDataSerializable(in, in.readShort());
-      case USER_DATA_SERIALIZABLE_4:
-        return readUserDataSerializable(in, in.readInt());
-
-      case DATA_SERIALIZABLE:
-        return readDataSerializable(in);
-
-      case SERIALIZABLE: {
-        final boolean isDebugEnabled_SERIALIZER =
-            logger.isTraceEnabled(LogMarker.SERIALIZER_VERBOSE);
-        Object serializableResult;
-        if (in instanceof DSObjectInputStream) {
-          serializableResult = ((DSObjectInputStream) in).readObject();
+    if (header == DSCODE.DS_FIXED_ID_BYTE.toByte()) {
+      return DSFIDFactory.create(in.readByte(), in);
+    }
+    if (header == DSCODE.DS_FIXED_ID_SHORT.toByte()) {
+      return DSFIDFactory.create(in.readShort(), in);
+    }
+    if (header == DSCODE.DS_FIXED_ID_INT.toByte()) {
+      return DSFIDFactory.create(in.readInt(), in);
+    }
+    if (header == DSCODE.DS_NO_FIXED_ID.toByte()) {
+      return readDataSerializableFixedID(in);
+    }
+    if (header == DSCODE.NULL.toByte()) {
+      return null;
+    }
+    if (header == DSCODE.NULL_STRING.toByte() || header == DSCODE.STRING.toByte()
+        || header == DSCODE.HUGE_STRING.toByte() || header == DSCODE.STRING_BYTES.toByte()
+        || header == DSCODE.HUGE_STRING_BYTES.toByte()) {
+      return readString(in, header);
+    }
+    if (header == DSCODE.CLASS.toByte()) {
+      return readClass(in);
+    }
+    if (header == DSCODE.DATE.toByte()) {
+      return readDate(in);
+    }
+    if (header == DSCODE.FILE.toByte()) {
+      return readFile(in);
+    }
+    if (header == DSCODE.INET_ADDRESS.toByte()) {
+      return readInetAddress(in);
+    }
+    if (header == DSCODE.BOOLEAN.toByte()) {
+      return readBoolean(in);
+    }
+    if (header == DSCODE.CHARACTER.toByte()) {
+      return readCharacter(in);
+    }
+    if (header == DSCODE.BYTE.toByte()) {
+      return readByte(in);
+    }
+    if (header == DSCODE.SHORT.toByte()) {
+      return readShort(in);
+    }
+    if (header == DSCODE.INTEGER.toByte()) {
+      return readInteger(in);
+    }
+    if (header == DSCODE.LONG.toByte()) {
+      return readLong(in);
+    }
+    if (header == DSCODE.FLOAT.toByte()) {
+      return readFloat(in);
+    }
+    if (header == DSCODE.DOUBLE.toByte()) {
+      return readDouble(in);
+    }
+    if (header == DSCODE.BYTE_ARRAY.toByte()) {
+      return readByteArray(in);
+    }
+    if (header == DSCODE.ARRAY_OF_BYTE_ARRAYS.toByte()) {
+      return readArrayOfByteArrays(in);
+    }
+    if (header == DSCODE.SHORT_ARRAY.toByte()) {
+      return readShortArray(in);
+    }
+    if (header == DSCODE.STRING_ARRAY.toByte()) {
+      return readStringArray(in);
+    }
+    if (header == DSCODE.INT_ARRAY.toByte()) {
+      return readIntArray(in);
+    }
+    if (header == DSCODE.LONG_ARRAY.toByte()) {
+      return readLongArray(in);
+    }
+    if (header == DSCODE.FLOAT_ARRAY.toByte()) {
+      return readFloatArray(in);
+    }
+    if (header == DSCODE.DOUBLE_ARRAY.toByte()) {
+      return readDoubleArray(in);
+    }
+    if (header == DSCODE.BOOLEAN_ARRAY.toByte()) {
+      return readBooleanArray(in);
+    }
+    if (header == DSCODE.CHAR_ARRAY.toByte()) {
+      return readCharArray(in);
+    }
+    if (header == DSCODE.OBJECT_ARRAY.toByte()) {
+      return readObjectArray(in);
+    }
+    if (header == DSCODE.ARRAY_LIST.toByte()) {
+      return readArrayList(in);
+    }
+    if (header == DSCODE.LINKED_LIST.toByte()) {
+      return readLinkedList(in);
+    }
+    if (header == DSCODE.HASH_SET.toByte()) {
+      return readHashSet(in);
+    }
+    if (header == DSCODE.LINKED_HASH_SET.toByte()) {
+      return readLinkedHashSet(in);
+    }
+    if (header == DSCODE.HASH_MAP.toByte()) {
+      return readHashMap(in);
+    }
+    if (header == DSCODE.IDENTITY_HASH_MAP.toByte()) {
+      return readIdentityHashMap(in);
+    }
+    if (header == DSCODE.HASH_TABLE.toByte()) {
+      return readHashtable(in);
+    }
+    if (header == DSCODE.CONCURRENT_HASH_MAP.toByte()) {
+      return readConcurrentHashMap(in);
+    }
+    if (header == DSCODE.PROPERTIES.toByte()) {
+      return readProperties(in);
+    }
+    if (header == DSCODE.TIME_UNIT.toByte()) {
+      return readTimeUnit(in);
+    }
+    if (header == DSCODE.USER_CLASS.toByte()) {
+      return readUserObject(in, in.readByte());
+    }
+    if (header == DSCODE.USER_CLASS_2.toByte()) {
+      return readUserObject(in, in.readShort());
+    }
+    if (header == DSCODE.USER_CLASS_4.toByte()) {
+      return readUserObject(in, in.readInt());
+    }
+    if (header == DSCODE.VECTOR.toByte()) {
+      return readVector(in);
+    }
+    if (header == DSCODE.STACK.toByte()) {
+      return readStack(in);
+    }
+    if (header == DSCODE.TREE_MAP.toByte()) {
+      return readTreeMap(in);
+    }
+    if (header == DSCODE.TREE_SET.toByte()) {
+      return readTreeSet(in);
+    }
+    if (header == DSCODE.BOOLEAN_TYPE.toByte()) {
+      return Boolean.TYPE;
+    }
+    if (header == DSCODE.CHARACTER_TYPE.toByte()) {
+      return Character.TYPE;
+    }
+    if (header == DSCODE.BYTE_TYPE.toByte()) {
+      return Byte.TYPE;
+    }
+    if (header == DSCODE.SHORT_TYPE.toByte()) {
+      return Short.TYPE;
+    }
+    if (header == DSCODE.INTEGER_TYPE.toByte()) {
+      return Integer.TYPE;
+    }
+    if (header == DSCODE.LONG_TYPE.toByte()) {
+      return Long.TYPE;
+    }
+    if (header == DSCODE.FLOAT_TYPE.toByte()) {
+      return Float.TYPE;
+    }
+    if (header == DSCODE.DOUBLE_TYPE.toByte()) {
+      return Double.TYPE;
+    }
+    if (header == DSCODE.VOID_TYPE.toByte()) {
+      return Void.TYPE;
+    }
+    if (header == DSCODE.USER_DATA_SERIALIZABLE.toByte()) {
+      return readUserDataSerializable(in, in.readByte());
+    }
+    if (header == DSCODE.USER_DATA_SERIALIZABLE_2.toByte()) {
+      return readUserDataSerializable(in, in.readShort());
+    }
+    if (header == DSCODE.USER_DATA_SERIALIZABLE_4.toByte()) {
+      return readUserDataSerializable(in, in.readInt());
+    }
+    if (header == DSCODE.DATA_SERIALIZABLE.toByte()) {
+      return readDataSerializable(in);
+    }
+    if (header == DSCODE.SERIALIZABLE.toByte()) {
+      final boolean isDebugEnabled_SERIALIZER = logger.isTraceEnabled(LogMarker.SERIALIZER_VERBOSE);
+      Object serializableResult;
+      if (in instanceof DSObjectInputStream) {
+        serializableResult = ((DSObjectInputStream) in).readObject();
+      } else {
+        InputStream stream;
+        if (in instanceof InputStream) {
+          stream = (InputStream) in;
         } else {
-          InputStream stream;
-          if (in instanceof InputStream) {
-            stream = (InputStream) in;
-          } else {
-            stream = new InputStream() {
-              @Override
-              public int read() throws IOException {
-                try {
-                  return in.readUnsignedByte(); // fix for bug 47249
-                } catch (EOFException ignored) {
-                  return -1;
-                }
+          stream = new InputStream() {
+            @Override
+            public int read() throws IOException {
+              try {
+                return in.readUnsignedByte(); // fix for bug 47249
+              } catch (EOFException ignored) {
+                return -1;
               }
-
-            };
-          }
-
-          ObjectInput ois = new DSObjectInputStream(stream);
-          serializationFilter.setFilterOn((ObjectInputStream) ois);
-          if (stream instanceof VersionedDataStream) {
-            Version v = ((VersionedDataStream) stream).getVersion();
-            if (v != null && v != Version.CURRENT) {
-              ois = new VersionedObjectInput(ois, v);
             }
-          }
 
-          serializableResult = ois.readObject();
+          };
+        }
 
-          if (isDebugEnabled_SERIALIZER) {
-            logger.trace(LogMarker.SERIALIZER_VERBOSE, "Read Serializable object: {}",
-                serializableResult);
+        ObjectInput ois = new DSObjectInputStream(stream);
+        serializationFilter.setFilterOn((ObjectInputStream) ois);
+        if (stream instanceof VersionedDataStream) {
+          Version v = ((VersionedDataStream) stream).getVersion();
+          if (v != null && v != Version.CURRENT) {
+            ois = new VersionedObjectInput(ois, v);
           }
         }
+
+        serializableResult = ois.readObject();
+
         if (isDebugEnabled_SERIALIZER) {
-          logger.trace(LogMarker.SERIALIZER_VERBOSE, "deserialized instanceof {}",
-              serializableResult.getClass());
+          logger.trace(LogMarker.SERIALIZER_VERBOSE, "Read Serializable object: {}",
+              serializableResult);
         }
-        return serializableResult;
-      }
-      case PDX:
-        return readPdxSerializable(in);
-      case PDX_ENUM:
-        return readPdxEnum(in);
-      case GEMFIRE_ENUM:
-        return readGemFireEnum(in);
-      case PDX_INLINE_ENUM:
-        return readPdxInlineEnum(in);
-      case BIG_INTEGER:
-        return readBigInteger(in);
-      case BIG_DECIMAL:
-        return readBigDecimal(in);
-      case UUID:
-        return readUUID(in);
-      case TIMESTAMP:
-        return readTimestamp(in);
-      default:
-        String s = "Unknown header byte: " + header;
-        throw new IOException(s);
+      }
+      if (isDebugEnabled_SERIALIZER) {
+        logger.trace(LogMarker.SERIALIZER_VERBOSE, "deserialized instanceof {}",
+            serializableResult.getClass());
+      }
+      return serializableResult;
+    }
+    if (header == DSCODE.PDX.toByte()) {
+      return readPdxSerializable(in);
+    }
+    if (header == DSCODE.PDX_ENUM.toByte()) {
+      return readPdxEnum(in);
+    }
+    if (header == DSCODE.GEMFIRE_ENUM.toByte()) {
+      return readGemFireEnum(in);
     }
+    if (header == DSCODE.PDX_INLINE_ENUM.toByte()) {
+      return readPdxInlineEnum(in);
+    }
+    if (header == DSCODE.BIG_INTEGER.toByte()) {
+      return readBigInteger(in);
+    }
+    if (header == DSCODE.BIG_DECIMAL.toByte()) {
+      return readBigDecimal(in);
+    }
+    if (header == DSCODE.UUID.toByte()) {
+      return readUUID(in);
+    }
+    if (header == DSCODE.TIMESTAMP.toByte()) {
+      return readTimestamp(in);
+    }
+
+    String s = "Unknown header byte: " + header;
+    throw new IOException(s);
   }
 
   private static Object readUserDataSerializable(final DataInput in, int classId)
@@ -3195,7 +3262,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
   public static PdxInstance readPdxInstance(final byte[] dataBytes, InternalCache internalCache) {
     try {
       byte type = dataBytes[0];
-      if (type == PDX) {
+      if (type == DSCODE.PDX.toByte()) {
         PdxInputStream in = new PdxInputStream(dataBytes);
         in.readByte(); // throw away the type byte
         int len = in.readInt();
@@ -3206,7 +3273,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
         }
 
         return new PdxInstanceImpl(pdxType, in, len);
-      } else if (type == DSCODE.PDX_ENUM) {
+      } else if (type == DSCODE.PDX_ENUM.toByte()) {
         PdxInputStream in = new PdxInputStream(dataBytes);
         in.readByte(); // throw away the type byte
         int dsId = in.readByte();
@@ -3218,7 +3285,7 @@ public abstract class InternalDataSerializer extends DataSerializer implements D
           throw new IllegalStateException("Unknown pdx enum id=" + enumId);
         }
         return ei.getPdxInstance(enumId);
-      } else if (type == DSCODE.PDX_INLINE_ENUM) {
+      } else if (type == DSCODE.PDX_INLINE_ENUM.toByte()) {
         PdxInputStream in = new PdxInputStream(dataBytes);
         in.readByte(); // throw away the type byte
         String className = DataSerializer.readString(in);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheDistributionAdvisor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheDistributionAdvisor.java
index d190e8c..ed52f28 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/CacheDistributionAdvisor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/CacheDistributionAdvisor.java
@@ -845,7 +845,7 @@ public class CacheDistributionAdvisor extends DistributionAdvisor {
 
     private void writeSet(Set<?> set, DataOutput out) throws IOException {
       // to fix bug 47205 always serialize the Set as a HashSet.
-      out.writeByte(DSCODE.HASH_SET);
+      out.writeByte(DSCODE.HASH_SET.toByte());
       InternalDataSerializer.writeSet(set, out);
     }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/CachedDeserializableFactory.java b/geode-core/src/main/java/org/apache/geode/internal/cache/CachedDeserializableFactory.java
index 5d3cf27..b3202c8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/CachedDeserializableFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/CachedDeserializableFactory.java
@@ -59,7 +59,7 @@ public class CachedDeserializableFactory {
   private static boolean isPdxEncoded(byte[] v) {
     // assert v != null;
     if (v.length > 0) {
-      return v[0] == DSCODE.PDX;
+      return v[0] == DSCODE.PDX.toByte();
     }
     return false;
   }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index 9ec44f1..f8140ce 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -5376,7 +5376,7 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
   public void registerPdxMetaData(Object instance) {
     try {
       byte[] blob = BlobHelper.serializeToBlob(instance);
-      if (blob.length == 0 || blob[0] != DSCODE.PDX) {
+      if (blob.length == 0 || blob[0] != DSCODE.PDX.toByte()) {
         throw new SerializationException("The instance is not PDX serializable");
       }
     } catch (IOException e) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/Token.java b/geode-core/src/main/java/org/apache/geode/internal/cache/Token.java
index 9fa5759..88e85c1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/Token.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/Token.java
@@ -141,7 +141,7 @@ public abstract class Token {
 
     public boolean isSerializedValue(byte[] value) {
       ByteBuffer buf = ByteBuffer.wrap(value);
-      return buf.capacity() == 3 && buf.get() == DSCODE.DS_FIXED_ID_SHORT
+      return buf.capacity() == 3 && buf.get() == DSCODE.DS_FIXED_ID_SHORT.toByte()
           && buf.getShort() == getDSFID();
     }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java
index 4b65d8c..19e03c6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/snapshot/RegionSnapshotServiceImpl.java
@@ -261,7 +261,7 @@ public class RegionSnapshotServiceImpl<K, V> implements RegionSnapshotService<K,
           // If the underlying object is a byte[], we can't wrap it in a
           // CachedDeserializable. Somewhere along the line the header bytes
           // get lost and we start seeing serialization problems.
-          if (data.length > 0 && data[0] == DSCODE.BYTE_ARRAY) {
+          if (data.length > 0 && data[0] == DSCODE.BYTE_ARRAY.toByte()) {
             // It would be faster to use System.arraycopy() directly but since
             // length field is variable it's probably safest and simplest to
             // keep the logic in the InternalDataSerializer.
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ChunkedMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ChunkedMessage.java
index b12b8b8..753fcc1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ChunkedMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ChunkedMessage.java
@@ -282,7 +282,7 @@ public class ChunkedMessage extends Message {
   public void sendHeader() throws IOException {
     if (this.socket != null) {
       synchronized (getCommBuffer()) {
-        getHeaderBytesForWrite();
+        getDSCODEsForWrite();
         flushBuffer();
         // Darrel says: I see no need for the following os.flush() call
         // so I've deadcoded it for performance.
@@ -353,7 +353,7 @@ public class ChunkedMessage extends Message {
   /**
    * Converts the header of this message into a <code>byte</code> array using a {@link ByteBuffer}.
    */
-  protected void getHeaderBytesForWrite() {
+  protected void getDSCODEsForWrite() {
     final ByteBuffer cb = getCommBuffer();
     cb.clear();
     cb.putInt(this.messageType);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientUpdateMessageImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientUpdateMessageImpl.java
index 11ad04f..5b94a15 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientUpdateMessageImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientUpdateMessageImpl.java
@@ -1475,7 +1475,7 @@ public class ClientUpdateMessageImpl implements ClientUpdateMessage, Sizeable, N
     @Override
     public void sendTo(DataOutput out) throws IOException {
       // When serialized it needs to look just as if writeObject was called on a HASH_MAP
-      out.writeByte(DSCODE.HASH_MAP);
+      out.writeByte(DSCODE.HASH_MAP.toByte());
       int size = size();
       InternalDataSerializer.writeArrayLength(size, out);
       if (size > 0) {
@@ -1547,7 +1547,7 @@ public class ClientUpdateMessageImpl implements ClientUpdateMessage, Sizeable, N
     @Override
     public void sendTo(DataOutput out) throws IOException {
       // When serialized it needs to look just as if writeObject was called on a HASH_MAP
-      out.writeByte(DSCODE.HASH_MAP);
+      out.writeByte(DSCODE.HASH_MAP.toByte());
       DataSerializer.writeHashMap(this, out);
     }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HAEventWrapper.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HAEventWrapper.java
index fc69216..1977c9e 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HAEventWrapper.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/HAEventWrapper.java
@@ -331,7 +331,7 @@ public class HAEventWrapper implements Conflatable, DataSerializableFixedID, Siz
               CqNameToOp value;
               {
                 byte typeByte = in.readByte();
-                if (typeByte == DSCODE.HASH_MAP) {
+                if (typeByte == DSCODE.HASH_MAP.toByte()) {
                   int cqNamesSize = InternalDataSerializer.readArrayLength(in);
                   if (cqNamesSize == -1) {
                     throw new IllegalStateException(
@@ -350,7 +350,7 @@ public class HAEventWrapper implements Conflatable, DataSerializableFixedID, Siz
                       value.add(cqNamesKey, cqNamesValue);
                     }
                   }
-                } else if (typeByte == DSCODE.NULL) {
+                } else if (typeByte == DSCODE.NULL.toByte()) {
                   throw new IllegalStateException(
                       "The value of a ConcurrentHashMap is not allowed to be null.");
                 } else {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/Part.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/Part.java
index d701f2e..9606e6f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/Part.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/Part.java
@@ -85,7 +85,7 @@ public class Part {
     }
     if (isObject() && this.part instanceof byte[]) {
       byte[] b = (byte[]) this.part;
-      if (b.length == 1 && b[0] == DSCODE.NULL) {
+      if (b.length == 1 && b[0] == DSCODE.NULL.toByte()) {
         return true;
       }
     }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/offheap/AbstractStoredObject.java b/geode-core/src/main/java/org/apache/geode/internal/offheap/AbstractStoredObject.java
index 7d22b21..028e431 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/offheap/AbstractStoredObject.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/offheap/AbstractStoredObject.java
@@ -117,7 +117,8 @@ public abstract class AbstractStoredObject implements StoredObject {
       return false;
     }
     byte dsCode = this.readDataByte(0);
-    return dsCode == DSCODE.PDX || dsCode == DSCODE.PDX_ENUM || dsCode == DSCODE.PDX_INLINE_ENUM;
+    return dsCode == DSCODE.PDX.toByte() || dsCode == DSCODE.PDX_ENUM.toByte()
+        || dsCode == DSCODE.PDX_INLINE_ENUM.toByte();
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/internal/offheap/DataType.java b/geode-core/src/main/java/org/apache/geode/internal/offheap/DataType.java
index 8513d23..35183a5 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/offheap/DataType.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/offheap/DataType.java
@@ -32,7 +32,7 @@ import org.apache.geode.internal.InternalInstantiator;
  *
  * @since Geode 1.0
  */
-public class DataType implements DSCODE {
+public class DataType {
 
   public static String getDataType(byte[] bytes) {
     final DataInput in = getDataInput(bytes);
@@ -43,182 +43,233 @@ public class DataType implements DSCODE {
       return "IOException: " + e.getMessage();
     }
     try {
-      switch (header) {
-        case DS_FIXED_ID_BYTE: {
-          return "org.apache.geode.internal.DataSerializableFixedID:"
-              + DSFIDFactory.create(in.readByte(), in).getClass().getName();
-        }
-        case DS_FIXED_ID_SHORT: {
-          return "org.apache.geode.internal.DataSerializableFixedID:"
-              + DSFIDFactory.create(in.readShort(), in).getClass().getName();
-        }
-        case DS_FIXED_ID_INT: {
-          return "org.apache.geode.internal.DataSerializableFixedID:"
-              + DSFIDFactory.create(in.readInt(), in).getClass().getName();
-        }
-        case DS_NO_FIXED_ID:
-          return "org.apache.geode.internal.DataSerializableFixedID:"
-              + DataSerializer.readClass(in).getName();
-        case NULL:
-          return "null";
-        case NULL_STRING:
-        case STRING:
-        case HUGE_STRING:
-        case STRING_BYTES:
-        case HUGE_STRING_BYTES:
-          return "java.lang.String";
-        case CLASS:
-          return "java.lang.Class";
-        case DATE:
-          return "java.util.Date";
-        case FILE:
-          return "java.io.File";
-        case INET_ADDRESS:
-          return "java.net.InetAddress";
-        case BOOLEAN:
-          return "java.lang.Boolean";
-        case CHARACTER:
-          return "java.lang.Character";
-        case BYTE:
-          return "java.lang.Byte";
-        case SHORT:
-          return "java.lang.Short";
-        case INTEGER:
-          return "java.lang.Integer";
-        case LONG:
-          return "java.lang.Long";
-        case FLOAT:
-          return "java.lang.Float";
-        case DOUBLE:
-          return "java.lang.Double";
-        case BYTE_ARRAY:
-          return "byte[]";
-        case ARRAY_OF_BYTE_ARRAYS:
-          return "byte[][]";
-        case SHORT_ARRAY:
-          return "short[]";
-        case STRING_ARRAY:
-          return "java.lang.String[]";
-        case INT_ARRAY:
-          return "int[]";
-        case LONG_ARRAY:
-          return "long[]";
-        case FLOAT_ARRAY:
-          return "float[]";
-        case DOUBLE_ARRAY:
-          return "double[]";
-        case BOOLEAN_ARRAY:
-          return "boolean[]";
-        case CHAR_ARRAY:
-          return "char[]";
-        case OBJECT_ARRAY:
-          return "java.lang.Object[]";
-        case ARRAY_LIST:
-          return "java.util.ArrayList";
-        case LINKED_LIST:
-          return "java.util.LinkedList";
-        case HASH_SET:
-          return "java.util.HashSet";
-        case LINKED_HASH_SET:
-          return "java.util.LinkedHashSet";
-        case HASH_MAP:
-          return "java.util.HashMap";
-        case IDENTITY_HASH_MAP:
-          return "java.util.IdentityHashMap";
-        case HASH_TABLE:
-          return "java.util.Hashtable";
-        // ConcurrentHashMap is written as java.io.serializable
-        // case CONCURRENT_HASH_MAP:
-        // return "java.util.concurrent.ConcurrentHashMap";
-        case PROPERTIES:
-          return "java.util.Properties";
-        case TIME_UNIT:
-          return "java.util.concurrent.TimeUnit";
-        case USER_CLASS:
-          byte userClassDSId = in.readByte();
-          return "DataSerializer: with Id:" + userClassDSId;
-        case USER_CLASS_2:
-          short userClass2DSId = in.readShort();
-          return "DataSerializer: with Id:" + userClass2DSId;
-        case USER_CLASS_4:
-          int userClass4DSId = in.readInt();
-          return "DataSerializer: with Id:" + userClass4DSId;
-        case VECTOR:
-          return "java.util.Vector";
-        case STACK:
-          return "java.util.Stack";
-        case TREE_MAP:
-          return "java.util.TreeMap";
-        case TREE_SET:
-          return "java.util.TreeSet";
-        case BOOLEAN_TYPE:
-          return "java.lang.Boolean.class";
-        case CHARACTER_TYPE:
-          return "java.lang.Character.class";
-        case BYTE_TYPE:
-          return "java.lang.Byte.class";
-        case SHORT_TYPE:
-          return "java.lang.Short.class";
-        case INTEGER_TYPE:
-          return "java.lang.Integer.class";
-        case LONG_TYPE:
-          return "java.lang.Long.class";
-        case FLOAT_TYPE:
-          return "java.lang.Float.class";
-        case DOUBLE_TYPE:
-          return "java.lang.Double.class";
-        case VOID_TYPE:
-          return "java.lang.Void.class";
-        case USER_DATA_SERIALIZABLE: {
-          Instantiator instantiator = InternalInstantiator.getInstantiator(in.readByte());
-          return "org.apache.geode.Instantiator:" + instantiator.getInstantiatedClass().getName();
-        }
-        case USER_DATA_SERIALIZABLE_2: {
-          Instantiator instantiator = InternalInstantiator.getInstantiator(in.readShort());
-          return "org.apache.geode.Instantiator:" + instantiator.getInstantiatedClass().getName();
-        }
-        case USER_DATA_SERIALIZABLE_4: {
-          Instantiator instantiator = InternalInstantiator.getInstantiator(in.readInt());
-          return "org.apache.geode.Instantiator:" + instantiator.getInstantiatedClass().getName();
-        }
-        case DATA_SERIALIZABLE:
-          return "org.apache.geode.DataSerializable:" + DataSerializer.readClass(in).getName();
-        case SERIALIZABLE: {
-          String name = null;
-          try {
-            Object obj = InternalDataSerializer.basicReadObject(getDataInput(bytes));
-            name = obj.getClass().getName();
-          } catch (ClassNotFoundException e) {
-            name = e.getMessage();
-          }
-          return "java.io.Serializable:" + name;
-        }
-        case PDX: {
-          int typeId = in.readInt();
-          return "pdxType:" + typeId;
-        }
-        case PDX_ENUM: {
-          in.readByte(); // dsId is not needed
-          int enumId = InternalDataSerializer.readArrayLength(in);
-          return "pdxEnum:" + enumId;
-        }
-        case GEMFIRE_ENUM: {
-          String name = DataSerializer.readString(in);
-          return "java.lang.Enum:" + name;
-        }
-        case PDX_INLINE_ENUM: {
-          String name = DataSerializer.readString(in);
-          return "java.lang.Enum:" + name;
+      if (header == DSCODE.DS_FIXED_ID_BYTE.toByte()) {
+        return "org.apache.geode.internal.DataSerializableFixedID:"
+            + DSFIDFactory.create(in.readByte(), in).getClass().getName();
+      }
+      if (header == DSCODE.DS_FIXED_ID_SHORT.toByte()) {
+        return "org.apache.geode.internal.DataSerializableFixedID:"
+            + DSFIDFactory.create(in.readShort(), in).getClass().getName();
+      }
+      if (header == DSCODE.DS_FIXED_ID_INT.toByte()) {
+        return "org.apache.geode.internal.DataSerializableFixedID:"
+            + DSFIDFactory.create(in.readInt(), in).getClass().getName();
+      }
+      if (header == DSCODE.DS_NO_FIXED_ID.toByte()) {
+        return "org.apache.geode.internal.DataSerializableFixedID:"
+            + DataSerializer.readClass(in).getName();
+      }
+      if (header == DSCODE.NULL.toByte()) {
+        return "null";
+      }
+      if (header == DSCODE.NULL_STRING.toByte() || header == DSCODE.STRING.toByte()
+          || header == DSCODE.HUGE_STRING.toByte() || header == DSCODE.STRING_BYTES.toByte()
+          || header == DSCODE.HUGE_STRING_BYTES.toByte()) {
+        return "java.lang.String";
+      }
+      if (header == DSCODE.CLASS.toByte()) {
+        return "java.lang.Class";
+      }
+      if (header == DSCODE.DATE.toByte()) {
+        return "java.util.Date";
+      }
+      if (header == DSCODE.FILE.toByte()) {
+        return "java.io.File";
+      }
+      if (header == DSCODE.INET_ADDRESS.toByte()) {
+        return "java.net.InetAddress";
+      }
+      if (header == DSCODE.BOOLEAN.toByte()) {
+        return "java.lang.Boolean";
+      }
+      if (header == DSCODE.CHARACTER.toByte()) {
+        return "java.lang.Character";
+      }
+      if (header == DSCODE.BYTE.toByte()) {
+        return "java.lang.Byte";
+      }
+      if (header == DSCODE.SHORT.toByte()) {
+        return "java.lang.Short";
+      }
+      if (header == DSCODE.INTEGER.toByte()) {
+        return "java.lang.Integer";
+      }
+      if (header == DSCODE.LONG.toByte()) {
+        return "java.lang.Long";
+      }
+      if (header == DSCODE.FLOAT.toByte()) {
+        return "java.lang.Float";
+      }
+      if (header == DSCODE.DOUBLE.toByte()) {
+        return "java.lang.Double";
+      }
+      if (header == DSCODE.BYTE_ARRAY.toByte()) {
+        return "byte[]";
+      }
+      if (header == DSCODE.ARRAY_OF_BYTE_ARRAYS.toByte()) {
+        return "byte[][]";
+      }
+      if (header == DSCODE.SHORT_ARRAY.toByte()) {
+        return "short[]";
+      }
+      if (header == DSCODE.STRING_ARRAY.toByte()) {
+        return "java.lang.String[]";
+      }
+      if (header == DSCODE.INT_ARRAY.toByte()) {
+        return "int[]";
+      }
+      if (header == DSCODE.LONG_ARRAY.toByte()) {
+        return "long[]";
+      }
+      if (header == DSCODE.FLOAT_ARRAY.toByte()) {
+        return "float[]";
+      }
+      if (header == DSCODE.DOUBLE_ARRAY.toByte()) {
+        return "double[]";
+      }
+      if (header == DSCODE.BOOLEAN_ARRAY.toByte()) {
+        return "boolean[]";
+      }
+      if (header == DSCODE.CHAR_ARRAY.toByte()) {
+        return "char[]";
+      }
+      if (header == DSCODE.OBJECT_ARRAY.toByte()) {
+        return "java.lang.Object[]";
+      }
+      if (header == DSCODE.ARRAY_LIST.toByte()) {
+        return "java.util.ArrayList";
+      }
+      if (header == DSCODE.LINKED_LIST.toByte()) {
+        return "java.util.LinkedList";
+      }
+      if (header == DSCODE.HASH_SET.toByte()) {
+        return "java.util.HashSet";
+      }
+      if (header == DSCODE.LINKED_HASH_SET.toByte()) {
+        return "java.util.LinkedHashSet";
+      }
+      if (header == DSCODE.HASH_MAP.toByte()) {
+        return "java.util.HashMap";
+      }
+      if (header == DSCODE.IDENTITY_HASH_MAP.toByte()) {
+        return "java.util.IdentityHashMap";
+      }
+      if (header == DSCODE.HASH_TABLE.toByte()) {
+        return "java.util.Hashtable";
+      }
+      // ConcurrentHashMap is written as java.io.serializable
+      // if (header == DSCODE.CONCURRENT_HASH_MAP.toByte()) {
+      // return "java.util.concurrent.ConcurrentHashMap";
+      if (header == DSCODE.PROPERTIES.toByte()) {
+        return "java.util.Properties";
+      }
+      if (header == DSCODE.TIME_UNIT.toByte()) {
+        return "java.util.concurrent.TimeUnit";
+      }
+      if (header == DSCODE.USER_CLASS.toByte()) {
+        byte userClassDSId = in.readByte();
+        return "DataSerializer: with Id:" + userClassDSId;
+      }
+      if (header == DSCODE.USER_CLASS_2.toByte()) {
+        short userClass2DSId = in.readShort();
+        return "DataSerializer: with Id:" + userClass2DSId;
+      }
+      if (header == DSCODE.USER_CLASS_4.toByte()) {
+        int userClass4DSId = in.readInt();
+        return "DataSerializer: with Id:" + userClass4DSId;
+      }
+      if (header == DSCODE.VECTOR.toByte()) {
+        return "java.util.Vector";
+      }
+      if (header == DSCODE.STACK.toByte()) {
+        return "java.util.Stack";
+      }
+      if (header == DSCODE.TREE_MAP.toByte()) {
+        return "java.util.TreeMap";
+      }
+      if (header == DSCODE.TREE_SET.toByte()) {
+        return "java.util.TreeSet";
+      }
+      if (header == DSCODE.BOOLEAN_TYPE.toByte()) {
+        return "java.lang.Boolean.class";
+      }
+      if (header == DSCODE.CHARACTER_TYPE.toByte()) {
+        return "java.lang.Character.class";
+      }
+      if (header == DSCODE.BYTE_TYPE.toByte()) {
+        return "java.lang.Byte.class";
+      }
+      if (header == DSCODE.SHORT_TYPE.toByte()) {
+        return "java.lang.Short.class";
+      }
+      if (header == DSCODE.INTEGER_TYPE.toByte()) {
+        return "java.lang.Integer.class";
+      }
+      if (header == DSCODE.LONG_TYPE.toByte()) {
+        return "java.lang.Long.class";
+      }
+      if (header == DSCODE.FLOAT_TYPE.toByte()) {
+        return "java.lang.Float.class";
+      }
+      if (header == DSCODE.DOUBLE_TYPE.toByte()) {
+        return "java.lang.Double.class";
+      }
+      if (header == DSCODE.VOID_TYPE.toByte()) {
+        return "java.lang.Void.class";
+      }
+      if (header == DSCODE.USER_DATA_SERIALIZABLE.toByte()) {
+        Instantiator instantiator = InternalInstantiator.getInstantiator(in.readByte());
+        return "org.apache.geode.Instantiator:" + instantiator.getInstantiatedClass().getName();
+      }
+      if (header == DSCODE.USER_DATA_SERIALIZABLE_2.toByte()) {
+        Instantiator instantiator = InternalInstantiator.getInstantiator(in.readShort());
+        return "org.apache.geode.Instantiator:" + instantiator.getInstantiatedClass().getName();
+      }
+      if (header == DSCODE.USER_DATA_SERIALIZABLE_4.toByte()) {
+        Instantiator instantiator = InternalInstantiator.getInstantiator(in.readInt());
+        return "org.apache.geode.Instantiator:" + instantiator.getInstantiatedClass().getName();
+      }
+      if (header == DSCODE.DATA_SERIALIZABLE.toByte()) {
+        return "org.apache.geode.DataSerializable:" + DataSerializer.readClass(in).getName();
+      }
+      if (header == DSCODE.SERIALIZABLE.toByte()) {
+        String name = null;
+        try {
+          Object obj = InternalDataSerializer.basicReadObject(getDataInput(bytes));
+          name = obj.getClass().getName();
+        } catch (ClassNotFoundException e) {
+          name = e.getMessage();
         }
-        case BIG_INTEGER:
-          return "java.math.BigInteger";
-        case BIG_DECIMAL:
-          return "java.math.BigDecimal";
-        case UUID:
-          return "java.util.UUID";
-        case TIMESTAMP:
-          return "java.sql.Timestamp";
-        default:
+        return "java.io.Serializable:" + name;
+      }
+      if (header == DSCODE.PDX.toByte()) {
+        int typeId = in.readInt();
+        return "pdxType:" + typeId;
+      }
+      if (header == DSCODE.PDX_ENUM.toByte()) {
+        in.readByte(); // dsId is not needed
+        int enumId = InternalDataSerializer.readArrayLength(in);
+        return "pdxEnum:" + enumId;
+      }
+      if (header == DSCODE.GEMFIRE_ENUM.toByte()) {
+        String name = DataSerializer.readString(in);
+        return "java.lang.Enum:" + name;
+      }
+      if (header == DSCODE.PDX_INLINE_ENUM.toByte()) {
+        String name = DataSerializer.readString(in);
+        return "java.lang.Enum:" + name;
+      }
+      if (header == DSCODE.BIG_INTEGER.toByte()) {
+        return "java.math.BigInteger";
+      }
+      if (header == DSCODE.BIG_DECIMAL.toByte()) {
+        return "java.math.BigDecimal";
+      }
+      if (header == DSCODE.UUID.toByte()) {
+        return "java.util.UUID";
+      }
+      if (header == DSCODE.TIMESTAMP.toByte()) {
+        return "java.sql.Timestamp";
       }
       return "Unknown header byte: " + header;
     } catch (IOException e) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/offheap/OffHeapRegionEntryHelper.java b/geode-core/src/main/java/org/apache/geode/internal/offheap/OffHeapRegionEntryHelper.java
index 08e768b..f203bed 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/offheap/OffHeapRegionEntryHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/offheap/OffHeapRegionEntryHelper.java
@@ -245,7 +245,7 @@ public class OffHeapRegionEntryHelper {
     } else if (isSerialized && !isCompressed) {
       // Check for some special types that take more than 7 bytes to serialize
       // but that might be able to be inlined with less than 8 bytes.
-      if (v[0] == DSCODE.LONG) {
+      if (v[0] == DSCODE.LONG.toByte()) {
         // A long is currently always serialized as 8 bytes (9 if you include the dscode).
         // But many long values will actually be small enough for is to encode in 7 bytes.
         if ((v[1] == 0 && (v[2] & 0x80) == 0) || (v[1] == -1 && (v[2] & 0x80) != 0)) {
@@ -306,7 +306,7 @@ public class OffHeapRegionEntryHelper {
     byte[] bytes;
     if (isLong) {
       bytes = new byte[9];
-      bytes[0] = DSCODE.LONG;
+      bytes[0] = DSCODE.LONG.toByte();
       for (int i = 8; i >= 2; i--) {
         addr >>= 8;
         bytes[i] = (byte) (addr & 0x00ff);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/offheap/OffHeapStoredObject.java b/geode-core/src/main/java/org/apache/geode/internal/offheap/OffHeapStoredObject.java
index e370c58..5a77a8d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/offheap/OffHeapStoredObject.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/offheap/OffHeapStoredObject.java
@@ -290,7 +290,7 @@ public class OffHeapStoredObject extends AbstractStoredObject
         if (this.isSerialized()) {
           hdos.write(bb);
         } else {
-          hdos.writeByte(DSCODE.BYTE_ARRAY);
+          hdos.writeByte(DSCODE.BYTE_ARRAY.toByte());
           InternalDataSerializer.writeArrayLength(bb.remaining(), hdos);
           hdos.write(bb);
         }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/util/BlobHelper.java b/geode-core/src/main/java/org/apache/geode/internal/util/BlobHelper.java
index 46a1f67..c955f4c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/util/BlobHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/util/BlobHelper.java
@@ -81,7 +81,7 @@ public class BlobHelper {
       throws IOException, ClassNotFoundException {
     Object result;
     final long start = startDeserialization();
-    if (blob.length > 0 && blob[0] == DSCODE.PDX) {
+    if (blob.length > 0 && blob[0] == DSCODE.PDX.toByte()) {
       // If the first byte of blob indicates a pdx then wrap
       // blob in a PdxInputStream instead.
       // This will prevent us from making a copy of the byte[]
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/FieldType.java b/geode-core/src/main/java/org/apache/geode/pdx/FieldType.java
index 521fdbe..5c56c86 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/FieldType.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/FieldType.java
@@ -40,8 +40,8 @@ public enum FieldType {
   FLOAT(true, DataSize.FLOAT_SIZE, "float", new byte[] {0, 0, 0, 0}, 0),
   DOUBLE(true, DataSize.DOUBLE_SIZE, "double", new byte[] {0, 0, 0, 0, 0, 0, 0, 0}, 0),
   DATE(true, DataSize.DATE_SIZE, "Date", new byte[] {-1, -1, -1, -1, -1, -1, -1, -1}, null),
-  STRING(false, -1, "String", new byte[] {DSCODE.NULL_STRING}, null),
-  OBJECT(false, -1, "Object", new byte[] {DSCODE.NULL}, null),
+  STRING(false, -1, "String", new byte[] {DSCODE.NULL_STRING.toByte()}, null),
+  OBJECT(false, -1, "Object", new byte[] {DSCODE.NULL.toByte()}, null),
   BOOLEAN_ARRAY(false, -1, "boolean[]", new byte[] {InternalDataSerializer.NULL_ARRAY}, null),
   CHAR_ARRAY(false, -1, "char[]", new byte[] {InternalDataSerializer.NULL_ARRAY}, null),
   BYTE_ARRAY(false, -1, "byte[]", new byte[] {InternalDataSerializer.NULL_ARRAY}, null),
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/EnumInfo.java b/geode-core/src/main/java/org/apache/geode/pdx/internal/EnumInfo.java
index 1114cfb..1d0da47 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/EnumInfo.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/EnumInfo.java
@@ -24,8 +24,6 @@ import java.util.Collections;
 import java.util.List;
 
 import org.apache.geode.DataSerializer;
-import org.apache.geode.internal.ClassPathLoader;
-import org.apache.geode.internal.DSCODE;
 import org.apache.geode.internal.DataSerializableFixedID;
 import org.apache.geode.internal.HeapDataOutputStream;
 import org.apache.geode.internal.InternalDataSerializer;
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxInstanceEnum.java b/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxInstanceEnum.java
index e596eb0..fc2afe3 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxInstanceEnum.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxInstanceEnum.java
@@ -126,7 +126,7 @@ public class PdxInstanceEnum implements PdxInstance, Sendable, ConvertableToByte
   }
 
   public void sendTo(DataOutput out) throws IOException {
-    out.writeByte(DSCODE.PDX_INLINE_ENUM);
+    out.writeByte(DSCODE.PDX_INLINE_ENUM.toByte());
     DataSerializer.writeString(this.className, out);
     DataSerializer.writeString(this.enumName, out);
     InternalDataSerializer.writeArrayLength(this.enumOrdinal, out);
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxInstanceImpl.java b/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxInstanceImpl.java
index f55df95..0c19a79 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxInstanceImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxInstanceImpl.java
@@ -161,7 +161,7 @@ public class PdxInstanceImpl extends PdxReaderImpl implements InternalPdxInstanc
       PdxWriterImpl writer = convertToTypeWithNoDeletedFields(ur);
       writer.sendTo(out);
     } else {
-      out.write(DSCODE.PDX);
+      out.write(DSCODE.PDX.toByte());
       out.writeInt(ur.basicSize());
       out.writeInt(ur.getPdxType().getTypeId());
       ur.basicSendTo(out);
@@ -177,7 +177,7 @@ public class PdxInstanceImpl extends PdxReaderImpl implements InternalPdxInstanc
     } else {
       byte[] result = new byte[PdxWriterImpl.HEADER_SIZE + ur.basicSize()];
       ByteBuffer bb = ByteBuffer.wrap(result);
-      bb.put(DSCODE.PDX);
+      bb.put(DSCODE.PDX.toByte());
       bb.putInt(ur.basicSize());
       bb.putInt(ur.getPdxType().getTypeId());
       ur.basicSendTo(bb);
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxReaderImpl.java b/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxReaderImpl.java
index 8c1e122..88175e6 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxReaderImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxReaderImpl.java
@@ -896,8 +896,9 @@ public class PdxReaderImpl implements InternalPdxReader, java.io.Serializable {
       }
       int offset = getPositionForField(ft) + buffer.arrayOffset();
       // Do not create PdxString if the field is NULL
-      if (bytes[offset] == DSCODE.STRING || bytes[offset] == DSCODE.STRING_BYTES
-          || bytes[offset] == DSCODE.HUGE_STRING || bytes[offset] == DSCODE.HUGE_STRING_BYTES) {
+      if (bytes[offset] == DSCODE.STRING.toByte() || bytes[offset] == DSCODE.STRING_BYTES.toByte()
+          || bytes[offset] == DSCODE.HUGE_STRING.toByte()
+          || bytes[offset] == DSCODE.HUGE_STRING_BYTES.toByte()) {
         return new PdxString(bytes, offset);
       }
     }
@@ -917,7 +918,7 @@ public class PdxReaderImpl implements InternalPdxReader, java.io.Serializable {
     }
     int offset = getPositionForField(ft) + buffer.arrayOffset();
     // Do not create PdxString if the field is NULL
-    if (bytes[offset] == DSCODE.NULL || bytes[offset] == DSCODE.NULL_STRING) {
+    if (bytes[offset] == DSCODE.NULL.toByte() || bytes[offset] == DSCODE.NULL_STRING.toByte()) {
       return null;
     }
     return new PdxString(bytes, offset);
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxString.java b/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxString.java
index 6d7046b..8cc85fb 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxString.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxString.java
@@ -58,12 +58,12 @@ public class PdxString implements Comparable<PdxString>, Sendable {
   private int calcOffset(int header, int offset) {
     offset++; // increment offset for the header byte
     // length is stored as short for small strings
-    if (header == DSCODE.STRING_BYTES || header == DSCODE.STRING) {
+    if (header == DSCODE.STRING_BYTES.toByte() || header == DSCODE.STRING.toByte()) {
       offset += 2; // position the offset to the start of the String
                    // (skipping header and length bytes)
     }
     // length is stored as int for huge strings
-    else if (header == DSCODE.HUGE_STRING_BYTES || header == DSCODE.HUGE_STRING) {
+    else if (header == DSCODE.HUGE_STRING_BYTES.toByte() || header == DSCODE.HUGE_STRING.toByte()) {
       offset += 4; // position the offset to the start of the String
                    // (skipping header and length bytes)
     }
@@ -73,14 +73,14 @@ public class PdxString implements Comparable<PdxString>, Sendable {
   private int getLength() {
     int length = 0;
     int lenOffset = this.offset;
-    if (header == DSCODE.STRING_BYTES || header == DSCODE.STRING) {
+    if (header == DSCODE.STRING_BYTES.toByte() || header == DSCODE.STRING.toByte()) {
       lenOffset -= 2;
       byte a = bytes[lenOffset];
       byte b = bytes[lenOffset + 1];
       length = ((a & 0xff) << 8) | (b & 0xff);
     }
     // length is stored as int for huge strings
-    else if (header == DSCODE.HUGE_STRING_BYTES || header == DSCODE.HUGE_STRING) {
+    else if (header == DSCODE.HUGE_STRING_BYTES.toByte() || header == DSCODE.HUGE_STRING.toByte()) {
       lenOffset -= 4;
       byte a = bytes[lenOffset];
       byte b = bytes[lenOffset + 1];
@@ -168,12 +168,13 @@ public class PdxString implements Comparable<PdxString>, Sendable {
     int headerOffset = this.offset;
     try {
       --headerOffset; // for header byte
-      if (header == DSCODE.STRING_BYTES || header == DSCODE.STRING) {
+      if (header == DSCODE.STRING_BYTES.toByte() || header == DSCODE.STRING.toByte()) {
         headerOffset -= 2; // position the offset to the start of the String (skipping
         // header and length bytes)
       }
       // length is stored as int for huge strings
-      else if (header == DSCODE.HUGE_STRING_BYTES || header == DSCODE.HUGE_STRING) {
+      else if (header == DSCODE.HUGE_STRING_BYTES.toByte()
+          || header == DSCODE.HUGE_STRING.toByte()) {
         headerOffset -= 4;
       }
       ByteBuffer stringByteBuffer =
@@ -195,10 +196,11 @@ public class PdxString implements Comparable<PdxString>, Sendable {
     int len = getLength();
     --offset; // for header byte
     len++;
-    if (header == DSCODE.STRING_BYTES || header == DSCODE.STRING) {
+    if (header == DSCODE.STRING_BYTES.toByte() || header == DSCODE.STRING.toByte()) {
       len += 2;
       offset -= 2;
-    } else if (header == DSCODE.HUGE_STRING_BYTES || header == DSCODE.HUGE_STRING) {
+    } else if (header == DSCODE.HUGE_STRING_BYTES.toByte()
+        || header == DSCODE.HUGE_STRING.toByte()) {
       len += 4;
       offset -= 4;
     }
diff --git a/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxWriterImpl.java b/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxWriterImpl.java
index 4061cae..29dfe20 100644
--- a/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxWriterImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/pdx/internal/PdxWriterImpl.java
@@ -533,7 +533,7 @@ public class PdxWriterImpl implements PdxWriter {
       this.lu.update(bits);
     } // !alreadyGenerated
 
-    return getCurrentOffset() + 1; // +1 for DSCODE.PDX
+    return getCurrentOffset() + 1; // +1 for DSCODE.PDX.toByte()
   }
 
   /**
@@ -839,7 +839,7 @@ public class PdxWriterImpl implements PdxWriter {
   private HeapDataOutputStream.LongUpdater lu;
 
   private void writeHeader() {
-    this.os.write(DSCODE.PDX);
+    this.os.write(DSCODE.PDX.toByte());
     this.lu = this.os.reserveLong(); // dummy length and type id
   }
 
@@ -932,7 +932,7 @@ public class PdxWriterImpl implements PdxWriter {
     if (valueBytes == null || valueBytes.length < 1) {
       return false;
     }
-    return valueBytes[0] == DSCODE.PDX;
+    return valueBytes[0] == DSCODE.PDX.toByte();
   }
 
   public int position() {
diff --git a/geode-core/src/test/java/org/apache/geode/internal/DSCODETest.java b/geode-core/src/test/java/org/apache/geode/internal/DSCODETest.java
new file mode 100644
index 0000000..6c100e5
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/DSCODETest.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal;
+
+import static org.junit.Assert.assertFalse;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class DSCODETest {
+  @Test
+  public void testNoDuplicateByteValues() throws Exception {
+    Set<Integer> previouslySeen = new HashSet<>();
+    for (DSCODE value : DSCODE.values()) {
+      final int integerValue = (int) value.toByte();
+      assertFalse("Each byte value should only occur with a single header byte enumerate",
+          previouslySeen.contains(integerValue));
+      previouslySeen.add(integerValue);
+    }
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/offheap/DataTypeJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/offheap/DataTypeJUnitTest.java
index 913e901..f5e8fe7 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/offheap/DataTypeJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/offheap/DataTypeJUnitTest.java
@@ -112,7 +112,7 @@ public class DataTypeJUnitTest {
 
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    DataSerializer.writeByte(DSCODE.DS_FIXED_ID_INT, out);
+    DataSerializer.writeByte(DSCODE.DS_FIXED_ID_INT.toByte(), out);
     DataSerializer.writeInteger(someDSFIDInt, out);
     byte[] bytes = baos.toByteArray();
     String type = DataType.getDataType(bytes);
@@ -124,7 +124,7 @@ public class DataTypeJUnitTest {
   public void testDataSerializableFixedIDClass() throws IOException {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    DataSerializer.writeByte(DSCODE.DS_NO_FIXED_ID, out);
+    DataSerializer.writeByte(DSCODE.DS_NO_FIXED_ID.toByte(), out);
     DataSerializer.writeClass(Integer.class, out);
     byte[] bytes = baos.toByteArray();
     String type = DataType.getDataType(bytes);
@@ -586,7 +586,7 @@ public class DataTypeJUnitTest {
   public void testBooleanType() throws IOException {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.BOOLEAN_TYPE);
+    out.writeByte(DSCODE.BOOLEAN_TYPE.toByte());
     byte[] bytes = baos.toByteArray();
     String type = DataType.getDataType(bytes);
     assertEquals("java.lang.Boolean.class", type);
@@ -596,7 +596,7 @@ public class DataTypeJUnitTest {
   public void testCharacterType() throws IOException {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.CHARACTER_TYPE);
+    out.writeByte(DSCODE.CHARACTER_TYPE.toByte());
     byte[] bytes = baos.toByteArray();
     String type = DataType.getDataType(bytes);
     assertEquals("java.lang.Character.class", type);
@@ -606,7 +606,7 @@ public class DataTypeJUnitTest {
   public void testByteType() throws IOException {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.BYTE_TYPE);
+    out.writeByte(DSCODE.BYTE_TYPE.toByte());
     byte[] bytes = baos.toByteArray();
     String type = DataType.getDataType(bytes);
     assertEquals("java.lang.Byte.class", type);
@@ -616,7 +616,7 @@ public class DataTypeJUnitTest {
   public void testShortType() throws IOException {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.SHORT_TYPE);
+    out.writeByte(DSCODE.SHORT_TYPE.toByte());
     byte[] bytes = baos.toByteArray();
     String type = DataType.getDataType(bytes);
     assertEquals("java.lang.Short.class", type);
@@ -626,7 +626,7 @@ public class DataTypeJUnitTest {
   public void testIntegerType() throws IOException {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.INTEGER_TYPE);
+    out.writeByte(DSCODE.INTEGER_TYPE.toByte());
     byte[] bytes = baos.toByteArray();
     String type = DataType.getDataType(bytes);
     assertEquals("java.lang.Integer.class", type);
@@ -636,7 +636,7 @@ public class DataTypeJUnitTest {
   public void testLongType() throws IOException {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.LONG_TYPE);
+    out.writeByte(DSCODE.LONG_TYPE.toByte());
     byte[] bytes = baos.toByteArray();
     String type = DataType.getDataType(bytes);
     assertEquals("java.lang.Long.class", type);
@@ -646,7 +646,7 @@ public class DataTypeJUnitTest {
   public void testFloatType() throws IOException {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.FLOAT_TYPE);
+    out.writeByte(DSCODE.FLOAT_TYPE.toByte());
     byte[] bytes = baos.toByteArray();
     String type = DataType.getDataType(bytes);
     assertEquals("java.lang.Float.class", type);
@@ -656,7 +656,7 @@ public class DataTypeJUnitTest {
   public void testDoubleType() throws IOException {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.DOUBLE_TYPE);
+    out.writeByte(DSCODE.DOUBLE_TYPE.toByte());
     byte[] bytes = baos.toByteArray();
     String type = DataType.getDataType(bytes);
     assertEquals("java.lang.Double.class", type);
@@ -666,7 +666,7 @@ public class DataTypeJUnitTest {
   public void testVoidType() throws IOException {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.VOID_TYPE);
+    out.writeByte(DSCODE.VOID_TYPE.toByte());
     byte[] bytes = baos.toByteArray();
     String type = DataType.getDataType(bytes);
     assertEquals("java.lang.Void.class", type);
@@ -679,7 +679,7 @@ public class DataTypeJUnitTest {
     byte someUserClassId = 1;
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.USER_CLASS);
+    out.writeByte(DSCODE.USER_CLASS.toByte());
     out.writeByte(someUserClassId);
     byte[] bytes = baos.toByteArray();
     String type = DataType.getDataType(bytes);
@@ -691,7 +691,7 @@ public class DataTypeJUnitTest {
     short someUserClass2Id = 1;
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.USER_CLASS_2);
+    out.writeByte(DSCODE.USER_CLASS_2.toByte());
     out.writeShort(someUserClass2Id);
     byte[] bytes = baos.toByteArray();
     String type = DataType.getDataType(bytes);
@@ -703,7 +703,7 @@ public class DataTypeJUnitTest {
     int someUserClass4Id = 1;
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.USER_CLASS_4);
+    out.writeByte(DSCODE.USER_CLASS_4.toByte());
     out.writeInt(someUserClass4Id);
     byte[] bytes = baos.toByteArray();
     String type = DataType.getDataType(bytes);
@@ -724,7 +724,7 @@ public class DataTypeJUnitTest {
 
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.USER_DATA_SERIALIZABLE);
+    out.writeByte(DSCODE.USER_DATA_SERIALIZABLE.toByte());
     out.writeByte(someClassId);
 
     byte[] bytes = baos.toByteArray();
@@ -748,7 +748,7 @@ public class DataTypeJUnitTest {
 
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.USER_DATA_SERIALIZABLE_2);
+    out.writeByte(DSCODE.USER_DATA_SERIALIZABLE_2.toByte());
     out.writeShort(someClassId);
 
     byte[] bytes = baos.toByteArray();
@@ -772,7 +772,7 @@ public class DataTypeJUnitTest {
 
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.USER_DATA_SERIALIZABLE_4);
+    out.writeByte(DSCODE.USER_DATA_SERIALIZABLE_4.toByte());
     out.writeInt(someClassId);
 
     byte[] bytes = baos.toByteArray();
@@ -813,7 +813,7 @@ public class DataTypeJUnitTest {
     int somePdxTypeInt = 1;
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.PDX);
+    out.writeByte(DSCODE.PDX.toByte());
     out.writeInt(somePdxTypeInt);
     byte[] bytes = baos.toByteArray();
     String type = DataType.getDataType(bytes);
@@ -840,7 +840,7 @@ public class DataTypeJUnitTest {
 
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.GEMFIRE_ENUM);
+    out.writeByte(DSCODE.GEMFIRE_ENUM.toByte());
     byte[] bytes = baos.toByteArray();
     String type = DataType.getDataType(bytes);
 
@@ -885,7 +885,7 @@ public class DataTypeJUnitTest {
   public void testSQLTimestamp() throws IOException {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutputStream out = new DataOutputStream(baos);
-    out.writeByte(DSCODE.TIMESTAMP);
+    out.writeByte(DSCODE.TIMESTAMP.toByte());
     byte[] bytes = baos.toByteArray();
     String type = DataType.getDataType(bytes);
     assertEquals("java.sql.Timestamp", type);
diff --git a/geode-core/src/test/java/org/apache/geode/internal/offheap/MemoryBlockNodeJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/offheap/MemoryBlockNodeJUnitTest.java
index 3800f20..48e9f02 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/offheap/MemoryBlockNodeJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/offheap/MemoryBlockNodeJUnitTest.java
@@ -324,7 +324,7 @@ public class MemoryBlockNodeJUnitTest {
   public void getDataValueWithIllegalDataTypeCatchesIOException() {
     Object obj = getValue();
     storedObject = createValueAsSerializedStoredObject(obj);
-    storedObject.writeDataByte(0, DSCODE.ILLEGAL);
+    storedObject.writeDataByte(0, DSCODE.ILLEGAL.toByte());
     MemoryBlock mb = new MemoryBlockNode(ma, (MemoryBlock) storedObject);
     ByteArrayOutputStream errContent = new ByteArrayOutputStream();
     System.setErr(new PrintStream(errContent));
diff --git a/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapRegionEntryHelperJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapRegionEntryHelperJUnitTest.java
index 2c38312..a7598a7 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapRegionEntryHelperJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapRegionEntryHelperJUnitTest.java
@@ -150,7 +150,7 @@ public class OffHeapRegionEntryHelperJUnitTest {
   @Test
   public void encodeDataAsAddressShouldReturnZeroIfValueIsLargerThanEightBytesAndNotLong() {
     byte[] someValue = new byte[8];
-    someValue[0] = DSCODE.CLASS;
+    someValue[0] = DSCODE.CLASS.toByte();
 
     boolean isSerialized = true;
     boolean isCompressed = false;
diff --git a/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapStoredObjectJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapStoredObjectJUnitTest.java
index 1e37e65..1554300 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapStoredObjectJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/offheap/OffHeapStoredObjectJUnitTest.java
@@ -375,19 +375,19 @@ public class OffHeapStoredObjectJUnitTest extends AbstractStoredObjectTestBase {
     OffHeapStoredObject chunk = createValueAsSerializedStoredObject(getValue());
 
     byte[] serailizedValue = chunk.getSerializedValue();
-    serailizedValue[0] = DSCODE.PDX;
+    serailizedValue[0] = DSCODE.PDX.toByte();
     chunk.setSerializedValue(serailizedValue);
 
     assertThat(chunk.isSerializedPdxInstance()).isTrue();
 
     serailizedValue = chunk.getSerializedValue();
-    serailizedValue[0] = DSCODE.PDX_ENUM;
+    serailizedValue[0] = DSCODE.PDX_ENUM.toByte();
     chunk.setSerializedValue(serailizedValue);
 
     assertThat(chunk.isSerializedPdxInstance()).isTrue();
 
     serailizedValue = chunk.getSerializedValue();
-    serailizedValue[0] = DSCODE.PDX_INLINE_ENUM;
+    serailizedValue[0] = DSCODE.PDX_INLINE_ENUM.toByte();
     chunk.setSerializedValue(serailizedValue);
 
     assertThat(chunk.isSerializedPdxInstance()).isTrue();
@@ -572,7 +572,7 @@ public class OffHeapStoredObjectJUnitTest extends AbstractStoredObjectTestBase {
     byte[] actual = dataOutput.toByteArray();
 
     byte[] expected = new byte[regionEntryValue.length + 2];
-    expected[0] = DSCODE.BYTE_ARRAY;
+    expected[0] = DSCODE.BYTE_ARRAY.toByte();
     expected[1] = (byte) regionEntryValue.length;
     System.arraycopy(regionEntryValue, 0, expected, 2, regionEntryValue.length);
 
diff --git a/geode-core/src/test/java/org/apache/geode/internal/offheap/TinyStoredObjectJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/offheap/TinyStoredObjectJUnitTest.java
index 7d2efac..c20cff0 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/offheap/TinyStoredObjectJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/offheap/TinyStoredObjectJUnitTest.java
@@ -23,6 +23,7 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import org.apache.geode.compression.Compressor;
+import org.apache.geode.internal.DSCODE;
 import org.apache.geode.internal.cache.BytesAndBitsForCompactor;
 import org.apache.geode.internal.cache.CachePerfStats;
 import org.apache.geode.internal.cache.EntryEventImpl;
@@ -346,7 +347,7 @@ public class TinyStoredObjectJUnitTest extends AbstractStoredObjectTestBase {
     byte[] serializedValue = EntryEventImpl.serialize(regionEntryValueAsBytes);
 
     // store -127 (DSCODE.ILLEGAL) - in order the deserialize to throw exception
-    serializedValue[0] = -127;
+    serializedValue[0] = DSCODE.ILLEGAL.toByte();
 
     // encode a un serialized entry value to address
     long encodedAddress =
diff --git a/geode-core/src/test/java/org/apache/geode/pdx/PdxSerializableJUnitTest.java b/geode-core/src/test/java/org/apache/geode/pdx/PdxSerializableJUnitTest.java
index 37ac5f9..04b44fd 100644
--- a/geode-core/src/test/java/org/apache/geode/pdx/PdxSerializableJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/pdx/PdxSerializableJUnitTest.java
@@ -293,13 +293,13 @@ public class PdxSerializableJUnitTest {
     DataSerializer.writeObject(object, out);
     int typeId = getPdxTypeIdForClass(SimpleClass.class);
     byte[] actual = out.toByteArray();
-    byte[] expected = new byte[] {DSCODE.PDX, // byte
+    byte[] expected = new byte[] {DSCODE.PDX.toByte(), // byte
         0, 0, 0, 4 + 1 + 1, // int - length of byte stream = 4(myInt) + 1(myByte) + 1 (myEnum)
         (byte) (typeId >> 24), (byte) (typeId >> 16), (byte) (typeId >> 8), (byte) typeId, // int -
                                                                                            // typeId
         0, 0, 0, 1, // int - myInt = 1
         5, // byte - myByte = 5
-        DSCODE.NULL};
+        DSCODE.NULL.toByte()};
 
     StringBuffer msg = new StringBuffer("Actual output: ");
     for (byte val : actual) {
@@ -364,7 +364,7 @@ public class PdxSerializableJUnitTest {
     int offset3 = offset1 + 8 + str1Bytes.length + str2Bytes.length;
     byte[] actual = out.toByteArray();
     int floatBytes = Float.floatToRawIntBits(myFloat);
-    Byte[] expected = new Byte[] {DSCODE.PDX, // byte
+    Byte[] expected = new Byte[] {DSCODE.PDX.toByte(), // byte
         (byte) (length >> 24), (byte) (length >> 16), (byte) (length >> 8), (byte) length, // int -
                                                                                            // length
                                                                                            // of
@@ -392,7 +392,7 @@ public class PdxSerializableJUnitTest {
                                                                                                    // for:
                                                                                                    // 1
                                                                                                    // for
-                                                                                                   // DSCODE.PDX
+                                                                                                   // DSCODE.PDX.toByte()
                                                                                                    // and
                                                                                                    // 4
                                                                                                    // for
@@ -591,7 +591,7 @@ public class PdxSerializableJUnitTest {
     int offset3 = offset1 + 8 + str1Bytes.length + str2Bytes.length;
     byte[] actual = out.toByteArray();
     int floatBytes = Float.floatToRawIntBits(myFloat);
-    Byte[] expected = new Byte[] {DSCODE.PDX, // byte
+    Byte[] expected = new Byte[] {DSCODE.PDX.toByte(), // byte
         (byte) (length >> 24), (byte) (length >> 16), (byte) (length >> 8), (byte) length, // int -
                                                                                            // length
                                                                                            // of
@@ -619,7 +619,7 @@ public class PdxSerializableJUnitTest {
                                                                                                    // for:
                                                                                                    // 1
                                                                                                    // for
-                                                                                                   // DSCODE.PDX
+                                                                                                   // DSCODE.PDX.toByte()
                                                                                                    // and
                                                                                                    // 4
                                                                                                    // for
@@ -803,7 +803,7 @@ public class PdxSerializableJUnitTest {
     int offset3 = offset1 + 8 + str1Bytes.length + mapBytes.length;
     byte[] actual = out.toByteArray();
     int floatBytes = Float.floatToRawIntBits(myFloat);
-    Byte[] expected = new Byte[] {DSCODE.PDX, // byte
+    Byte[] expected = new Byte[] {DSCODE.PDX.toByte(), // byte
         (byte) (length >> 24), (byte) (length >> 16), (byte) (length >> 8), (byte) length, // int -
                                                                                            // length
                                                                                            // of
@@ -901,7 +901,7 @@ public class PdxSerializableJUnitTest {
     int offset3 = offset1 + 8 + str1Bytes.length + dsBytes.length;
     byte[] actual = out.toByteArray();
     int floatBytes = Float.floatToRawIntBits(myFloat);
-    Byte[] expected = new Byte[] {DSCODE.PDX, // byte
+    Byte[] expected = new Byte[] {DSCODE.PDX.toByte(), // byte
         (byte) (length >> 24), (byte) (length >> 16), (byte) (length >> 8), (byte) length, // int -
                                                                                            // length
                                                                                            // of
@@ -925,7 +925,7 @@ public class PdxSerializableJUnitTest {
                                                                                                    // for:
                                                                                                    // 1
                                                                                                    // for
-                                                                                                   // DSCODE.PDX
+                                                                                                   // DSCODE.PDX.toByte()
                                                                                                    // and
                                                                                                    // 4
                                                                                                    // for
@@ -1012,7 +1012,7 @@ public class PdxSerializableJUnitTest {
 
     byte[] actual = out.toByteArray();
     int floatBytes = Float.floatToRawIntBits(myFloat);
-    Byte[] expected = new Byte[] {DSCODE.DATA_SERIALIZABLE, // byte
+    Byte[] expected = new Byte[] {DSCODE.DATA_SERIALIZABLE.toByte(), // byte
         (byte) (myLong >> 56), (byte) (myLong >> 48), (byte) (myLong >> 40), (byte) (myLong >> 32),
         (byte) (myLong >> 24), (byte) (myLong >> 16), (byte) (myLong >> 8), (byte) myLong, // long -
                                                                                            // myLong
diff --git a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/excludedClasses.txt b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
index fdc1c43..fef1243 100644
--- a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
+++ b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
@@ -12,6 +12,7 @@ org/apache/geode/distributed/internal/membership/gms/mgr/GMSMembershipManager$Bo
 org/apache/geode/distributed/internal/tcpserver/LocatorCancelException
 org/apache/geode/internal/AbstractConfig$SortedProperties
 org/apache/geode/internal/AvailablePort$Keeper
+org/apache/geode/internal/DSCODE
 org/apache/geode/internal/ExitCode
 org/apache/geode/internal/JarDeployer
 org/apache/geode/internal/ObjIdConcurrentMap
@@ -90,4 +91,4 @@ org/apache/geode/cache/query/internal/types/TypeUtils$ComparisonStrategy$3
 org/apache/geode/cache/query/internal/types/TypeUtils$ComparisonStrategy$4
 org/apache/geode/cache/query/internal/types/TypeUtils$ComparisonStrategy$5
 org/apache/geode/cache/client/internal/pooling/ConnectionManagerImpl$ClosedPoolConnectionList
-org/apache/geode/cache/query/internal/parse/ASTArithmeticOp
\ No newline at end of file
+org/apache/geode/cache/query/internal/parse/ASTArithmeticOp
diff --git a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
index 62f44ff..f22486f 100644
--- a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
+++ b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
@@ -1912,7 +1912,7 @@ fromData,171
 toData,162
 
 org/apache/geode/internal/cache/tier/sockets/HAEventWrapper,2
-fromData,432
+fromData,440
 toData,90
 
 org/apache/geode/internal/cache/tier/sockets/InterestResultPolicyImpl,2

-- 
To stop receiving notification emails like this one, please contact
pivotalsarge@apache.org.

Mime
View raw message