com.silverpeas.export
Class ImportExportDescriptor

java.lang.Object
  extended by com.silverpeas.export.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
static String NO_FORMAT
          A specific value for the export-import resource format indicating that no explicit format is defined.
 
Constructor Summary
ImportExportDescriptor()
           
 
Method Summary
 String getFormat()
          Gets the format in (or from) which the resource has to be exported (or imported).
<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>
O
inFormat(String format)
          Sets a format in which the resource to export will be or the resource to import is.
 boolean isParameterSet(String name)
          Is the parameter identified by the specified name set within this descriptor?
<T extends Serializable>
void
setParameter(String name, T value)
          Sets the specified process parameter with the specified value.
<O extends ImportExportDescriptor>
O
withoutParameter(String name)
          Removes the process parameter identified by the specified name.
<T extends Serializable,O extends ImportExportDescriptor>
O
withParameter(String name, T value)
          Adds a new process parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_FORMAT

public static final String NO_FORMAT
A specific value for the export-import resource format indicating that no explicit format is defined. In general, this specific value means the exporter or importer processes for a single predefined defined format and thus it is useless to specify it.

See Also:
Constant Field Values
Constructor Detail

ImportExportDescriptor

public ImportExportDescriptor()
Method Detail

getFormat

public String getFormat()
Gets the format in (or from) which the resource has to be exported (or imported). If no format is defined, then NO_FORMAT is returned.

Returns:
the format for export and import.

inFormat

public <O extends ImportExportDescriptor> O inFormat(String format)
Sets a format in which the resource to export will be or the resource to import is.

Parameters:
format - the export/import format 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.


Copyright © 2016 Silverpeas. All Rights Reserved.