Source Code Cross Referenced for Attribute.java in  » Web-Server » Jigsaw » org » w3c » tools » resources » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Server » Jigsaw » org.w3c.tools.resources 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // Attribute.java
002:        // $Id: Attribute.java,v 1.4 2002/06/09 09:44:12 ylafon Exp $
003:        // (c) COPYRIGHT MIT and INRIA, 1996.
004:        // Please first read the full copyright statement in file COPYRIGHT.html
005:
006:        package org.w3c.tools.resources;
007:
008:        import java.io.Serializable;
009:
010:        /**
011:         * Instances of this class describe an attribute of a resource.
012:         */
013:
014:        abstract public class Attribute implements  Serializable {
015:            /**
016:             * Flags value - This attribute is computed from the resource state.
017:             */
018:            public static final int COMPUTED = (1 << 0);
019:            /**
020:             * Flag value - This attribute is editable.
021:             */
022:            public static final int EDITABLE = (1 << 1);
023:            /**
024:             * Flag value - This attribute is mandatory.
025:             */
026:            public static final int MANDATORY = (1 << 2);
027:            /**
028:             * Flag value - This attribute shouldn't be saved.
029:             */
030:            public static final int DONTSAVE = (1 << 3);
031:            /**
032:             * The attribute name.
033:             */
034:            protected String name = null;
035:            /**
036:             * The attribute's value type, as the name of its class.
037:             */
038:            protected String type = null;
039:            /**
040:             * The attribute's default value.
041:             */
042:            private transient Object defvalue = null;
043:            /**
044:             * The associated flags (see the predefined flags).
045:             */
046:            protected int flags = 0;
047:
048:            public String getFlag() {
049:                return String.valueOf(flags);
050:            }
051:
052:            public void setFlag(String flag) {
053:                try {
054:                    flags = Integer.parseInt(flag);
055:                } catch (Exception ex) {
056:                    flags = 0;
057:                }
058:            }
059:
060:            /**
061:             * Get this attribute name.
062:             * @return A String giving the attribute name.
063:             */
064:
065:            public String getName() {
066:                return name;
067:            }
068:
069:            /**
070:             * set the attribute name.
071:             * @param name the attribute name.
072:             */
073:            public void setName(String name) {
074:                this .name = name.intern();
075:            }
076:
077:            /**
078:             * Get this attribute type.
079:             */
080:
081:            public String getType() {
082:                return type;
083:            }
084:
085:            /**
086:             * Check some flag on this attribute description.
087:             */
088:
089:            public boolean checkFlag(int tst) {
090:                return (flags & tst) == tst;
091:            }
092:
093:            /**
094:             * Get this attribute default value.
095:             * @return A default value for this attribute (may be
096:             *    <strong>null</strong>).
097:             */
098:
099:            public Object getDefault() {
100:                return defvalue;
101:            }
102:
103:            /**
104:             * Is the provided object a suitable value for this attribute ?
105:             * If so, store it into the given store.
106:             * @param value The value to check.
107:             * @param store The array to store the value to if succeed.
108:             * @param idx The location in the above array.
109:             * @return A boolean <strong>true</strong> if this object can be used
110:             *    as a value for this attribute.
111:             * @exception IllegalAttributeAccess If the provided value doesn't match
112:             *    the expected type.
113:             */
114:
115:            public abstract boolean checkValue(Object value);
116:
117:            public abstract String stringify(Object value);
118:
119:            /**
120:             * Private constructore to create a new resource attribute description.
121:             * @param name The name of the attribute.
122:             * @param def Its default value.
123:             * @param flags Its associated flags.
124:             */
125:
126:            public Attribute(String name, Object def, int flags) {
127:                this .name = name.intern();
128:                this .defvalue = def;
129:                this .flags = flags;
130:            }
131:
132:            /**
133:             * Empty contructor, (cls.newInstance())
134:             */
135:            public Attribute() {
136:                this.defvalue = null;
137:                this.flags = COMPUTED;
138:            }
139:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.