/*
 * Copyright (c) 2011, 2020 Oracle and/or its affiliates. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0,
 * or the Eclipse Distribution License v. 1.0 which is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
 */

// Contributors:
//     Matt MacIvor - 2.4 - initial implementation
package org.eclipse.persistence.testing.jaxb.externalizedmetadata.superclassoverride;

import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class SubClass extends SpecialMap<String, String> {

    @XmlElement(name="myProperty")
    public String getMyProperty() {
        return super.get("myProperty");
    }

    public void setMyProperty(String value) {
        super.put("myProperty", value);
    }

    public boolean equals(Object subClass) {
        return getMyProperty().equals(((SubClass)subClass).getMyProperty());
    }
}
