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

com.carrotsearch.ant.tasks.junit4.gson.stream.IOContext Maven / Gradle / Ivy

The newest version!
package com.carrotsearch.ant.tasks.junit4.gson.stream;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class IOContext {
  private Map context = new HashMap();

  public void registerInContext(Object key, Object value) throws IOException {
    if (inContext(key)) {
      throw new IOException("Key already registered: " + key);
    }
    if (value == null) {
      throw new IOException("Value cannot be null for key: " + key);
    }
    context.put(key, value);
  }

  public Object lookupInContext(Object key) {
    return context.get(key);
  }
  
  public boolean inContext(Object key) {
    return context.containsKey(key);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy