Android Open Source - ContentProviderProcessor Default Content Provider Processor






From Project

Back to project page ContentProviderProcessor.

License

The source code is released under:

Apache License

If you think the Android project ContentProviderProcessor listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package de.wackernagel.android.contractcontentprovider;
//from   ww  w .j  a  v  a  2  s  .  com
import android.content.UriMatcher;
import android.net.Uri;

public class DefaultContentProviderProcessor extends AbstractContentProviderProcessor {

  private final int directoryType = 1;
  private final int itemType = 2;
  
  private final String databaseTable;  
  private final UriMatcher uriMatcher;
  
  public DefaultContentProviderProcessor( String authority, String databaseTable ) {
    this.databaseTable = databaseTable;
    
    uriMatcher = new UriMatcher( UriMatcher.NO_MATCH );
    uriMatcher.addURI( authority, databaseTable, directoryType );
    uriMatcher.addURI( authority, databaseTable + "/#", itemType );
  }
  
  @Override
  public String getTable() {
    return databaseTable;
  }

  @Override
  public boolean isItemType( Uri uri ) {
    return (uriMatcher.match( uri ) == itemType);
  }

  @Override
  public boolean isDirectoryType( Uri uri ) {
    return (uriMatcher.match( uri ) == directoryType);
  }

}




Java Source Code List

de.wackernagel.android.contractcontentprovider.AbstractContentProviderProcessor.java
de.wackernagel.android.contractcontentprovider.ContentProviderProcessor.java
de.wackernagel.android.contractcontentprovider.ContentProviderUtils.java
de.wackernagel.android.contractcontentprovider.ContractContentProvider.java
de.wackernagel.android.contractcontentprovider.ContractSQLiteOpenHelper.java
de.wackernagel.android.contractcontentprovider.Contract.java
de.wackernagel.android.contractcontentprovider.DefaultContentProviderProcessor.java
de.wackernagel.android.contractcontentprovider.GenericUriMatcher.java
de.wackernagel.android.contractcontentprovider.sample.MainActivity.java
de.wackernagel.android.contractcontentprovider.sample.provider.CustomerContract.java
de.wackernagel.android.contractcontentprovider.sample.provider.SampleProvider.java