java.lang.Object
org.apache.jena.sparql.util.Context
A class for setting and keeping named values. Used to pass
implementation-specific parameters across general interfaces.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()<V> Vcompute(Symbol key, BiFunction<Symbol, Object, ? extends V> remappingFunction) Atomic compute.<V> VcomputeIfAbsent(Symbol key, Function<Symbol, ? extends V> mappingFunction) Atomic computeIfAbsent.<V> VcomputeIfPresent(Symbol key, BiFunction<Symbol, Object, V> remappingFunction) Atomic computeIfPresent.copy()Return a copy of this context.static Contextcreate()Create an empty contextstatic final ContextEmpty, immutable contextbooleanstatic ContextfromDataset(DatasetGraph dataset) Return the context of the dataset (not copied); if the dataset is null, return null<T> TGet the object value of a property or null<T> TGet the object value of a property - return the default value if not present .getAsString(Symbol property) Get the value a string (uses .toString() if the value is not null)getAsString(Symbol property, String defaultValue) Get the value a string (uses .toString() if the value is not null) - supply a default string valuestatic AtomicBooleangetCancelSignal(Context context) intGet the value as a long value.longGet the value as a long value.static AtomicBooleangetOrSetCancelSignal(Context context) Get the context's cancel signal.getTrueOrFalse(Symbol property) Is the value true or false, either as a Boolean or a string.inthashCode()booleanTest whether a named value is a specific value (.equals)booleanhasValueAsString(Symbol property, String value) Test whether a named value (as a string) has a specific string formbooleanhasValueAsString(Symbol property, String value, boolean ignoreCase) Test whether a named value (as a string) has a specific string form - can ignore casebooleanIs a property set?booleanIs the value 'false' (either set to the string "false" or Boolean.FALSE)booleanisFalseOrUndef(Symbol property) Is the value 'false' (either set to the string "false" or Boolean.FALSE) or undefinedbooleanIs the value 'true' (either set to the string "true" or Boolean.TRUE)booleanisTrueOrUndef(Symbol property) Is the value 'true' (either set to the string "true" or Boolean.TRUE) or undefined?booleanIs a property not set?keys()Set of properties (as Symbols) currently definedstatic ContextMerge an outer (defaults to the system global context) and local context to produce a new context The new context is always a separate copy.voidStore a named value - overwrites any previous set value.voidvoidRemove any value associated with a propertyStore a named value - overwrites any previous set value.Store a named value - overwrites any previous set value.static voidsetCurrentDateTime(Context context) Set property value to be false.setIfUndef(Symbol property, Object value) Store a named value only if it is not currently set.Set property value to be true.static ContextsetupContextForDataset(Context globalContext, DatasetGraph dataset) Setup a context using another context and a dataset.intsize()Return the number of context itemstoString()Remove any value associated with a property.
-
Constructor Details
-
Context
public Context()Create an empty context
-
-
Method Details
-
emptyContext
Empty, immutable context -
create
Create an empty context -
copy
Return a copy of this context. Modifications of the copy do not affect the original context. -
get
Get the object value of a property or null -
get
Get the object value of a property - return the default value if not present . -
put
Store a named value - overwrites any previous set value. -
set
Store a named value - overwrites any previous set value. Returns "this". -
set
Store a named value - overwrites any previous set value. Returns "this". -
setIfUndef
Store a named value only if it is not currently set. Returns "this". -
setTrue
Set property value to be true. Returns "this". -
setFalse
Set property value to be false. Returns "this". -
setAll
-
putAll
-
remove
Remove any value associated with a property -
unset
Remove any value associated with a property. Returns "this". -
isDefined
Is a property set? -
isUndef
Is a property not set? -
getAsString
Get the value a string (uses .toString() if the value is not null) - supply a default string value -
getAsString
Get the value a string (uses .toString() if the value is not null) -
getInt
Get the value as a long value. The context entry can be a string, Integer or Long. -
getLong
Get the value as a long value. The context entry can be a string, Integer or Long. -
isTrue
Is the value 'true' (either set to the string "true" or Boolean.TRUE) -
isTrueOrUndef
Is the value 'true' (either set to the string "true" or Boolean.TRUE) or undefined? -
isFalse
Is the value 'false' (either set to the string "false" or Boolean.FALSE) -
isFalseOrUndef
Is the value 'false' (either set to the string "false" or Boolean.FALSE) or undefined -
getTrueOrFalse
Is the value true or false, either as a Boolean or a string. If undefined, return null. Exception if not a boolean or a string. -
hasValue
Test whether a named value is a specific value (.equals) -
hasValueAsString
Test whether a named value (as a string) has a specific string form -
hasValueAsString
Test whether a named value (as a string) has a specific string form - can ignore case -
keys
Set of properties (as Symbols) currently defined -
size
public int size()Return the number of context items -
clear
public void clear() -
toString
-
fromDataset
Return the context of the dataset (not copied); if the dataset is null, return null -
setupContextForDataset
Setup a context using another context and a dataset. -
setCurrentDateTime
-
getCancelSignal
-
compute
Atomic compute. -
computeIfAbsent
Atomic computeIfAbsent. -
computeIfPresent
Atomic computeIfPresent. -
getOrSetCancelSignal
Get the context's cancel signal. Create and set one if needed. Context must not be null. -
mergeCopy
Merge an outer (defaults to the system global context) and local context to produce a new context The new context is always a separate copy. -
hashCode
public int hashCode() -
equals
-