public class TypeFactory extends TypeFactory
logger| Constructor and Description |
|---|
TypeFactory() |
| Modifier and Type | Method and Description |
|---|---|
static SystemMetadata |
buildMinimalSystemMetadata(Identifier id,
InputStream data,
String checksumAlgorithm,
ObjectFormatIdentifier formatId,
Subject submitterRightsHolder)
Builds a minimal and 'typical' SystemMetadata object containing all of the required fields needed
for submission to DataONE at time of create.
|
static <T> T |
convertTypeFromType(Object original,
Class<T> destinationClass)
Intended for converting DataONE objects to an instance of another version,
this method copies and converts based on common properties.
|
buildAccessRule, buildAccessRule, buildFormatIdentifier, buildIdentifier, buildNodeReference, buildSubject, clone, cloneFormatIdentifier, cloneIdentifier, cloneNodeReference, cloneSubjectpublic static SystemMetadata buildMinimalSystemMetadata(Identifier id, InputStream data, String checksumAlgorithm, ObjectFormatIdentifier formatId, Subject submitterRightsHolder) throws NoSuchAlgorithmException, IOException, NotFound, ServiceFailure
id - data - checksumAlgorithm - - if null, defaults to "MD5"formatId - - this method does not validate whether the formatId is supportedsubmitterRightsHolder - - uses this Subject as values for both of the propertiesNoSuchAlgorithmExceptionIOExceptionNotFoundServiceFailurepublic static <T> T convertTypeFromType(Object original, Class<T> destinationClass) throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
Properties of the destination may share references with the original. Use TypeFactory.clone(original) prior to conversion if shared references are not desired.
NOTE: when converting v2.Log to v1.Log, LogEntries with incompatible events will be removed to preclude serialization errors (the event property cannot be null). Similarly, when converting v2.LogEntry to v1.LogEntry, an InstantiationException will be thrown if the event is incompatible.
original - the instance being converteddestinationClass - the target class to return an instance ofInstantiationExceptionIllegalAccessExceptionMarshallingExceptionIOExceptionInvocationTargetExceptionNoSuchMethodExceptionCopyright © 2018. All Rights Reserved.