Skip to content

P15/bdg-convert

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bdg-convert

###Hacking bdg-convert

Install

To build

$ mvn install

###About bdg-convert

The Converter interface, inspired by Apache Commons Convert (sandbox component, never released), provides for converting from a source type S to a target type T, with a conversion stringency and SLF4J logger given as context.

public interface Converter<S, T> {
  T convert(S source, ConversionStringency stringency, Logger logger) throws ConversionException;
  // ...
}

Rather than implement a custom converter registry, bdg-convert relies on dependency injection via Google Guice.

Use the @Inject annotation to inject converters into class constructors:

final class MyClass {
  private final Converter<String, OntologyTerm ontologyTermConverter;
  private final ConversionStringency stringency = ConversionStringency.STRICT;
  private static final logger = LoggerFactory.getLogger(MyClass.class);

  @Inject
  MyClass(final Converter<String, OntologyTerm> ontologyTermConverter) {
    this.ontologyTermConverter = ontologyTermConverter;
  }

  void doIt() {
    OntologyTerm ontologyTerm = ontologyTermConverter.convert("SO:0000110", stringency, logger);
  }
}

The Guice injector handles construction of the converter instances, managing nested converter dependencies as necessary (if say, a SAMRecord to AlignmentRecord converter depends on a String to Strand converter).

About

Conversions to and from Big Data Genomics Avro Formats

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 100.0%