    001    /*
    002     * Copyright 2010 Red Hat, Inc.
    003     * Red Hat licenses this file to you under the Apache License, version
    004     * 2.0 (the "License"); you may not use this file except in compliance
    005     * with the License.  You may obtain a copy of the License at
    006     *    http://www.apache.org/licenses/LICENSE-2.0
    007     * Unless required by applicable law or agreed to in writing, software
    008     * distributed under the License is distributed on an "AS IS" BASIS,
    009     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
    010     * implied.  See the License for the specific language governing
    011     * permissions and limitations under the License.
    012     */
    013
    014    package org.hornetq.api.jms;
    015
    016    /**
    017     * A JMSFactoryType
    018     *
    019     * @author howard
    020     *
    021     *
    022     */
    023    public enum JMSFactoryType
    024    {
    025       CF, QUEUE_CF, TOPIC_CF, XA_CF, QUEUE_XA_CF, TOPIC_XA_CF;
    026
    027       public int intValue()
    028       {
    029          int val = 0;
    030          switch (this)
    031          {
    032             case CF:
    033                val = 0;
    034                break;
    035             case QUEUE_CF:
    036                val = 1;
    037                break;
    038             case TOPIC_CF:
    039                val = 2;
    040                break;
    041             case XA_CF:
    042                val = 3;
    043                break;
    044             case QUEUE_XA_CF:
    045                val = 4;
    046                break;
    047             case TOPIC_XA_CF:
    048                val = 5;
    049                break;
    050          }
    051          return val;
    052       }
    053
    054       public static JMSFactoryType valueOf(int val)
    055       {
    056          JMSFactoryType type;
    057          switch (val)
    058          {
    059             case 0:
    060                type = CF;
    061                break;
    062             case 1:
    063                type = QUEUE_CF;
    064                break;
    065             case 2:
    066                type = TOPIC_CF;
    067                break;
    068             case 3:
    069                type = XA_CF;
    070                break;
    071             case 4:
    072                type = QUEUE_XA_CF;
    073                break;
    074             case 5:
    075                type = TOPIC_XA_CF;
    076                break;
    077             default:
    078                type = XA_CF;
    079                break;
    080          }
    081          return type;
    082       }
    083    }