001
002/*
003 * Copyright (C) 2010 Archie L. Cobbs. All rights reserved.
004 *
005 * $Id$
006 */
007
008package org.dellroad.jibxbindings.pidf.lo.gml;
009
010/**
011 * Superclass for GML objects.
012 */
013public abstract class GMLObject implements Cloneable {
014
015    private String gmlId;
016
017    protected GMLObject() {
018    }
019
020    protected GMLObject(String gmlId) {
021        this.setGMLId(gmlId);
022    }
023
024    /**
025     * The id from the {@code gml:id} attribute.
026     */
027    public String getGMLId() {
028        return this.gmlId;
029    }
030    public void setGMLId(String gmlId) {
031        this.gmlId = gmlId;
032    }
033
034    /**
035     * Apply {@link GMLObjectSwitch} visitor pattern.
036     */
037    public abstract void visit(GMLObjectSwitch gmlObjectSwitch);
038
039// Cloneable
040
041    @Override
042    public GMLObject clone() {
043        try {
044            return (GMLObject)super.clone();
045        } catch (CloneNotSupportedException e) {
046            throw new RuntimeException(e);
047        }
048    }
049}
050