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

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

/**
 * Given a data-source definition, this annotation allows generating the
 * associated content provider. Basically, this annotation simply specifies the
 * authority to put into `manifest.xml` file.
 * 
 * 

Attributes

* *
    *
  • authority: define the AUTHORITY for the content * provider.
  • *
* *

Usage Given an example datasource definition

* *
 * @BindContentProvider(authority = "com.abubusoft.contentprovidersample.provider")
 * @BindDataSourceOptions(updateTasks = { @BindDataSourceUpdateTask(version = 1, task = SampleUpdate02.class) }, populator = SamplePopulator.class)
 * @BindDataSource(daoSet = { CheeseDao.class }, fileName = "sample.db", version = 1)
 * public interface SampleDataSource {
 * 
 * }
 * 
* *

* Kripton generates the data-source implementation and the associated content * provider. For the `SampleDataSource`, the content provider generated has name * BindSampleContentProvider. Into manifest.xml you need to define * the content provider: *

* *
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.MyApplication">

   <application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:supportsRtl="true"
      android:theme="@style/AppTheme">
         <activity android:name=".MainActivity">
            <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
         </activity>
        
      <provider android:name="PersonProvider"
         android:authorities=
"com.example.MyApplication.BindSampleContentProvider"/>
   </application>
</manifest>
 * 
* *

* The generated content provider is generated with Javadoc, feel free to * inspect generated source Javadoc to see managed URL and many other features * of the generated content provider. *

* * @author Francesco Benincasa ([email protected]) * @see content-provider-basics */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface BindContentProvider { /** * Define the AUTHORITY for content provider. * * @return content provider authority */ public String authority(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy