Package org.apache.xmlgraphics.xmp
Class XMPSchemaAdapter
java.lang.Object
org.apache.xmlgraphics.xmp.XMPSchemaAdapter
- Direct Known Subclasses:
AdobePDFAdapter
,DublinCoreAdapter
,PDFAAdapter
,PDFAExtensionAdapter
,PDFUAAdapter
,PDFVTAdapter
,PDFXAdapter
,XAPMMAdapter
,XMPBasicAdapter
Base class for schema-specific adapters that provide user-friendly access to XMP values.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addDateToSeq
(String propName, Date value) Adds a date value to an ordered array.protected void
addObjectToArray
(String propName, Object value, XMPArrayType arrayType) Adds a Object value to an array.protected void
addStringToBag
(String propName, String value) Adds a String value to an unordered array.protected void
addStringToSeq
(String propName, String value) Adds a String value to an ordered array.protected PropertyAccess
findQualifiedStructure
(String propName, QName qualifier, String qualifierValue) Finds a structure that matches a given qualifier.protected Object
findQualifiedValue
(String propName, QName qualifier, String qualifierValue) Finds a value that matches a given qualifier.static String
Formats a Date using ISO 8601 format in the default time zone.static String
formatISO8601Date
(Date dt, TimeZone tz) Formats a Date using ISO 8601 format in the given time zone.protected Date[]
getDateArray
(String propName) Returns a Date array representation of the property's values.protected Date
getDateValue
(String propName) Returns a date value.protected String
getLangAlt
(String lang, String propName) Returns a language-dependent value.protected Object[]
getObjectArray
(String propName) Returns an object array representation of the property's values.protected QName
Returns the QName for a given propertyprotected String[]
getStringArray
(String propName) Returns a String array representation of the property's values.protected String
Returns a simple value.protected String
removeLangAlt
(String lang, String propName) Removes a language-dependent value from an alternative array.protected boolean
removeStringFromArray
(String propName, String value) Removes a value from an array.void
setCompact
(boolean c) protected void
setDateValue
(String propName, Date value) Set a date value.protected void
setLangAlt
(String propName, String lang, String value) Sets a language-dependent value.protected void
setProperty
(String propName, XMPProperty subProp) protected void
Sets a simple value.
-
Field Details
-
meta
the Metadata object this schema instance operates on
-
-
Constructor Details
-
XMPSchemaAdapter
Main constructor.- Parameters:
meta
- the Metadata object to wraoschema
- the XMP schema for which this adapter was written
-
-
Method Details
-
getSchema
- Returns:
- the XMP schema associated with this adapter
-
getQName
Returns the QName for a given property- Parameters:
propName
- the property name- Returns:
- the resulting QName
-
addObjectToArray
Adds a Object value to an array.- Parameters:
propName
- the property namevalue
- the Object valuearrayType
- the type of array to operate on
-
removeStringFromArray
Removes a value from an array.- Parameters:
propName
- the name of the propertyvalue
- the value to be removed- Returns:
- true if the value was removed, false if it was not found
-
addStringToSeq
Adds a String value to an ordered array.- Parameters:
propName
- the property namevalue
- the String value
-
addStringToBag
Adds a String value to an unordered array.- Parameters:
propName
- the property namevalue
- the String value
-
formatISO8601Date
Formats a Date using ISO 8601 format in the default time zone.- Parameters:
dt
- the date- Returns:
- the formatted date
-
formatISO8601Date
Formats a Date using ISO 8601 format in the given time zone.- Parameters:
dt
- the datetz
- the time zone- Returns:
- the formatted date
-
addDateToSeq
Adds a date value to an ordered array.- Parameters:
propName
- the property namevalue
- the date value
-
setDateValue
Set a date value.- Parameters:
propName
- the property namevalue
- the date value
-
getDateValue
Returns a date value.- Parameters:
propName
- the property name- Returns:
- the date value or null if the value is not set
-
setLangAlt
Sets a language-dependent value.- Parameters:
propName
- the property namelang
- the language ("x-default" or null for the default language)value
- the value
-
setValue
Sets a simple value.- Parameters:
propName
- the property namevalue
- the value
-
getValue
Returns a simple value.- Parameters:
propName
- the property name- Returns:
- the requested value or null if it isn't set
-
setProperty
-
removeLangAlt
Removes a language-dependent value from an alternative array.- Parameters:
lang
- the language ("x-default" for the default language)propName
- the property name- Returns:
- the removed value
-
getLangAlt
Returns a language-dependent value. If the value in the requested language is not available the value for the default language is returned.- Parameters:
lang
- the language ("x-default" for the default language)propName
- the property name- Returns:
- the requested value
-
findQualifiedStructure
protected PropertyAccess findQualifiedStructure(String propName, QName qualifier, String qualifierValue) Finds a structure that matches a given qualifier.- Parameters:
propName
- the property namequalifier
- the qualifierqualifierValue
- the qualifier value- Returns:
- the structure if a match was found (or null if no match was found)
-
findQualifiedValue
Finds a value that matches a given qualifier.- Parameters:
propName
- the property namequalifier
- the qualifierqualifierValue
- the qualifier value- Returns:
- the value if a match was found (or null if no match was found)
-
getObjectArray
Returns an object array representation of the property's values.- Parameters:
propName
- the property name- Returns:
- the object array or null if the property isn't set
-
getStringArray
Returns a String array representation of the property's values. Complex values are converted to Strings using the toString() method.- Parameters:
propName
- the property name- Returns:
- the String array or null if the property isn't set
-
getDateArray
Returns a Date array representation of the property's values.- Parameters:
propName
- the property name- Returns:
- the Date array or null if the property isn't set
-
setCompact
public void setCompact(boolean c)
-