In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to use Android APT". Friends who are interested might as well take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use Android APT.
Three swordsmen of Android AOP: APT, AspectJ, Javassist
Android APT
APT (short for Annotation Processing Tool) can parse annotations during code compilation and generate new Java files, reducing manual code input. Now many mainstream libraries use APT, such as Dagger2, ButterKnife, EventBus3 and so on.
Representative framework:
DataBinding
Dagger2
ButterKnife
EventBus3
DBFlow
AndroidAnnotation
Use posture
1. In the android project, create a Module of java and write a class that inherits AbstractProcessor
@ AutoService (Processor.class) / / javax.annotation.processing.IProcessor @ SupportedSourceVersion (SourceVersion.RELEASE_7) / / java @ SupportedAnnotationTypes ({/ / Annotation processor supported annotation types "com.annotation.SingleDelegate", "com.annotation.MultiDelegate"}) public class AnnotationProcessor extends AbstractProcessor {public static final String PACKAGE = "com.poet.delegate"; public static final String CLASS_DESC = "From poet compiler"; public Filer filer; / / File-related helper class public Elements elements / / element-related auxiliary class public Messager messager; / / log-related auxiliary class public Types types; @ Override public boolean process (Set
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.