org.webbitserver.rest.furi.URIResolveResultMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of webbit-rest Show documentation
Show all versions of webbit-rest Show documentation
An uri-template based REST API for Webbit
The newest version!
package org.webbitserver.rest.furi;
import org.weborganic.furi.URIResolveResult;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
class URIResolveResultMap implements Map {
private final URIResolveResult resolveResult;
public URIResolveResultMap(URIResolveResult resolveResult) {
this.resolveResult = resolveResult;
}
@Override
public int size() {
return resolveResult.names().size();
}
@Override
public boolean isEmpty() {
return resolveResult.names().isEmpty();
}
@Override
public boolean containsKey(Object key) {
return resolveResult.names().contains(key);
}
@Override
public boolean containsValue(Object value) {
return values().contains(value);
}
@Override
public Object get(Object key) {
return key instanceof String ? resolveResult.get((String) key) : null;
}
@Override
public Object put(String key, Object value) {
throw new UnsupportedOperationException();
}
@Override
public Object remove(Object key) {
throw new UnsupportedOperationException();
}
@Override
public void putAll(Map extends String, ? extends Object> m) {
throw new UnsupportedOperationException();
}
@Override
public void clear() {
throw new UnsupportedOperationException();
}
@Override
public Set keySet() {
return resolveResult.names();
}
@Override
public Collection