![JAR search and dependency download from the Maven repository](/logo.png)
com.tsc9526.monalisa.orm.annotation.Select Maven / Gradle / Ivy
/*******************************************************************************************
* Copyright (c) 2016, zzg.zhou([email protected])
*
* Monalisa is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*******************************************************************************************/
package com.tsc9526.monalisa.orm.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* First of all, please setup eclipse:
* Window -> Preferences -> Java -> Editor -> Save Action -> Configure -> monalisa
* Enable this option: @Select
*
* Annotation: @Select indicating that the method will generate a DTO.
*
* Optional parameter: name
* specifies the name of the class generated DTO,
* if not specified, using the default: "Result" + the method's name
* Optional parameter: build
* a Java snippet for initializing the method parameters,
* replace the default initialization rule
*
* For example: @Select(name = "UserBlog")
* After saved, the plugin will automatically modify the return value: List -> List <UserBlog>
*
* The first time, DTO class does not exist. In order to compile the code correctly,
* the return value and the result of the query must be replaced by a generic value.
* If saved, the plugin will automatically modify the results to the corresponding values.
*
* Here is the corresponding relationship between return value and results of the query:
* 1. List query
* Public DataTable method_name (...) {... return query.getList ();} or
* Public List method_name (...) {... return query.getList ();}
*
* 2. Page query
* Public Page method_name (...) {... return query.Page (); }
*
* 3. Single record
* Public Object method_name (...) {... return query.getResult ();}
*
* @author zzg.zhou([email protected])
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Select{
/**
* @return the DTO class name. default: Result + method name
*/
String name() default "";
/**
* @return Init running parameters
*/
String build() default "";
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy