Mantid
Loading...
Searching...
No Matches
PropertyManager.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7//----------------------------------------------------------------------
8// Includes
9//----------------------------------------------------------------------
11#include "MantidJson/Json.h"
18
19#include <json/json.h>
20
21namespace Mantid::Kernel {
22
23using std::string;
24
25namespace {
26// static logger reference
27Logger g_log("PropertyManager");
28
34const std::string createKey(const std::string &name) {
35 std::string key = name;
36 std::transform(key.begin(), key.end(), key.begin(), toupper);
37 return key;
38}
39} // namespace
40
41const std::string PropertyManager::INVALID_VALUES_SUFFIX = "_invalid_values";
43std::string PropertyManager::getInvalidValuesFilterLogName(const std::string &logName) {
45}
46std::string PropertyManager::getLogNameFromInvalidValuesFilter(const std::string &logName) {
47 std::string retVal = "";
49 retVal = logName.substr(0, logName.size() - PropertyManager::INVALID_VALUES_SUFFIX.size());
50 }
51 return retVal;
52}
53
55bool PropertyManager::isAnInvalidValuesFilterLog(const std::string &logName) {
57 if (logName.length() >= ending.length()) {
58 return (0 == logName.compare(logName.length() - ending.length(), ending.length(), ending));
59 } else {
60 return false;
61 }
62}
63//-----------------------------------------------------------------------------------------------
65PropertyManager::PropertyManager() : m_properties(), m_orderedProperties() {}
66
67//-----------------------------------------------------------------------------------------------
71 : m_properties(), m_orderedProperties(other.m_orderedProperties.size()) {
72 // We need to do a deep copy of the property pointers here
73 for (unsigned int i = 0; i < m_orderedProperties.size(); ++i) {
74 auto p = std::unique_ptr<Property>(other.m_orderedProperties[i]->clone());
75 this->m_orderedProperties[i] = p.get();
76 this->m_properties[createKey(p->name())] = std::move(p);
77 }
78}
79
80//-----------------------------------------------------------------------------------------------
85 // We need to do a deep copy here
86 if (this != &other) {
87 this->m_properties.clear();
88 this->m_orderedProperties.resize(other.m_orderedProperties.size());
89 for (unsigned int i = 0; i < m_orderedProperties.size(); ++i) {
90 auto p = std::unique_ptr<Property>(other.m_orderedProperties[i]->clone());
91 this->m_orderedProperties[i] = p.get();
92 this->m_properties[createKey(p->name())] = std::move(p);
93 }
94 }
95 return *this;
96}
97
98//-----------------------------------------------------------------------------------------------
101
102//-----------------------------------------------------------------------------------------------
109 // Iterate through all properties on the RHS
110 PropertyMap::const_iterator it;
111 for (it = rhs.m_properties.begin(); it != rhs.m_properties.end(); ++it) {
112 // The name on the rhs
113 string rhs_name = it->first;
114 try {
115 Property *lhs_prop = this->getPointerToProperty(rhs_name);
116 // Use the property's += operator to add THAT. Isn't abstraction fun?!
117 (*lhs_prop) += it->second.get();
118 } catch (Exception::NotFoundError &) {
119 // The property isnt on the lhs.
120 // Let's copy it
121 auto copy = std::unique_ptr<Property>(it->second->clone());
122 // And we add a copy of that property to *this
123 this->declareProperty(std::move(copy), "");
124 }
125 }
126
127 return *this;
128}
129
130//-----------------------------------------------------------------------------------------------
139 const std::vector<std::string> &excludedFromFiltering) {
140 auto filter = logFilter->filter();
141 for (auto &orderedProperty : m_orderedProperties) {
142 // cppcheck-suppress invalidLifetime
143 std::string const propName = orderedProperty->name();
144 if (std::find(excludedFromFiltering.cbegin(), excludedFromFiltering.cend(), propName) !=
145 excludedFromFiltering.cend()) {
146 // this log should be excluded from filtering
147 continue;
148 }
149
150 if (auto doubleSeries = dynamic_cast<TimeSeriesProperty<double> *>(orderedProperty)) {
151 // don't filter the invalid values filters
153 break;
154 std::unique_ptr<Property> filtered(nullptr);
156
157 // add the filter to the passed in filters
159 auto const *tspFilterProp = dynamic_cast<TimeSeriesProperty<bool> const *>(filterProp);
160 if (!tspFilterProp)
161 break;
162 logFilter->addFilter(*tspFilterProp);
163
164 filtered = std::make_unique<FilteredTimeSeriesProperty<double>>(doubleSeries, *logFilter->filter());
165 } else if (filter->size() > 0) {
166 // attach the filter to the TimeSeriesProperty, thus creating the FilteredTimeSeriesProperty<double>
167 filtered = std::make_unique<FilteredTimeSeriesProperty<double>>(doubleSeries, *filter);
168 }
169 if (filtered) {
170 // Now replace in the map
171 orderedProperty = filtered.get();
172 this->m_properties[createKey(propName)] = std::move(filtered);
173 }
174 }
175 }
176}
177
187 PropertyManager *newMgr = new PropertyManager();
188 newMgr->m_orderedProperties.reserve(m_orderedProperties.size());
189 // We need to do a deep copy of the property pointers here
190 for (auto const *prop : m_orderedProperties) {
191 std::unique_ptr<Property> newProp;
192 if (auto const *tsp = dynamic_cast<ITimeSeriesProperty const *>(prop))
193 newProp = std::unique_ptr<Property>(tsp->cloneInTimeROI(timeROI));
194 else
195 newProp = std::unique_ptr<Property>(prop->clone());
196 newMgr->m_orderedProperties.emplace_back(newProp.get());
197 newMgr->m_properties[createKey(newProp->name())] = std::move(newProp);
198 }
199 return newMgr;
200}
201
208 for (auto prop : m_orderedProperties) {
209 if (auto tsp = dynamic_cast<ITimeSeriesProperty *>(prop))
210 tsp->removeDataOutsideTimeROI(timeROI);
211 }
212}
213
214//-----------------------------------------------------------------------------------------------
222void PropertyManager::declareProperty(std::unique_ptr<Property> p, const std::string &doc) {
223 p->setDocumentation(doc);
224
225 const std::string key = createKey(p->name());
226 auto existing = m_properties.find(key);
227 if (existing == m_properties.end()) {
228 m_orderedProperties.emplace_back(p.get());
229 m_properties[key] = std::move(p);
230 } else {
231 // Don't error if this is actually the same property object!
232 if (existing->second != p) {
233 throw Exception::ExistsError("Property with given name already exists", key);
234 }
235 }
236}
237
243void PropertyManager::declareOrReplaceProperty(std::unique_ptr<Property> p, const std::string &doc) {
244 p->setDocumentation(doc);
245
246 const std::string key = createKey(p->name());
247 auto existing = m_properties.find(key);
248 if (existing != std::end(m_properties)) {
249 // replace it in the same position
250 auto oldPropPtr = existing->second.get();
251 auto ordereredPropPos = std::find(std::begin(m_orderedProperties), std::end(m_orderedProperties), oldPropPtr);
252 // if the property exists it should be guaranteed to be in the ordered list
253 // by declareProperty
254 assert(ordereredPropPos != std::end(m_orderedProperties));
255 *ordereredPropPos = p.get();
256 } else {
257 m_orderedProperties.emplace_back(p.get());
258 }
259 m_properties[key] = std::move(p);
260}
261
265 for (auto &prop : getProperties()) {
266 if (!prop->isDefault())
267 prop->setValue(prop->getDefault());
268 }
269}
270
271//-----------------------------------------------------------------------------------------------
283void PropertyManager::setProperties(const std::string &propertiesJson,
284 const std::unordered_set<std::string> &ignoreProperties, bool createMissing) {
285 setProperties(propertiesJson, this, ignoreProperties, createMissing);
286}
287//-----------------------------------------------------------------------------------------------
301void PropertyManager::setProperties(const std::string &propertiesJson, IPropertyManager *targetPropertyManager,
302 const std::unordered_set<std::string> &ignoreProperties, bool createMissing) {
303 ::Json::Value jsonValue;
304
305 if (Mantid::JsonHelpers::parse(propertiesJson, &jsonValue)) {
306 setProperties(jsonValue, targetPropertyManager, ignoreProperties, createMissing);
307 } else {
308 throw std::invalid_argument("propertiesArray was not valid json");
309 }
310}
311//-----------------------------------------------------------------------------------------------
319void PropertyManager::setProperties(const ::Json::Value &jsonValue,
320 const std::unordered_set<std::string> &ignoreProperties, bool createMissing) {
321 setProperties(jsonValue, this, ignoreProperties, createMissing);
322}
323
324//-----------------------------------------------------------------------------------------------
334void PropertyManager::setProperties(const ::Json::Value &jsonValue, IPropertyManager *targetPropertyManager,
335 const std::unordered_set<std::string> &ignoreProperties, bool createMissing) {
336 if (jsonValue.type() != ::Json::ValueType::objectValue)
337 return;
338
339 // Some algorithms require Filename to be set first do that here
340 static const std::string propFilename = "Filename";
341 const ::Json::Value &filenameValue = jsonValue[propFilename];
342 if (!filenameValue.isNull()) {
343 const std::string value = filenameValue.asString();
344 // Set it
345 targetPropertyManager->setPropertyValue(propFilename, value);
346 }
347 const auto memberNames = jsonValue.getMemberNames();
348 for (::Json::ArrayIndex i = 0; i < jsonValue.size(); i++) {
349 const auto &propName = memberNames[i];
350 if ((propFilename == propName) || (ignoreProperties.find(propName) != ignoreProperties.end())) {
351 continue;
352 }
353 const ::Json::Value &propValue = jsonValue[propName];
354 if (createMissing) {
355 targetPropertyManager->declareOrReplaceProperty(decodeAsProperty(propName, propValue));
356 } else {
357 targetPropertyManager->setPropertyValueFromJson(propName, propValue);
358 }
359 }
360}
361
368void PropertyManager::setPropertiesWithString(const std::string &propertiesString,
369 const std::unordered_set<std::string> &ignoreProperties) {
370 if (propertiesString.empty()) {
371 return;
372 }
373 auto firstSymbol = propertiesString.find_first_not_of(" \n\t");
374 if (firstSymbol == std::string::npos) {
375 return;
376 }
377 if (propertiesString[firstSymbol] == '{') {
378 setPropertiesWithJSONString(propertiesString, ignoreProperties);
379 } else {
380 setPropertiesWithSimpleString(propertiesString, ignoreProperties);
381 }
382}
383
389void PropertyManager::setPropertiesWithJSONString(const std::string &propertiesString,
390 const std::unordered_set<std::string> &ignoreProperties) {
391 ::Json::Value propertyJson;
392
393 if (Mantid::JsonHelpers::parse(propertiesString, &propertyJson)) {
394 setProperties(propertyJson, ignoreProperties);
395 } else {
396 throw std::invalid_argument("Could not parse JSON string when trying to set a property from: " + propertiesString);
397 }
398}
399
406void PropertyManager::setPropertiesWithSimpleString(const std::string &propertiesString,
407 const std::unordered_set<std::string> &ignoreProperties) {
408 ::Json::Value propertyJson;
409 // Split up comma-separated properties
411
412 boost::char_separator<char> sep(";");
413 tokenizer propPairs(propertiesString, ";", Mantid::Kernel::StringTokenizer::TOK_TRIM);
414 // Iterate over the properties
415 for (const auto &pair : propPairs) {
416 size_t n = pair.find('=');
417 if (n != std::string::npos) {
418 // Normal "PropertyName=value" string.
419 std::string propName;
420 std::string value;
421
422 // Extract the value string
423 if (n < pair.size() - 1) {
424 propName = pair.substr(0, n);
425 value = pair.substr(n + 1, pair.size() - n - 1);
426 } else {
427 // String is "PropertyName="
428 propName = pair.substr(0, n);
429 value = "";
430 }
431 // Set it
432 propertyJson[propName] = value;
433 }
434 }
435 setProperties(propertyJson, ignoreProperties);
436}
437
438//-----------------------------------------------------------------------------------------------
447void PropertyManager::setPropertyValue(const std::string &name, const std::string &value) {
448 auto *prop = getPointerToProperty(name);
449 auto helpMsg = prop->setValue(value);
451 if (!helpMsg.empty()) {
452 helpMsg = "Invalid value for property " + prop->name() + " (" + prop->type() + ") from string \"" + value +
453 "\": " + helpMsg;
454 throw std::invalid_argument(helpMsg);
455 }
456}
457
465void PropertyManager::setPropertyValueFromJson(const std::string &name, const Json::Value &value) {
466 auto *prop = getPointerToProperty(name);
467 auto helpMsg = prop->setValueFromJson(value);
469 if (!helpMsg.empty()) {
470 helpMsg = "Invalid value for property " + prop->name() + " (" + prop->type() + ") from Json \"" +
471 value.toStyledString() + "\": " + helpMsg;
472 throw std::invalid_argument(helpMsg);
473 }
474}
475
476//-----------------------------------------------------------------------------------------------
485void PropertyManager::setPropertyOrdinal(const int &index, const std::string &value) {
486 Property *p = getPointerToPropertyOrdinal(index); // throws runtime_error if property not in vector
487 std::string errorMsg = p->setValue(value);
488 this->afterPropertySet(p->name());
489 if (!errorMsg.empty()) {
490 errorMsg = "Invalid value for property " + p->name() + " (" + p->type() + ") \"" + value + "\" : " + errorMsg;
491 throw std::invalid_argument(errorMsg);
492 }
493}
494
495//-----------------------------------------------------------------------------------------------
501bool PropertyManager::existsProperty(const std::string &name) const {
502 const std::string key = createKey(name);
503 auto it = m_properties.find(key);
504 return (it != m_properties.end());
505}
506
507//-----------------------------------------------------------------------------------------------
512 bool allValid = true;
513 for (const auto &property : m_properties) {
514 // check for errors in each property
515 std::string error = property.second->isValid();
516 //"" means no error
517 if (!error.empty()) {
518 g_log.error() << "Property \"" << property.first << "\" is not set to a valid value: \"" << error << "\".\n";
519 allValid = false;
520 }
521 }
522 return allValid;
523}
524
525//-----------------------------------------------------------------------------------------------
531
532//-----------------------------------------------------------------------------------------------
538std::string PropertyManager::getPropertyValue(const std::string &name) const {
539 Property const *p = getPointerToProperty(name); // throws NotFoundError if property not in vector
540 return p->value();
541}
542
543//-----------------------------------------------------------------------------------------------
551std::string PropertyManager::asString(bool withDefaultValues) const {
552 Json::StreamWriterBuilder builder;
553 builder.settings_["indentation"] = "";
554 const string output = Json::writeString(builder, asJson(withDefaultValues));
555
556 return output;
557}
558
559//-----------------------------------------------------------------------------------------------
565::Json::Value PropertyManager::asJson(bool withDefaultValues) const {
566 ::Json::Value jsonMap;
567 const auto count = static_cast<int>(propertyCount());
568 for (int i = 0; i < count; ++i) {
570 if (isPropertyEnabled(p->name()) && p->isValueSerializable() && (withDefaultValues || !p->isDefault())) {
571 jsonMap[p->name()] = p->valueAsJson();
572 }
573 }
574
575 return jsonMap;
576}
577
579 if (other.m_properties.size() != m_properties.size())
580 return false;
581 for (const auto &[key, value] : m_properties) {
582 if (other.m_properties.count(key) != 1)
583 return false;
584 if (*other.m_properties.at(key) != *value)
585 return false;
586 }
587 return true;
588}
589
590bool PropertyManager::operator!=(const PropertyManager &other) const { return !this->operator==(other); }
591
592//-----------------------------------------------------------------------------------------------
599 const std::string key = createKey(name);
600 auto it = m_properties.find(key);
601 if (it != m_properties.end()) {
602 return it->second.get();
603 }
604 throw Exception::NotFoundError("Unknown property", name);
605}
606
607//-----------------------------------------------------------------------------------------------
613 const std::string key = createKey(name);
614 auto it = m_properties.find(key);
615 if (it != m_properties.end()) {
616 return it->second.get();
617 }
618 return nullptr;
619}
620
621//-----------------------------------------------------------------------------------------------
628
629 if (index < static_cast<int>(m_orderedProperties.size())) {
631 }
632 throw std::runtime_error("Property index too high");
633}
634
635//-----------------------------------------------------------------------------------------------
640const std::vector<Property *> &PropertyManager::getProperties() const { return m_orderedProperties; }
641
642//-----------------------------------------------------------------------------------------------
647std::vector<std::string> PropertyManager::getDeclaredPropertyNames() const noexcept {
648 std::vector<std::string> names;
649 const auto &props = getProperties();
650 names.reserve(props.size());
651 std::transform(props.cbegin(), props.cend(), std::back_inserter(names),
652 [](auto &propPtr) { return propPtr->name(); });
653 return names;
654}
655
656//-----------------------------------------------------------------------------------------------
674 return TypedValue(*this, name);
675}
676
677//-----------------------------------------------------------------------------------------------
682void PropertyManager::removeProperty(const std::string &name, const bool delproperty) {
683 if (existsProperty(name)) {
684 // remove it
686 const std::string key = createKey(name);
687 m_properties.erase(key);
688 std::vector<Property *>::iterator itr;
689 itr = find(m_orderedProperties.begin(), m_orderedProperties.end(), prop);
690 m_orderedProperties.erase(itr);
691 (void)delproperty; // not used
692 }
693}
694
700std::unique_ptr<Property> PropertyManager::takeProperty(const size_t index) {
701 try {
702 auto const *property = m_orderedProperties[index];
703 const std::string key = createKey(property->name());
704 auto propertyPtr = std::move(m_properties[key]);
705 m_properties.erase(key);
707 return propertyPtr;
708 } catch (const std::out_of_range &) {
709 return NULL;
710 }
711}
712
713//-----------------------------------------------------------------------------------------------
718 m_orderedProperties.clear();
719 m_properties.clear();
720}
721
722//-----------------------------------------------------------------------------------------------
728Json::Value encodeAsJson(const PropertyManager &propMgr) { return propMgr.asJson(true); }
729
730} // namespace Mantid::Kernel
std::string name
Definition Run.cpp:60
const std::vector< double > & rhs
double value
The value of the point.
Definition FitMW.cpp:51
double error
std::map< DeltaEMode::Type, std::string > index
int count
counter
Definition Matrix.cpp:37
Exception for when an item is already in a collection.
Definition Exception.h:164
Exception for when an item is not found in a collection.
Definition Exception.h:145
Interface to PropertyManager.
virtual void setPropertyValue(const std::string &name, const std::string &value)=0
Sets property value from a string.
virtual void declareOrReplaceProperty(std::unique_ptr< Property > p, const std::string &doc="")=0
Function to declare properties (i.e. store them)
virtual void afterPropertySet(const std::string &)
Override this method to perform a custom action right after a property was set.
bool isPropertyEnabled(const std::string &name) const
Test if a given property should be enabled.
virtual void setPropertyValueFromJson(const std::string &name, const Json::Value &value)=0
Sets property value from a Json::Value.
A non-templated interface to a TimeSeriesProperty.
This class is for filtering TimeSeriesProperty data.
Definition LogFilter.h:32
const TimeSeriesProperty< bool > * filter() const
Returns a reference to the filter.
Definition LogFilter.h:55
void addFilter(const TimeSeriesProperty< bool > &filter)
Adds a filter using boolean AND.
Definition LogFilter.cpp:55
void error(const std::string &msg)
Logs at error level.
Definition Logger.cpp:108
Property manager helper class.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
void clear() override final
Clears the whole property map.
bool operator!=(const PropertyManager &other) const
void setPropertyValue(const std::string &name, const std::string &value) override
Set the value of a property by string N.B.
bool validateProperties() const override
Validates all the properties in the collection.
void removeProperty(const std::string &name, const bool delproperty=true) override
removes the property from properties map
void setPropertyOrdinal(const int &index, const std::string &value) override
Set the value of a property by an index N.B.
void declareOrReplaceProperty(std::unique_ptr< Property > p, const std::string &doc="") override
Add or replace a property in the list of managed properties.
size_t propertyCount() const override
Count the number of properties under management.
PropertyManager & operator+=(const PropertyManager &rhs)
Addition operator.
PropertyManager()
Default constructor.
void resetProperties() override
Reset property values back to initial values (blank or default values)
Property * getPointerToProperty(const std::string &name) const override
Get a property by name.
bool existsProperty(const std::string &name) const override
Checks whether the named property is already in the list of managed property.
void setProperties(const std::string &propertiesJson, const std::unordered_set< std::string > &ignoreProperties=std::unordered_set< std::string >(), bool createMissing=false) override
Set the ordered list of properties by one string of values, separated by semicolons.
void setPropertiesWithString(const std::string &propertiesString, const std::unordered_set< std::string > &ignoreProperties=std::unordered_set< std::string >()) override
Sets all the declared properties from a string.
PropertyMap m_properties
The properties under management.
void removeDataOutsideTimeROI(const Kernel::TimeROI &timeROI)
For time series properties, remove time values outside of TimeROI regions, each defined as [roi_begin...
std::string asString(bool withDefaultValues=false) const override
Return the property manager serialized as a string.
void setPropertiesWithJSONString(const std::string &propertiesString, const std::unordered_set< std::string > &ignoreProperties)
Sets all the declared properties from a string.
static bool isAnInvalidValuesFilterLog(const std::string &logName)
Determine if the log's name has a substring indicating it should not be filtered.
void setPropertiesWithSimpleString(const std::string &propertiesString, const std::unordered_set< std::string > &ignoreProperties)
Sets all the declared properties from a string.
static std::string getInvalidValuesFilterLogName(const std::string &logName)
Gets the correct log name for the matching invalid values log for a given log name.
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
std::unique_ptr< Property > takeProperty(const size_t index) override
removes the property from the properties map and returns a pointer to it
static std::string getLogNameFromInvalidValuesFilter(const std::string &logName)
void filterByProperty(Mantid::Kernel::LogFilter *logFilter, const std::vector< std::string > &excludedFromFiltering=std::vector< std::string >()) override
Filter the managed properties by the given boolean property mask.
Property * getPointerToPropertyOrdinal(const int &index) const override
Get a property by an index.
::Json::Value asJson(bool withDefaultValues=false) const override
Return the property manager serialized as a json object.
Property * getPointerToPropertyOrNull(const std::string &name) const
Get a property by name.
std::vector< Property * > m_orderedProperties
Stores the order in which the properties were declared.
void declareProperty(std::unique_ptr< Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
PropertyManager & operator=(const PropertyManager &)
Assignment operator - performs a deep copy.
bool operator==(const PropertyManager &other) const
void setPropertyValueFromJson(const std::string &name, const Json::Value &value) override
Set the value of a property by Json::Value.
static const std::string INVALID_VALUES_SUFFIX
const std::vector< Property * > & getProperties() const override
Get the list of managed properties.
PropertyManager * cloneInTimeROI(const Kernel::TimeROI &timeROI)
Create a partial copy of this object such that every time series property is cloned according to the ...
virtual ~PropertyManager() override
Virtual destructor.
std::vector< std::string > getDeclaredPropertyNames() const noexcept override
Return the list of declared property names.
Base class for properties.
Definition Property.h:94
virtual std::string setValue(const std::string &)=0
Set the value of the property via a string.
virtual bool isDefault() const =0
Overriden function that returns if property has the same value that it was initialised with,...
const std::string & name() const
Get the property's name.
Definition Property.cpp:63
const std::string type() const
Returns the type of the property as a string.
Definition Property.cpp:89
virtual Json::Value valueAsJson() const =0
Returns the value of the property as a Json::Value.
virtual std::string value() const =0
Returns the value of the property as a string.
virtual bool isValueSerializable() const
Whether the string returned by value() can be used for serialization.
Definition Property.h:142
@ TOK_TRIM
remove leading and trailing whitespace from tokens
TimeROI : Object that holds information about when the time measurement was active.
Definition TimeROI.h:18
A specialised Property class for holding a series of time-value pairs.
MANTID_KERNEL_DLL std::unique_ptr< Property > decodeAsProperty(const std::string &name, const Json::Value &value)
Attempt to create a Property of the most appropriate type from a string name and Json value object.
MANTID_KERNEL_DLL::Json::Value encodeAsJson(const OptionalBool &)
Encode an OptionalBool as a Json::Value.
Utility class that enables the getProperty() method to effectively be templated on the return type.