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

pocketknife.IntentBuilder Maven / Gradle / Ivy

The newest version!
package pocketknife;

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

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.CLASS;

/**
 * Denotes an interface method that will return an {@link android.content.Intent} with the variables as extras.
 * {@literal @}{@link pocketknife.Data} is used to specify a parameter that will be assigned
 * to the data element of the intent.
 *
 * 

 *     {@literal @}IntentBuilder(action = Intent.ACTION_VIEW)
 *     Intent buildIntent({@literal @}Data String data, int i);
 * 
* * Generated code will look something like this *

 *     public static final String EXTRA_I = "EXTRA_I";
 *
 *     Intent buildIntent(String data, int i) {
 *         Intent intent = new Intent();
 *         intent.setAction(Intent.ACTION_VIEW);
 *         intent.setData(data);
 *         intent.putExtra(EXTRA_I, i);
 *         return intent;
 *     }
 * 
*/ @Retention(CLASS) @Target(METHOD) public @interface IntentBuilder { int flags() default 0; Class cls() default Void.class; String action() default ""; String[] categories() default { }; String type() default ""; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy