xmlgraphics-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r615893 - in /xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas: DublinCoreAdapter.java XMPBasicAdapter.java pdf/AdobePDFAdapter.java pdf/PDFAAdapter.java
Date Mon, 28 Jan 2008 14:32:09 GMT
Author: jeremias
Date: Mon Jan 28 06:32:06 2008
New Revision: 615893

URL: http://svn.apache.org/viewvc?rev=615893&view=rev
Log:
Use constants in metadata adapters.

Modified:
    xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/DublinCoreAdapter.java
    xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicAdapter.java
    xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/AdobePDFAdapter.java
    xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFAAdapter.java

Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/DublinCoreAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/DublinCoreAdapter.java?rev=615893&r1=615892&r2=615893&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/DublinCoreAdapter.java
(original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/DublinCoreAdapter.java
Mon Jan 28 06:32:06 2008
@@ -33,6 +33,13 @@
  */
 public class DublinCoreAdapter extends XMPSchemaAdapter {
 
+    private static final String CREATOR = "creator";
+    private static final String DATE = "date";
+    private static final String SUBJECT = "subject";
+    private static final String TITLE = "title";
+    private static final String DESCRIPTION = "description";
+    private static final String LANGUAGE = "language";
+    
     /**
      * Constructs a new adapter for Dublin Core around the given metadata object.
      * @param meta the underlying metadata
@@ -46,12 +53,12 @@
      * @param value the new value
      */
     public void addCreator(String value) {
-        addStringToSeq("creator", value);
+        addStringToSeq(CREATOR, value);
     }
     
     /** @return a String array of all creators */
     public String[] getCreators() {
-        return getStringArray("creator");
+        return getStringArray(CREATOR);
     }
     
     /**
@@ -60,7 +67,7 @@
      * @param value the date value 
      */
     public void addDate(Date value) {
-        addDateToSeq("date", value);
+        addDateToSeq(DATE, value);
     }
     
     /**
@@ -69,12 +76,12 @@
      * @param value the new value
      */
     public void addSubject(String value) {
-        addStringToBag("subject", value);
+        addStringToBag(SUBJECT, value);
     }
     
     /** @return a String array of all subjects */
     public String[] getSubjects() {
-        return getStringArray("subject");
+        return getStringArray(SUBJECT);
     }
     
     /**
@@ -91,7 +98,7 @@
      * @param value the new value
      */
     public void setTitle(String lang, String value) {
-        setLangAlt("title", lang, value);
+        setLangAlt(TITLE, lang, value);
     }
     
     /** @return the title of the resource (in the default language) */
@@ -105,7 +112,7 @@
      * @return the language-dependent value.
      */
     public String getTitle(String lang) {
-        return getLangAlt(lang, "title");
+        return getLangAlt(lang, TITLE);
     }
     
     /**
@@ -114,7 +121,7 @@
      * @param value the new value
      */
     public void setDescription(String lang, String value) {
-        setLangAlt("description", lang, value);
+        setLangAlt(DESCRIPTION, lang, value);
     }
     
     /** @return the description of the content of the resource (in the default language)
*/
@@ -128,7 +135,7 @@
      * @return the language-dependent value.
      */
     public String getDescription(String lang) {
-        return getLangAlt(lang, "description");
+        return getLangAlt(lang, DESCRIPTION);
     }
     
     /**
@@ -136,12 +143,12 @@
      * @param value the new value
      */
     public void addLanguage(String value) {
-        addStringToBag("language", value);
+        addStringToBag(LANGUAGE, value);
     }
     
     /** @return a String array of all language */
     public String[] getLanguages() {
-        return getStringArray("language");
+        return getStringArray(LANGUAGE);
     }
     
 }

Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicAdapter.java?rev=615893&r1=615892&r2=615893&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicAdapter.java
(original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/XMPBasicAdapter.java
Mon Jan 28 06:32:06 2008
@@ -30,6 +30,11 @@
  */
 public class XMPBasicAdapter extends XMPSchemaAdapter {
 
+    private static final String CREATOR_TOOL = "CreatorTool";
+    private static final String CREATE_DATE = "CreateDate";
+    private static final String MODIFY_DATE = "ModifyDate";
+    private static final String METADATA_DATE = "MetadataDate";
+
     /**
      * Constructs a new adapter for XMP Basic around the given metadata object.
      * @param meta the underlying metadata
@@ -43,12 +48,12 @@
      * @param value the creator tool
      */
     public void setCreatorTool(String value) {
-        setValue("CreatorTool", value);
+        setValue(CREATOR_TOOL, value);
     }
 
     /** @return the first known tool used to create the resource */
     public String getCreatorTool() {
-        return getValue("CreatorTool");
+        return getValue(CREATOR_TOOL);
     }
 
     /**
@@ -56,12 +61,12 @@
      * @param creationDate the creation date
      */
     public void setCreateDate(Date creationDate) {
-        setDateValue("CreateDate", creationDate);
+        setDateValue(CREATE_DATE, creationDate);
     }
 
     /** @return the date and time the resource was originally created */
     public Date getCreateDate() {
-        return getDateValue("CreateDate");
+        return getDateValue(CREATE_DATE);
     }
     
     /**
@@ -69,12 +74,12 @@
      * @param modifyDate the modification date
      */
     public void setModifyDate(Date modifyDate) {
-        setDateValue("ModifyDate", modifyDate);
+        setDateValue(MODIFY_DATE, modifyDate);
     }
 
     /** @return the date and time the resource was last modified */
     public Date getModifyDate() {
-        return getDateValue("ModifyDate");
+        return getDateValue(MODIFY_DATE);
     }
     
     /**
@@ -82,12 +87,12 @@
      * @param metadataDate the modification date for the metadata
      */
     public void setMetadataDate(Date metadataDate) {
-        setDateValue("MetadataDate", metadataDate);
+        setDateValue(METADATA_DATE, metadataDate);
     }
     
     /** @return the date and time the resource was originally created */
     public Date getMetadataDate() {
-        return getDateValue("MetadataDate");
+        return getDateValue(METADATA_DATE);
     }
 
 }

Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/AdobePDFAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/AdobePDFAdapter.java?rev=615893&r1=615892&r2=615893&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/AdobePDFAdapter.java
(original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/AdobePDFAdapter.java
Mon Jan 28 06:32:06 2008
@@ -28,6 +28,10 @@
  */
 public class AdobePDFAdapter extends XMPSchemaAdapter {
 
+    private static final String KEYWORDS = "Keywords";
+    private static final String PDFVERSION = "PDFVersion";
+    private static final String PRODUCER = "Producer";
+
     /**
      * Constructs a new adapter for Adobe PDF around the given metadata object.
      * @param meta the underlying metadata
@@ -38,7 +42,7 @@
 
     /** @return the keywords */
     public String getKeywords() {
-        return getValue("Keywords");
+        return getValue(KEYWORDS);
     }
     
     /**
@@ -46,12 +50,12 @@
      * @param value the keywords
      */
     public void setKeywords(String value) {
-        setValue("Keywords", value);
+        setValue(KEYWORDS, value);
     }
 
     /** @return the PDF version */
     public String getPDFVersion() {
-        return getValue("PDFVersion");
+        return getValue(PDFVERSION);
     }
     
     /**
@@ -59,12 +63,12 @@
      * @param value the PDF version (ex. "1.4")
      */
     public void setPDFVersion(String value) {
-        setValue("PDFVersion", value);
+        setValue(PDFVERSION, value);
     }
 
     /** @return the name of the tool that produced the PDF document */
     public String getProducer() {
-        return getValue("Producer");
+        return getValue(PRODUCER);
     }
     
     /**
@@ -72,7 +76,7 @@
      * @param value the producer
      */
     public void setProducer(String value) {
-        setValue("Producer", value);
+        setValue(PRODUCER, value);
     }
 
 }

Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFAAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFAAdapter.java?rev=615893&r1=615892&r2=615893&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFAAdapter.java
(original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/xmp/schemas/pdf/PDFAAdapter.java
Mon Jan 28 06:32:06 2008
@@ -29,6 +29,10 @@
  */
 public class PDFAAdapter extends XMPSchemaAdapter {
 
+    private static final String PART = "part";
+    private static final String AMD = "amd";
+    private static final String CONFORMANCE = "conformance";
+
     /**
      * Constructs a new adapter for PDF/A around the given metadata object.
      * @param meta the underlying metadata
@@ -44,12 +48,12 @@
      * @param value the version identifier ("1" for PDF/A-1)
      */
     public void setPart(int value) {
-        setValue("part", Integer.toString(value));
+        setValue(PART, Integer.toString(value));
     }
 
     /** @return the PDF/A version identifier */
     public int getPart() {
-        return Integer.parseInt(getValue("part"));
+        return Integer.parseInt(getValue(PART));
     }
 
     /**
@@ -57,12 +61,12 @@
      * @param value the amendment identifiert
      */
     public void setAmendment(String value) {
-        setValue("amd", value);
+        setValue(AMD, value);
     }
     
     /** @return the PDF/A amendment identifier */
     public String getAmendment() {
-        return getValue("amd");
+        return getValue(AMD);
     }
     
     /**
@@ -70,12 +74,12 @@
      * @param value the conformance level ("A" or "B" for PDF/A-1)
      */
     public void setConformance(String value) {
-        setValue("conformance", value);
+        setValue(CONFORMANCE, value);
     }
     
     /** @return the PDF/A conformance level */
     public String getConformance() {
-        return getValue("conformance");
+        return getValue(CONFORMANCE);
     }
     
 }



---------------------------------------------------------------------
Apache XML Graphics Project URL: http://xmlgraphics.apache.org/
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org


Mime
View raw message