io.nosqlbench.engine.api.activityconfig.rawyaml.RawStmtFields Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of engine-api Show documentation
Show all versions of engine-api Show documentation
The engine API for nosqlbench;
Provides the interfaces needed to build internal modules for the
nosqlbench core engine
/*
*
* Copyright 2016 jshook
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* /
*/
package io.nosqlbench.engine.api.activityconfig.rawyaml;
import io.nosqlbench.nb.api.errors.BasicError;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
public class RawStmtFields extends Tags {
private final static Logger logger = LogManager.getLogger(RawStmtFields.class);
private String name = "";
private String desc = "";
private final Map bindings = new LinkedHashMap<>();
private final Map params = new LinkedHashMap<>();
public RawStmtFields() {
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public void setDescription(String desc) {
this.desc = desc;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map getBindings() {
return Collections.unmodifiableMap(bindings);
}
public void setBindings(Map bindings) {
this.bindings.clear();
this.bindings.putAll(bindings);
}
public Map getParams() {
return this.params;
}
// public Map getParamsAsText() {
// Map paramsMap = new HashMap<>();
// this.params.forEach((ko,vo) -> paramsMap.put(ko,vo.toString()));
// return paramsMap;
// }
public void setParams(Map config) {
this.params.clear();
this.params.putAll(config);
}
public void applyBlockParams(RawStmtFields other) {
setName(other.getName());
setBindings(other.getBindings());
setTags(other.getTags());
setParams(other.getParams());
}
@SuppressWarnings("unchecked")
public void setFieldsByReflection(Map propsmap) {
Object descriptionObj = propsmap.remove("description");
if (descriptionObj!=null) {
setDescription(descriptionObj.toString());
}
Object nameObj = propsmap.remove("name");
if (nameObj!=null) {
setName(nameObj.toString());
}
Object bindingsObject = propsmap.remove("bindings");
if (bindingsObject!=null) {
if (bindingsObject instanceof Map) {
Map
© 2015 - 2024 Weber Informatics LLC | Privacy Policy