All Downloads are FREE. Search and download functionalities are using the official Maven repository.

co.easimart.NoObjectsEncoder Maven / Gradle / Ivy

package co.easimart;

import org.json.JSONObject;

/**
 * Throws an exception if someone attemps to encode a {@code EasimartObject}.
 */
/** package */ class NoObjectsEncoder extends EasimartEncoder {

  // This class isn't really a Singleton, but since it has no state, it's more efficient to get the
  // default instance.
  private static final NoObjectsEncoder INSTANCE = new NoObjectsEncoder();
  public static NoObjectsEncoder get() {
    return INSTANCE;
  }

  @Override
  public JSONObject encodeRelatedObject(EasimartObject object) {
    throw new IllegalArgumentException("EasimartObjects not allowed here");
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy