Example #1
0
  TaskSetter(String helperKey, Class<?> type, IModule module, IIntrospectionHelper helper) {
    super(helperKey, type, module);
    if (type.isPrimitive()) {
      _typeCategory = TypeCategory.PRIMITIVE;
    } else {
      _typeCategory = TypeCategory.PLAIN;

      // Check if it is an enumerated attribute
      try {
        Class<?> clazz = helper.loadClass(EnumeratedAttribute.class.getName());
        if (clazz.isAssignableFrom(type)) {
          _typeCategory = TypeCategory.ENUM;
        }
      } catch (ClassNotFoundException ex) {
        AntlibTypeLoader.log(
            "could not load proper EnumeratedAttribute.class", Project.MSG_VERBOSE);
      }
    }
  }
Example #2
0
 IType makeParamType(Class clazz) {
   switch (_typeCategory) {
     case PRIMITIVE:
       return TypeSystem.getBoxType(TypeSystem.get(clazz));
     case ENUM:
       String enumName = TypeSystem.get(_type).getRelativeName().replace('.', '_');
       try {
         return TypeSystem.getByFullName("gw.vark.enums." + enumName);
       } catch (Exception e) {
         AntlibTypeLoader.log(
             "could not find generated enum type for "
                 + enumName
                 + " - must use EnumeratedAttribute instance instead",
             Project.MSG_VERBOSE);
       }
       _typeCategory = TypeCategory.PLAIN;
       // fall through
     case PLAIN:
     default:
       return TypeSystem.get(clazz);
   }
 }