private void parseRClass(String respectivePackageName, String rClass) { Element element; try { element = elementUtils.getTypeElement(rClass); } catch (MirroredTypeException mte) { element = typeUtils.asElement(mte.getTypeMirror()); } JCTree tree = (JCTree) trees.getTree(element); if (tree != null) { // tree can be null if the references are compiled types and not source IdScanner idScanner = new IdScanner(symbols, elementUtils.getPackageOf(element) .getQualifiedName().toString(), respectivePackageName); tree.accept(idScanner); } else { parseCompiledR(respectivePackageName, (TypeElement) element); } }
private String getViewClassFromAnnotationParams(TypeElement typeElement) { InjectViewState annotation = typeElement.getAnnotation(InjectViewState.class); String mvpViewClassName = ""; if (annotation != null) { TypeMirror value = null; try { annotation.view(); } catch (MirroredTypeException mte) { value = mte.getTypeMirror(); } mvpViewClassName = Util.getFullClassName(value); } if (mvpViewClassName.isEmpty() || DefaultView.class.getName().equals(mvpViewClassName)) { return null; } return mvpViewClassName; }
private String getViewStateClassFromAnnotationParams(TypeElement typeElement) { InjectViewState annotation = typeElement.getAnnotation(InjectViewState.class); String mvpViewStateClassName = ""; if (annotation != null) { TypeMirror value; try { annotation.value(); } catch (MirroredTypeException mte) { value = mte.getTypeMirror(); mvpViewStateClassName = value.toString(); } } if (mvpViewStateClassName.isEmpty() || DefaultViewState.class.getName().equals(mvpViewStateClassName)) { return null; } return mvpViewStateClassName; }
public FactoryAnnotatedClass(TypeElement classElement) throws IllegalArgumentException { this.annotatedClassElement = classElement; Factory annotation = classElement.getAnnotation(Factory.class); id = annotation.id(); if (id == null || id.length() == 0) { throw new IllegalArgumentException( String.format("id() in @%s for class %s is null or empty! that's not allowed", Factory.class.getSimpleName(), classElement.getQualifiedName().toString())); } // Get the full QualifiedTypeName try { Class<?> clazz = annotation.type(); qualifiedSuperClassName = clazz.getCanonicalName(); simpleTypeName = clazz.getSimpleName(); } catch (MirroredTypeException mte) { DeclaredType classTypeMirror = (DeclaredType) mte.getTypeMirror(); TypeElement classTypeElement = (TypeElement) classTypeMirror.asElement(); qualifiedSuperClassName = classTypeElement.getQualifiedName().toString(); simpleTypeName = classTypeElement.getSimpleName().toString(); } }
public JsonProperty(String humanName, ExecutableElement element) { this.methodName = element.getSimpleName().toString(); this.humanName = humanName; this.element = element; this.type = TypeName.get(element.getReturnType()); this.annotations = buildAnnotations(element); JsonAdapter jsonAdapter = element.getAnnotation(JsonAdapter.class); if (jsonAdapter != null) { try { jsonAdapter.value(); } catch (MirroredTypeException e) { typeAdapter = e.getTypeMirror(); } } DefaultValue defaultValue = element.getAnnotation(DefaultValue.class); if (defaultValue != null) { this.defaultValue = defaultValue.value(); } }
private void parseRClass(String respectivePackageName, String rClass) { Element element; try { element = elementUtils.getTypeElement(rClass); } catch (MirroredTypeException mte) { element = typeUtils.asElement(mte.getTypeMirror()); } JCTree tree = (JCTree) trees.getTree(element); if (tree != null) { IdScanner idScanner = new IdScanner(symbols, elementUtils.getPackageOf(element) .getQualifiedName().toString(), respectivePackageName); tree.accept(idScanner); } else { parseCompiledR(respectivePackageName, (TypeElement) element); } }
Property(String fieldName, TypeName typeName, VariableElement element, boolean isMapped) { this.fieldName = fieldName; this.element = element; this.typeName = typeName; this.annotations = getAnnotations(element); this.isMapped = isMapped; // get the parcel adapter if any ParcelAdapter parcelAdapter = element.getAnnotation(ParcelAdapter.class); if (parcelAdapter != null) { try { parcelAdapter.value(); } catch (MirroredTypeException e) { this.typeAdapter = e.getTypeMirror(); } } // get the element version, default 0 ParcelVersion parcelVersion = element.getAnnotation(ParcelVersion.class); this.version = parcelVersion == null ? 0 : parcelVersion.from(); }
public FactoryAnnotatedClass(TypeElement classElement) throws IllegalArgumentException { this.annotatedClassElement = classElement; Factory annotation = classElement.getAnnotation(Factory.class); id = annotation.id(); if ("".equalsIgnoreCase(id) || id == null) { throw new IllegalArgumentException( String.format("id() in @%s for class %s is null or empty! that's not allowed", Factory.class.getSimpleName(), classElement.getQualifiedName().toString())); } // Get the full QualifiedTypeName try { Class<?> clazz = annotation.type(); // 返回底层阶级Java语言规范中定义的标准名称。 qualifiedSuperClassName = clazz.getCanonicalName(); simpleTypeName = clazz.getSimpleName(); } catch (MirroredTypeException mte) { DeclaredType classTypeMirror = (DeclaredType) mte.getTypeMirror(); TypeElement classTypeElement = (TypeElement) classTypeMirror.asElement(); qualifiedSuperClassName = classTypeElement.getQualifiedName().toString(); simpleTypeName = classTypeElement.getSimpleName().toString(); } }
private TypeName getConvertClass(PrefField prefField) { TypeElement typeElement = null; try { prefField.converter(); } catch (MirroredTypeException e) { DeclaredType typeMirror = (DeclaredType) e.getTypeMirror(); typeElement = (TypeElement) typeMirror.asElement(); } if (typeElement == null) { throw new IllegalArgumentException("TypeConverter may be wrong"); } TypeMirror superType = typeElement.getSuperclass(); TypeMirror arg = ((DeclaredType) superType).getTypeArguments().get(1); return ClassName.get(arg); }
private void parseRClass(String rClass) { Element element; try { element = elementUtils.getTypeElement(rClass); } catch (MirroredTypeException mte) { element = typeUtils.asElement(mte.getTypeMirror()); } JCTree tree = (JCTree) trees.getTree(element); if (tree != null) { // tree can be null if the references are compiled types and not source IdScanner idScanner = new IdScanner(symbols, elementUtils.getPackageOf(element).getQualifiedName().toString()); tree.accept(idScanner); } else { parseCompiledR((TypeElement) element); } }
private void parseConductorController(Element element, Map<TypeElement, DelegateClassGenerator> delegateClassMap) { if (!SuperficialValidation.validateElement(element)) { error("Superficial validation error for %s", element.getSimpleName()); return; } if (!Validator.isNotAbstractClass(element)) { error("%s is abstract", element.getSimpleName()); return; } if (!Validator.isSubType(element, CONDUCTOR_CONTROLLER_CLASS_NAME, processingEnv)) { error("%s must extend View", element.getSimpleName()); return; } //getEnclosing for class type will returns its package/ TypeElement enclosingElement = (TypeElement) element; DelegateClassGenerator delegateClassGenerator = getDelegate(enclosingElement, delegateClassMap); delegateClassGenerator.setViewType(ViewType.CONDUCTOR_CONTROLLER); ConductorController annotation = element.getAnnotation(ConductorController.class); try { annotation.presenter(); } catch (MirroredTypeException mte) { parsePresenter(delegateClassGenerator, mte); } }
public SPResponse(ApiResponse apiResponse, ExecutableElement element) { int intCode = apiResponse.code(); if (intCode != -1) { code = String.valueOf(apiResponse.code()); } else { code = "default"; } description = apiResponse.message(); TypeMirror tm = null; try { // Force exception apiResponse.response().toString(); } catch (MirroredTypeException e) { tm = e.getTypeMirror(); } schema = SPSchema.fromTypeMirrorAndContainer(tm, apiResponse.responseContainer(), element); }
private Mockery.Behaviour getBehaviourMockery(Mockery mockery) { try { mockery.value(); } catch (MirroredTypeException e) { TypeElement typeElement = (TypeElement) types.asElement(e.getTypeMirror()); try { String className = typeElement.getQualifiedName().toString(); Class<?> behaviourClass = Class.forName(className); Mockery.Behaviour behaviour = (Mockery.Behaviour) instantiateInterface.from(behaviourClass); return behaviour; } catch (ClassNotFoundException e1) { e1.printStackTrace(); } } return null; }
Property(String fieldName, VariableElement element) { this.fieldName = fieldName; this.element = element; this.typeName = TypeName.get(element.asType()); this.annotations = getAnnotations(element); // get the parcel adapter if any ParcelAdapter parcelAdapter = element.getAnnotation(ParcelAdapter.class); if (parcelAdapter != null) { try { parcelAdapter.value(); } catch (MirroredTypeException e) { this.typeAdapter = e.getTypeMirror(); } } // get the element version, default 0 ParcelVersion parcelVersion = element.getAnnotation(ParcelVersion.class); this.version = parcelVersion == null ? 0 : parcelVersion.from(); }
@Override public void processElement(Element element) throws IOException { //Get the @Component annotation for the current element. Component annot = element.getAnnotation(Component.class); String clsName = element.toString(); String scope = ""; try { annot.scope(); } catch (MirroredTypeException e) { scope = e.getTypeMirror().toString(); } appendProperty(clsName, scope); }
private static String[] validateAnnotation(TypeElement annotatedElement) { final ParseWrapperClass annotation = annotatedElement.getAnnotation(ParseWrapperClass.class); String canonicalName; String shortName; try { Class<?> clazz = annotation.value(); canonicalName = clazz.getCanonicalName(); shortName = clazz.getSimpleName(); } catch (MirroredTypeException mte) { DeclaredType classTypeMirror = (DeclaredType) mte.getTypeMirror(); TypeElement classTypeElement = (TypeElement) classTypeMirror.asElement(); canonicalName = classTypeElement.getQualifiedName().toString(); shortName = classTypeElement.getSimpleName().toString(); } if (!contains(WrapperElementCodeGenerator.ALLOWED_CLASSES, canonicalName)) { Logger.getInstance().error("You cannot create a WrapperModel with " + canonicalName + ". See allowed classes in " + WrapperElementCodeGenerator.class.getSimpleName() + ".ALLOWED_CLASSES"); } final String packageName = canonicalName.substring(0, canonicalName.length() - shortName.length() - 1); return new String[]{packageName, shortName}; }
/** * 1.获取 该 R class 在 scanForRClasses(...) 时,生辰生成的那棵树 * - 如果存在树,就解析编译好的 R class * - 不存在的话,创建一个 Id 扫描类,扫描 R class 内的所有 Id * 2.Id 扫描类,内还会让树调用 Var 扫描类,扫描全部 int 变量 * * @param respectivePackageName R class package name * @param rClass R class */ private void parseRClass(String respectivePackageName, String rClass) { Element element; try { element = elementUtils.getTypeElement(rClass); } catch (MirroredTypeException mte) { element = typeUtils.asElement(mte.getTypeMirror()); } JCTree tree = (JCTree) trees.getTree(element); if (tree != null) { // tree can be null if the references are compiled types and not source IdScanner idScanner = new IdScanner(symbols, elementUtils.getPackageOf(element) .getQualifiedName().toString(), respectivePackageName); tree.accept(idScanner); } else { parseCompiledR(respectivePackageName, (TypeElement) element); } }
/** * 1.获取 该 R class 在 scanForRClasses(...) 时,生辰生成的那棵树 * - 如果存在树,就解析编译好的 R class * - 不存在的话,创建一个 Id 扫描类,扫描 R class 内的所有 Id * 2.Id 扫描类,内还会让树调用 Var 扫描类,扫描全部 int 变量 * * @param respectivePackageName R class package name * @param rClass R class */ private void parseRClass(String respectivePackageName, String rClass) { Element element; try { element = elementUtils.getTypeElement(rClass); } catch (MirroredTypeException mte) { element = typeUtils.asElement(mte.getTypeMirror()); } JCTree tree = (JCTree) trees.getTree(element); if (tree != null) { // tree can be null if the references are compiled types and not source IdScanner idScanner = new IdScanner(this.symbols, this.elementUtils.getPackageOf(element) .getQualifiedName().toString(), respectivePackageName); tree.accept(idScanner); } else { parseCompiledR(respectivePackageName, (TypeElement) element); } }
public Property(String humanName, ExecutableElement element) { this.methodName = element.getSimpleName().toString(); this.humanName = humanName; this.element = element; type = TypeName.get(element.getReturnType()); annotations = buildAnnotations(element); nullable = nullableAnnotation() != null; ParcelAdapter parcelAdapter = element.getAnnotation(ParcelAdapter.class); if (parcelAdapter != null) { try { parcelAdapter.value(); } catch (MirroredTypeException e) { typeAdapter = e.getTypeMirror(); } } }
public static TypeDef getInlineReturnType(BuilderContext context, Inline inline, TypeDef fallback) { try { Class returnType = inline.returnType(); if (returnType == null) { return fallback; } return ClassTo.TYPEDEF.apply(inline.returnType()); } catch (MirroredTypeException e) { if (None.FQN.equals(e.getTypeMirror().toString())) { return fallback; } Element element = context.getTypes().asElement(e.getTypeMirror()); return ElementTo.TYPEDEF.apply((TypeElement) element); } }
private String buildConverter(ExecutableElement method) { String converterName = ""; Retrofit.Converter converterAnnotation = method.getAnnotation(Retrofit.Converter.class); if (converterAnnotation != null) { TypeMirror converter = null; try { converter = getTypeMirror(processingEnv, converterAnnotation.value()); } catch (MirroredTypeException mte) { // http://blog.retep.org/2009/02/13/getting-class-values-from-annotations-in-an-annotationprocessor/ converter = mte.getTypeMirror(); } converterName = typeSimplifier.simplify(converter); TypeMirror gsonConverterType = getTypeMirror(processingEnv, retrofit.converter.GsonConverter.class); Types typeUtils = processingEnv.getTypeUtils(); if (typeUtils.isSubtype(gsonConverterType, converter)) { this.gsonConverter = converterName; } } return converterName; }
/** * Uses a neat trick to get a useful TypeMirror from an unusable Class * * @param processingEnv * @param type * @return the type-mirror for this type * @since 0.4 * @see "http://blog.retep.org/2009/02/13/getting-class-values-from-annotations-in-an-annotationprocessor/" */ @Nullable public static DeclaredType getTypeMirror(@Nullable final ProcessingEnvironment processingEnv, @Nonnull final Supplier<Class<?>> type) { try{ type.get().getCanonicalName(); } catch(MirroredTypeException mte) { return ( DeclaredType ) mte.getTypeMirror(); } //fall back to default behavior if(processingEnv == null) { return null; } return ( DeclaredType )processingEnv.getElementUtils().getTypeElement( type.get().getCanonicalName()).asType(); }
public Field(Element element, Key key) { this.prefKeyName = key.name(); try { Class clazz = key.serializer(); serializerType = TypeName.get(clazz); serializeType = detectSerializeTypeNameByClass(clazz); } catch (MirroredTypeException mte) { DeclaredType classTypeMirror = (DeclaredType) mte.getTypeMirror(); TypeElement classTypeElement = (TypeElement) classTypeMirror.asElement(); serializerType = TypeName.get(classTypeMirror); serializeType = detectSerializeTypeByTypeElement(classTypeElement); } VariableElement variable = (VariableElement) element; this.fieldType = TypeName.get(element.asType()); this.name = element.getSimpleName().toString(); this.value = variable.getConstantValue(); }
public ArgumentAnnotatedField(Element element, TypeElement classElement, Arg annotation) throws ProcessingException { this.name = element.getSimpleName().toString(); this.key = getKey(element, annotation); this.type = element.asType().toString(); this.element = element; this.required = annotation.required(); this.classElement = classElement; // Private or protected fields need a setter method useSetterMethod = element.getModifiers().contains(javax.lang.model.element.Modifier.PRIVATE) || element.getModifiers().contains(javax.lang.model.element.Modifier.PROTECTED); try { Class<? extends ArgsBundler> clazz = annotation.bundler(); bundlerClass = getFullQualifiedNameByClass(clazz); } catch (MirroredTypeException mte) { TypeMirror baggerClass = mte.getTypeMirror(); bundlerClass = getFullQualifiedNameByTypeMirror(baggerClass); } }
private void processDefinitionModelBuilder(final Element e, final String className, final Map<String, String> processingContextMap) { Definition definitionAnn = e.getAnnotation(Definition.class); TypeMirror bMirror = null; try { Class<?> builderClass = definitionAnn.builder(); } catch (MirroredTypeException mte) { bMirror = mte.getTypeMirror(); } if (null != bMirror && !VoidBuilder.class.getName().equals(bMirror.toString())) { String fqcn = bMirror.toString(); processingContextMap.put(className, fqcn); } }
private void processDefinitionSetModelBuilder(final Element e, final String className, final Map<String, String> processingContextMap) { DefinitionSet definitionAnn = e.getAnnotation(DefinitionSet.class); TypeMirror bMirror = null; try { Class<?> builderClass = definitionAnn.builder(); } catch (MirroredTypeException mte) { bMirror = mte.getTypeMirror(); } if (null != bMirror && !VoidBuilder.class.getName().equals(bMirror.toString())) { String fqcn = bMirror.toString(); processingContextMap.put(className, fqcn); } }
private void parseRClass(PackageElement respectivePackageName, Symbol.ClassSymbol rClass, Set<String> referenced) { TypeElement element; try { element = rClass; } catch (MirroredTypeException mte) { element = (TypeElement) typeUtils.asElement(mte.getTypeMirror()); } JCTree tree = (JCTree) trees.getTree(element); if (tree != null) { // tree can be null if the references are compiled types and not source IdScanner idScanner = new IdScanner(symbols, elementUtils.getPackageOf(element), respectivePackageName, referenced); tree.accept(idScanner); } else { parseCompiledR(respectivePackageName, element, referenced); } }
private void parseActivityView(Element element, Map<TypeElement, DelegateClassGenerator> delegateClassMap) { //TODO print errors if (!SuperficialValidation.validateElement(element)) { error("Superficial validation error for %s", element.getSimpleName()); return; } if (!Validator.isNotAbstractClass(element)) { error("%s is abstract", element.getSimpleName()); return; } boolean isActivity = Validator.isSubType(element, ANDROID_ACTIVITY_CLASS_NAME, processingEnv); boolean isSupportActivity = Validator.isSubType(element, ANDROID_SUPPORT_ACTIVITY_CLASS_NAME, processingEnv); if (!isActivity && !isSupportActivity) { error("%s must extend Activity or AppCompatActivity", element.getSimpleName()); return; } //getEnclosing for class type will returns its package/ TypeElement enclosingElement = (TypeElement) element; DelegateClassGenerator delegateClassGenerator = getDelegate(enclosingElement, delegateClassMap); ActivityView annotation = element.getAnnotation(ActivityView.class); delegateClassGenerator.setResourceID(annotation.layout()); if (isSupportActivity) { needSupportLoader = true; delegateClassGenerator.setViewType(ViewType.SUPPORT_ACTIVITY); } else { needLoader = true; delegateClassGenerator.setViewType(ViewType.ACTIVITY); } try { annotation.presenter(); } catch (MirroredTypeException mte) { parsePresenter(delegateClassGenerator, mte); } }
private void parseFragmentView(Element element, Map<TypeElement, DelegateClassGenerator> delegateClassMap) { //TODO print errors if (!SuperficialValidation.validateElement(element)) { error("Superficial validation error for %s", element.getSimpleName()); return; } if (!Validator.isNotAbstractClass(element)) { error("%s is abstract", element.getSimpleName()); return; } boolean isFragment = Validator.isSubType(element, ANDROID_FRAGMENT_CLASS_NAME, processingEnv); boolean isSupportFragment = Validator.isSubType(element, ANDROID_SUPPORT_FRAGMENT_CLASS_NAME, processingEnv); if (!isFragment && !isSupportFragment) { error("%s must extend Fragment or support Fragment", element.getSimpleName()); return; } //getEnclosing for class type will returns its package/ TypeElement enclosingElement = (TypeElement) element; DelegateClassGenerator delegateClassGenerator = getDelegate(enclosingElement, delegateClassMap); if (isFragment) { needLoader = true; delegateClassGenerator.setViewType(ViewType.FRAGMENT); } else { needSupportLoader = true; delegateClassGenerator.setViewType(ViewType.SUPPORT_FRAGMENT); } FragmentView annotation = element.getAnnotation(FragmentView.class); try { annotation.presenter(); } catch (MirroredTypeException mte) { parsePresenter(delegateClassGenerator, mte); } }
private void parseCustomView(Element element, Map<TypeElement, DelegateClassGenerator> delegateClassMap) { //TODO print errors if (!SuperficialValidation.validateElement(element)) { error("Superficial validation error for %s", element.getSimpleName()); return; } if (!Validator.isNotAbstractClass(element)) { error("%s is abstract", element.getSimpleName()); return; } if (!Validator.isSubType(element, ANDROID_CUSTOM_VIEW_CLASS_NAME, processingEnv)) { error("%s must extend View", element.getSimpleName()); return; } //getEnclosing for class type will returns its package/ TypeElement enclosingElement = (TypeElement) element; DelegateClassGenerator delegateClassGenerator = getDelegate(enclosingElement, delegateClassMap); delegateClassGenerator.setViewType(ViewType.CUSTOM_VIEW); CustomView annotation = element.getAnnotation(CustomView.class); try { annotation.presenter(); } catch (MirroredTypeException mte) { parsePresenter(delegateClassGenerator, mte); } }
private void parsePresenter(DelegateClassGenerator delegateClassGenerator, MirroredTypeException mte) { TypeElement presenterElement = getTypeElement(mte); delegateClassGenerator.setPresenter(getClassName(presenterElement)); String presenterView = findViewTypeOfPresenter(presenterElement); delegateClassGenerator.setPresenterViewQualifiedName(presenterView); }
private void processJsonFieldAnnotation(Element element, Map<String, JsonObjectHolder> jsonObjectMap, Elements elements, Types types) { if (!isJsonFieldFieldAnnotationValid(element, elements)) { return; } TypeElement enclosingElement = (TypeElement)element.getEnclosingElement(); JsonObjectHolder objectHolder = jsonObjectMap.get(TypeUtils.getInjectedFQCN(enclosingElement, elements)); JsonFieldHolder fieldHolder = objectHolder.fieldMap.get(element.getSimpleName().toString()); if (fieldHolder == null) { fieldHolder = new JsonFieldHolder(); objectHolder.fieldMap.put(element.getSimpleName().toString(), fieldHolder); } JsonField annotation = element.getAnnotation(JsonField.class); TypeMirror typeConverterType; try { typeConverterType = mProcessingEnv.getElementUtils().getTypeElement(annotation.typeConverter().getCanonicalName()).asType(); } catch (MirroredTypeException mte) { typeConverterType = mte.getTypeMirror(); } String[] fieldName = annotation.name(); JsonIgnore ignoreAnnotation = element.getAnnotation(JsonIgnore.class); boolean shouldParse = ignoreAnnotation == null || ignoreAnnotation.ignorePolicy() == IgnorePolicy.SERIALIZE_ONLY; boolean shouldSerialize = ignoreAnnotation == null || ignoreAnnotation.ignorePolicy() == IgnorePolicy.PARSE_ONLY; String error = fieldHolder.fill(element, elements, types, fieldName, typeConverterType, objectHolder, shouldParse, shouldSerialize); if (!TextUtils.isEmpty(error)) { error(element, error); } ensureTypeConverterClassValid(typeConverterType, elements, types); }
private static TypeMirror getComponent(InjectApplication annotation) { try { annotation.component(); // this should throw } catch (MirroredTypeException mte) { return mte.getTypeMirror(); } return null; // can this ever happen ?? }
public static TypeName getOnBindToRecyclerViewAdapterClass(Element bindAction) { TypeMirror bindClass; try { bindAction.getAnnotation(se.snylt.witch.annotations.BindToRecyclerView.class).adapter(); return null; } catch (MirroredTypeException mte) { bindClass = mte.getTypeMirror(); } return TypeName.get(bindClass); }
public static TypeName getOnBindToViewPagerAdapterClass(Element bindAction) { TypeMirror bindClass; try { bindAction.getAnnotation(se.snylt.witch.annotations.BindToViewPager.class).adapter(); return null; } catch (MirroredTypeException mte) { bindClass = mte.getTypeMirror(); } return TypeName.get(bindClass); }
public static TypeMirror getOnBindTypeMirror(Element action) { TypeMirror bindClass; try { action.getAnnotation(se.snylt.witch.annotations.OnBind.class).value(); return null; } catch (MirroredTypeException mte) { bindClass = mte.getTypeMirror(); } return bindClass; }
public static TypeName getOnBindToViewClass(Element action) { TypeMirror bindClass; try { action.getAnnotation(se.snylt.witch.annotations.BindToView.class).view(); return null; } catch (MirroredTypeException mte) { bindClass = mte.getTypeMirror(); } return TypeName.get(bindClass); }
/** * 获取DUnitGroup的group字段的TypeMirror */ public TypeMirror getUnitGroupModelGroupTypeMirror(DUnitGroup dUnitGroup){ try { dUnitGroup.group(); }catch (MirroredTypeException e){ TypeMirror typeMirror = e.getTypeMirror(); return typeMirror; } return null; }
/** * 获取DUnit的group字段的TypeMirror */ public TypeMirror getUnitModelGroupTypeMirror(DUnit dUnit){ try { dUnit.group(); }catch (MirroredTypeException e){ TypeMirror typeMirror = e.getTypeMirror(); return typeMirror; } return null; }