
com.github.davidmoten.odata.client.Context Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of odata-client-runtime Show documentation
Show all versions of odata-client-runtime Show documentation
OData client runtime for use with generated code
The newest version!
package com.github.davidmoten.odata.client;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public final class Context {
private final Serializer serializer;
private final HttpService service;
// used to specify options that override standard odata behaviour to deal with
// service bugs etc. For example, MsGraph @odata.mediaEditLink is wrong for an
// fileAttachment and needs special editing to get working until Microsoft fix
// this bug.
private final Map properties;
// used to look up subclasses when deserializing
private final List schemas;
public Context(Serializer serializer, HttpService service, Map properties, List schemas) {
this.serializer = serializer;
this.service = service;
this.properties = new HashMap<>(properties);
this.schemas = schemas;
}
public Context(Serializer serializer, HttpService service, List schemas) {
this(serializer, service, Collections.emptyMap(), schemas);
}
public Serializer serializer() {
return serializer;
}
public HttpService service() {
return service;
}
public Object getProperty(String name) {
return properties.get(name);
}
public Map getProperties() {
return new HashMap<>(properties);
}
public boolean propertyIsTrue(String name) {
return "true".equalsIgnoreCase(String.valueOf(properties.get(name)));
}
public boolean propertyIsFalse(String name) {
return "false".equalsIgnoreCase(String.valueOf(properties.get(name)));
}
public List schemas() {
return schemas;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy