本文整理汇总了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();
}