public class Context extends Object
Modifier and Type | Field and Description |
---|---|
static Context |
emptyContext |
Constructor and Description |
---|
Context()
Create an empty context
|
Context(Context cxt)
Create a context and initialize it with a copy of the named values of
another one.
|
Modifier and Type | Method and Description |
---|---|
Context |
copy()
Return a copy of this context.
|
boolean |
equals(Object obj) |
<T> T |
get(Symbol property)
Get the object value of a property or null
|
Object |
get(Symbol property,
Object defaultValue)
Get the object value of a property - return the default value if not
present .
|
String |
getAsString(Symbol property)
Get the value a string (uses .toString() if the value is not null)
|
String |
getAsString(Symbol property,
String defaultValue)
Get the value a string (uses .toString() if the value is not null) -
supply a default string value
|
int |
getInt(Symbol symbol,
int defaultValue)
Get the value as a long value.
|
long |
getLong(Symbol symbol,
long defaultValue)
Get the value as a long value.
|
int |
hashCode() |
boolean |
hasValue(Symbol property,
Object value)
Test whether a named value is a specific value (.equals)
|
boolean |
hasValueAsString(Symbol property,
String value)
Test whether a named value (as a string) has a specific string form
|
boolean |
hasValueAsString(Symbol property,
String value,
boolean ignoreCase)
Test whether a named value (as a string) has a specific string form - can
ignore case
|
boolean |
isDefined(Symbol property)
Is a property set?
|
boolean |
isFalse(Symbol property)
Is the value 'false' (either set to the string "false" or Boolean.FALSE)
|
boolean |
isFalseOrUndef(Symbol property)
Is the value 'false' (either set to the string "false" or Boolean.FALSE)
or undefined
|
boolean |
isTrue(Symbol property)
Is the value 'true' (either set to the string "true" or Boolean.TRUE)
|
boolean |
isTrueOrUndef(Symbol property)
Is the value 'true' (either set to the string "true" or Boolean.TRUE) or
undefined?
|
boolean |
isUndef(Symbol property)
Is a property not set?
|
Set<Symbol> |
keys()
Set of properties (as Symbols) currently defined
|
static Context |
mergeCopy(Context contextGlobal,
Context contextLocal)
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.
|
void |
put(Symbol property,
Object value)
Store a named value - overwrites any previous set value
|
void |
putAll(Context other) |
void |
remove(Symbol property)
Remove any value associated with a property
|
void |
set(Symbol property,
boolean value)
Store a named value - overwrites any previous set value
|
void |
set(Symbol property,
Object value)
Store a named value - overwrites any previous set value
|
static void |
setCurrentDateTime(Context context) |
void |
setFalse(Symbol property)
Set property value to be false
|
void |
setIfUndef(Symbol property,
Object value)
Store a named value only if it is not currently set
|
void |
setTrue(Symbol property)
Set property value to be true
|
static Context |
setupContextForDataset(Context globalContext,
DatasetGraph dataset)
Setup a context using another context and a dataset.
|
int |
size()
Return the number of context items
|
String |
toString() |
void |
unset(Symbol property)
Remove any value associated with a property - alternative method name
|
public static final Context emptyContext
public Context()
public Context(Context cxt)
public Context copy()
public <T> T get(Symbol property)
public Object get(Symbol property, Object defaultValue)
public void put(Symbol property, Object value)
public void set(Symbol property, Object value)
public void set(Symbol property, boolean value)
public void setIfUndef(Symbol property, Object value)
public void remove(Symbol property)
public void unset(Symbol property)
public boolean isDefined(Symbol property)
public boolean isUndef(Symbol property)
public String getAsString(Symbol property, String defaultValue)
public String getAsString(Symbol property)
public int getInt(Symbol symbol, int defaultValue)
public long getLong(Symbol symbol, long defaultValue)
public void putAll(Context other)
public void setTrue(Symbol property)
public void setFalse(Symbol property)
public boolean isTrue(Symbol property)
public boolean isTrueOrUndef(Symbol property)
public boolean isFalse(Symbol property)
public boolean isFalseOrUndef(Symbol property)
public boolean hasValue(Symbol property, Object value)
public boolean hasValueAsString(Symbol property, String value)
public boolean hasValueAsString(Symbol property, String value, boolean ignoreCase)
public int size()
public static Context setupContextForDataset(Context globalContext, DatasetGraph dataset)
public static void setCurrentDateTime(Context context)
public static Context mergeCopy(Context contextGlobal, Context contextLocal)
Licenced under the Apache License, Version 2.0