001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 2005 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: HCAttributeRestrictions.java 7521 2005-10-19 02:14:21Z pasmith $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.webapp.jonasadmin.xml.xs.hardcoded;
025:
026: import org.objectweb.jonas.webapp.jonasadmin.xml.xs.AttributeRestrictions;
027:
028: /**
029: * An implementation of HCAttributeRestrictions where the restrictions are not
030: * retrieved from the schema but hard coded inside the class.
031: *
032: * @author Gregory Lapouchnian
033: * @author Patrick Smith
034: */
035: public class HCAttributeRestrictions implements AttributeRestrictions {
036:
037: /** The name of this attribute */
038: private String name;
039:
040: /** If this attribute is optional */
041: private boolean isOptional;
042:
043: /** The fixed value for this attribute. */
044: private String fixed;
045:
046: /**
047: * Create a new hardcoded attribute restriction
048: * @param name the name of this attribute
049: * @param optional is this attribute optional
050: * @param fixed the fixed value for this attribute
051: */
052: public HCAttributeRestrictions(String name, boolean optional,
053: String fixed) {
054: this .name = name;
055: this .isOptional = optional;
056: this .fixed = fixed;
057: }
058:
059: /**
060: * Get the fixed value for this attribute.
061: * @return the fixed value for this attribute.
062: */
063: public String getFixed() {
064: return fixed;
065: }
066:
067: /**
068: * Sets the fixed value for this attribute.
069: * @param fixed the fixed value for this attribute.
070: */
071: public void setFixed(String fixed) {
072: this .fixed = fixed;
073: }
074:
075: /**
076: * Returns if this attribute is optional.
077: * @return if this attribute is optional or not.
078: */
079: public boolean isOptional() {
080: return isOptional;
081: }
082:
083: /**
084: * Sets if this attribute is optional.
085: * @param isOptional if this attribute is optional.
086: */
087: public void setOptional(boolean isOptional) {
088: this .isOptional = isOptional;
089: }
090:
091: /**
092: * Return the name of the attribute.
093: * @return the element of this attribute.
094: */
095: public String getName() {
096: return name;
097: }
098:
099: /**
100: * Sets the name of this element.
101: * @param name the name of this element.
102: */
103: public void setName(String name) {
104: this.name = name;
105: }
106: }
|