001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018 package org.apache.commons.betwixt.schema; 019 020 /** 021 * Models a simpleType tag in an XML schema. 022 * A simple type is an element that cannot have element content 023 * and which has no attributes. 024 * 025 * @author <a href='http://commons.apache.org/'>Apache Commons Team</a> 026 * @version $Revision: 561314 $ 027 */ 028 public class SimpleType { 029 private String name; 030 031 /** 032 * Gets the name 033 * @return the name of this type 034 */ 035 public String getName() { 036 return name; 037 } 038 039 /** 040 * Sets the name 041 * @param name 042 */ 043 public void setName(String name) { 044 this.name = name; 045 } 046 047 public boolean equals(Object obj) { 048 boolean result = false; 049 if (obj instanceof SimpleType) { 050 SimpleType simpleType = (SimpleType) obj; 051 result = isEqual(name, simpleType.name); 052 } 053 return result; 054 } 055 056 public int hashCode() { 057 return 0; 058 } 059 060 061 /** 062 * Null safe equals method 063 * @param one 064 * @param two 065 * @return 066 */ 067 private boolean isEqual(String one, String two) { 068 boolean result = false; 069 if (one == null) { 070 result = (two == null); 071 } 072 else 073 { 074 result = one.equals(two); 075 } 076 077 return result; 078 } 079 080 public String toString() { 081 return "<xsd:simpleType name='" + name + "'/>"; 082 } 083 }