code: private void appendPrimitive(JsonWriter writer, Object primitive) throws SerializerException {
          if (primitive instanceof PEnumValue) {
              if (IdType.ID.equals(enumValueType)) {
                  writer.value(((PEnumValue<?>) primitive).asInteger());
              } else {
                  writer.valueUnescaped(primitive.toString());
              }
          } else if (primitive instanceof Boolean) {
              writer.value(((Boolean) primitive));
          } else if (primitive instanceof Byte) {
              writer.value(((Byte) primitive));
          } else if (primitive instanceof Short) {
              writer.value(((Short) primitive));
          } else if (primitive instanceof Integer) {
              writer.value(((Integer) primitive));
          } else if (primitive instanceof Long) {
              writer.value(((Long) primitive));
          } else if (primitive instanceof Double) {
              writer.value(((Double) primitive));
          } else if (primitive instanceof CharSequence) {
              writer.value((String) primitive);
          } else if (primitive instanceof Binary) {
              writer.value((Binary) primitive);
          } else {
              throw new SerializerException("illegal primitive type class " + primitive.getClass()
                                                                                       .getSimpleName());
          }
      }
docs: Append a primitive value to json struct.
  
  @param writer    The JSON writer.
  @param primitive The primitive instance.