/*
* Geotoolkit - An Open Source Java GIS Toolkit
* http://www.geotoolkit.org
*
* (C) 2010, Geomatys
*
* 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.
*/
package org.geotoolkit.xal.model;
import java.util.List;
import static java.util.Collections.*;
/**
*
* @author Samuel Andrés
* @module
*/
public class DefaultSubAdministrativeArea implements SubAdministrativeArea {
private List<GenericTypedGrPostal> addressLines;
private List<GenericTypedGrPostal> subAdministrativeAreaNames;
private Locality locality;
private PostOffice postOffice;
private PostalCode postalCode;
private String type;
private String usageType;
private String indicator;
public DefaultSubAdministrativeArea(){
this.addressLines = EMPTY_LIST;
this.subAdministrativeAreaNames = EMPTY_LIST;
}
/**
*
* @param addressLines
* @param subAdministrativeAreaNames
* @param localisation
* @param type
* @param usageType
* @param indicator
* @throws XalException
*/
public DefaultSubAdministrativeArea(List<GenericTypedGrPostal> addressLines,
List<GenericTypedGrPostal> subAdministrativeAreaNames,
Object localisation, String type, String usageType, String indicator) throws XalException{
this.addressLines = (addressLines == null) ? EMPTY_LIST : addressLines;
this.subAdministrativeAreaNames = (subAdministrativeAreaNames == null) ? EMPTY_LIST : subAdministrativeAreaNames;
if (localisation instanceof Locality){
this.locality = (Locality) localisation;
} else if (localisation instanceof PostOffice){
this.postOffice = (PostOffice) localisation;
} else if (localisation instanceof PostalCode){
this.postalCode = (PostalCode) localisation;
} else if (localisation != null){
throw new XalException("This kind of type is not allowed here.");
}
this.type = type;
this.usageType = usageType;
this.indicator = indicator;
}
/**
*
* @{@inheritDoc }
*/
@Override
public List<GenericTypedGrPostal> getAddressLines() {return this.addressLines;}
/**
*
* @{@inheritDoc }
*/
@Override
public List<GenericTypedGrPostal> getSubAdministrativeAreaNames() {return this.subAdministrativeAreaNames;}
/**
*
* @{@inheritDoc }
*/
@Override
public Locality getLocality() {return this.locality;}
/**
*
* @{@inheritDoc }
*/
@Override
public PostOffice getPostOffice() {return this.postOffice;}
/**
*
* @{@inheritDoc }
*/
@Override
public PostalCode getPostalCode() {return this.postalCode;}
/**
*
* @{@inheritDoc }
*/
@Override
public String getType() {return this.type;}
/**
*
* @{@inheritDoc }
*/
@Override
public String getUsageType() {return this.usageType;}
/**
*
* @{@inheritDoc }
*/
@Override
public String getIndicator() {return this.indicator;}
/**
*
* @{@inheritDoc }
*/
@Override
public void setAddressLines(List<GenericTypedGrPostal> addressLines) {
this.addressLines = addressLines;
}
/**
*
* @{@inheritDoc }
*/
@Override
public void setSubAdministrativeAreaNames(List<GenericTypedGrPostal> subAdministrativeAreaNames) {
this.subAdministrativeAreaNames = subAdministrativeAreaNames;
}
/**
*
* @{@inheritDoc }
*/
@Override
public void setLocality(Locality locality) {
this.locality = locality;
}
/**
*
* @{@inheritDoc }
*/
@Override
public void setPostOffice(PostOffice postOffice) {
this.postOffice = postOffice;
}
/**
*
* @{@inheritDoc }
*/
@Override
public void setPostalCode(PostalCode postalCode) {
this.postalCode = postalCode;
}
/**
*
* @{@inheritDoc }
*/
@Override
public void setType(String type) {
this.type = type;
}
/**
*
* @{@inheritDoc }
*/
@Override
public void setUsageType(String usageType) {
this.usageType = usageType;
}
/**
*
* @{@inheritDoc }
*/
@Override
public void setIndicator(String indicator) {
this.indicator = indicator;
}
}