001/*
002 * oauth2-oidc-sdk
003 *
004 * Copyright 2012-2016, Connect2id Ltd and contributors.
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use
007 * this file except in compliance with the License. You may obtain a copy of the
008 * License at
009 *
010 *    http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software distributed
013 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
014 * CONDITIONS OF ANY KIND, either express or implied. See the License for the
015 * specific language governing permissions and limitations under the License.
016 */
017
018package com.nimbusds.openid.connect.sdk.assurance.claims;
019
020
021import com.nimbusds.oauth2.sdk.ParseException;
022import com.nimbusds.oauth2.sdk.id.Identifier;
023
024
025/**
026 * Abstract class for country codes.
027 */
028public abstract class CountryCode extends Identifier {
029        
030        
031        /**
032         * Creates a new country code.
033         *
034         * @param value The country code value.
035         */
036        protected CountryCode(final String value) {
037                super(value);
038        }
039        
040        
041        /**
042         * Casts this code to an ISO 3166-1 alpha-2 (two-letter) country code.
043         *
044         * @return The ISO 3166-1 alpha-2 (two-letter) country code.
045         */
046        public ISO3166_1Alpha2CountryCode toISO3166_1Alpha2CountryCode() {
047                
048                return (ISO3166_1Alpha2CountryCode)this;
049        }
050        
051        
052        /**
053         * Parses a country code.
054         *
055         * @param s The string to parse. Must not be {@code null}.
056         *
057         * @return The country code.
058         *
059         * @throws ParseException If parsing failed.
060         */
061        public static CountryCode parse(final String s)
062                throws ParseException {
063                
064                return ISO3166_1Alpha2CountryCode.parse(s);
065        }
066        
067        
068        @Override
069        public abstract boolean equals(final Object other);
070}