org.neo4j.jdbc.values.MapAccessorWithDefaultValue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neo4j-jdbc Show documentation
Show all versions of neo4j-jdbc Show documentation
Implementation of the Neo4j JDBC driver.
/*
* Copyright (c) 2023-2024 "Neo4j,"
* Neo4j Sweden AB [https://neo4j.com]
*
* This file is part of Neo4j.
*
* 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
*
* https://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 org.neo4j.jdbc.values;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
/**
* Provides methods to access the value of an underlying unordered map by key. When
* calling the methods, a user need to provide a default value, which will be given back
* if no match found by the key provided. The default value also servers the purpose of
* specifying the return type of the value found in map by key. If the type of the value
* found A differs from the type of the default value B, a cast from A to B would happen
* automatically. Note: Error might arise if the cast from A to B is not possible.
*
* @author Neo4j Drivers Team
* @since 6.0.0
*/
public interface MapAccessorWithDefaultValue extends MapAccessor {
/**
* Retrieve the value with the given key. If no value found by the key, then the
* default value provided would be returned.
* @param key the key of the value
* @param defaultValue the default value that would be returned if no value found by
* the key in the map
* @return the value found by the key or the default value if no such key exists
*/
Value get(String key, Value defaultValue);
/**
* Retrieve the object with the given key. If no object found by the key, then the
* default object provided would be returned.
* @param key the key of the object
* @param defaultValue the default object that would be returned if no object found by
* the key in the map
* @return the object found by the key or the default object if no such key exists
*/
Object get(String key, Object defaultValue);
/**
* Retrieve the number with the given key. If no number found by the key, then the
* default number provided would be returned.
* @param key the key of the number
* @param defaultValue the default number that would be returned if no number found by
* the key in the map
* @return the number found by the key or the default number if no such key exists
*/
Number get(String key, Number defaultValue);
/**
* Retrieve the entity with the given key. If no entity found by the key, then the
* default entity provided would be returned.
* @param key the key of the entity
* @param defaultValue the default entity that would be returned if no entity found by
* the key in the map
* @return the entity found by the key or the default entity if no such key exists
*/
Entity get(String key, Entity defaultValue);
/**
* Retrieve the node with the given key. If no node found by the key, then the default
* node provided would be returned.
* @param key the key of the node
* @param defaultValue the default node that would be returned if no node found by the
* key in the map
* @return the node found by the key or the default node if no such key exists
*/
Node get(String key, Node defaultValue);
/**
* Retrieve the path with the given key. If no path found by the key, then the default
* path provided would be returned.
* @param key the key of the property
* @param defaultValue the default path that would be returned if no path found by the
* key in the map
* @return the path found by the key or the default path if no such key exists
*/
Path get(String key, Path defaultValue);
/**
* Retrieve the value with the given key. If no value found by the key, then the
* default value provided would be returned.
* @param key the key of the property
* @param defaultValue the default value that would be returned if no value found by
* the key in the map
* @return the value found by the key or the default value if no such key exists
*/
Relationship get(String key, Relationship defaultValue);
/**
* Retrieve the list of objects with the given key. If no value found by the key, then
* the default value provided would be returned.
* @param key the key of the value
* @param defaultValue the default value that would be returned if no value found by
* the key in the map
* @return the list of objects found by the key or the default value if no such key
* exists
*/
List