KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > datatypes > processors > Readonly


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.datatypes.processors;
11
12 import org.mmbase.bridge.*;
13
14 /**
15  * This processor can be used as a 'set' processor on a field.
16  * If the field is set an exception is thrown (in other words, the field is read only).
17  *
18  * @author Nico Klasens
19  * @version $Id: Readonly.java,v 1.2 2005/12/10 14:33:36 michiel Exp $
20  * @since MMBase-1.8
21  */

22 public class Readonly implements Processor {
23
24     private static final long serialVersionUID = 1L;
25
26     /**
27      * You can plug this in on every set-action besides 'object' which will make this
28      * field unmodifiable, except for set(Object) itself (which is never used from editors).
29      */

30     public Object JavaDoc process(Node node, Field field, Object JavaDoc value) {
31         throw new BridgeException("You cannot change the field " + field.getName());
32     }
33
34 }
35
Popular Tags