C# OJAI Client API
MapRDB.Driver.Ojai.OjaiDocument Class Reference
Inheritance diagram for MapRDB.Driver.Ojai.OjaiDocument:
MapRDB.Driver.Ojai.IDocument

Public Member Functions

 OjaiDocument ()
 Constructor of OjaiDocument instance. More...
 
 OjaiDocument (string jsonString)
 Constructor of OjaiDocument instance from JSON string. More...
 
 OjaiDocument (IDictionary< string, OjaiValue > dictionary)
 Constructor of OjaiDocument instance from dictionary. More...
 
string ToJsonString ()
 Parse document into JSON string. More...
 
string ToJsonString (Formatting formatting)
 Parse document into JSON string. More...
 
IDictionary< string, OjaiValueToDictionary ()
 Return document as dictionary. More...
 
IDocument SetID (string value)
 Set string ID of document. More...
 
IDocument SetID (byte[] value)
 Set binary ID of document. More...
 
IDocument Set (string path, string value)
 Set string value in document at given path. More...
 
IDocument Set (string path, bool value)
 Set bool value in document at given path. More...
 
IDocument Set (string path, byte value)
 Set byte value in document at given path. More...
 
IDocument Set (string path, short value)
 Set short value in document at given path. More...
 
IDocument Set (string path, int value)
 Set int value in document at given path. More...
 
IDocument Set (string path, long value)
 Set long value in document at given path. More...
 
IDocument Set (string path, float value)
 Set float value in document at given path. More...
 
IDocument Set (string path, double value)
 Set double value in document at given path. More...
 
IDocument Set (string path, decimal value)
 Set decimal value in document at given path. More...
 
IDocument SetNull (string path)
 Set null value in document at given path. More...
 
IDocument Set (string path, OjaiDate value)
 Set OJAI date value in document at given path. More...
 
IDocument Set (string path, OjaiTime value)
 Set OJAI time value in document at given path. More...
 
IDocument Set (string path, OjaiTimestamp value)
 Set OJAI timestamp value in document at given path. More...
 
IDocument Set (string path, OjaiInterval value)
 Set OJAI interval value in document at given path. More...
 
IDocument Set (string path, byte[] value)
 Set binary value in document at given path. More...
 
IDocument SetList (string path, IList< OjaiValue > value)
 Set IList value in document at given path. More...
 
IDocument SetList (string path, IList< string > value)
 Set IList value in document at given path. More...
 
IDocument SetList (string path, IList< bool > value)
 Set IList value in document at given path. More...
 
IDocument SetList (string path, IList< byte > value)
 Set IList value in document at given path. More...
 
IDocument SetList (string path, IList< short > value)
 Set IList value in document at given path. More...
 
IDocument SetList (string path, IList< int > value)
 Set IList value in document at given path. More...
 
IDocument SetList (string path, IList< long > value)
 Set IList value in document at given path. More...
 
IDocument SetList (string path, IList< float > value)
 Set IList value in document at given path. More...
 
IDocument SetList (string path, IList< double > value)
 Set IList value in document at given path. More...
 
IDocument SetList (string path, IList< decimal > value)
 Set IList value in document at given path. More...
 
IDocument SetList (string path, IList< OjaiDate > value)
 Set IList value in document at given path. More...
 
IDocument SetList (string path, IList< OjaiTime > value)
 Set IList value in document at given path. More...
 
IDocument SetList (string path, IList< OjaiTimestamp > value)
 Set IList value in document at given path. More...
 
IDocument SetList (string path, IList< OjaiInterval > value)
 Set IList value in document at given path. More...
 
IDocument Set (string path, IDictionary< string, OjaiValue > value)
 Set dictionary value in document at given path. More...
 
IDocument Set (string path, IDocument value)
 Set document value in document at given path. More...
 
IDocument Delete (string path)
 Deletes the value at the specified FieldPath if it exists. More...
 
IDocument DeleteID ()
 Deletes the ID field. More...
 
string GetIdString ()
 Returns the String "id" of this document. More...
 
byte [] GetIdBinary ()
 Returns the Binary "id" of this document. More...
 
string GetString (string path)
 Returns the value at the specified fieldPath as a String object or null if the specified FieldPath does not exist in the document. More...
 
bool? GetBool (string path)
 Returns the value at the specified fieldPath as a bool object or null if the specified FieldPath does not exist in the document. More...
 
byte? GetByte (string path)
 Returns the value at the specified fieldPath as a byte object or null if the specified FieldPath does not exist in the document. More...
 
short? GetShort (string path)
 Returns the value at the specified fieldPath as a short object or null if the specified FieldPath does not exist in the document. More...
 
int? GetInt (string path)
 Returns the value at the specified fieldPath as a int object or null if the specified FieldPath does not exist in the document. More...
 
long? GetLong (string path)
 Returns the value at the specified fieldPath as a long object or null if the specified FieldPath does not exist in the document. More...
 
float? GetFloat (string path)
 Returns the value at the specified fieldPath as a float object or null if the specified FieldPath does not exist in the document. More...
 
double? GetDouble (string path)
 Returns the value at the specified fieldPath as a double object or null if the specified FieldPath does not exist in the document. More...
 
decimal? GetDecimal (string path)
 Returns the value at the specified fieldPath as a decimal object or null if the specified FieldPath does not exist in the document. More...
 
OjaiTime GetTime (string path)
 Returns the value at the specified fieldPath as a OjaiTime object or null if the specified FieldPath does not exist in the document. More...
 
OjaiDate GetDate (string path)
 Returns the value at the specified fieldPath as an OjaiDate object or null if the specified FieldPath does not exist in the document. More...
 
OjaiTimestamp GetTimestamp (string path)
 Returns the value at the specified fieldPath as an OjaiTimestamp object or null if the specified FieldPath does not exist in the document. More...
 
byte [] GetBinary (string path)
 Returns the value at the specified fieldPath as a byte[] object or null if the specified FieldPath does not exist in the document. More...
 
OjaiInterval GetInterval (string path)
 Returns the value at the specified fieldPath as an OjaiInterval object or null if the specified FieldPath does not exist in the document. More...
 
OjaiValue GetValue (string path)
 Returns the value at the specified fieldPath as an OjaiValue object or null if the specified FieldPath does not exist in the document. More...
 
IDictionary< string, OjaiValueGetDictionary (string path)
 Returns the value at the specified fieldPath as a Dictionary object or null if the specified FieldPath does not exist in the document. More...
 
IList< OjaiValueGetList (string path)
 Returns the value at the specified fieldPath as a List object or null if the specified FieldPath does not exist in the document. More...
 
IDocument Clear ()
 Clear document. More...
 
- Public Member Functions inherited from MapRDB.Driver.Ojai.IDocument
IDocument Set (string path, Byte[] value)
 Set binary value in document at given path. More...
 

Private Member Functions

internal bool CheckID ()
 Check if document has ID. More...
 
void SetOjai (string path, OjaiValue value)
 Set OJAI value in document at given path. More...
 
bool SetPath (IDictionary< string, OjaiValue > dictionary, OjaiValue value)
 Recursive method to validate path and set value. More...
 
bool SetListValue (IList< OjaiValue > list, int index, OjaiValue value)
 Recursive method to validate path and set value. More...
 
GetValue< T > (string path)
 Generic method to get value. More...
 
void GetValue (ref OjaiValue value, IDictionary< string, OjaiValue > dictionary, bool delete=false)
 Recursive method to validate path and get value. More...
 
void GetListValue (ref OjaiValue value, IList< OjaiValue > list, int index, bool delete)
 Recursive method to validate path and get value. More...
 
CheckValue< T > (OjaiValue value)
 Generic method to check value type. More...
 
Queue< string > ParseFieldPath (string path)
 Parse string path into queue. More...
 

Private Attributes

IDictionary< string, OjaiValue_internalDictionary
 
Regex _listPathRegex = new Regex("\\w+\\[\\d+\\]", RegexOptions.Compiled)
 
Regex _internalListPathRegex = new Regex("\\w*\\[\\d+\\]", RegexOptions.Compiled)
 
Regex _parsePathRegex = new Regex("(?:^|.)(\"(?:[^\"]+|\"\")*\"|[^.]*)", RegexOptions.Compiled)
 
Queue< string > _parsedPath
 

Constructor & Destructor Documentation

◆ OjaiDocument() [1/3]

MapRDB.Driver.Ojai.OjaiDocument.OjaiDocument ( )

Constructor of OjaiDocument instance.

◆ OjaiDocument() [2/3]

MapRDB.Driver.Ojai.OjaiDocument.OjaiDocument ( string  jsonString)

Constructor of OjaiDocument instance from JSON string.

◆ OjaiDocument() [3/3]

MapRDB.Driver.Ojai.OjaiDocument.OjaiDocument ( IDictionary< string, OjaiValue dictionary)

Constructor of OjaiDocument instance from dictionary.

Member Function Documentation

◆ CheckID()

internal bool MapRDB.Driver.Ojai.OjaiDocument.CheckID ( )
private

Check if document has ID.

◆ CheckValue< T >()

T MapRDB.Driver.Ojai.OjaiDocument.CheckValue< T > ( OjaiValue  value)
private

Generic method to check value type.

◆ Clear()

IDocument MapRDB.Driver.Ojai.OjaiDocument.Clear ( )

Clear document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ Delete()

IDocument MapRDB.Driver.Ojai.OjaiDocument.Delete ( string  path)

Deletes the value at the specified FieldPath if it exists.

Implements MapRDB.Driver.Ojai.IDocument.

◆ DeleteID()

IDocument MapRDB.Driver.Ojai.OjaiDocument.DeleteID ( )

Deletes the ID field.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetBinary()

byte [] MapRDB.Driver.Ojai.OjaiDocument.GetBinary ( string  path)

Returns the value at the specified fieldPath as a byte[] object or null if the specified FieldPath does not exist in the document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetBool()

bool? MapRDB.Driver.Ojai.OjaiDocument.GetBool ( string  path)

Returns the value at the specified fieldPath as a bool object or null if the specified FieldPath does not exist in the document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetByte()

byte? MapRDB.Driver.Ojai.OjaiDocument.GetByte ( string  path)

Returns the value at the specified fieldPath as a byte object or null if the specified FieldPath does not exist in the document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetDate()

OjaiDate MapRDB.Driver.Ojai.OjaiDocument.GetDate ( string  path)

Returns the value at the specified fieldPath as an OjaiDate object or null if the specified FieldPath does not exist in the document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetDecimal()

decimal? MapRDB.Driver.Ojai.OjaiDocument.GetDecimal ( string  path)

Returns the value at the specified fieldPath as a decimal object or null if the specified FieldPath does not exist in the document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetDictionary()

IDictionary<string, OjaiValue> MapRDB.Driver.Ojai.OjaiDocument.GetDictionary ( string  path)

Returns the value at the specified fieldPath as a Dictionary object or null if the specified FieldPath does not exist in the document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetDouble()

double? MapRDB.Driver.Ojai.OjaiDocument.GetDouble ( string  path)

Returns the value at the specified fieldPath as a double object or null if the specified FieldPath does not exist in the document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetFloat()

float? MapRDB.Driver.Ojai.OjaiDocument.GetFloat ( string  path)

Returns the value at the specified fieldPath as a float object or null if the specified FieldPath does not exist in the document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetIdBinary()

byte [] MapRDB.Driver.Ojai.OjaiDocument.GetIdBinary ( )

Returns the Binary "id" of this document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetIdString()

string MapRDB.Driver.Ojai.OjaiDocument.GetIdString ( )

Returns the String "id" of this document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetInt()

int? MapRDB.Driver.Ojai.OjaiDocument.GetInt ( string  path)

Returns the value at the specified fieldPath as a int object or null if the specified FieldPath does not exist in the document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetInterval()

OjaiInterval MapRDB.Driver.Ojai.OjaiDocument.GetInterval ( string  path)

Returns the value at the specified fieldPath as an OjaiInterval object or null if the specified FieldPath does not exist in the document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetList()

IList<OjaiValue> MapRDB.Driver.Ojai.OjaiDocument.GetList ( string  path)

Returns the value at the specified fieldPath as a List object or null if the specified FieldPath does not exist in the document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetListValue()

void MapRDB.Driver.Ojai.OjaiDocument.GetListValue ( ref OjaiValue  value,
IList< OjaiValue list,
int  index,
bool  delete 
)
private

Recursive method to validate path and get value.

◆ GetLong()

long? MapRDB.Driver.Ojai.OjaiDocument.GetLong ( string  path)

Returns the value at the specified fieldPath as a long object or null if the specified FieldPath does not exist in the document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetShort()

short? MapRDB.Driver.Ojai.OjaiDocument.GetShort ( string  path)

Returns the value at the specified fieldPath as a short object or null if the specified FieldPath does not exist in the document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetString()

string MapRDB.Driver.Ojai.OjaiDocument.GetString ( string  path)

Returns the value at the specified fieldPath as a String object or null if the specified FieldPath does not exist in the document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetTime()

OjaiTime MapRDB.Driver.Ojai.OjaiDocument.GetTime ( string  path)

Returns the value at the specified fieldPath as a OjaiTime object or null if the specified FieldPath does not exist in the document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetTimestamp()

OjaiTimestamp MapRDB.Driver.Ojai.OjaiDocument.GetTimestamp ( string  path)

Returns the value at the specified fieldPath as an OjaiTimestamp object or null if the specified FieldPath does not exist in the document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetValue() [1/2]

OjaiValue MapRDB.Driver.Ojai.OjaiDocument.GetValue ( string  path)

Returns the value at the specified fieldPath as an OjaiValue object or null if the specified FieldPath does not exist in the document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ GetValue() [2/2]

void MapRDB.Driver.Ojai.OjaiDocument.GetValue ( ref OjaiValue  value,
IDictionary< string, OjaiValue dictionary,
bool  delete = false 
)
private

Recursive method to validate path and get value.

◆ GetValue< T >()

T MapRDB.Driver.Ojai.OjaiDocument.GetValue< T > ( string  path)
private

Generic method to get value.

◆ ParseFieldPath()

Queue<string> MapRDB.Driver.Ojai.OjaiDocument.ParseFieldPath ( string  path)
private

Parse string path into queue.

◆ Set() [1/16]

IDocument MapRDB.Driver.Ojai.OjaiDocument.Set ( string  path,
string  value 
)

Set string value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ Set() [2/16]

IDocument MapRDB.Driver.Ojai.OjaiDocument.Set ( string  path,
bool  value 
)

Set bool value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ Set() [3/16]

IDocument MapRDB.Driver.Ojai.OjaiDocument.Set ( string  path,
byte  value 
)

Set byte value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ Set() [4/16]

IDocument MapRDB.Driver.Ojai.OjaiDocument.Set ( string  path,
short  value 
)

Set short value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ Set() [5/16]

IDocument MapRDB.Driver.Ojai.OjaiDocument.Set ( string  path,
int  value 
)

Set int value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ Set() [6/16]

IDocument MapRDB.Driver.Ojai.OjaiDocument.Set ( string  path,
long  value 
)

Set long value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ Set() [7/16]

IDocument MapRDB.Driver.Ojai.OjaiDocument.Set ( string  path,
float  value 
)

Set float value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ Set() [8/16]

IDocument MapRDB.Driver.Ojai.OjaiDocument.Set ( string  path,
double  value 
)

Set double value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ Set() [9/16]

IDocument MapRDB.Driver.Ojai.OjaiDocument.Set ( string  path,
decimal  value 
)

Set decimal value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ Set() [10/16]

IDocument MapRDB.Driver.Ojai.OjaiDocument.Set ( string  path,
OjaiDate  value 
)

Set OJAI date value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ Set() [11/16]

IDocument MapRDB.Driver.Ojai.OjaiDocument.Set ( string  path,
OjaiTime  value 
)

Set OJAI time value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ Set() [12/16]

IDocument MapRDB.Driver.Ojai.OjaiDocument.Set ( string  path,
OjaiTimestamp  value 
)

Set OJAI timestamp value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ Set() [13/16]

IDocument MapRDB.Driver.Ojai.OjaiDocument.Set ( string  path,
OjaiInterval  value 
)

Set OJAI interval value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ Set() [14/16]

IDocument MapRDB.Driver.Ojai.OjaiDocument.Set ( string  path,
byte []  value 
)

Set binary value in document at given path.

◆ Set() [15/16]

IDocument MapRDB.Driver.Ojai.OjaiDocument.Set ( string  path,
IDictionary< string, OjaiValue value 
)

Set dictionary value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ Set() [16/16]

IDocument MapRDB.Driver.Ojai.OjaiDocument.Set ( string  path,
IDocument  value 
)

Set document value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetID() [1/2]

IDocument MapRDB.Driver.Ojai.OjaiDocument.SetID ( string  value)

Set string ID of document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetID() [2/2]

IDocument MapRDB.Driver.Ojai.OjaiDocument.SetID ( byte []  value)

Set binary ID of document.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetList() [1/14]

IDocument MapRDB.Driver.Ojai.OjaiDocument.SetList ( string  path,
IList< OjaiValue value 
)

Set IList value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetList() [2/14]

IDocument MapRDB.Driver.Ojai.OjaiDocument.SetList ( string  path,
IList< string >  value 
)

Set IList value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetList() [3/14]

IDocument MapRDB.Driver.Ojai.OjaiDocument.SetList ( string  path,
IList< bool >  value 
)

Set IList value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetList() [4/14]

IDocument MapRDB.Driver.Ojai.OjaiDocument.SetList ( string  path,
IList< byte >  value 
)

Set IList value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetList() [5/14]

IDocument MapRDB.Driver.Ojai.OjaiDocument.SetList ( string  path,
IList< short >  value 
)

Set IList value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetList() [6/14]

IDocument MapRDB.Driver.Ojai.OjaiDocument.SetList ( string  path,
IList< int >  value 
)

Set IList value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetList() [7/14]

IDocument MapRDB.Driver.Ojai.OjaiDocument.SetList ( string  path,
IList< long >  value 
)

Set IList value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetList() [8/14]

IDocument MapRDB.Driver.Ojai.OjaiDocument.SetList ( string  path,
IList< float >  value 
)

Set IList value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetList() [9/14]

IDocument MapRDB.Driver.Ojai.OjaiDocument.SetList ( string  path,
IList< double >  value 
)

Set IList value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetList() [10/14]

IDocument MapRDB.Driver.Ojai.OjaiDocument.SetList ( string  path,
IList< decimal >  value 
)

Set IList value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetList() [11/14]

IDocument MapRDB.Driver.Ojai.OjaiDocument.SetList ( string  path,
IList< OjaiDate value 
)

Set IList value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetList() [12/14]

IDocument MapRDB.Driver.Ojai.OjaiDocument.SetList ( string  path,
IList< OjaiTime value 
)

Set IList value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetList() [13/14]

IDocument MapRDB.Driver.Ojai.OjaiDocument.SetList ( string  path,
IList< OjaiTimestamp value 
)

Set IList value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetList() [14/14]

IDocument MapRDB.Driver.Ojai.OjaiDocument.SetList ( string  path,
IList< OjaiInterval value 
)

Set IList value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetListValue()

bool MapRDB.Driver.Ojai.OjaiDocument.SetListValue ( IList< OjaiValue list,
int  index,
OjaiValue  value 
)
private

Recursive method to validate path and set value.

◆ SetNull()

IDocument MapRDB.Driver.Ojai.OjaiDocument.SetNull ( string  path)

Set null value in document at given path.

Implements MapRDB.Driver.Ojai.IDocument.

◆ SetOjai()

void MapRDB.Driver.Ojai.OjaiDocument.SetOjai ( string  path,
OjaiValue  value 
)
private

Set OJAI value in document at given path.

◆ SetPath()

bool MapRDB.Driver.Ojai.OjaiDocument.SetPath ( IDictionary< string, OjaiValue dictionary,
OjaiValue  value 
)
private

Recursive method to validate path and set value.

◆ ToDictionary()

IDictionary<string, OjaiValue> MapRDB.Driver.Ojai.OjaiDocument.ToDictionary ( )

Return document as dictionary.

Implements MapRDB.Driver.Ojai.IDocument.

◆ ToJsonString() [1/2]

string MapRDB.Driver.Ojai.OjaiDocument.ToJsonString ( )

Parse document into JSON string.

Implements MapRDB.Driver.Ojai.IDocument.

◆ ToJsonString() [2/2]

string MapRDB.Driver.Ojai.OjaiDocument.ToJsonString ( Formatting  formatting)

Parse document into JSON string.

Implements MapRDB.Driver.Ojai.IDocument.