private boolean elementExtendsRuntimeExceptionDao(Element element) { TypeMirror elementType = element.asType(); return annotationHelper.isSubtype(elementType, ormLiteHelper.getRuntimeExceptionDaoParametrizedType()); } }
protected boolean isViewPagerParameter(TypeMirror parameterType) { TypeElement viewPagerTypeElement = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.VIEW_PAGER); TypeElement androidxViewPagerTypeElement = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.ANDROIDX_VIEW_PAGER); TypeMirror viewPagerType = viewPagerTypeElement == null ? null : viewPagerTypeElement.asType(); TypeMirror androidxViewPagerType = androidxViewPagerTypeElement == null ? null : androidxViewPagerTypeElement.asType(); return viewPagerType != null && annotationHelper.isSubtype(parameterType, viewPagerType) || androidxViewPagerType != null && annotationHelper.isSubtype(parameterType, androidxViewPagerType); } }
protected final boolean isTypeOrSubclass(String baseType, Element element) { TypeMirror typeMirror = element.asType(); TypeElement typeElement = annotationHelper.typeElementFromQualifiedName(baseType); return typeElement != null && annotationHelper.isSubtype(typeMirror, typeElement.asType()); }
@Override public void process(Element element, EActivityHolder holder) throws Exception { WindowFeature annotation = element.getAnnotation(WindowFeature.class); int[] features = annotation.value(); TypeElement appCompatActivity = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.APPCOMPAT_ACTIVITY); TypeElement androidxAppCompatActivity = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.ANDROIDX_APPCOMPAT_ACTIVITY); TypeElement actionBarActivity = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.ACTIONBAR_ACTIVITY); TypeElement type = (TypeElement) element; String methodName; if ((appCompatActivity != null && annotationHelper.isSubtype(type, appCompatActivity)) || (androidxAppCompatActivity != null && annotationHelper.isSubtype(type, androidxAppCompatActivity)) || (actionBarActivity != null && annotationHelper.isSubtype(type, actionBarActivity))) { methodName = "supportRequestWindowFeature"; } else { methodName = "requestWindowFeature"; } for (int feature : features) { holder.getInitBodyInjectionBlock().invoke(methodName).arg(JExpr.lit(feature)); } } }
} else { TypeMirror textViewType = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.TEXT_VIEW).asType(); if (annotationHelper.isSubtype(parameterType, textViewType)) { viewParameterPosition = i; viewParameterType = parameterType;
if (annotationHelper.isSubtype(parameterType, textViewType)) { viewParameterPosition = i; viewParameterType = parameterType;
if (annotationHelper.isSubtype(parameterType, textViewType)) { viewParameterPosition = i; viewParameterType = parameterType;
@Override public void assignValue(JBlock targetBlock, IJAssignmentTarget fieldRef, EComponentWithViewSupportHolder holder, Element element, Element param) { TypeMirror elementType = param.asType(); String typeQualifiedName = elementType.toString(); TypeElement nativeFragmentElement = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.FRAGMENT); boolean isNativeFragment = nativeFragmentElement != null && annotationHelper.isSubtype(elementType, nativeFragmentElement.asType()); String fieldName = element.getSimpleName().toString(); if (holder instanceof EFragmentHolder) { boolean childFragment = annotationHelper.extractAnnotationParameter(element, "childFragment"); String fragmentManagerGetter = childFragment ? "getChildFragmentManager" : "getFragmentManager"; targetBlock.add(fieldRef.assign(cast(getJClass(typeQualifiedName), invoke(fragmentManagerGetter).invoke(findFragmentMethodName).arg(getFragmentId(element, fieldName))))); } else { JMethod findFragmentMethod = getFindFragmentMethod(isNativeFragment, holder); targetBlock.add(fieldRef.assign(cast(getJClass(typeQualifiedName), invoke(findFragmentMethod).arg(getFragmentId(element, fieldName))))); } }
protected final boolean isTypeOrSubclass(String baseType, Element element) { TypeMirror typeMirror = element.asType(); TypeElement typeElement = annotationHelper.typeElementFromQualifiedName(baseType); return typeElement != null && annotationHelper.isSubtype(typeMirror, typeElement.asType()); }
protected boolean isViewPagerParameter(TypeMirror parameterType) { TypeElement viewPagerTypeElement = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.VIEW_PAGER); TypeElement androidxViewPagerTypeElement = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.ANDROIDX_VIEW_PAGER); TypeMirror viewPagerType = viewPagerTypeElement == null ? null : viewPagerTypeElement.asType(); TypeMirror androidxViewPagerType = androidxViewPagerTypeElement == null ? null : androidxViewPagerTypeElement.asType(); return viewPagerType != null && annotationHelper.isSubtype(parameterType, viewPagerType) || androidxViewPagerType != null && annotationHelper.isSubtype(parameterType, androidxViewPagerType); } }
@Override public void process(Element element, EActivityHolder holder) throws Exception { WindowFeature annotation = element.getAnnotation(WindowFeature.class); int[] features = annotation.value(); TypeElement appCompatActivity = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.APPCOMPAT_ACTIVITY); TypeElement androidxAppCompatActivity = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.ANDROIDX_APPCOMPAT_ACTIVITY); TypeElement actionBarActivity = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.ACTIONBAR_ACTIVITY); TypeElement type = (TypeElement) element; String methodName; if ((appCompatActivity != null && annotationHelper.isSubtype(type, appCompatActivity)) || (androidxAppCompatActivity != null && annotationHelper.isSubtype(type, androidxAppCompatActivity)) || (actionBarActivity != null && annotationHelper.isSubtype(type, actionBarActivity))) { methodName = "supportRequestWindowFeature"; } else { methodName = "requestWindowFeature"; } for (int feature : features) { holder.getInitBodyInjectionBlock().invoke(methodName).arg(JExpr.lit(feature)); } } }
} else { TypeMirror textViewType = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.TEXT_VIEW).asType(); if (annotationHelper.isSubtype(parameterType, textViewType)) { viewParameterPosition = i; viewParameterType = parameterType;
if (annotationHelper.isSubtype(parameterType, textViewType)) { viewParameterPosition = i; viewParameterType = parameterType;
if (annotationHelper.isSubtype(parameterType, textViewType)) { viewParameterPosition = i; viewParameterType = parameterType;
@Override public void assignValue(JBlock targetBlock, IJAssignmentTarget fieldRef, EComponentWithViewSupportHolder holder, Element element, Element param) { TypeMirror elementType = param.asType(); String typeQualifiedName = elementType.toString(); TypeElement nativeFragmentElement = annotationHelper.typeElementFromQualifiedName(CanonicalNameConstants.FRAGMENT); boolean isNativeFragment = nativeFragmentElement != null && annotationHelper.isSubtype(elementType, nativeFragmentElement.asType()); String fieldName = element.getSimpleName().toString(); if (holder instanceof EFragmentHolder) { boolean childFragment = annotationHelper.extractAnnotationParameter(element, "childFragment"); String fragmentManagerGetter = childFragment ? "getChildFragmentManager" : "getFragmentManager"; targetBlock.add(fieldRef.assign(cast(getJClass(typeQualifiedName), invoke(fragmentManagerGetter).invoke(findFragmentMethodName).arg(getFragmentId(element, fieldName))))); } else { JMethod findFragmentMethod = getFindFragmentMethod(isNativeFragment, holder); targetBlock.add(fieldRef.assign(cast(getJClass(typeQualifiedName), invoke(findFragmentMethod).arg(getFragmentId(element, fieldName))))); } }