@Test public void testGetComponentDefinition_AnnotatedField() throws Exception { LinkkiComponentDefinition componentDefinition = ComponentAnnotationReader .getComponentDefinition(ClassWithComponentAnnotatedAnnotations.class.getField("component") .getAnnotation(AnnotationWithComponentAnnotation.class), ClassWithComponentAnnotatedAnnotations.class.getField("component")); assertThat(componentDefinition.createComponent("input"), is(TESTCOMPONENT)); assertThat(componentDefinition.createComponent(this), is(TESTCOMPONENT)); }
public static <A extends Annotation> LinkkiComponentDefinition getComponentDefinition( A annotation, AnnotatedElement annotatedElement) { LinkkiComponent linkkiComponent = LINKKI_COMPONENT_ANNOTATION.findOn(annotation) .orElseThrow(LINKKI_COMPONENT_ANNOTATION .missingAnnotation(annotation, annotatedElement, ComponentAnnotationReader.class.getSimpleName() + "#isComponentDefinition(Annotation)")); @SuppressWarnings("unchecked") Class<ComponentDefinitionCreator<A>> creatorClass = (Class<ComponentDefinitionCreator<A>>)linkkiComponent .value(); return Classes.instantiate(creatorClass).create(annotation, annotatedElement); }
ComponentAnnotationReader { public static <A extends Annotation> LinkkiComponentDefinition getComponentDefinition( A annotation, AnnotatedElement annotatedElement) { LinkkiComponent linkkiComponent = LINKKI_COMPONENT_ANNOTATION.findOn(annotation) .orElseThrow(LINKKI_COMPONENT_ANNOTATION .missingAnnotation(annotation, annotatedElement, ComponentAnnotationReader.class.getSimpleName() + "#isComponentDefinition(Annotation)")); @SuppressWarnings("unchecked") Class<ComponentDefinitionCreator<A>> creatorClass = (Class<ComponentDefinitionCreator<A>>)linkkiComponent .value(); return Classes.instantiate(creatorClass).create(annotation, annotatedElement); } }
ComponentAnnotationReader { public static <A extends Annotation> LinkkiComponentDefinition getComponentDefinition( A annotation, AnnotatedElement annotatedElement) { LinkkiComponent linkkiComponent = LINKKI_COMPONENT_ANNOTATION.findOn(annotation) .orElseThrow(LINKKI_COMPONENT_ANNOTATION .missingAnnotation(annotation, annotatedElement, ComponentAnnotationReader.class.getSimpleName() + "#isComponentDefinition(Annotation)")); @SuppressWarnings("unchecked") Class<ComponentDefinitionCreator<A>> creatorClass = (Class<ComponentDefinitionCreator<A>>)linkkiComponent .value(); return Classes.instantiate(creatorClass).create(annotation, annotatedElement); } private  ComponentAnnotationReader(); }
ComponentAnnotationReader { public static <A extends Annotation> LinkkiComponentDefinition getComponentDefinition( A annotation, AnnotatedElement annotatedElement) { LinkkiComponent linkkiComponent = LINKKI_COMPONENT_ANNOTATION.findOn(annotation) .orElseThrow(LINKKI_COMPONENT_ANNOTATION .missingAnnotation(annotation, annotatedElement, ComponentAnnotationReader.class.getSimpleName() + "#isComponentDefinition(Annotation)")); @SuppressWarnings("unchecked") Class<ComponentDefinitionCreator<A>> creatorClass = (Class<ComponentDefinitionCreator<A>>)linkkiComponent .value(); return Classes.instantiate(creatorClass).create(annotation, annotatedElement); } private  ComponentAnnotationReader(); static boolean isComponentDefinition(@CheckForNull Annotation annotation); static boolean isComponentDefinitionPresent(AnnotatedElement annotatedElement); static Stream<Method> getComponentDefinitionMethods(Class<?> pmoClass); static LinkkiComponentDefinition getComponentDefinition(
            A annotation,
            AnnotatedElement annotatedElement); static Optional<LinkkiComponentDefinition> findComponentDefinition(AnnotatedElement annotatedElement); static Annotation getComponentDefinitionAnnotation(AnnotatedElement annotatedElement, Object pmo); }
ComponentAnnotationReader { public static <A extends Annotation> LinkkiComponentDefinition getComponentDefinition( A annotation, AnnotatedElement annotatedElement) { LinkkiComponent linkkiComponent = LINKKI_COMPONENT_ANNOTATION.findOn(annotation) .orElseThrow(LINKKI_COMPONENT_ANNOTATION .missingAnnotation(annotation, annotatedElement, ComponentAnnotationReader.class.getSimpleName() + "#isComponentDefinition(Annotation)")); @SuppressWarnings("unchecked") Class<ComponentDefinitionCreator<A>> creatorClass = (Class<ComponentDefinitionCreator<A>>)linkkiComponent .value(); return Classes.instantiate(creatorClass).create(annotation, annotatedElement); } private  ComponentAnnotationReader(); static boolean isComponentDefinition(@CheckForNull Annotation annotation); static boolean isComponentDefinitionPresent(AnnotatedElement annotatedElement); static Stream<Method> getComponentDefinitionMethods(Class<?> pmoClass); static LinkkiComponentDefinition getComponentDefinition(
            A annotation,
            AnnotatedElement annotatedElement); static Optional<LinkkiComponentDefinition> findComponentDefinition(AnnotatedElement annotatedElement); static Annotation getComponentDefinitionAnnotation(AnnotatedElement annotatedElement, Object pmo); static final String COMPONENT_PROPERTY_SUFFIX; }