Class PropertyUtilities
- java.lang.Object
-
- de.julielab.neo4j.plugins.auxiliaries.PropertyUtilities
-
- Direct Known Subclasses:
NodeUtilities
public class PropertyUtilities extends Object
-
-
Constructor Summary
Constructors Constructor Description PropertyUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> intaddToArrayProperty(org.neo4j.graphdb.Entity node, String key, T value)Adds value to the property with name key but does not allow duplicates or null values.static <T> intaddToArrayProperty(org.neo4j.graphdb.Entity node, String key, T value, boolean allowDuplicates)static <T> intaddToArrayProperty(org.neo4j.graphdb.Entity node, String key, T value, boolean allowDuplicates, boolean allowNullValues)static voidcopyObjectToEntity(Object object, org.neo4j.graphdb.Entity node)static voidcopyObjectToEntity(Object object, org.neo4j.graphdb.Entity node, String... exclusions)static voidcopyObjectToEntity(Object object, org.neo4j.graphdb.Entity node, Set<String> exclusions)static intfindFirstValueInArrayProperty(org.neo4j.graphdb.Node term, String key, String value)static StringgetNodePropertiesAsString(org.neo4j.graphdb.Entity node)static ObjectgetNonNullNodeProperty(org.neo4j.graphdb.Entity node, String key)Returns the property stored at key key in the specified property container or null.static booleanhasContradictingPropertyValue(org.neo4j.graphdb.Entity term, String key, Object valueToCompare)Determines whether the property container has a value for the property with key key and this value does not equal valueToCompare.static booleanhasSamePropertyValue(org.neo4j.graphdb.Entity term, String key, Object valueToCompare)Checks whether the property container has the exact valueToCompare as value for the property identified by key.static <T> voidmergeArrayProperty(org.neo4j.graphdb.Entity node, String key, Supplier<T[]> arraySupplier)static <T> voidmergeArrayProperty(org.neo4j.graphdb.Entity node, String key, T[] array)Gets the current property values at key for the node node and adds them all into a single Set together with the contents of array to avoid duplicates.static voidmergeEntityIntoEntity(org.neo4j.graphdb.Node from, org.neo4j.graphdb.Node to, String... exclusions)static voidmergeObjectIntoEntity(Object object, org.neo4j.graphdb.Entity node, String... exclusions)static voidmergeObjectIntoEntity(Object object, org.neo4j.graphdb.Entity node, Set<String> exclusions)static booleanmergeProperties(org.neo4j.graphdb.Entity propContainer, Object... properties)static voidsetNonNullNodeProperty(org.neo4j.graphdb.Entity node, String key, Object value)Sets the property at property key key of node to value, if value is not null and the property on the node not already set.static voidsetNonNullNodeProperty(org.neo4j.graphdb.Entity node, String key, Object value, Object defaultValue)Sets the property at property key key of node to value, if value is not null and the property on the node not already set.static voidsetNonNullNodeProperty(org.neo4j.graphdb.Entity node, String key, Supplier<Object> value)
-
-
-
Method Detail
-
copyObjectToEntity
public static void copyObjectToEntity(Object object, org.neo4j.graphdb.Entity node)
-
copyObjectToEntity
public static void copyObjectToEntity(Object object, org.neo4j.graphdb.Entity node, String... exclusions)
-
copyObjectToEntity
public static void copyObjectToEntity(Object object, org.neo4j.graphdb.Entity node, Set<String> exclusions)
-
mergeObjectIntoEntity
public static void mergeObjectIntoEntity(Object object, org.neo4j.graphdb.Entity node, String... exclusions)
-
mergeObjectIntoEntity
public static void mergeObjectIntoEntity(Object object, org.neo4j.graphdb.Entity node, Set<String> exclusions)
-
mergeEntityIntoEntity
public static void mergeEntityIntoEntity(org.neo4j.graphdb.Node from, org.neo4j.graphdb.Node to, String... exclusions)
-
mergeArrayProperty
public static <T> void mergeArrayProperty(org.neo4j.graphdb.Entity node, String key, Supplier<T[]> arraySupplier)
-
mergeArrayProperty
public static <T> void mergeArrayProperty(org.neo4j.graphdb.Entity node, String key, T[] array)Gets the current property values at key for the node node and adds them all into a single Set together with the contents of array to avoid duplicates. Then, the Set is converted back into an array which is then set as the new node property. ALinkedHashSetis used to maintain the original order. The original values are added first. Thus, new values are appended to the end of the new array.- Parameters:
node-key-array-
-
addToArrayProperty
public static <T> int addToArrayProperty(org.neo4j.graphdb.Entity node, String key, T value)Adds value to the property with name key but does not allow duplicates or null values.- Parameters:
node-key-value-- Returns:
-
addToArrayProperty
public static <T> int addToArrayProperty(org.neo4j.graphdb.Entity node, String key, T value, boolean allowDuplicates)
-
addToArrayProperty
public static <T> int addToArrayProperty(org.neo4j.graphdb.Entity node, String key, T value, boolean allowDuplicates, boolean allowNullValues)
-
setNonNullNodeProperty
public static void setNonNullNodeProperty(org.neo4j.graphdb.Entity node, String key, Supplier<Object> value)
-
setNonNullNodeProperty
public static void setNonNullNodeProperty(org.neo4j.graphdb.Entity node, String key, Object value)Sets the property at property key key of node to value, if value is not null and the property on the node not already set.- Parameters:
node-key-value-
-
setNonNullNodeProperty
public static void setNonNullNodeProperty(org.neo4j.graphdb.Entity node, String key, Object value, Object defaultValue)Sets the property at property key key of node to value, if value is not null and the property on the node not already set. If value is null, the property is set to defaultValue.- Parameters:
node-key-value-
-
getNonNullNodeProperty
public static Object getNonNullNodeProperty(org.neo4j.graphdb.Entity node, String key)
Returns the property stored at key key in the specified property container or null.- Parameters:
node-key-- Returns:
-
getNodePropertiesAsString
public static String getNodePropertiesAsString(org.neo4j.graphdb.Entity node)
-
findFirstValueInArrayProperty
public static int findFirstValueInArrayProperty(org.neo4j.graphdb.Node term, String key, String value)
-
hasSamePropertyValue
public static boolean hasSamePropertyValue(org.neo4j.graphdb.Entity term, String key, Object valueToCompare)Checks whether the property container has the exact valueToCompare as value for the property identified by key.- Parameters:
term-key-valueToCompare-- Returns:
-
hasContradictingPropertyValue
public static boolean hasContradictingPropertyValue(org.neo4j.graphdb.Entity term, String key, Object valueToCompare)Determines whether the property container has a value for the property with key key and this value does not equal valueToCompare. I.e. if the property value is null, this is not seen as a contradiction - not even if term of valueToCompare itself is null.- Parameters:
term-key-valueToCompare-- Returns:
-
mergeProperties
public static boolean mergeProperties(org.neo4j.graphdb.Entity propContainer, Object... properties)
-
-