001    package edu.nrao.sss.model.proposal;
002    
003    import edu.nrao.sss.util.EnumerationUtility;
004    
005    /** <i>Placeholder for time when we integrate proposal work.</i>
006     * An enumeration of the levels of support that an observer
007     * might need from NRAO.
008     * 
009     * @version 1.1
010     * @since   2006-03-03
011     */
012    public enum SupportType
013    {
014      /** Signifies that an observer needs no help from NRAO
015       *  with their project.
016       *  <p>
017       *  The name of this element (for use with
018       *  {@code getInstanceFromName(String)}) is <i>NONE</i>.</p>
019       */
020      NONE, 
021    
022      /** Signifies that an observer would like to consult
023       *  with NRAO about their project.
024       *  <p>
025       *  The name of this element (for use with
026       *  {@code getInstanceFromName(String)}) is <i>CONSULTATION</i>.</p>
027       */
028      CONSULTATION, 
029      
030      /** Signifies that an observer would like to have
031       *  NRAO heavily involved with their project.
032       *  <p>
033       *  The name of this element (for use with
034       *  {@code getInstanceFromName(String)}) is <i>FRIEND</i>.</p>
035       */
036      FRIEND,
037      
038      /** Signifies that the observer's need for support
039       *  is unknown.
040       *  <p>
041       *  This element is used to implement the
042       *  <i>Null Object Pattern</i>.  In situations where a method might
043       *  be tempted to return <i>null</i>, this element is returned instead.</p>
044       */
045      UNKNOWN;
046    
047      /**
048       * Returns a default support type.
049       * @return a default support type.
050       */
051      public static SupportType getDefault()
052      {
053        return NONE;
054      }
055      
056      /**
057       * Returns a text representation of this enumeration constant.
058       * @return a text representation of this enumeration constant.
059       */
060      public String toString()
061      {
062        return EnumerationUtility.getSharedInstance().enumToString(this);
063      }
064    
065      /**
066       * Returns the support type represented by {@code text}.
067       * <p>
068       * For details about the transformation, see
069       * {@link EnumerationUtility#enumFromString(Class, String)}.</p>
070       * 
071       * @param text a text representation of a support type.
072       * 
073       * @return the support type represented by {@code text}.
074       */
075      public static SupportType fromString(String text)
076      {
077        return EnumerationUtility.getSharedInstance()
078                                 .enumFromString(SupportType.class, text);
079      }
080    }