Package org.silverpeas.core.importexport
Class ImportExportDescriptor
- java.lang.Object
-
- org.silverpeas.core.importexport.ImportExportDescriptor
-
- Direct Known Subclasses:
ExportDescriptor
,ImportDescriptor
public abstract class ImportExportDescriptor extends Object
An import-export descriptor is an object that provides useful information to exporters and importers for performing their tasks. Information is carried through import and export process parameters.
-
-
Field Summary
Fields Modifier and Type Field Description static String
NO_MIMETYPE
A specific value for the export-import format MIME type indicating that the MIME type isn't specified.
-
Constructor Summary
Constructors Constructor Description ImportExportDescriptor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getMimeType()
Gets the MIME type of the serialized resource.<T> T
getParameter(String name)
Gets the parameter identified by the specified name.List<String>
getParameters()
Gets a list of the parameter names from this descriptor.<O extends ImportExportDescriptor>
OinMimeType(String mimeType)
Sets a MIME type for the serialized resource to export or to import.boolean
isParameterSet(String name)
Is the parameter identified by the specified name set within this descriptor?<T extends Serializable>
voidsetParameter(String name, T value)
Sets the specified process parameter with the specified value.<O extends ImportExportDescriptor>
OwithoutParameter(String name)
Removes the process parameter identified by the specified name.<T extends Serializable,O extends ImportExportDescriptor>
OwithParameter(String name, T value)
Adds a new process parameter.
-
-
-
Field Detail
-
NO_MIMETYPE
public static final String NO_MIMETYPE
A specific value for the export-import format MIME type indicating that the MIME type isn't specified. In general, this specific value means the exporter or importer works only with a serialization format in a single well-known MIME type and thus it is useless to specify it.- See Also:
- Constant Field Values
-
-
Method Detail
-
getMimeType
public String getMimeType()
Gets the MIME type of the serialized resource. If no MIME type is defined, thenNO_MIMETYPE
is returned.- Returns:
- the MIME type of the serialized resource.
-
inMimeType
public <O extends ImportExportDescriptor> O inMimeType(String mimeType)
Sets a MIME type for the serialized resource to export or to import.- Parameters:
mimeType
- the export/import mimeType to set.- Returns:
- itself.
-
withParameter
public <T extends Serializable,O extends ImportExportDescriptor> O withParameter(String name, T value)
Adds a new process parameter. If a parameter already exists with the specified name, the value is replaced.- Type Parameters:
T
- the type of the parameter value.- Parameters:
name
- the parameter name.value
- the parameter value.- Returns:
- itself.
-
setParameter
public <T extends Serializable> void setParameter(String name, T value)
Sets the specified process parameter with the specified value. If the parameter already exists, the value is replaced with the specified one.- Type Parameters:
T
- the type of the parameter value to set.- Parameters:
name
- the name of the parameter.value
- the parameter value to set.
-
withoutParameter
public <O extends ImportExportDescriptor> O withoutParameter(String name)
Removes the process parameter identified by the specified name. If no parameter with the specified name exists, nothing is done.- Parameters:
name
- the parameter name.- Returns:
- itself.
-
getParameter
public <T> T getParameter(String name)
Gets the parameter identified by the specified name. If no parameter with the specified name exists, null is returned.- Type Parameters:
T
- the type of the parameter value.- Parameters:
name
- the parameter name.- Returns:
- the value of the parameter or null if no such parameter exists.
-
getParameters
public List<String> getParameters()
Gets a list of the parameter names from this descriptor.- Returns:
- a list of parameter names.
-
isParameterSet
public boolean isParameterSet(String name)
Is the parameter identified by the specified name set within this descriptor?- Parameters:
name
- the parameter name- Returns:
- true if the parameter is set, false otherwise.
-
-