001: /**
002: * $Id: StreetAddress.java,v 1.3 2005/05/13 07:39:37 pg133018 Exp $
003: * Copyright 2003 Sun Microsystems, Inc. All
004: * rights reserved. Use of this product is subject
005: * to license terms. Federal Acquisitions:
006: * Commercial Software -- Government Users
007: * Subject to Standard License Terms and
008: * Conditions.
009: *
010: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011: * are trademarks or registered trademarks of Sun Microsystems,
012: * Inc. in the United States and other countries.
013: */package com.sun.portal.psftportlet.common;
014:
015: /**
016: * This is the StreetAddress class
017: *
018: * @author Pradeep Gond
019: */
020:
021: public class StreetAddress {
022:
023: private String addrLine1 = "";
024: private String addrLine2 = "";
025: private String city = "";
026: private String state = "";
027: //private String country;
028: private String pin = "";
029: private String row = "1";
030:
031: public static String SEPERATOR = "<br>";
032: public static String COMMA_SPACE = ", ";
033:
034: public StreetAddress(String addrLine1, String addrLine2,
035: String city, String state,
036: //String country,
037: String pin, String row) {
038: this .addrLine1 = addrLine1;
039: this .addrLine2 = addrLine2;
040: this .city = city;
041: this .state = state;
042: //this.country = country;
043: this .pin = pin;
044: this .row = row;
045: }
046:
047: public StreetAddress(String[] address) {
048: if (address.length >= 5) {
049: this .addrLine1 = address[0];
050: this .addrLine2 = address[1];
051: this .city = address[2];
052: this .state = address[3];
053: this .pin = address[4];
054: }
055: if (address.length >= 6) {
056: this .row = address[5];
057: }
058: }
059:
060: public String toString() {
061: String result = "";
062:
063: if (addrLine1 != null && !addrLine1.equals("")) {
064: result = addrLine1;
065: }
066: if (addrLine2 != null && !addrLine2.equals("")) {
067: result += SEPERATOR + addrLine2;
068: }
069: if (city != null && !city.equals("")) {
070: result += SEPERATOR + city;
071: }
072: if (state != null && !state.equals("")) {
073: result += COMMA_SPACE + state;
074: }
075: if (pin != null && !pin.equals("")) {
076: result += SEPERATOR + pin;
077: }
078:
079: //result = addrLine1 + SEPERATOR + addrLine2 + SEPERATOR + city +
080: // COMMA_SPACE + state + SEPERATOR + pin;
081:
082: return result;
083: }
084:
085: // get set methods
086: public String getAddrLine1() {
087: return addrLine1;
088: }
089:
090: void setAddrLine1(String addrLine1) {
091: this .addrLine1 = addrLine1;
092: }
093:
094: public String getAddrLine2() {
095: return addrLine2;
096: }
097:
098: void setAddrLine2(String addrLine2) {
099: this .addrLine2 = addrLine2;
100: }
101:
102: public String getCity() {
103: return city;
104: }
105:
106: void setCity(String city) {
107: this .city = city;
108: }
109:
110: public String getState() {
111: return state;
112: }
113:
114: void setState(String state) {
115: this .state = state;
116: }
117:
118: public String getPin() {
119: return pin;
120: }
121:
122: void setPin(String pin) {
123: this .pin = pin;
124: }
125:
126: public String getRow() {
127: return row;
128: }
129:
130: void setRow(String row) {
131: this.row = row;
132: }
133:
134: }
|