本文整理匯總了Java中com.bumptech.glide.annotation.GlideModule類的典型用法代碼示例。如果您正苦於以下問題:Java GlideModule類的具體用法?Java GlideModule怎麽用?Java GlideModule使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GlideModule類屬於com.bumptech.glide.annotation包,在下文中一共展示了GlideModule類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: generate
import com.bumptech.glide.annotation.GlideModule; //導入依賴的package包/類
TypeSpec generate(List<TypeElement> types) {
List<TypeElement> modules = new ArrayList<>();
List<TypeElement> extensions = new ArrayList<>();
for (TypeElement element : types) {
if (processorUtil.isExtension(element)) {
extensions.add(element);
} else if (processorUtil.isLibraryGlideModule(element)) {
modules.add(element);
} else {
throw new IllegalArgumentException("Unrecognized type: " + element);
}
}
if (!modules.isEmpty() && !extensions.isEmpty()) {
throw new IllegalArgumentException("Given both modules and extensions, expected one or the "
+ "other. Modules: " + modules + " Extensions: " + extensions);
}
if (!modules.isEmpty()) {
return generate(types, GlideModule.class);
} else {
return generate(types, GlideExtension.class);
}
}
示例2: processModules
import com.bumptech.glide.annotation.GlideModule; //導入依賴的package包/類
boolean processModules(Set<? extends TypeElement> set, RoundEnvironment env) {
// Order matters here, if we find an Indexer below, we return before writing the root module.
// If we fail to add to appModules before then, we might accidentally skip a valid RootModule.
List<TypeElement> libraryGlideModules = new ArrayList<>();
for (TypeElement element : processorUtil.getElementsFor(GlideModule.class, env)) {
// Root elements are added separately and must be checked separately because they're sub
// classes of LibraryGlideModules.
if (processorUtil.isAppGlideModule(element)) {
continue;
} else if (!processorUtil.isLibraryGlideModule(element)) {
throw new IllegalStateException("@GlideModule can only be applied to LibraryGlideModule"
+ " and AppGlideModule implementations, not: " + element);
}
libraryGlideModules.add(element);
}
processorUtil.debugLog("got child modules: " + libraryGlideModules);
if (libraryGlideModules.isEmpty()) {
return false;
}
TypeSpec indexer = indexerGenerator.generate(libraryGlideModules);
processorUtil.writeIndexer(indexer);
processorUtil.debugLog("Wrote an Indexer this round, skipping the app module to ensure all "
+ "indexers are found");
// If I write an Indexer in a round in the target package, then try to find all classes in
// the target package, my newly written Indexer won't be found. Since we wrote a class with
// an Annotation handled by this processor, we know we will be called again in the next round
// and we can safely wait to write our AppGlideModule until then.
return true;
}
示例3: processModules
import com.bumptech.glide.annotation.GlideModule; //導入依賴的package包/類
void processModules(Set<? extends TypeElement> set, RoundEnvironment env) {
for (TypeElement element : processorUtil.getElementsFor(GlideModule.class, env)) {
if (processorUtil.isAppGlideModule(element)) {
appGlideModules.add(element);
}
}
processorUtil.debugLog("got app modules: " + appGlideModules);
if (appGlideModules.size() > 1) {
throw new IllegalStateException(
"You cannot have more than one AppGlideModule, found: " + appGlideModules);
}
}
示例4: getAnnotationValue
import com.bumptech.glide.annotation.GlideModule; //導入依賴的package包/類
private static String getAnnotationValue(Class<? extends Annotation> annotation) {
if (annotation == GlideModule.class) {
return "modules";
} else if (annotation == GlideExtension.class) {
return "extensions";
} else {
throw new IllegalArgumentException("Unrecognized annotation: " + annotation);
}
}
示例5: processModules
import com.bumptech.glide.annotation.GlideModule; //導入依賴的package包/類
boolean processModules(RoundEnvironment env) {
// Order matters here, if we find an Indexer below, we return before writing the root module.
// If we fail to add to appModules before then, we might accidentally skip a valid RootModule.
List<TypeElement> libraryGlideModules = new ArrayList<>();
for (TypeElement element : processorUtil.getElementsFor(GlideModule.class, env)) {
// Root elements are added separately and must be checked separately because they're sub
// classes of LibraryGlideModules.
if (processorUtil.isAppGlideModule(element)) {
continue;
} else if (!processorUtil.isLibraryGlideModule(element)) {
throw new IllegalStateException("@GlideModule can only be applied to LibraryGlideModule"
+ " and AppGlideModule implementations, not: " + element);
}
libraryGlideModules.add(element);
}
processorUtil.debugLog("got child modules: " + libraryGlideModules);
if (libraryGlideModules.isEmpty()) {
return false;
}
TypeSpec indexer = indexerGenerator.generate(libraryGlideModules);
processorUtil.writeIndexer(indexer);
processorUtil.debugLog("Wrote an Indexer this round, skipping the app module to ensure all "
+ "indexers are found");
// If I write an Indexer in a round in the target package, then try to find all classes in
// the target package, my newly written Indexer won't be found. Since we wrote a class with
// an Annotation handled by this processor, we know we will be called again in the next round
// and we can safely wait to write our AppGlideModule until then.
return true;
}
示例6: getSupportedAnnotationTypes
import com.bumptech.glide.annotation.GlideModule; //導入依賴的package包/類
Set<String> getSupportedAnnotationTypes() {
return Collections.singleton(GlideModule.class.getName());
}
示例7: getGlideName
import com.bumptech.glide.annotation.GlideModule; //導入依賴的package包/類
private String getGlideName(TypeElement appModule) {
return appModule.getAnnotation(GlideModule.class).glideName();
}