KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xslt > model > impl > XslElements


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.xslt.model.impl;
20
21 import java.util.HashSet JavaDoc;
22 import java.util.Set JavaDoc;
23 import java.util.concurrent.atomic.AtomicReference JavaDoc;
24
25 import javax.xml.namespace.QName JavaDoc;
26
27 import org.netbeans.modules.xslt.model.XslComponent;
28
29
30 /**
31  * Enumeration representing XSL specific elements.
32  * Please note that almost any XML element could
33  * appear in XSL document and we should provide
34  * access to this element. This enumeration
35  * contains only XSL specific elements ( lile xsl instructions ).
36  *
37  * @author ads
38  *
39  */

40 enum XslElements {
41
42     ANALIZE_STRING( "analyze-string" ), // NOI18N
43
APPLY_IMPORTS( "apply-imports" ), // NOI18N
44
APPLY_TEMPLATES( "apply-templates" ), // NOI18N
45
ATTRIBUTE( "attribute" ), // NOI18N
46
ATTRIBUTE_SET( "attribute-set" ), // NOI18N
47
CALL_TEMPLATE( "call-template" ), // NOI18N
48
CHARACTER_MAP( "character-map" ), // NOI18N
49
CHOOSE( "choose" ), // NOI18N
50
COMMENT( "comment" ), // NOI18N
51
COPY( "copy" ), // NOI18N
52
COPY_OF( "copy-of" ), // NOI18N
53
DECIMAL_FORMAT( "decimal-format" ), // NOI18N
54
DOCUMENT( "document" ), // NOI18N
55
ELEMENT( "element" ), // NOI18N
56
FALLBACK( "fallback" ), // NOI18N
57
FOR_EACH( "for-each" ), // NOI18N
58
FOR_EACH_GROUP( "for-each-group" ), // NOI18N
59
FUNCTION( "function" ), // NOI18N
60
IF( "if" ), // NOI18N
61
IMPORT( "imoprt" ), // NOI18N
62
IMPORT_SCHEMA( "import-schema" ), // NOI18N
63
INCLUDE( "include" ), // NOI18N
64
KEY( "key" ), // NOI18N
65
MATCHING_SUBSTRING( "matching-substring" ), // NOI18N
66
MESSAGE( "message" ), // NOI18N
67
NAMESPACE( "namespace" ), // NOI18N
68
NAMESPACE_ALIAS( "namespace-alias" ), // NOI18N
69
NEXT_MATCH( "next-match" ), // NOI18N
70
NON_MATCHING_SUBSTRING( "non-matching-substring" ), // NOI18N
71
NUMBER( "number" ), // NOI18N
72
OTHERWISE( "otherwise" ), // NOI18N
73
OUTPUT( "output" ), // NOI18N
74
OUTPUT_CHARACTER( "output-character" ), // NOI18N
75
PARAM( "param" ), // NOI18N
76
PERFORM_SORT( "perform-sort" ), // NOI18N
77
PRESERVE_SPACE( "preserve-space" ), // NOI18N
78
PROCESSING_INSTRUCTION( "processing-instruction" ), // NOI18N
79
RESULT_DOCUMENT( "result-document" ), // NOI18N
80
SEQUENCE( "sequence" ), // NOI18N
81
SORT( "sort" ), // NOI18N
82
STRIP_SPACE( "strip-space" ), // NOI18N
83
STYLESHEET( "stylesheet"), // NOI18N
84
TRANSFORM( "transform" ), // NOI18N this is the same tag as previous "stylesheet".
85
TEMPLATE( "template" ), // NOI18N
86
TEXT( "text" ), // NOI18N
87
VALUE_OF( "value-of" ), // NOI18N
88
VARIABLE( "variable" ), // NOI18N
89
WHEN( "when" ), // NOI18N
90
WHITH_PARAM( "with-param" ) // NOI18N
91
;
92     
93     XslElements( String JavaDoc str ){
94         myName = str;
95     }
96     
97     public String JavaDoc getName() {
98         return myName;
99     }
100     
101     public QName JavaDoc getQName() {
102         return new QName JavaDoc( XslComponent.XSL_NAMESPACE, getName() );
103     }
104     
105     public static Set JavaDoc<QName JavaDoc> allQNames() {
106         if ( myQNames.get() == null ) {
107             Set JavaDoc<QName JavaDoc> set = new HashSet JavaDoc<QName JavaDoc>( values().length );
108             for (XslElements element : values() ) {
109                 set.add( element.getQName() );
110             }
111             myQNames.compareAndSet( null, set );
112         }
113         return myQNames.get();
114     }
115     
116     private String JavaDoc myName;
117     
118     private static AtomicReference JavaDoc<Set JavaDoc<QName JavaDoc>> myQNames =
119         new AtomicReference JavaDoc<Set JavaDoc<QName JavaDoc>>();
120 }
121
122
Popular Tags