org.eclipse.rdf4j.spring.util.ObjectMapUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rdf4j-spring Show documentation
Show all versions of rdf4j-spring Show documentation
Spring integration for RDF4J
The newest version!
/*******************************************************************************
* Copyright (c) 2021 Eclipse RDF4J contributors.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Distribution License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*******************************************************************************/
package org.eclipse.rdf4j.spring.util;
import static org.eclipse.rdf4j.spring.util.TypeMappingUtils.toBoolean;
import static org.eclipse.rdf4j.spring.util.TypeMappingUtils.toBooleanMaybe;
import static org.eclipse.rdf4j.spring.util.TypeMappingUtils.toBooleanOptional;
import static org.eclipse.rdf4j.spring.util.TypeMappingUtils.toIRI;
import static org.eclipse.rdf4j.spring.util.TypeMappingUtils.toIRIMaybe;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import org.eclipse.rdf4j.model.IRI;
/**
* @author Florian Kleedorfer
* @since 4.0.0
*/
public class ObjectMapUtils {
public static IRI getIRI(Map map, String key) {
return toIRI((String) map.get(key));
}
public static IRI getIRIMaybe(Map map, String key) {
return toIRIMaybe((String) map.get(key));
}
public static Boolean getBoolean(Map map, String key) {
return toBoolean((String) map.get(key));
}
public static Boolean getBooleanMaybe(Map map, String key) {
return toBooleanMaybe((Boolean) map.get(key));
}
public static Optional getBooleanOptional(Map map, String key) {
return toBooleanOptional((Boolean) map.get(key));
}
public static String getString(Map map, String key) {
String value = (String) map.get(key);
Objects.requireNonNull(value);
return value;
}
public static String getStringMaybe(Map map, String key) {
return (String) map.get(key);
}
public static Optional getStringOptional(Map map, String key) {
return Optional.ofNullable(getStringMaybe(map, key));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy