001: /*
002: * Geotools2 - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2005-2006, GeoTools Project Managment Committee (PMC)
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;
009: * version 2.1 of the License.
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: */
017: package org.geotools.data.complex.config;
018:
019: import java.util.Collection;
020: import java.util.Map;
021: import java.util.Set;
022:
023: import org.opengis.feature.type.AttributeType;
024: import org.opengis.feature.type.Name;
025: import org.opengis.util.InternationalString;
026:
027: /**
028: *
029: * @author Gabriel Roldan, Axios Engineering
030: * @version $Id: AttributeTypeProxy.java 27535 2007-10-17 23:46:43Z groldan $
031: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/community-schemas/community-schema-ds/src/main/java/org/geotools/data/complex/config/AttributeTypeProxy.java $
032: * @since 2.4
033: */
034: class AttributeTypeProxy implements AttributeType {
035:
036: private Name typeName;
037:
038: private Map registry;
039:
040: private AttributeType subject;
041:
042: public AttributeTypeProxy(Name typeName, Map registry) {
043: this .typeName = typeName;
044: this .registry = registry;
045: }
046:
047: public AttributeType getSubject() {
048: if (subject == null) {
049: subject = (AttributeType) registry.get(typeName);
050: if (subject == null) {
051: throw new IllegalStateException(
052: "Subject type not loaded yet");
053: }
054: }
055: return subject;
056: }
057:
058: public Class getBinding() {
059: return getSubject().getBinding();
060: }
061:
062: public Collection getOperations() {
063: return null;
064: }
065:
066: public Set getRestrictions() {
067: return getSubject().getRestrictions();
068: }
069:
070: public AttributeType getSuper() {
071: return getSubject().getSuper();
072: }
073:
074: public boolean isAbstract() {
075: return getSubject().isAbstract();
076: }
077:
078: public boolean isIdentified() {
079: return getSubject().isIdentified();
080: }
081:
082: public InternationalString getDescription() {
083: return getSubject().getDescription();
084: }
085:
086: public Name getName() {
087: return typeName;
088: }
089:
090: public Object getUserData(Object key) {
091: return getSubject().getUserData(key);
092: }
093:
094: public void putUserData(Object key, Object value) {
095: getSubject().putUserData(key, value);
096: }
097:
098: public boolean equals(Object o) {
099: AttributeType subject = getSubject();
100: return subject.equals(o);
101: }
102:
103: public int hashCode() {
104: AttributeType subject = getSubject();
105: return subject.hashCode();
106: }
107: }
|