Examples of TypeToken


Examples of cc.concurrent.mango.util.TypeToken

        if (method.getGenericParameterTypes().length != 1) {
            throw new IncorrectParameterCountException("batch update expected one and only one parameter but " +
                    method.getGenericParameterTypes().length); // 批量更新只能有一个参数
        }
        Type type = method.getGenericParameterTypes()[0];
        TypeToken typeToken = new TypeToken(type);
        Class<?> mappedClass = typeToken.getMappedClass();
        if (mappedClass == null || !typeToken.isIterable()) {
            throw new IncorrectParameterTypeException("parameter of batch update " +
                    "expected array or implementations of java.util.List or implementations of java.util.Set " +
                    "but " + type); // 批量更新的参数必须可迭代
        }
        return new Type[]{mappedClass};
View Full Code Here

Examples of cc.concurrent.mango.util.TypeToken

    }

    @Override
    public void checkType(TypeContext context) {
        Type type = context.getPropertyType(parameterName, propertyPath);
        TypeToken typeToken = new TypeToken(type);
        Class<?> mappedClass = typeToken.getMappedClass();
        if (!typeToken.isIterable()) { // 不是集合或数组抛出异常
            throw new IncorrectParameterTypeException("invalid type of " + fullName + ", " +
                    "expected array or implementations of java.util.List or implementations of java.util.Set " +
                    "but " + type);
        }
        if (mappedClass == null || !JdbcUtils.isSingleColumnClass(mappedClass)) {
            String s = typeToken.isArray() ? "component" : "actual";
            throw new IncorrectParameterTypeException("invalid " + s + " type of " + fullName + ", " +
                    s + " type of " + fullName + " expected a class can be identified by jdbc " +
                    "but " + typeToken.getMappedType());
        }
    }
View Full Code Here

Examples of cc.concurrent.mango.util.TypeToken

    }

    @Override
    public void checkType(TypeContext context) {
        Type type = context.getPropertyType(parameterName, propertyPath);
        TypeToken typeToken = new TypeToken(type);
        Class<?> mappedClass = typeToken.getMappedClass();
        if (mappedClass == null || typeToken.isIterable() || !JdbcUtils.isSingleColumnClass(mappedClass)) {
            throw new IncorrectParameterTypeException("invalid type of " + fullName + ", " +
                    "expected a class can be identified by jdbc but " + type);
        }
    }
View Full Code Here

Examples of cc.concurrent.mango.util.TypeToken

                }

                checkCacheBy();

                Type suffixType = getTypeContext().getPropertyType(suffixParameterName, suffixPropertyPath);
                TypeToken typeToken = new TypeToken(suffixType);
                useMultipleKeys = typeToken.isIterable();
                suffixClass = typeToken.getMappedClass();
            }
        }
    }
View Full Code Here

Examples of cc.concurrent.mango.util.TypeToken

        super(rootNode, method, sqlType);
        init(rootNode, method);
    }

    private void init(ASTRootNode rootNode, Method method) {
        TypeToken typeToken = new TypeToken(method.getGenericReturnType());
        isForList = typeToken.isList();
        isForSet = typeToken.isSet();
        isForArray = typeToken.isArray();
        Class<?> mappedClass = typeToken.getMappedClass();
        rowMapper = getRowMapper(mappedClass);

        List<ASTIterableParameter> ips = rootNode.getIterableParameters();
        if (!ips.isEmpty() && !isForList && !isForSet && !isForArray) {
            throw new IncorrectReturnTypeException("if sql has in clause, return type " +
View Full Code Here

Examples of cc.concurrent.mango.util.TypeToken

        if (method.getGenericParameterTypes().length != 1) {
            throw new IncorrectParameterCountException("batch update expected one and only one parameter but " +
                    method.getGenericParameterTypes().length); // 批量更新只能有一个参数
        }
        Type type = method.getGenericParameterTypes()[0];
        TypeToken typeToken = new TypeToken(type);
        Class<?> mappedClass = typeToken.getMappedClass();
        if (mappedClass == null || !typeToken.isIterable()) {
            throw new IncorrectParameterTypeException("parameter of batch update " +
                    "expected array or implementations of java.util.List or implementations of java.util.Set " +
                    "but " + type); // 批量更新的参数必须可迭代
        }
        return new Type[]{mappedClass};
View Full Code Here

Examples of cc.concurrent.mango.util.TypeToken

        super(rootNode, method, sqlType);
        init(rootNode, method);
    }

    private void init(ASTRootNode rootNode, Method method) {
        TypeToken typeToken = new TypeToken(method.getGenericReturnType());
        isForList = typeToken.isList();
        isForSet = typeToken.isSet();
        isForArray = typeToken.isArray();
        Class<?> mappedClass = typeToken.getMappedClass();
        rowMapper = getRowMapper(mappedClass);

        List<ASTIterableParameter> ips = rootNode.getIterableParameters();
        if (!ips.isEmpty() && !isForList && !isForSet && !isForArray) {
            throw new IncorrectReturnTypeException("if sql has in clause, return type " +
View Full Code Here

Examples of com.google.common.reflect.TypeToken

    * Returns an {@link Iterable} of {@link org.jclouds.management.ViewMBean} for the specified {@link View}.
    * @param view
    * @return
    */
   private static Iterable<ViewMBean> viewManagementOf(final View view) {
      TypeToken type = TypeToken.of(view.getClass());
      return Iterables.transform(ViewMBeanFactories.forType(type), new Function<ViewMBeanFactory, ViewMBean>() {
         @Override
         public ViewMBean apply(@Nullable ViewMBeanFactory factory) {
            return factory.create(view);
         }
View Full Code Here

Examples of com.google.common.reflect.TypeToken

    * Returns an {@link Iterable} of {@link org.jclouds.management.ViewMBean} for the specified {@link View}.
    * @param view
    * @return
    */
   private static Iterable<ViewMBean> viewManagementOf(final View view) {
      TypeToken type = TypeToken.of(view.getClass());
      return Iterables.transform(ViewMBeanFactories.forType(type), new Function<ViewMBeanFactory, ViewMBean>() {
         @Override
         public ViewMBean apply(@Nullable ViewMBeanFactory factory) {
            return factory.create(view);
         }
View Full Code Here

Examples of com.google.common.reflect.TypeToken

     * @return The found result. If there is no matching result, it will return <tt>null</tt>. (Nullable)
     */
    @SuppressWarnings("rawtypes")
    private ReturnValue getReturnValueFromHistoryByType(final Type type) {
       
        final TypeToken returnValueType = TypeToken.of(getTypeFromReturnValue(type));
        for (ReturnValue returnValue : returnValueHistory) {
            if (returnValueType.isAssignableFrom(returnValue.getType())) {
                return returnValue;
            }
        }
        return null;
    }
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.