]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Added getISO639_1Language(PropertyValue)
authorPeter Bernard West <pbwest@apache.org>
Sun, 30 May 2004 06:33:51 +0000 (06:33 +0000)
committerPeter Bernard West <pbwest@apache.org>
Sun, 30 May 2004 06:33:51 +0000 (06:33 +0000)
and getLanguage(PropertyValue)

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197670 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/datatypes/LanguageType.java

index be437794c543d5e0599ce488e3694e6ec182b1d0..8126279823c3314eccf6b23f2d873c4da3267037 100644 (file)
@@ -76,7 +76,41 @@ public class LanguageType extends NCName {
         return string;
     }
 
+    /**
+     * Gets the ISO 639-2T language code from a PropertyValue
+     * @param pv
+     * @return the language code
+     * @exception PropertyException if the <code>PropertyValue</code> is not
+     * a <code>LanguageType</code>
+     */
+    public static String getLanguage(PropertyValue pv)
+    throws PropertyException {
+        if (pv.getType() == PropertyValue.LANGUAGE) {
+            return ((LanguageType)pv).getLanguage();
+        }
+        throw new PropertyException("PropertyValue not an LANGUAGE type");
+    }
+
+    /**
+     * Gets the ISO 639-1 language code
+     * @return the language code
+     */
     public String getISO639_1Language() {
         return iso639_1Code;
     }
+
+    /**
+     * Gets the ISO 639-1 language code from a PropertyValue
+     * @param pv
+     * @return the language code
+     * @exception PropertyException if the <code>PropertyValue</code> is not
+     * a <code>LanguageType</code>
+     */
+    public static String getISO639_1Language(PropertyValue pv)
+    throws PropertyException {
+        if (pv.getType() == PropertyValue.LANGUAGE) {
+            return ((LanguageType)pv).getISO639_1Language();
+        }
+        throw new PropertyException("PropertyValue not an LANGUAGE type");
+    }
 }