jnr.posix.SimpleFunctionMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cassandra-driver Show documentation
Show all versions of cassandra-driver Show documentation
Shaded version of DataStax Java Driver for Apache Cassandra
The newest version!
package jnr.posix;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
public class SimpleFunctionMapper implements jnr.ffi.mapper.FunctionMapper {
private final Map functionNameMap;
private SimpleFunctionMapper(Map map) {
functionNameMap = Collections.unmodifiableMap(new HashMap(map));
}
public String mapFunctionName(String functionName, Context context) {
String nativeFunction = functionNameMap.get(functionName);
return nativeFunction != null ? nativeFunction : functionName;
}
public static class Builder {
private final Map functionNameMap = Collections.synchronizedMap(new HashMap());
public Builder map(String posixName, String nativeFunction) {
functionNameMap.put(posixName, nativeFunction);
return this;
}
public SimpleFunctionMapper build() {
return new SimpleFunctionMapper(functionNameMap);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy