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

com.abubusoft.kripton.android.annotation.BindContentProviderEntry Maven / Gradle / Ivy

The newest version!
/*******************************************************************************
 * Copyright 2015, 2017 Francesco Benincasa ([email protected]).
 *
 * 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.abubusoft.kripton.android.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 

* Used to manage an URI managed by a content provider path for annotated data * source. This annotation can be used only on methods of DAO * definition. *

*

* To use this annotation on DAO method, there are some constraints to respect. *

* *

Insert constraints

*
    *
  • return type must be the primary key value (an integer or a * long or bean value)
  • *
* *

Examples

*

* What follows is an examples of UPDATE method with a parameter used in content * provider too. *

* *
 * @BindContentProviderPath(path = "cheese")
 * @BindDao(Cheese.class)
 * public interface CheeseDao {
 * 
 * 	@BindSqlSelect(fields = "count(*)")
 * 	int count();
 * 
 * 	@BindContentProviderEntry
 * 	@BindSqlInsert
 * 	long insert(Cheese cheese);
 * 
 * 	@BindContentProviderEntry()
 * 	@BindSqlSelect
 * 	List<Cheese> selectAll();
 * 
 * 	@BindContentProviderEntry(path = "${id}")
 * 	@BindSqlSelect(where = "id=${id}")
 * 	Cheese selectById(long id);
 * 
 * 	@BindContentProviderEntry(path = "${id}")
 * 	@BindSqlDelete(where = "id=${id}")
 * 	int deleteById(long id);
 * 
 * 	@BindContentProviderEntry(path = "${cheese.id}")
 * 	@BindSqlUpdate(where = "id=${cheese.id}")
 * 	int update(Cheese cheese);
 * 
 * }
 * 
* * @author Francesco Benincasa ([email protected]) * * @see content-provider-basics * */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface BindContentProviderEntry { /** * Define the segment path associated to DAO. Do not insert '/' at * beginning of path, it's automatically added. * * @return content provider authority */ String path() default ""; /** * Define numerosity of result of operation exposed by content provider. * * @return the multiplicity result type */ MultiplicityResultType multiplicityResult() default MultiplicityResultType.DEFAULT; /** * The Enum MultiplicityResultType. */ enum MultiplicityResultType { /** * default means: select return many rows, other operation only one. */ DEFAULT, /** The one. */ ONE, /** The many. */ MANY } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy