Package com.director.core

Examples of com.director.core.DirectException


   private Object invokeActionMethod(Object action, DirectAction directAction, DirectMethod directMethod, Object[] params) {
      try {
         return directMethod.getMethod().invoke(action, params);
      } catch(InvocationTargetException e) {
         String message = "Cannot invoke the action method " + directMethod + " of the direct class " + directAction;
         throw new DirectException(message, e.getTargetException());
      } catch(Throwable e) {
         String message = "Cannot invoke the action method " + directMethod + " of the direct class " + directAction;
         throw new DirectException(message, e);
      }
   }
View Full Code Here


         DirectTransactionResult result = methodInterceptor.result;
         methodInterceptor.result = null;
         return result;
      } catch(InvocationTargetException e) {
         String message = "Cannot invoke the action method " + directMethod + " of the direct class " + directAction;
         throw new DirectException(message, e.getTargetException());
      } catch(Throwable e) {
         String message = "Cannot invoke the action method " + directMethod + " of the direct class " + directAction;
         throw new DirectException(message, e);
      }
   }
View Full Code Here

   @SuppressWarnings("unchecked")
   public <T> T parseValue(int order, Type type) {
      if(json.isJsonArray()) {
         JsonArray jsonArray = json.getAsJsonArray();
         if(jsonArray.size() <= order) {
            throw new DirectException("Transaction data list of values cannot doesn't contain parameter with order index: " + order + " cause is too short: " + jsonArray.size());
         }
         JsonElement jsonElement = jsonArray.get(order);

         if(type instanceof ParameterizedType && Collection.class.isAssignableFrom((Class)((ParameterizedType)type).getRawType())) {
            Class collectionClass = (Class) ((ParameterizedType) type).getRawType();
            Object collectionArg = this.context.deserialize(jsonElement, this.getArrayComponentType(type));
            Collection collection = Set.class.isAssignableFrom(collectionClass) ? new HashSet(1) : new ArrayList(1);
            collection.add(collectionArg);
            return (T) collection;
         }

         if(this.isArray(type) && jsonElement.isJsonObject()) {
            Object arrayArg = this.context.deserialize(jsonElement, this.getArrayComponentType(type));
            Object[] array = (Object[]) Array.newInstance(this.getArrayComponentType(type), 1);
            array[0] = arrayArg;
            return (T) array;
         }

         return (T) this.context.deserialize(jsonElement, type);
      }
      throw new DirectException("Transaction data aren't a list of values, cannot access through parameter order index: " + order);
   }
View Full Code Here

      if(jsonData.isJsonObject()) {
         JsonObject jsonObject = jsonData.getAsJsonObject();
         JsonElement jsonElement = jsonObject.get(name);
         return (T) this.context.deserialize(jsonElement, type);
      }
      throw new DirectException("Transaction data aren't a list of names/values pairs, cannot access through parameter name: " + name);
   }
View Full Code Here

TOP

Related Classes of com.director.core.DirectException

Copyright © 2018 www.massapicom. 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.