Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * The SmartWeb Framework
   * Copyright (C) 2004-2006
   *
   * This library is free software; you can redistribute it and/or
   * modify it under the terms of the GNU Lesser General Public
   * License as published by the Free Software Foundation; either
   * version 2.1 of the License, or (at your option) any later version.
   *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  * For further informations on the SmartWeb Framework please visit
  *
  *                        http://smartweb.sourceforge.net
  */
 package net.smartlab.web.registry;
 
Represents a fully qualified mail address usable for postal delivery

Author(s):
rlogiacco
Hibernate.joined:
subclass schema="registry" table="`mail-address`"
Hibernate.joined:
subclass-key column="`id`"
 
 public class MailAddress extends Address {
 
 	private final static long serialVersionUID = -678094002234942516L;

An optional description for delivery purposes.
 
 	private String at;

The fully qualified city.

Directed:
true
Stereotype:
component
Uml.property:
name="locality"
Uml.associationEnd:
multiplicity="(1 1)" aggregation="composite" inverse="mailAddress:net.smartlab.web.registry.Locality"
 
 	private Locality locality = new Locality();

An optional name to describe an additional subdivision of the city.
 
 	private String hamlet;

The delivery code used in local area identifications.
 
 	private String zipCode;

The street.
 
 	private String street;

The string identifing the street subdivision.
 
 	private String civic;


Default constructor
 
 	public MailAddress() {
 		super();
 	}
Constructor using fields

Parameters:
street the street to be set
civic the civic to be set
 
 	public MailAddress(String streetString civic) {
 		this(streetcivicnullnullnullnull);
 	}

Constructor using fields

Parameters:
street the street to be set
civic the civic to be set
locality the locality to be set
 
 	public MailAddress(String streetString civicLocality locality) {
 		this(streetcivicnulllocalitynullnull);
	}

Constructor using all fields

Parameters:
street the street to be set
civic the civic to be set
at The at to be set
locality the locality to be set
hamlet the hamlet to be set
zipCode the zipCode to be set
	public MailAddress(String streetString civicString atLocality localityString hamletString zipCode) {
		super();
		this. = at;
		this. = locality == null ? new Locality() : locality;
		this. = hamlet;
		this. = zipCode;
		this. = street;
		this. = civic;
	}

Returns the at

Returns:
returns the at.
Hibernate.property:
column="`at`" length="250"
	public String getAt() {
		return ;
	}

Sets the at

Parameters:
at the at to set.
	public void setAt(String at) {
		this. = at;
	}

Returns the civic

Returns:
returns the civic.
Hibernate.property:
column="`civic`" length="50"
	public String getCivic() {
		return ;
	}

Sets the civic

Parameters:
civic the civic to set.
	public void setCivic(String civic) {
		this. = civic;
	}

Returns the locality

Returns:
returns the locality.
Hibernate.component:
Uml.property:
name="locality"
	public Locality getLocality() {
		return ;
	}

Sets the locality

Parameters:
locality the locality to set.
Uml.property:
name="locality"
	public void setLocality(Locality locality) {
		this. = locality;
	}

Returns the hamlet

Returns:
returns the hamlet.
Hibernate.property:
column="`hamlet`" length="250"
	public String getHamlet() {
		return ;
	}

Sets the hamlet

Parameters:
hamlet the hamlet to set.
	public void setHamlet(String hamlet) {
		this. = hamlet;
	}

Returns the street

Returns:
returns the street.
Hibernate.property:
column="`street`" length="250"
	public String getStreet() {
		return ;
	}

Set the street

Parameters:
street the street to set.
	public void setStreet(String street) {
		this. = street;
	}

Returns the zip code

Returns:
returns the zipCode.
Hibernate.property:
column="`zipCode`" length="25"
	public String getZipCode() {
		return ;
	}

Returns the zip code

Parameters:
zipCode the zipCode to set.
	public void setZipCode(String zipCode) {
		this. = zipCode;
	}

		StringBuffer address = new StringBuffer();
		address.append(this. != null ? this. + " " : "");
		address.append(this. != null ? this. + " " : "");
		address.append(this. != null ? this. + " " : "");
		if (this. != null) {
			address.append(this..getCity() != null ? this..getCity() + " " : "");
			address.append(this..getState() != null ? this..getState() + " " : "");
			address.append(this..getCountry() != null ? this..getCountry().getDisplay() + " " : "");
		}
		return address.toString().trim();
	}

	public boolean equals(Object object) {
		if (!(object instanceof MailAddress)){
			return false;
        }
		MailAddress rhs = (MailAddressobject;
		return new EqualsBuilder()
		.append(this.getStreet(), rhs.getStreet())
		.append(this.getAt(), rhs.getAt())
		.append(this.getCivic(), rhs.getCivic())
		.append(this.getHamlet(), rhs.getHamlet())
		.append(this.getZipCode(), rhs.getZipCode())
	}

	public int hashCode() {
		HashCodeBuilder hb = new HashCodeBuilder(1816801317, 257614045)
		.append(this.)
		if(super.getEntity()!=null)
			hb.append(super.getEntity().getId());
		return hb.toHashCode();
	}

	public String toString() {
		sb.append("at",this.)
		.append("civic",this.)
		.append("hamlet",this.)
		.append("locality",this.)
		.append("street",this.)
		.append("zipCode",this.);
		return sb.toString();
	}
New to GrepCode? Check out our FAQ X