Update of /var/cvs/src/org/mmbase/bridge/implementation In directory james.mmbase.org:/tmp/cvs-serv20343
Modified Files: BasicNode.java Log Message: wrapped all processor results in casting, which makes it easier to implement them 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.230 retrieving revision 1.231 diff -u -b -r1.230 -r1.231 --- BasicNode.java 7 Jul 2008 15:28:33 -0000 1.230 +++ BasicNode.java 17 Nov 2008 14:13:35 -0000 1.231 @@ -31,7 +31,7 @@ * @author Rob Vermeulen * @author Pierre van Rooden * @author Michiel Meeuwissen - * @version $Id: BasicNode.java,v 1.230 2008/07/07 15:28:33 michiel Exp $ + * @version $Id: BasicNode.java,v 1.231 2008/11/17 14:13:35 michiel Exp $ * @see org.mmbase.bridge.Node * @see org.mmbase.module.core.MMObjectNode */ @@ -345,7 +345,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 = (Boolean) field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_BOOLEAN).process(this, field, result); + result = Casting.toBoolean(field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_BOOLEAN).process(this, field, result)); } return result.booleanValue(); } @@ -355,7 +355,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; @@ -393,7 +393,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; @@ -404,7 +404,8 @@ Integer result = Integer.valueOf(getNode().getIntValue(fieldName)); if (nodeManager.hasField(fieldName)) { // gui(..) stuff could not work. Field field = nodeManager.getField(fieldName); - result = (Integer) field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_INTEGER).process(this, field, result); + result = Casting.toInteger(field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_INTEGER).process(this, field, result)); + // Casting on this position. Should it not be done in all get<..>Value's? } return result.intValue(); @@ -415,7 +416,7 @@ Float result = 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 = Casting.toFloat(field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_FLOAT).process(this, field, result)); } return result.floatValue(); } @@ -425,7 +426,7 @@ Long result = 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 = Casting.toLong(field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_LONG).process(this, field, result)); } return result.longValue(); } @@ -435,7 +436,7 @@ Double result = 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 = Casting.toDouble(field.getDataType().getProcessor(DataType.PROCESS_GET, Field.TYPE_DOUBLE).process(this, field, result)); } return result.doubleValue(); } @@ -445,7 +446,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; } @@ -454,7 +455,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; } @@ -467,7 +468,7 @@ String result = getNode().getStringValue(fieldName); if (nodeManager.hasField(fieldName)) { // gui(..) stuff could not work. Field field = nodeManager.getField(fieldName); - 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; } @@ -477,7 +478,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