Skip to content
  • Marek Szuba's avatar
    RNAProduct: do not hardcode mappings between type IDs and class names · ccfc19a8
    Marek Szuba authored
    There is now a dedicated class, Utils::RNAProductTypeMapper, which
    provides type_id<->class_name mappings to both RNAProduct constructor
    (with the side bonus of no longer having to set the type ID in the
    constructor of each subclass) and RNAProductAdaptor. The latter will
    likely be used more frequently than the former, therefore the default
    map uses type IDs as keys; the reverse map is only generated the first
    time it is needed.
    
    In addition to the constructor, the RNAProductTypeMapper.pm defines a
    function called mapper() which provides a singleton instance of the
    mapper object.
    
    The mappings are hardcoded instead of being retrieved from the database
    because the latter could in principle result in execution of arbitrary
    code.
    
    Some tests have been defined as well.
    ccfc19a8