Coverage Report - org.kuali.student.enrollment.courseoffering.dto.FinalExam
 
Classes in this File Line Coverage Branch Coverage Complexity
FinalExam
0%
0/11
0%
0/6
2.333
 
 1  
 package org.kuali.student.enrollment.courseoffering.dto;
 2  
 
 3  
 import javax.xml.bind.annotation.XmlEnum;
 4  
 
 5  
 /**
 6  
  * @Author Sri komandur@uw.edu
 7  
  *
 8  
  * Our use case involves jpa persistence, storing enum in attributes as 'string' and conversion back to enum
 9  
  * This design, explicitly specifying 'business type'  gives flexibility and avoids pitfalls in the future when a stored enum
 10  
  * is renamed, for example.
 11  
  */
 12  0
 @XmlEnum(String.class)
 13  
 public enum FinalExam {
 14  
 
 15  0
     STANDARD("STANDARD"), ALTERNATE("ALTERNATE"), NONE("NONE");
 16  
 
 17  
     private final String name;
 18  
 
 19  0
     FinalExam(String name) {
 20  0
         this.name = name;
 21  0
     }
 22  
 
 23  
     public static FinalExam toEnum(String value) {
 24  0
         if (value != null) {
 25  0
             for (FinalExam finalExam : values()) {
 26  0
                 if (finalExam.name.equals(value)) {
 27  0
                     return finalExam;
 28  
                 }
 29  
             }
 30  
         }
 31  0
         return FinalExam.NONE;
 32  
     }
 33  
 
 34  
     public String fromEnum() {
 35  0
         return name;
 36  
     }
 37  
 }