javax.persistence.metamodel.StaticMetamodel#javax.lang.model.type.MirroredTypeException源码实例Demo

下面列出了javax.persistence.metamodel.StaticMetamodel#javax.lang.model.type.MirroredTypeException 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: aircon   文件: LibraryConfigAnnotationParser.java
@SuppressWarnings("unchecked")
@Override
public <T> T getAttribute(final String attr) {
	try {
		return (T) Objects.requireNonNull(mConfigAnnotation)
		                  .annotationType()
		                  .getMethod(attr)
		                  .invoke(mConfigAnnotation);
	} catch (Exception e) {
		if (e.getCause() instanceof MirroredTypeException) {
			return (T) ((MirroredTypeException) e.getCause()).getTypeMirror();
		}
	}

	return null;
}
 
源代码2 项目: ShapeView   文件: FactoryAnnotatedCls.java
public FactoryAnnotatedCls(TypeElement classElement) throws ProcessingException {
    this.mAnnotatedClsElement = classElement;
    ShapeType annotation = classElement.getAnnotation(ShapeType.class);
    type = annotation.value();
    try {

        mSupperClsSimpleName = annotation.superClass().getSimpleName();
        mSupperClsQualifiedName = annotation.superClass().getCanonicalName();
    } catch (MirroredTypeException mte) {
        DeclaredType classTypeMirror = (DeclaredType) mte.getTypeMirror();
        TypeElement classTypeElement = (TypeElement) classTypeMirror.asElement();
        mSupperClsQualifiedName = classTypeElement.getQualifiedName().toString();
        mSupperClsSimpleName = classTypeElement.getSimpleName().toString();
    }

    if (mSupperClsSimpleName == null || mSupperClsSimpleName.equals("")) {
        throw new ProcessingException(classElement,
                "superClass() in @%s for class %s is null or empty! that's not allowed",
                ShapeType.class.getSimpleName(), classElement.getQualifiedName().toString());
    }
}
 
源代码3 项目: Intimate   文件: IntimateProcesser.java
private void processRefTarget(RoundEnvironment roundEnv) {
    for (Element element : roundEnv.getElementsAnnotatedWith(RefTarget.class)) {
        if (this.element == null) {
            this.element = element;
        }
        TypeElement classElement = (TypeElement) element;
        RefTarget refTarget = classElement.getAnnotation(RefTarget.class);
        String interfaceFullName = classElement.getQualifiedName().toString();
        String targetName;
        try {
            targetName = refTarget.clazz().getCanonicalName();
        } catch (MirroredTypeException mte) {
            targetName = mte.getTypeMirror().toString();
        }
        RefTargetModel model = new RefTargetModel(interfaceFullName,
                targetName,
                false,
                refTarget.optimizationRef());

        targetModelMap.put(interfaceFullName, model);
    }
}
 
源代码4 项目: kvs-schema   文件: Field.java
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();
}
 
源代码5 项目: convalida   文件: AndroidResourceSanner.java
private static void parseRClass(String respectivePackageName, String rClass) {
    Element element;

    try {
        element = scanner.elementUtils.getTypeElement(rClass);
    } catch (MirroredTypeException mte) {
        element = scanner.typeUtils.asElement(mte.getTypeMirror());
    }

    JCTree tree = (JCTree) scanner.trees.getTree(element);
    if (tree != null) {
        IdScanner idScanner = new IdScanner(scanner.symbols, scanner.elementUtils.getPackageOf(element)
                .getQualifiedName().toString(), respectivePackageName);
        tree.accept(idScanner);
    } else {
        parseCompiledR(respectivePackageName, (TypeElement) element);
    }
}
 
源代码6 项目: openjdk-jdk9   文件: ServiceProviderProcessor.java
private void processElement(TypeElement serviceProvider) {
    if (processed.contains(serviceProvider)) {
        return;
    }

    processed.add(serviceProvider);
    ServiceProvider annotation = serviceProvider.getAnnotation(ServiceProvider.class);
    if (annotation != null) {
        try {
            annotation.value();
        } catch (MirroredTypeException ex) {
            TypeMirror serviceInterface = ex.getTypeMirror();
            if (verifyAnnotation(serviceInterface, serviceProvider)) {
                String interfaceName = ex.getTypeMirror().toString();
                createProviderFile(serviceProvider, interfaceName);
            }
        }
    }
}
 
源代码7 项目: Moxy   文件: InjectViewStateProcessor.java
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;
}
 
源代码8 项目: Moxy   文件: InjectViewStateProcessor.java
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;
}
 
源代码9 项目: EasyMVP   文件: EasyMVPProcessor.java
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);
    }
}
 
源代码10 项目: fragmentargs   文件: ArgumentAnnotatedField.java
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;

  try {
    Class<? extends ArgsBundler> clazz = annotation.bundler();
    bundlerClass = getFullQualifiedNameByClass(clazz);
  } catch (MirroredTypeException mte) {
    TypeMirror baggerClass = mte.getTypeMirror();
    bundlerClass = getFullQualifiedNameByTypeMirror(baggerClass);
  }
}
 
源代码11 项目: auto-parcel   文件: AutoParcelProcessor.java
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();
}
 
源代码12 项目: sundrio   文件: BuilderUtils.java
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);
    }
}
 
源代码13 项目: aircon   文件: LibraryConfigAnnotationParser.java
private TypeMirror getAnnotationJsonType() {
	try {
		((JsonConfig) mConfigAnnotation).type();
	} catch (MirroredTypeException e) {
		return e.getTypeMirror();
	}

	return null;
}
 
源代码14 项目: aircon   文件: CustomConfigAnnotationParser.java
private TypeMirror getConfigTypeResolverTypeMirror(final ConfigType configTypeAnnotation) {
	try {
		configTypeAnnotation.value();
	} catch (MirroredTypeException e) {
		return e.getTypeMirror();
	}
	// Should never happen
	return null;
}
 
源代码15 项目: aircon   文件: ConfigFieldParser.java
private TypeMirror getTypeMirror(final Element element) {
	final Source annotation = element.getAnnotation(Source.class);
	if (annotation != null) {
		try {
			annotation.value();
		} catch (MirroredTypeException e) {
			return e.getTypeMirror();
		}
	}

	return null;
}
 
源代码16 项目: AnnotatedAdapter   文件: ViewInfo.java
public ViewInfo(ViewField viewField){
  fieldName = viewField.name();
  id = viewField.id();

  try
  {
    qualifiedClassName = viewField.type().getCanonicalName();
  }
  catch( MirroredTypeException mte )
  {
    qualifiedClassName = mte.getTypeMirror().toString();
  }

}
 
源代码17 项目: nalu   文件: PopUpControllerAnnotationScanner.java
private TypeElement getComponentTypeElement(PopUpController annotation) {
  try {
    annotation.component();
  } catch (MirroredTypeException exception) {
    return (TypeElement) this.processingEnvironment.getTypeUtils()
                                                   .asElement(exception.getTypeMirror());
  }
  return null;
}
 
源代码18 项目: nalu   文件: PopUpControllerAnnotationScanner.java
private TypeElement getComponentInterfaceTypeElement(PopUpController annotation) {
  try {
    annotation.componentInterface();
  } catch (MirroredTypeException exception) {
    return (TypeElement) this.processingEnvironment.getTypeUtils()
                                                   .asElement(exception.getTypeMirror());
  }
  return null;
}
 
源代码19 项目: nalu   文件: TrackerAnnotationValidator.java
private TypeElement getTracker(Tracker trackerAnnotation) {
  try {
    trackerAnnotation.value();
  } catch (MirroredTypeException exception) {
    return (TypeElement) this.processingEnvironment.getTypeUtils()
                                                   .asElement(exception.getTypeMirror());
  }
  return null;
}
 
源代码20 项目: nalu   文件: DebugAnnotationValidator.java
private TypeElement getLogger(Debug debugAnnotation) {
  try {
    debugAnnotation.logger();
  } catch (MirroredTypeException exception) {
    return (TypeElement) this.processingEnvironment.getTypeUtils()
                                                   .asElement(exception.getTypeMirror());
  }
  return null;
}
 
源代码21 项目: nalu   文件: ControllerAnnotationScanner.java
private TypeElement getComponentTypeElement(Controller annotation) {
  try {
    annotation.component();
  } catch (MirroredTypeException exception) {
    return (TypeElement) this.processingEnvironment.getTypeUtils()
                                                   .asElement(exception.getTypeMirror());
  }
  return null;
}
 
源代码22 项目: nalu   文件: ControllerAnnotationScanner.java
private TypeElement getComponentInterfaceTypeElement(Controller annotation) {
  try {
    annotation.componentInterface();
  } catch (MirroredTypeException exception) {
    return (TypeElement) this.processingEnvironment.getTypeUtils()
                                                   .asElement(exception.getTypeMirror());
  }
  return null;
}
 
源代码23 项目: nalu   文件: ApplicationAnnotationScanner.java
private TypeElement getApplicationLoaderTypeElement(Application applicationAnnotation) {
  try {
    applicationAnnotation.loader();
  } catch (MirroredTypeException exception) {
    return (TypeElement) this.processingEnvironment.getTypeUtils()
                                                   .asElement(exception.getTypeMirror());
  }
  return null;
}
 
源代码24 项目: nalu   文件: ApplicationAnnotationScanner.java
private TypeElement getCustomAlertPresenterTypeElement(Application applicationAnnotation) {
  try {
    applicationAnnotation.alertPresenter();
  } catch (MirroredTypeException exception) {
    return (TypeElement) this.processingEnvironment.getTypeUtils()
                                                   .asElement(exception.getTypeMirror());
  }
  return null;
}
 
源代码25 项目: nalu   文件: ApplicationAnnotationScanner.java
private TypeElement getCustomConfirmPresenterTypeElement(Application applicationAnnotation) {
  try {
    applicationAnnotation.confirmPresenter();
  } catch (MirroredTypeException exception) {
    return (TypeElement) this.processingEnvironment.getTypeUtils()
                                                   .asElement(exception.getTypeMirror());
  }
  return null;
}
 
源代码26 项目: nalu   文件: ApplicationAnnotationScanner.java
private TypeElement getContextTypeElement(Application applicationAnnotation) {
  try {
    applicationAnnotation.context();
  } catch (MirroredTypeException exception) {
    return (TypeElement) this.processingEnvironment.getTypeUtils()
                                                   .asElement(exception.getTypeMirror());
  }
  return null;
}
 
源代码27 项目: nalu   文件: CompositesAnnotationScanner.java
private TypeElement getCompositeTypeElement(Composite annotation) {
  try {
    annotation.compositeController();
  } catch (MirroredTypeException exception) {
    return (TypeElement) this.processingEnvironment.getTypeUtils()
                                                   .asElement(exception.getTypeMirror());
  }
  return null;
}
 
源代码28 项目: nalu   文件: CompositesAnnotationScanner.java
private TypeElement getCompositeConditionElement(Composite annotation) {
  try {
    annotation.condition();
  } catch (MirroredTypeException exception) {
    return (TypeElement) this.processingEnvironment.getTypeUtils()
                                                   .asElement(exception.getTypeMirror());
  }
  return null;
}
 
源代码29 项目: nalu   文件: DebugAnnotationScanner.java
private TypeElement getLogger(Debug debugAnnotation) {
  try {
    debugAnnotation.logger();
  } catch (MirroredTypeException exception) {
    return (TypeElement) this.processingEnvironment.getTypeUtils()
                                                   .asElement(exception.getTypeMirror());
  }
  return null;
}
 
private TypeElement getComponentTypeElement(ErrorPopUpController annotation) {
  try {
    annotation.component();
  } catch (MirroredTypeException exception) {
    return (TypeElement) this.processingEnvironment.getTypeUtils()
                                                   .asElement(exception.getTypeMirror());
  }
  return null;
}