Examples of IllegalValueTypeException


Examples of org.crsh.cli.impl.descriptor.IllegalValueTypeException

          Type elementType = parameterizedType.getActualTypeArguments()[0];
          if (elementType instanceof Class<?>) {
            declaredType = (Class<Object>)elementType;
            multiplicity = Multiplicity.MULTI;
          } else {
            throw new IllegalValueTypeException();
          }
        } else {
          throw new IllegalValueTypeException();
        }
      } else {
        throw new IllegalValueTypeException();
      }
    } else {
      throw new IllegalValueTypeException();
    }

    //
    Class<?> effectiveType;
    ValueType valueType;
    if (declaredType == String.class) {
      effectiveType = String.class;
      valueType = ValueType.STRING;
    } else if (declaredType == Integer.class || declaredType == int.class) {
      effectiveType = Integer.class;
      valueType = ValueType.INTEGER;
    } else if (declaredType == Boolean.class || declaredType == boolean.class) {
      effectiveType = Boolean.class;
      valueType = ValueType.BOOLEAN;
    } else if (Enum.class.isAssignableFrom(declaredType)) {
      effectiveType = declaredType;
      valueType = ValueType.ENUM;
    } else {
      effectiveType = declaredType;
      valueType = factory.get(declaredType);
      if (valueType == null) {
        throw new IllegalValueTypeException("Type " + declaredType.getName() + " is not handled at the moment");
      }
    }

    //
    return new ParameterType(multiplicity, declaredType, effectiveType, valueType);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.