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

com.logicommerce.sdktest.models.PropertyValueMapFake Maven / Gradle / Ivy

package com.logicommerce.sdktest.models;

import java.util.Map;
import java.util.Set;
import com.logicommerce.sdk.models.PropertyValueMap;

public class PropertyValueMapFake implements PropertyValueMap {

	private Map map;

	public PropertyValueMapFake() {
		this(null);
	}

	public PropertyValueMapFake(Map map) {
		this.map = map;
	}

	@Override
	public  T get(String key, Class type) {
		if (map != null) {
			if (!map.containsKey(key)) {
				return null;
			}
			Object value = map.get(key);
			if (type.isInstance(value)) {
				return type.cast(value);
			}
		}
		return null;
	}

	@Override
	public Object getRaw(String key) {
		if (map != null) {
			return map.get(key);
		}
		return null;
	}

	@Override
	public boolean containsKey(String key) {
		if (map != null) {
			return map.containsKey(key);
		}
		return false;
	}

	@Override
	public boolean isEmpty() {
		return map == null || map.isEmpty();
	}

	@Override
	public Set keySet() {
		if (map != null) {
			return map.keySet();
		}
		return null;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy