Package com.complexible.stardog.metadata
Class Metadata
java.lang.Object
com.complexible.stardog.metadata.Metadata
- All Implemented Interfaces:
Copyable<Metadata>,com.complexible.stardog.metadata.MetadataLookup,Iterable<MetaProperty<Object>>
public final class Metadata
extends Object
implements com.complexible.stardog.metadata.MetadataLookup, Copyable<Metadata>, Iterable<MetaProperty<Object>>
Mapping from Stardog meta properties to values. Similar to a standard
Map but with some key differences.
This class does not allow null options to be used as keys. The get(MetaProperty) function
may return a value even though an option is not contained in the map explicitly.
In such cases the default value of the option is returned.- Since:
- 0.9
- Version:
- 4.0
- Author:
- Evren Sirin, Edgar Rodriguez-Diaz
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all of the properties from this metadata.<V> booleancontains(MetaProperty<V> option) Returns true if this collection contains an explicit value for the specified option.copy()Creates a copy of the StardogOptions instance.static Metadatacreate()Creates a new empty mutable StardogOptions instance.static Metadataempty()Creates a new empty immutable StardogOptions instance.boolean<V> Vget(MetaProperty<V> option) Returns the value associated with the given property or thedefault valueof the property if there is no associated value.<V> Vget(MetaProperty<V> option, OptionFunction theDefaultValues) Returns the value associated with the given property in this metadata, if that does not exist looks up for a value in the giventheDefaultPropertiesand iof that does not exist either, return thedefault valueof the property.inthashCode()Creates an immutable shallow copy of the StardogOptions instance.iterator()static <V> Metadataof(MetaProperty<V> key, V value) Creates an immutable metadata instance with the given single mapping.<V> Vremove(MetaProperty<V> option) Removes any previous value associated with this option.<V> Metadataset(MetaProperty<V> option, V value) Associate the given value with the given option overriding any previous value.<V> MetadataCopies all of the option value mappings from the specified map to this map overriding Sets all the options in the given map the given option overriding any previous value .intsize()Gets the number of properties in the Metadata.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface com.complexible.stardog.metadata.MetadataLookup
is
-
Method Details
-
iterator
- Specified by:
iteratorin interfaceIterable<MetaProperty<Object>>
-
copy
Creates a copy of the StardogOptions instance. The copy can be updated freely without affecting this map. -
immutable
Creates an immutable shallow copy of the StardogOptions instance. The result is a shallow copy so updating the original metadata values will affect the immutable copy. If this needs to be avoidedaMetadata.copy().immutable()can be used.- Returns:
- a new map instance that will throw exceptions on modification function
-
empty
Creates a new empty immutable StardogOptions instance. -
of
Creates an immutable metadata instance with the given single mapping. -
create
Creates a new empty mutable StardogOptions instance. -
contains
Returns true if this collection contains an explicit value for the specified option. -
get
Returns the value associated with the given property or thedefault valueof the property if there is no associated value. The default value for an option might benullso there are cases this function will return anullvalue. Must be used with care in autoboxing.- Specified by:
getin interfacecom.complexible.stardog.metadata.MetadataLookup- See Also:
-
get
Returns the value associated with the given property in this metadata, if that does not exist looks up for a value in the giventheDefaultPropertiesand iof that does not exist either, return thedefault valueof the property. -
set
Associate the given value with the given option overriding any previous value.- Returns:
- a reference to this map to allow method chaining
-
setAll
Copies all of the option value mappings from the specified map to this map overriding Sets all the options in the given map the given option overriding any previous value .- Returns:
- a reference to this map to allow method chaining
-
remove
Removes any previous value associated with this option.- Returns:
- the previous value associated with this value in the map or the default value of the option if the option value was not set in the map
-
clear
public void clear()Removes all of the properties from this metadata. -
size
public int size()Gets the number of properties in the Metadata.- Returns:
- the number of properties in the Metadata
-
equals
-
hashCode
public int hashCode() -
toString
-