// Path: src/bindings/ejdb2_jni/src/main/java/com/softmotions/ejdb2/JSON.java
// public static enum ValueType {
//   UNKNOWN, NULL, BOOLEAN, NUMBER, STRING, OBJECT, ARRAY;
// 
//   public static ValueType getTypeOf(Object v) {
//     if (v == null) {
//       return NULL;
//     }
//     Class clazz = v.getClass();
//     if (clazz == String.class) {
//       return STRING;
//     }
//     if (clazz == Boolean.class) {
//       return BOOLEAN;
//     }
//     if (v instanceof Number) {
//       return NUMBER;
//     }
//     if (v instanceof Map) {
//       return OBJECT;
//     }
//     if (v instanceof List) {
//       return ARRAY;
//     }
//     return UNKNOWN;
//   }
// }


import com.softmotions.ejdb2.JSON.ValueType;
package com.softmotions.ejdb2;


public final class EJDB2Document {

  public final long id;

  public final JSON json;

  EJDB2Document(long id, byte[] data) {
    this(id, new JSON(data));
  }

  EJDB2Document(long id, String data) {
    this(id, new JSON(data));
  }

  EJDB2Document(long id, JSON json) {
    if (json.type != ValueType.OBJECT && json.type != ValueType.NULL) {
      throw new IllegalArgumentException("json is not an object or null");
    }
    this.id = id;
// Path: src/bindings/ejdb2_jni/src/main/java/com/softmotions/ejdb2/JSON.java
// public static enum ValueType {
//   UNKNOWN, NULL, BOOLEAN, NUMBER, STRING, OBJECT, ARRAY;
// 
//   public static ValueType getTypeOf(Object v) {
//     if (v == null) {
//       return NULL;
//     }
//     Class clazz = v.getClass();
//     if (clazz == String.class) {
//       return STRING;
//     }
//     if (clazz == Boolean.class) {
//       return BOOLEAN;
//     }
//     if (v instanceof Number) {
//       return NUMBER;
//     }
//     if (v instanceof Map) {
//       return OBJECT;
//     }
//     if (v instanceof List) {
//       return ARRAY;
//     }
//     return UNKNOWN;
//   }
// }


// Path: src/bindings/ejdb2_jni/src/main/java/com/softmotions/ejdb2/EJDB2Document.java
import com.softmotions.ejdb2.JSON.ValueType;

package com.softmotions.ejdb2;


public final class EJDB2Document {

  public final long id;

  public final JSON json;

  EJDB2Document(long id, byte[] data) {
    this(id, new JSON(data));
  }

  EJDB2Document(long id, String data) {
    this(id, new JSON(data));
  }

  EJDB2Document(long id, JSON json) {
    if (json.type != ValueType.OBJECT && json.type != ValueType.NULL) {
      throw new IllegalArgumentException("json is not an object or null");
    }
    this.id = id;
    this.json = json;