Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
SIX OVAL - http://code.google.com/p/six-oval/ Copyright (C) 2010 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number: H22PRO-1124 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package jp.go.aist.six.oval.core.model;
 
Helper functions for the OvalEnumeration.

Author(s):
Akihito Nakamura, AIST
Version:
$Id: OvalEnumerationHelper.java 3062 2013-02-25 03:18:33Z nakamura5akihito@gmail.com $
 
 public final class OvalEnumerationHelper
 {

    
Logger.
 
     private static final Logger  _LOG_ = LoggerFactory.getLoggerOvalEnumerationHelper.class );
 
 
     private static final HashMap<Class<? extends OvalEnumeration>, Method>
     _FROM_VALUE_METHODS_ = new HashMap<Class<? extends OvalEnumeration>, Method>();



    
Invokes the static fromValue(String) method of the given OvalEnumeration class.

Parameters:
type the concrete OvalEnumeration type.
value the value of the enumeration.
Returns:
the OvalEnumeration instance of the given type and value.
Throws:
jp.go.aist.six.oval.OvalException
 
     public static <T extends OvalEnumeration> T fromValue(
                     final Class<T> type,
                     final String value
                     )
     {
         if (type == null) {
             throw new IllegalArgumentException"empty type" );
         }
 
         Object  obj = null;
         Method  method = .gettype );
         try {
             if (method == null) {
                 method = type.getMethod"fromValue"String.class );
                               //throws NoSuchMethodexception
                 .puttypemethod );
             }
             obj = method.invokenullvalue );
                          //throws IllegalAccessException, InvocationTargetException
         } catch (Exception ex) {
             .errorex.getMessage() );
             throw new OvalExceptionex );
         }
 
         return type.castobj );
     }



    
Invokes the value() method of the given OvalEnumeration instance.

Parameters:
obj the OvalEnumeration instance.
Returns:
the return value of the value() method.
Throws:
jp.go.aist.six.oval.OvalException
 
     public static String value(
                    final OvalEnumeration obj
                    )
    {
        if (obj == null) {
            throw new IllegalArgumentException"empty object" );
        }
        .trace( String.valueOfobj.getClass() ) );
        return obj.value();
    }
//
New to GrepCode? Check out our FAQ X