@Override public Property newProperty(String key, Object val) { return new Property(key, val); }
protected void formatProperties(StringBuilder msg, Collection<Property> properties) { for (Property prop : properties) { if (prop.isTransient()) { continue; } msg.append("\n\t\t").append(prop.getKey()).append(": '").append(prop.getValue()).append(":") .append(prop.getDataType()).append(":").append(prop.getValueType()).append("'"); } } }
/** * Sets the type of property. * * @param key * of property * @param val * property value */ public void set(String key, Object val) { set(key, val, ValueTypes.VALUE_TYPE_NONE); }
@Override public String format(Property prop) { if (level == 9) { return super.format(prop); } if (prop == null || prop.isTransient()) { return EMPTY_STR; } Object value = prop.getValue(); if (isSpecialSuppress(value)) { return EMPTY_STR; } StringBuilder jsonString = new StringBuilder(256); jsonString.append(Utils.quote(StringEscapeUtils.escapeJson(getKeyStr(prop.getKey())))).append(ATTR_SEP); if (isNoNeedToQuote(value)) { jsonString.append(propValueToString(value)); } else { Utils.quote(StringEscapeUtils.escapeJson(propValueToString(value)), jsonString); } return jsonString.toString(); }
return property.getValue();
if (entry.isTransient()) { continue; buffer.append(END_ATTR); Object value = entry.getValue(); if (value instanceof DumpCollection) { buffer.append(subPadding); } else if (value instanceof Number) { buffer.append(subPadding); Utils.quote(entry.getKey(), buffer).append(": ").append(value); } else { buffer.append(subPadding); Utils.quote(entry.getKey(), buffer).append(": "); Utils.quote(value, buffer);
@Override public Snapshot add(Property property) { propSet.put(property.getKey(), property); return this; }
return property.getValue();
@Override public Property newProperty(String key, Object val, String valType) { return new Property(key, val, valType); }
@Override public String toString() { String key = getKey(); StringBuilder str = new StringBuilder(); str.append(getClass().getSimpleName()).append("{") .append("Name:").append(key).append(",") .append("Value:").append(getValue()).append(",") .append("Type:").append(getDataType()).append(",") .append("Value-Type:").append(getValueType()).append(",") .append("Transient:").append(isTransient()).append("}"); return str.toString(); } }
/** * Add a user defined property * * @param prop * property to be added * @see Property */ public void addProperty(Property prop) { properties.put(prop.getKey(), prop); }
/** * Constructs a Property objects with the specified properties. * * @param key * key of property * @param value * value for property * @param transient_ * flag indicating whether property is transient */ public Property(String key, Object value, boolean transient_) { set(key, value); this.transient_ = transient_; }
/** * Add a property with a given key and value. * * @param key * property key name * @param value * value associated with the key * @param transient_ * flag indicating whether property is transient * @return reference to this snapshot */ @Override public PropertySnapshot add(Object key, Object value, boolean transient_) { this.add(new Property(String.valueOf(key), value, transient_)); return this; }
if (prop == null || prop.isTransient()) { return EMPTY_STR; Object value = prop.getValue(); jsonString.append(START_JSON); jsonString.append(JSON_NAME_LABEL).append(ATTR_SEP); Utils.quote(StringEscapeUtils.escapeJson(prop.getKey()), jsonString).append(ATTR_JSON); jsonString.append(JSON_TYPE_LABEL).append(ATTR_SEP); Utils.quote(prop.getDataType(), jsonString).append(ATTR_JSON); if (prop.getValueType() != null && !prop.getValueType().equalsIgnoreCase(ValueTypes.VALUE_TYPE_NONE)) { jsonString.append(JSON_VALUE_TYPE_LABEL).append(ATTR_SEP); Utils.quote(prop.getValueType(), jsonString).append(ATTR_JSON);
/** * Finds snapshot contained property by defined property name ignoring case. * * @param snapshot * property snapshot instance * @param propName * property name * @return snapshot contained property */ public static Property getSnapPropertyIgnoreCase(Snapshot snapshot, String propName) { if (snapshot != null) { for (Property prop : snapshot.getSnapshot()) { if (prop.getKey().equalsIgnoreCase(propName)) { return prop; } } } return null; }
/** * Constructs a Property objects with the specified properties. * * @param key * key of property * @param value * value for property * @param valType * value type such as (currency, percent) * @param transient_ * flag indicating whether property is transient */ public Property(String key, Object value, String valType, boolean transient_) { set(key, value, valType); this.transient_ = transient_; }
/** * Add a property with a given key and value. * * @param key * property key name * @param value * value associated with the key * @param valType * value type such as (currency, percent). See {@link ValueTypes}. * @return reference to this snapshot */ @Override public PropertySnapshot add(Object key, Object value, String valType) { this.add(new Property(key.toString(), value, valType)); return this; }
return new Property(getKey(key), pValue, getValueType(key));
throw new SAXParseException("<" + SIM_XML_PROP + ">: invalid type: " + type, saxLocator); return new Property(name, propValue, valType);