001/*
002 * Shredzone Commons - pdb
003 *
004 * Copyright (C) 2009 Richard "Shred" Körber
005 *   http://commons.shredzone.org
006 *
007 * This program is free software: you can redistribute it and/or modify
008 * it under the terms of the GNU Library General Public License as
009 * published by the Free Software Foundation, either version 3 of the
010 * License, or (at your option) any later version.
011 *
012 * This program is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015 * GNU General Public License for more details.
016 *
017 * You should have received a copy of the GNU Library General Public License
018 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
019 */
020package org.shredzone.commons.pdb.appinfo;
021
022import java.util.EnumMap;
023
024import org.shredzone.commons.pdb.record.AddressRecord;
025
026/**
027 * A {@link CategoryAppInfo} with more details about the {@link AddressRecord}.
028 */
029public class AddressAppInfo extends CategoryAppInfo {
030
031    private EnumMap<AddressRecord.Label, String> labels = new EnumMap<>(AddressRecord.Label.class);
032
033    private String country;
034
035    /**
036     * Gets the label text for a label.
037     *
038     * @param field
039     *            Label to get the label text from
040     * @return Label text of that label
041     */
042    public String getLabel(AddressRecord.Label field) { return labels.get(field); }
043    public void setLabel(AddressRecord.Label field, String label) { labels.put(field, label); }
044
045    /**
046     * Gets the country code (as ISO 3166-1-alpha-2 code). {@code null} if the appinfo
047     * country code was unknown.
048     *
049     * @see <a href="http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm">ISO 3166 Code Lists</a>
050     */
051    public String getCountry()                  { return country; }
052    public void setCountry(String country)      { this.country = country; }
053
054}