From c0ebfaf6d76c1e1ccdb1296486057e3edc38aa2d Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Sun, 30 May 2004 06:31:48 +0000 Subject: [PATCH] Added getCountry(PropertyValue) git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197668 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/fop/datatypes/CountryType.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/fop/datatypes/CountryType.java b/src/java/org/apache/fop/datatypes/CountryType.java index 6b1cf1f28..4eb3dc0e9 100644 --- a/src/java/org/apache/fop/datatypes/CountryType.java +++ b/src/java/org/apache/fop/datatypes/CountryType.java @@ -55,12 +55,28 @@ public class CountryType extends NCName { } /** - * @return the String country code. + * Gets the ISO 3166 country code + * @return the country code */ public String getCountry() { return string; } + /** + * Gets the ISO 3166 country code from a PropertyValue + * @param pv the property value + * @return the country code + * @exception PropertyException if the PropertyValue is not + * a CountryType + */ + public static String getCountry(PropertyValue pv) + throws PropertyException { + if (pv.getType() == PropertyValue.COUNTRY) { + return ((CountryType)pv).getCountry(); + } + throw new PropertyException("PropertyValue not an COUNTRY type"); + } + /** * Validate the CountryType against the associated property. */ -- 2.39.5