Update of /var/cvs/src/org/mmbase/bridge/implementation In directory james.mmbase.org:/tmp/cvs-serv29447
Modified Files: Tag: MMBase-1_8 BasicNode.java Log Message: ported wrapping with casting from 1.9. This makes no difference if the processor already produced the correct type, but makes them easier to implement, because you don't necessary need to return the excact correct type any more (it is sometimes hard to know that that is) See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/bridge/implementation Index: BasicNode.java =================================================================== RCS file: /var/cvs/src/org/mmbase/bridge/implementation/BasicNode.java,v retrieving revision 1.210.2.9 retrieving revision 1.210.2.10 diff -u -b -r1.210.2.9 -r1.210.2.10 --- BasicNode.java 11 Nov 2008 18:58:18 -0000 1.210.2.9 +++ BasicNode.java 9 Dec 2008 10:39:53 -0000 1.210.2.10 @@ -32,7 +32,7 @@ * @author Rob Vermeulen * @author Pierre van Rooden * @author Michiel Meeuwissen - * @version $Id: BasicNode.java,v 1.210.2.9 2008/11/11 18:58:18 michiel Exp $ + * @version $Id: BasicNode.java,v 1.210.2.10 2008/12/09 10:39:53 michiel Exp $ * @see org.mmbase.bridge.Node * @see org.mmbase.module.core.MMObjectNode */ @@ -347,7 +347,7 @@ Boolean result = Boolean.valueOf(noderef.getBooleanValue(fieldName)); if (nodeManager.hasField(fieldName)) { // gui(..) stuff could not work. Field field = nodeManager.getField(fieldName); - result = (Boolean) field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_BOOLEAN).process(this, field, result); + result = Boolean.valueOf(Casting.toBoolean(field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_BOOLEAN).process(this, field, result))); } return result.booleanValue(); } @@ -356,7 +356,7 @@ Date result = noderef.getDateValue(fieldName); if (nodeManager.hasField(fieldName)) { // gui(..) stuff could not work. Field field = nodeManager.getField(fieldName); - result = (Date) field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_DATETIME).process(this, field, result); + result = Casting.toDate(field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_DATETIME).process(this, field, result)); } return result; } @@ -365,7 +365,7 @@ List result = noderef.getListValue(fieldName); if (nodeManager.hasField(fieldName)) { // gui(..) stuff could not work. Field field = nodeManager.getField(fieldName); - result = (List) field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_LIST).process(this, field, result); + result = Casting.toList(field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_LIST).process(this, field, result)); } return result; @@ -394,7 +394,7 @@ } if (nodeManager.hasField(fieldName)) { // only if this is actually a field of this node-manager, otherewise it might be e.g. a request for an 'element' of a cluster node Field field = nodeManager.getField(fieldName); - result = (Node) field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_NODE).process(this, field, result); + result = Casting.toNode(field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_NODE).process(this, field, result), getCloud()); } return result; @@ -415,7 +415,7 @@ Float result = new Float(getNode().getFloatValue(fieldName)); if (nodeManager.hasField(fieldName)) { // gui(..) stuff could not work. Field field = nodeManager.getField(fieldName); - result = (Float) field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_FLOAT).process(this, field, result); + result = new Float(Casting.toFloat(field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_FLOAT).process(this, field, result))); } return result.floatValue(); } @@ -424,7 +424,7 @@ Long result = new Long(getNode().getLongValue(fieldName)); if (nodeManager.hasField(fieldName)) { // gui(..) stuff could not work. Field field = nodeManager.getField(fieldName); - result = (Long) field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_LONG).process(this, field, result); + result = new Long(Casting.toLong(field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_LONG).process(this, field, result))); } return result.longValue(); } @@ -433,7 +433,7 @@ Double result = new Double(getNode().getDoubleValue(fieldName)); if (nodeManager.hasField(fieldName)) { // gui(..) stuff could not work. Field field = nodeManager.getField(fieldName); - result = (Double) field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_DOUBLE).process(this, field, result); + result = new Double(Casting.toDouble(field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_DOUBLE).process(this, field, result))); } return result.doubleValue(); } @@ -442,7 +442,7 @@ byte[] result = getNode().getByteValue(fieldName); if (nodeManager.hasField(fieldName)) { // gui(..) stuff could not work. Field field = nodeManager.getField(fieldName); - result = (byte[]) field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_BINARY).process(this, field, result); + result = Casting.toByte(field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_BINARY).process(this, field, result)); } return result; } @@ -450,7 +450,7 @@ java.io.InputStream result = getNode().getInputStreamValue(fieldName); if (nodeManager.hasField(fieldName)) { // gui(..) stuff could not work. Field field = nodeManager.getField(fieldName); - result = (java.io.InputStream) field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_BINARY).process(this, field, result); + result = Casting.toInputStream(field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_BINARY).process(this, field, result)); } return result; } @@ -463,7 +463,7 @@ if (nodeManager.hasField(fieldName)) { // gui(..) stuff could not work. Field field = nodeManager.getField(fieldName); log.debug("" + field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_STRING)); - result = (String) field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_STRING).process(this, field, result); + result = Casting.toString(field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_STRING).process(this, field, result)); } return result; } @@ -472,7 +472,7 @@ Document result = getNode().getXMLValue(fieldName); if (nodeManager.hasField(fieldName)) { // gui(..) stuff could not work. Field field = nodeManager.getField(fieldName); - result = (Document) field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_XML).process(this, field, result); + result = Casting.toXML(field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_XML).process(this, field, result)); } return result; } _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs