Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/jbpm/workflow/delegation/impl/ExceptionHandlingType.java


1   package org.jbpm.workflow.delegation.impl;
2   
3   import java.util.*;
4   
5   public class ExceptionHandlingType implements net.sf.hibernate.PersistentEnum, java.io.Serializable {
6   
7     private static List handlersById = new ArrayList();
8     private static Map handlersByText = new HashMap();
9   
10    public static final ExceptionHandlingType ROLLBACK = new ExceptionHandlingType( "rollback" );
11    public static final ExceptionHandlingType LOG      = new ExceptionHandlingType( "log" );
12    public static final ExceptionHandlingType IGNORE   = new ExceptionHandlingType( "ignore" );
13  
14    private ExceptionHandlingType( String text ) {
15      this.id = handlersById.size();
16      this.text = text;
17      handlersById.add( id, this );
18      handlersByText.put( text, this );
19    }
20    
21    public static final ExceptionHandlingType fromInt( int id ) {
22      return (ExceptionHandlingType) handlersById.get( id );
23    }
24    
25    public static final ExceptionHandlingType fromText( String text ) {
26      return (ExceptionHandlingType) handlersByText.get( text );
27    }
28    
29    public int toInt() {
30      return id;
31    }
32    
33    public String toString() {
34      return text;
35    }
36    
37    private int id = -1;
38    private String text = null;
39  }