All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.andyshaox.jdbc.annotation.Sqls Maven / Gradle / Ivy

package com.github.andyshaox.jdbc.annotation;

import java.lang.reflect.Method;
import java.util.Map;

import com.github.andyshao.reflect.ParameterOperation;
import com.github.andyshaox.jdbc.Sql;

/**
 * 
 * Title:
* Descript:
* Copyright: Copryright(c) Mar 9, 2016
* Encoding:UNIX UTF-8 * * @author Andy.Shao * */ public class Sqls { public static void build(Map result , Class clazz) { Sqls.build(result , clazz.getMethods()); } public static void build(Map result , Method... methods) { for (Method method : methods) { Sql value = Sqls.build(method); if (value != null) result.put(method , value); } } public static Sql build(Method method) { com.github.andyshaox.jdbc.annotation.Sql annotation = method.getAnnotation(com.github.andyshaox.jdbc.annotation.Sql.class); if (annotation == null) return null; Sql result = Sql.getDefault(); result.setProcessClass(method.getDeclaringClass()); result.setProcessMethod(method); result.setRetConvertor(annotation.retConvertor()); result.setSqlAssembly(annotation.sqlAssembly()); result.setSql(annotation.value()); result.setSqlType(annotation.sqlType()); result.setParameterNames(ParameterOperation.getParamNamesByAnnotation(method)); return result; } private Sqls() { throw new AssertionError("No " + Sqls.class + " instance for you"); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy