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,java.lang.Iterable<MetaProperty<java.lang.Object>>
public final class Metadata extends java.lang.Object implements com.complexible.stardog.metadata.MetadataLookup, Copyable<Metadata>, java.lang.Iterable<MetaProperty<java.lang.Object>>
Mapping from Stardog meta properties to values. Similar to a standardMapbut with some key differences. This class does not allownulloptions to be used as keys. Theget(MetaProperty)function may return a value even though an option is notcontainedin the map explicitly. In such cases thedefault valueof the option is returned.- Since:
- 0.9
- Version:
- 4.0
- Author:
- Evren Sirin, Edgar Rodriguez-Diaz
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()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.Metadatacopy()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.booleanequals(java.lang.Object o)<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()Metadataimmutable()Creates an immutable shallow copy of the StardogOptions instance.java.util.Iterator<MetaProperty<java.lang.Object>>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> MetadatasetAll(Metadata theOtherMap)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 .intsize()Gets the number of properties in the Metadata.java.lang.StringtoString()
-
-
-
Method Detail
-
iterator
@Nonnull public java.util.Iterator<MetaProperty<java.lang.Object>> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<MetaProperty<java.lang.Object>>
-
copy
public Metadata copy()
Creates a copy of the StardogOptions instance. The copy can be updated freely without affecting this map.
-
immutable
public Metadata 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
public static Metadata empty()
Creates a new empty immutable StardogOptions instance.
-
of
public static <V> Metadata of(MetaProperty<V> key, V value)
Creates an immutable metadata instance with the given single mapping.
-
create
public static Metadata create()
Creates a new empty mutable StardogOptions instance.
-
contains
public <V> boolean contains(MetaProperty<V> option)
Returns true if this collection contains an explicit value for the specified option.
-
get
public <V> V get(MetaProperty<V> option)
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:
MetadataLookup.is(MetaProperty)
-
get
public <V> V get(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.
-
set
public <V> Metadata set(MetaProperty<V> option, V value)
Associate the given value with the given option overriding any previous value.- Returns:
- a reference to this map to allow method chaining
-
setAll
public <V> Metadata setAll(Metadata theOtherMap)
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
public <V> V remove(MetaProperty<V> option)
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
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-