Package org.apache.xmlgraphics.xmp
Class XMPSchemaAdapter
- java.lang.Object
-
- org.apache.xmlgraphics.xmp.XMPSchemaAdapter
-
- Direct Known Subclasses:
AdobePDFAdapter,DublinCoreAdapter,PDFAAdapter,PDFUAAdapter,PDFVTAdapter,PDFXAdapter,XAPMMAdapter,XMPBasicAdapter
public class XMPSchemaAdapter extends java.lang.ObjectBase class for schema-specific adapters that provide user-friendly access to XMP values.
-
-
Constructor Summary
Constructors Constructor Description XMPSchemaAdapter(Metadata meta, XMPSchema schema)Main constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddDateToSeq(java.lang.String propName, java.util.Date value)Adds a date value to an ordered array.protected voidaddObjectToArray(java.lang.String propName, java.lang.Object value, XMPArrayType arrayType)Adds a Object value to an array.protected voidaddStringToBag(java.lang.String propName, java.lang.String value)Adds a String value to an unordered array.protected voidaddStringToSeq(java.lang.String propName, java.lang.String value)Adds a String value to an ordered array.protected PropertyAccessfindQualifiedStructure(java.lang.String propName, QName qualifier, java.lang.String qualifierValue)Finds a structure that matches a given qualifier.protected java.lang.ObjectfindQualifiedValue(java.lang.String propName, QName qualifier, java.lang.String qualifierValue)Finds a value that matches a given qualifier.static java.lang.StringformatISO8601Date(java.util.Date dt)Formats a Date using ISO 8601 format in the default time zone.static java.lang.StringformatISO8601Date(java.util.Date dt, java.util.TimeZone tz)Formats a Date using ISO 8601 format in the given time zone.protected java.util.Date[]getDateArray(java.lang.String propName)Returns a Date array representation of the property's values.protected java.util.DategetDateValue(java.lang.String propName)Returns a date value.protected java.lang.StringgetLangAlt(java.lang.String lang, java.lang.String propName)Returns a language-dependent value.protected java.lang.Object[]getObjectArray(java.lang.String propName)Returns an object array representation of the property's values.protected QNamegetQName(java.lang.String propName)Returns the QName for a given propertyXMPSchemagetSchema()protected java.lang.String[]getStringArray(java.lang.String propName)Returns a String array representation of the property's values.protected java.lang.StringgetValue(java.lang.String propName)Returns a simple value.protected java.lang.StringremoveLangAlt(java.lang.String lang, java.lang.String propName)Removes a language-dependent value from an alternative array.protected booleanremoveStringFromArray(java.lang.String propName, java.lang.String value)Removes a value from an array.voidsetCompact(boolean c)protected voidsetDateValue(java.lang.String propName, java.util.Date value)Set a date value.protected voidsetLangAlt(java.lang.String propName, java.lang.String lang, java.lang.String value)Sets a language-dependent value.protected voidsetValue(java.lang.String propName, java.lang.String value)Sets a simple value.
-
-
-
Field Detail
-
meta
protected Metadata meta
the Metadata object this schema instance operates on
-
-
Method Detail
-
getSchema
public XMPSchema getSchema()
- Returns:
- the XMP schema associated with this adapter
-
getQName
protected QName getQName(java.lang.String propName)
Returns the QName for a given property- Parameters:
propName- the property name- Returns:
- the resulting QName
-
addObjectToArray
protected void addObjectToArray(java.lang.String propName, java.lang.Object value, XMPArrayType arrayType)Adds a Object value to an array.- Parameters:
propName- the property namevalue- the Object valuearrayType- the type of array to operate on
-
removeStringFromArray
protected boolean removeStringFromArray(java.lang.String propName, java.lang.String value)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
protected void addStringToSeq(java.lang.String propName, java.lang.String value)Adds a String value to an ordered array.- Parameters:
propName- the property namevalue- the String value
-
addStringToBag
protected void addStringToBag(java.lang.String propName, java.lang.String value)Adds a String value to an unordered array.- Parameters:
propName- the property namevalue- the String value
-
formatISO8601Date
public static java.lang.String formatISO8601Date(java.util.Date dt)
Formats a Date using ISO 8601 format in the default time zone.- Parameters:
dt- the date- Returns:
- the formatted date
-
formatISO8601Date
public static java.lang.String formatISO8601Date(java.util.Date dt, java.util.TimeZone tz)Formats a Date using ISO 8601 format in the given time zone.- Parameters:
dt- the datetz- the time zone- Returns:
- the formatted date
-
addDateToSeq
protected void addDateToSeq(java.lang.String propName, java.util.Date value)Adds a date value to an ordered array.- Parameters:
propName- the property namevalue- the date value
-
setDateValue
protected void setDateValue(java.lang.String propName, java.util.Date value)Set a date value.- Parameters:
propName- the property namevalue- the date value
-
getDateValue
protected java.util.Date getDateValue(java.lang.String propName)
Returns a date value.- Parameters:
propName- the property name- Returns:
- the date value or null if the value is not set
-
setLangAlt
protected void setLangAlt(java.lang.String propName, java.lang.String lang, java.lang.String value)Sets a language-dependent value.- Parameters:
propName- the property namelang- the language ("x-default" or null for the default language)value- the value
-
setValue
protected void setValue(java.lang.String propName, java.lang.String value)Sets a simple value.- Parameters:
propName- the property namevalue- the value
-
getValue
protected java.lang.String getValue(java.lang.String propName)
Returns a simple value.- Parameters:
propName- the property name- Returns:
- the requested value or null if it isn't set
-
removeLangAlt
protected java.lang.String removeLangAlt(java.lang.String lang, java.lang.String propName)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
protected java.lang.String getLangAlt(java.lang.String lang, java.lang.String propName)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(java.lang.String propName, QName qualifier, java.lang.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
protected java.lang.Object findQualifiedValue(java.lang.String propName, QName qualifier, java.lang.String qualifierValue)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
protected java.lang.Object[] getObjectArray(java.lang.String propName)
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
protected java.lang.String[] getStringArray(java.lang.String propName)
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
protected java.util.Date[] getDateArray(java.lang.String propName)
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)
-
-