GlideOption

annotation class GlideOption

Identifies methods in GlideExtension annotated classes that extend com.bumptech.glide.request.RequestOptions.

All annotated methods will be added to a single com.bumptech.glide.request.RequestOptions implementation generated per application. Overlapping method names in different extensions may cause errors at compile time.

Static equivalents of annotated methods will also be generated.

Methods with this annotation will only be found if they belong to classes annotated with GlideExtension.

The preferred way of writing extension methods returns the provided com.bumptech.glide.request.RequestOptions object with one or more methods called on it. You must not return a newly instantiated com.bumptech.glide.request.RequestOptions object as doing so my cause a ClassCastException at runtime. Calling either com.bumptech.glide.request.RequestOptions#autoClone() or com.bumptech.glide.request.RequestOptions#lock() is safe, but unnecessary and should typically be avoided. The preferred style looks like:


{@}GlideExtension
public class MyExtension {
  private MyExtension() {}

  {@}GlideOption
  public static RequestOptions myOption(RequestOptions options) {
    return options
        .optionOne()
        .optionTwo();
  }
}

The deprecated way of writing extension methods is simply a static void method. The com.bumptech.glide.request.RequestOptions object is cloned before it is passed to this method to avoid an option method returning a new instance, but using methods like com.bumptech.glide.request.RequestOptions#clone() or com.bumptech.glide.request.RequestOptions#autoClone() can result in options applied in the method being silently ignored. Prefer the new style whenever possible.


{@}GlideExtension
public class MyExtension {
  private MyExtension() {}

  // Deprecated! Use the new style of GlideOption extensions instead.
  {@}GlideOption
  public static void myOption(RequestOptions options) {
    options
        .optionOne()
        .optionTwo();
  }
}

Functions

Link copied to clipboard
abstract fun annotationType(): Class<out Annotation>
Link copied to clipboard
abstract fun equals(p: Any): Boolean
Link copied to clipboard
abstract fun hashCode(): Int
Link copied to clipboard
abstract fun memoizeStaticMethod(): Boolean
true to indicate that it's safe to statically memoize the result of this method using com.bumptech.glide.request.RequestOptions#autoClone().
Link copied to clipboard
abstract fun override(): Int
Determines how and whether a generated method should extend a method from it's parent.
Link copied to clipboard
abstract fun skipStaticMethod(): Boolean
true to prevent a static builder method from being generated.
Link copied to clipboard
abstract fun staticMethodName(): String
Sets the name for the generated static version of this method.
Link copied to clipboard
abstract fun toString(): String

Properties

Link copied to clipboard
val OVERRIDE_EXTEND: Int
Expects to call super and then add additional functionality to an overridden method.
Link copied to clipboard
val OVERRIDE_NONE: Int
Does not intend to override a method in a super class.
Link copied to clipboard
val OVERRIDE_REPLACE: Int
Expects to not call super and replace an overridden method.