/** * This method is used to read the key value from the node. The value read from the node is * resolved using the template filter. If the key value can not be found according to the * annotation attributes then null is assumed and returned. * * @param node this is the node to read the key value from * @param value this is the value to deserialize in to * @return this returns the value deserialized from the node * @throws Exception if value is not null an exception is thrown */ public Object read(InputNode node, Object value) throws Exception { Position line = node.getPosition(); Class expect = type.getType(); if (value != null) { throw new PersistenceException("Can not read key of %s for %s at %s", expect, entry, line); } return read(node); }
/** * This method is used to read the key value from the node. The value read from the node is * resolved using the template filter. If the key value can not be found according to the * annotation attributes then null is assumed and returned. * * @param node this is the node to read the key value from * @return this returns the value deserialized from the node */ public Object read(InputNode node) throws Exception { Position line = node.getPosition(); Class expect = type.getType(); String name = entry.getKey(); if (name == null) { name = context.getName(expect); } if (entry.isAttribute()) { throw new AttributeException( "Can not have %s as an attribute for %s at %s", expect, entry, line); } return read(node, name); }