Search in sources :

Example 1 with IdsTypeTransformer

use of org.eclipse.dataspaceconnector.ids.spi.transform.IdsTypeTransformer in project DataSpaceConnector by eclipse-dataspaceconnector.

the class TransformerRegistryImpl method transform.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Nullable
private <INPUT, OUTPUT> OUTPUT transform(INPUT object, Class<OUTPUT> outputType, TransformerContext context) {
    Objects.requireNonNull(object);
    IdsTypeTransformer idsTypeTransformer = findEligibleTransformer(object, outputType);
    if (idsTypeTransformer == null) {
        // this is a programming error
        throw new EdcException("Transformer not found for pair:" + new TransformKey(object.getClass(), outputType));
    }
    return outputType.cast(idsTypeTransformer.transform(object, context));
}
Also used : IdsTypeTransformer(org.eclipse.dataspaceconnector.ids.spi.transform.IdsTypeTransformer) EdcException(org.eclipse.dataspaceconnector.spi.EdcException) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with IdsTypeTransformer

use of org.eclipse.dataspaceconnector.ids.spi.transform.IdsTypeTransformer in project DataSpaceConnector by eclipse-dataspaceconnector.

the class IdsTransformerRegistryImpl method transform.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Nullable
private <INPUT, OUTPUT> OUTPUT transform(INPUT object, Class<OUTPUT> outputType, TransformerContext context) {
    Objects.requireNonNull(object);
    IdsTypeTransformer idsTypeTransformer = findEligibleTransformer(object, outputType);
    if (idsTypeTransformer == null) {
        // this is a programming error
        throw new EdcException("Transformer not found for pair:" + new TransformKey(object.getClass(), outputType));
    }
    return outputType.cast(idsTypeTransformer.transform(object, context));
}
Also used : IdsTypeTransformer(org.eclipse.dataspaceconnector.ids.spi.transform.IdsTypeTransformer) EdcException(org.eclipse.dataspaceconnector.spi.EdcException) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

IdsTypeTransformer (org.eclipse.dataspaceconnector.ids.spi.transform.IdsTypeTransformer)2 EdcException (org.eclipse.dataspaceconnector.spi.EdcException)2 Nullable (org.jetbrains.annotations.Nullable)2