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

com.abubusoft.kripton.android.annotation.BindSqlRelation 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;

/**
 * 

* This annotation allows to specify that marked field is external to table. In * case of one-2-many relationship this flag is used to mark a collection or a * single bean as rapresentation of relation between two table. *

* *

This annotation can be used on List or Set type field.

* *

* Image the following model: *

* *
 * public class Album {
 * 	public long id;
 * 
 * 	@BindSqlRelation
 * 	public List<Song> songs;
 * }
 * 
 * public class Song {
 * 	public long id;
 * 
 *  @BindColumn(parentEntity=Album.class)
 * 	public long albumId;
 * }
 * 
* *

* Field songs will not be inserted in table album. If * you remove BindRelation it will be inserted as BLOB. * * * @author xcesco * */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface BindSqlRelation { /** * Indicates which field is used in the other table to link this table. If * there is only one field used as foreign key to this table, this attribute * can be omitted. * * @return * field name in children table used as foreign key for this relation */ String foreignKey() default ""; }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy