Author: michiel
Date: 2009-05-12 18:40:23 +0200 (Tue, 12 May 2009)
New Revision: 35104
Added:
mmbase/trunk/src/org/mmbase/datatypes/processors/OtherField.java
Log:
Another trivial Setter/Getter pair
Added: mmbase/trunk/src/org/mmbase/datatypes/processors/OtherField.java
===================================================================
--- mmbase/trunk/src/org/mmbase/datatypes/processors/OtherField.java
(rev 0)
+++ mmbase/trunk/src/org/mmbase/datatypes/processors/OtherField.java
2009-05-12 16:40:23 UTC (rev 35104)
@@ -0,0 +1,61 @@
+/*
+
+This software is OSI Certified Open Source Software.
+OSI Certified is a certification mark of the Open Source Initiative.
+
+The license (Mozilla version 1.0) can be read at the MMBase site.
+See http://www.MMBase.org/license
+
+*/
+package org.mmbase.datatypes.processors;
+
+import org.mmbase.bridge.*;
+import org.mmbase.bridge.util.*;
+import org.mmbase.datatypes.*;
+import org.mmbase.util.*;
+import org.mmbase.storage.search.*;
+import java.util.*;
+import org.mmbase.util.logging.*;
+
+/**
+ * The set- and get- processors implemented in this file can be used to make a
virtual field which
+ * acts as another field of the same node
+ *
+ *
+ * @author Michiel Meeuwissen
+ * @since MMBase-1.9.1
+ * @version $Id: Related.java 34900 2009-05-01 16:29:42Z michiel $
+ */
+
+public class OtherField {
+
+ private static final Logger log =
Logging.getLoggerInstance(OtherField.class);
+
+ public abstract static class AbstractProcessor implements Processor {
+
+ protected String fieldName;
+
+ public void setField(String fn) {
+ fieldName = fn;
+ }
+ }
+
+
+ public static class Setter extends AbstractProcessor {
+
+ private static final long serialVersionUID = 1L;
+ public Object process(final Node node, final Field field, final Object
value) {
+ node.setValue(fieldName, value);
+ return value;
+ }
+ }
+
+ public static class Getter extends AbstractProcessor {
+ private static final long serialVersionUID = 1L;
+
+ public Object process(Node node, Field field, Object value) {
+ return node.getValue(fieldName);
+ }
+ }
+
+}
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs