com.hp.hpl.jena.sparql.util
Class Context

java.lang.Object
  extended by com.hp.hpl.jena.sparql.util.Context

public class Context
extends Object

A class for setting and keeping named values. Used to pass implementation-specific parameters across general interfaces.


Constructor Summary
Context()
          Create an empty context
Context(Context cxt)
          Create a context and initialize it with a copy of the named values of another one.
 
Method Summary
 void addCallback(Callback m)
           
 Context copy()
          Return a copy of this context.
 Object 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
 List<Callback> getCallbacks()
           
 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
 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 removeCallback(Callback m)
           
 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
 void setFalse(Symbol property)
          Set propety 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 propety value to be true
static Context setupContext(Context context, DatasetGraph 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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Context

public Context()
Create an empty context


Context

public Context(Context cxt)
Create a context and initialize it with a copy of the named values of another one. Shallow copy: the values themselves are not copied

Method Detail

copy

public Context copy()
Return a copy of this context. Modifications of the copy do not affect the original context.


get

public Object get(Symbol property)
Get the object value of a property or null


get

public Object get(Symbol property,
                  Object defaultValue)
Get the object value of a property - return the default value if not present .


put

public void put(Symbol property,
                Object value)
Store a named value - overwrites any previous set value


set

public void set(Symbol property,
                Object value)
Store a named value - overwrites any previous set value


set

public void set(Symbol property,
                boolean value)
Store a named value - overwrites any previous set value


setIfUndef

public void setIfUndef(Symbol property,
                       Object value)
Store a named value only if it is not currently set


remove

public void remove(Symbol property)
Remove any value associated with a property


unset

public void unset(Symbol property)
Remove any value associated with a property - alternative method name


isDefined

public boolean isDefined(Symbol property)
Is a property set?


isUndef

public boolean isUndef(Symbol property)
Is a property not set?


getAsString

public String getAsString(Symbol property,
                          String defaultValue)
Get the value a string (uses .toString() if the value is not null) - supply a default string value


getAsString

public String getAsString(Symbol property)
Get the value a string (uses .toString() if the value is not null)


putAll

public void putAll(Context other)

setTrue

public void setTrue(Symbol property)
Set propety value to be true


setFalse

public void setFalse(Symbol property)
Set propety value to be false


isTrue

public boolean isTrue(Symbol property)
Is the value 'true' (either set to the string "true" or Boolean.TRUE)


isTrueOrUndef

public boolean isTrueOrUndef(Symbol property)
Is the value 'true' (either set to the string "true" or Boolean.TRUE) or undefined?


isFalse

public boolean isFalse(Symbol property)
Is the value 'false' (either set to the string "false" or Boolean.FALSE)


isFalseOrUndef

public boolean isFalseOrUndef(Symbol property)
Is the value 'false' (either set to the string "false" or Boolean.FALSE) or undefined


hasValue

public boolean hasValue(Symbol property,
                        Object value)
Test whether a named value is a specific value (.equals)


hasValueAsString

public boolean hasValueAsString(Symbol property,
                                String value)
Test whether a named value (as a string) has a specific string form


hasValueAsString

public boolean hasValueAsString(Symbol property,
                                String value,
                                boolean ignoreCase)
Test whether a named value (as a string) has a specific string form - can ignore case


keys

public Set<Symbol> keys()
Set of properties (as Symbols) currently defined


size

public int size()
Return the number of context items


addCallback

public void addCallback(Callback m)

removeCallback

public void removeCallback(Callback m)

getCallbacks

public List<Callback> getCallbacks()

toString

public String toString()
Overrides:
toString in class Object

setupContext

public static Context setupContext(Context context,
                                   DatasetGraph dataset)


Licenced under the Apache License, Version 2.0