org.biojava.bio.seq.impl
Class TemplateUtils

java.lang.Object
  extended by org.biojava.bio.seq.impl.TemplateUtils

public final class TemplateUtils
extends Object

Common things you may want to do with feature templates.

Since:
1.4
Author:
Matthew Pocock

Method Summary
static Feature.Template instantiateTemplate(Feature feat)
          This attempts to divine the 'best' template class for a feature and return a new instance readly for pupulating.
static Feature.Template makeTemplate(Feature feat)
           
static void populate(Feature.Template templ, Feature feat)
          This attempts to populate the fields of a template using the publically accessible information in a feature.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

makeTemplate

public static Feature.Template makeTemplate(Feature feat)
                                     throws BioException
Throws:
BioException