jakarta.mail.Address Maven / Gradle / Ivy
/*
* Copyright (c) 1997, 2021 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.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package jakarta.mail;
import java.io.Serializable;
/**
* This abstract class models the addresses in a message.
* Subclasses provide specific implementations. Subclasses
* will typically be serializable so that (for example) the
* use of Address objects in search terms can be serialized
* along with the search terms.
*
* @author John Mani
* @author Bill Shannon
*/
public abstract class Address implements Serializable {
private static final long serialVersionUID = -5822459626751992278L;
/**
* Creates a default {@code Address}.
*/
public Address() {
}
/**
* Return a type string that identifies this address type.
*
* @return address type
* @see jakarta.mail.internet.InternetAddress
*/
public abstract String getType();
/**
* Return a String representation of this address object.
*
* @return string representation of this address
*/
@Override
public abstract String toString();
/**
* The equality operator. Subclasses should provide an
* implementation of this method that supports value equality
* (do the two Address objects represent the same destination?),
* not object reference equality. A subclass must also provide
* a corresponding implementation of the hashCode
* method that preserves the general contract of
* equals
and hashCode
- objects that
* compare as equal must have the same hashCode.
*
* @param address Address object
*/
@Override
public abstract boolean equals(Object address);
}