Class NamedMappingTransformer<T>

java.lang.Object
org.incenp.obofoundry.sssom.transform.NamedMappingTransformer<T>
Type Parameters:
T - The type of object to transform the mapping into.
All Implemented Interfaces:
IMappingTransformer<T>

public class NamedMappingTransformer<T> extends Object implements IMappingTransformer<T>
A mapping transformer that has a string representation. This class merely wraps an existing transformer. It is mostly intended for debugging, so that transformers created using lambda functions can still be displayed in a readable form.

Example, for a transformer that produces basic string representations of mappings:

 IMappingTransformer<String> myTransformer = new NamedMappingTransformer<String>("mapping-to-string",
         (mapping) -> String.format("%s -[%s]-> %s", mapping.getSubjectId(), mapping.getPredicateId(),
                 mapping.getObjectId()));
 
  • Constructor Details

    • NamedMappingTransformer

      public NamedMappingTransformer(String name, IMappingTransformer<T> transformer)
      Creates a new instance.
      Parameters:
      name - A string representation of the transformer.
      transformer - The actual transformer.
  • Method Details