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

com.wesleyhome.dao.annotations.CustomQuery Maven / Gradle / Ivy

/*
 * Copyright 2014 Justin Wesley
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.wesleyhome.dao.annotations;

import static java.lang.annotation.ElementType.TYPE;
import java.lang.annotation.Target;

/**
 * This annotation will generate the method signature in the generated interface for
 * the entity that is annotated. If a custom query is defined, the implementation class
 * will be declare abstract and the developer will have to implement it themselves.
 * 
 * 
 * @CustomQuery(methodName="findByString", paramList={
 *     @Param(paramName="value", paramClass=String.class)
 * }, returnType=@Return(returnClass=EntityClass.class, keyClass=Integer.class, type=ReturnType.LIST))
 * @Entity
 * public class EntityClass {
 *
 *     @Id
 *     private Integer entityId;
 * }
 * 
*
*

* The previous code will generate the following in your interface: *

 * 
 * List findByString(String value);
 * 
 * 
*

* @author Justin Wesley */ @Target(TYPE) public @interface CustomQuery { /** * @return the name of the method */ String methodName(); /** * @return a list of parameters */ Param[] paramList() default {}; /** * @return the method return information */ Return returnType(); TypeVar[] typeParams() default {}; /** * Adds pagination parameters to query. * @return */ boolean paginate() default false; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy