KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jdesktop > jdnc > markup > attr > NullAttribute


1 /*
2  * $Id: NullAttribute.java,v 1.1.1.1 2004/06/16 01:43:40 davidson1 Exp $
3  *
4  * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
5  * Santa Clara, California 95054, U.S.A. All rights reserved.
6  */

7
8 package org.jdesktop.jdnc.markup.attr;
9
10 import net.openmarkup.ApplierException;
11 import net.openmarkup.AttributeApplier;
12 import net.openmarkup.AttributeHandler;
13 import net.openmarkup.Realizable;
14
15 import org.jdesktop.jdnc.markup.Attributes;
16 import org.jdesktop.jdnc.markup.Namespace;
17
18 /**
19  * This class contains the static nullApplier - which does nothing.
20  */

21 public class NullAttribute {
22     
23     /**
24      * The nullApplier should be used with for {@link AttributeHandler}s for attributes
25      * which are not handled by AttributeAppliers.
26      * <p>
27      * For example, many of the "id" attributes
28      */

29     public static final AttributeApplier nullApplier = new AttributeApplier() {
30         public void apply(Realizable target, String JavaDoc namespaceURI,
31                           String JavaDoc attributeName, String JavaDoc attributeValue) throws
32             ApplierException {
33         // Does nothing
34
}
35     };
36
37     /**
38      * Shared AttributeHandler for the "id" attribute.
39      */

40     public static final AttributeHandler idHandler =
41         new AttributeHandler(Namespace.JDNC, Attributes.ID,
42                              NullAttribute.nullApplier);
43
44     /**
45      * Shared AttributeHandler for the "value" attribute.
46      */

47     public static final AttributeHandler valueHandler =
48         new AttributeHandler(Namespace.JDNC, Attributes.VALUE,
49                  NullAttribute.nullApplier);
50
51 }
52
Popular Tags