1. /*
  2. * Copyright 2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.apache.commons.betwixt.schema;
  17. import java.beans.IntrospectionException;
  18. import org.apache.commons.betwixt.ElementDescriptor;
  19. /**
  20. * @author <a href='http://jakarta.apache.org/'>Jakarta Commons Team</a>
  21. * @version $Revision: 1.2 $
  22. */
  23. public class LocalElement implements Element {
  24. protected String name;
  25. protected String maxOccurs = "1";
  26. protected int minOccurs = 0;
  27. public LocalElement(String name) {
  28. this.name = name;
  29. }
  30. public LocalElement(ElementDescriptor descriptor, Schema schema) throws IntrospectionException {
  31. setName(descriptor.getLocalName());
  32. if (descriptor.isCollective()) {
  33. setMaxOccurs("unbounded");
  34. }
  35. }
  36. public String getName() {
  37. return name;
  38. }
  39. public void setName(String string) {
  40. name = string;
  41. }
  42. public int getMinOccurs() {
  43. return minOccurs;
  44. }
  45. public void setMinOccurs(int minOccurs) {
  46. this.minOccurs = minOccurs;
  47. }
  48. public String getMaxOccurs() {
  49. return maxOccurs;
  50. }
  51. public void setMaxOccurs(String maxOccurs) {
  52. this.maxOccurs = maxOccurs;
  53. }
  54. }