protected Object[] asPropertyMapEntry (final Object key, final Object val) { if (isSafeForAnItemName(key) && (val == null || BeanCoderUtils.isPrimitive(val))) { return new Object[] { key, val }; } return null; }
protected Object decodePrimitive () throws BeanCoderException { final Class primitiveClass = currentClass(); final String text = currentText(); return BeanCoderUtils.newPrimitive(primitiveClass, text); }
protected void beginBean (final Object bean) throws BeanCoderException { beginWithClass(bean); if (BeanCoderUtils.isPrimitive(bean)) // // this may happen, for map entry keys that are primitive but // whose value is not a primitive { this.currentNode() .setProperty(this.nsp + PN_PVALUE, bean.toString()); } }
/** * Overriding decodeBean() to intercept decode request for * primitive encoded as beans (it occurs for certains map keys). */ protected Object decodeBean () throws BeanCoderException { if (this.currentNode().hasProperty(this.nsp + PN_PVALUE)) { return BeanCoderUtils.newPrimitive (currentClass(), this.currentNode().getProperty (this.nsp + PN_PVALUE).getString()); } return super.decodeBean(); }
if (BeanCoderUtils.isPrimitive(bean))