Class TemplateUtils


  • public final class TemplateUtils
    extends Object
    Common things you may want to do with feature templates.
    Since:
    1.4
    Author:
    Matthew Pocock
    • Method Detail

      • instantiateTemplate

        public static Feature.Template instantiateTemplate​(Feature feat)
                                                    throws BioException
        This attempts to divine the 'best' template class for a feature and return a new instance readly for pupulating.

        This will (hopefully) be the most derived feature interface implemented by a feature class. This code assumes that feature interfaces are singly inherited. Of course, with the current template system, it is a fairly safe assumption.

        Throws:
        BioException
      • populate

        public static void populate​(Feature.Template templ,
                                    Feature feat)
                             throws BioException
        This attempts to populate the fields of a template using the publically accessible information in a feature. It is simple to call populate() within Feature.makeTemplate() to ensure all the slots get filled.
        Parameters:
        templ - the Feature.Template instance to populate
        feat - the Feature to read info from
        Throws:
        BioException