com.google.gwt.core.ext.typeinfo.JClassType Java Examples

The following examples show how to use com.google.gwt.core.ext.typeinfo.JClassType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Mvp4gConfigurationTest.java    From mvp4g with Apache License 2.0 6 votes vote down vote up
@Test
public void testParentEventBus()
  throws InvalidMvp4gConfigurationException {

  EventBusElement eventBus = new EventBusElement(EventBusOk.class.getName(),
                                                 BaseEventBus.class.getName(),
                                                 false);
  configuration.setEventBus(eventBus);

  configuration.loadParentModule();
  assertNull(configuration.getParentEventBus());
  assertTrue(configuration.isRootModule());

  configuration.setModule(oracle.addClass(Modules.Module01.class));
  setParentEventBus(Modules.Module01.class,
                    EventBus.class);
  JClassType c = oracle.findType(EventBus.class.getCanonicalName());
  configuration.loadParentModule();
  assertEquals(c.getQualifiedSourceName(),
               configuration.getParentEventBus()
                            .getQualifiedSourceName());
  assertFalse(configuration.isRootModule());
}
 
Example #2
Source File: Mvp4gGenerator.java    From mvp4g with Apache License 2.0 6 votes vote down vote up
private boolean checkModule(TreeLogger logger,
                            GeneratorContext ctx,
                            JClassType module) {

  long lastTimeGenerated = ctx.getCachedGeneratorResult()
                              .getTimeGenerated();

  if (module == null) {
    logger.log(TreeLogger.TRACE,
               "Found previously dependent type that's no longer present: " + Mvp4gModule.class.getName());
    return false;
  }
  assert module instanceof JRealClassType;
  JRealClassType realClass = (JRealClassType) module;
  if (realClass == null || realClass.getLastModifiedTime() > lastTimeGenerated) {
    return false;
  }

  return true;
}
 
Example #3
Source File: EventsAnnotationsLoaderTest.java    From mvp4g with Apache License 2.0 6 votes vote down vote up
@Test(expected = Mvp4gAnnotationException.class)
public void testEventNoAnnotation()
  throws Mvp4gAnnotationException {
  try {
    List<JClassType> annotedClasses = new ArrayList<JClassType>();
    annotedClasses.add(oracle.addClass(SimplePresenter01.class));
    new PresenterAnnotationsLoader().load(annotedClasses,
                                          configuration);

    annotedClasses.clear();

    JClassType type = oracle.addClass(Events.EventBusWithMethodAndNoAnnotation.class);
    annotedClasses.add(type);
    loader.load(annotedClasses,
                configuration);
  } catch (Mvp4gAnnotationException e) {
    assertTrue(e.getMessage()
                .contains("annotation missing."));
    throw e;
  }
}
 
Example #4
Source File: ObjectMapperCreator.java    From gwt-jackson with Apache License 2.0 6 votes vote down vote up
/**
 * Extract the type to map from the interface.
 *
 * @param interfaceClass the interface
 *
 * @return the extracted type to map
 * @throws UnableToCompleteException if we don't find the type
 */
private JClassType extractMappedType( JClassType interfaceClass ) throws UnableToCompleteException {
    JClassType intf = interfaceClass.isInterface();
    if ( intf == null ) {
        logger.log( TreeLogger.Type.ERROR, "Expected " + interfaceClass + " to be an interface." );
        throw new UnableToCompleteException();
    }

    JClassType[] intfs = intf.getImplementedInterfaces();
    for ( JClassType t : intfs ) {
        if ( t.getQualifiedSourceName().equals( OBJECT_MAPPER_CLASS ) ) {
            return extractParameterizedType( OBJECT_MAPPER_CLASS, t.isParameterized() );
        } else if ( t.getQualifiedSourceName().equals( OBJECT_READER_CLASS ) ) {
            return extractParameterizedType( OBJECT_READER_CLASS, t.isParameterized() );
        } else if ( t.getQualifiedSourceName().equals( OBJECT_WRITER_CLASS ) ) {
            return extractParameterizedType( OBJECT_WRITER_CLASS, t.isParameterized() );
        }
    }
    logger.log( TreeLogger.Type.ERROR, "Expected  " + interfaceClass + " to extend one of the following interface : " +
            OBJECT_MAPPER_CLASS + ", " + OBJECT_READER_CLASS + " or " + OBJECT_WRITER_CLASS );
    throw new UnableToCompleteException();
}
 
Example #5
Source File: EventsAnnotationsLoaderTest.java    From mvp4g with Apache License 2.0 6 votes vote down vote up
@Test(expected = Mvp4gAnnotationException.class)
public void testNoInstanceOfHistory()
  throws Mvp4gAnnotationException {
  try {
    List<JClassType> annotedClasses = new ArrayList<JClassType>();
    annotedClasses.add(oracle.addClass(PresenterWithName.class));
    new PresenterAnnotationsLoader().load(annotedClasses,
                                          configuration);

    annotedClasses.clear();

    annotedClasses = new ArrayList<JClassType>();
    JClassType type = oracle.addClass(EventBusOk.class);
    annotedClasses.add(type);
    loader.load(annotedClasses,
                configuration);
  } catch (Mvp4gAnnotationException e) {
    assertTrue(e.getMessage()
                .contains("No instance of"));
    throw e;
  }
}
 
Example #6
Source File: EventBinderWriterTest.java    From gwteventbinder with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldFailOnAbstractParameter() throws Exception {
  JClassType paramType = getEventType(AbstractEvent.class);
  when(paramType.isAbstract()).thenReturn(true);
  
  JMethod method = newMethod("myMethod", paramType);
  when(target.getInheritableMethods()).thenReturn(new JMethod[] {method});
  
  try {
    writer.writeDoBindEventHandlers(target, output, typeOracle);
    fail("Exception not thrown");
  } catch (UnableToCompleteException expected) {}
  
  verify(logger).log(
      eq(Type.ERROR), contains("myMethod"), isNull(Throwable.class), isNull(HelpInfo.class));
}
 
Example #7
Source File: EventsAnnotationsLoaderTest.java    From mvp4g with Apache License 2.0 6 votes vote down vote up
@Test(expected = Mvp4gAnnotationException.class)
public void testDoubleNotFoundHistory()
  throws Mvp4gAnnotationException {
  try {
    List<JClassType> annotedClasses = new ArrayList<JClassType>();
    annotedClasses.add(oracle.addClass(PresenterWithName.class));
    new PresenterAnnotationsLoader().load(annotedClasses,
                                          configuration);

    annotedClasses.clear();

    JClassType type = oracle.addClass(Events.EventBusDoubleNotFoundHistory.class);
    annotedClasses.add(type);
    loader.load(annotedClasses,
                configuration);
  } catch (Mvp4gAnnotationException e) {
    assertTrue(e.getMessage()
                .contains("Duplicate value for Not Found History event. It is already defined by another method or in your configuration file."));
    throw e;
  }
}
 
Example #8
Source File: EventsAnnotationsLoaderTest.java    From mvp4g with Apache License 2.0 6 votes vote down vote up
@Test
public void testEventBusSameFilter()
  throws Mvp4gAnnotationException {
  List<JClassType> annotedClasses = new ArrayList<JClassType>();
  annotedClasses.add(oracle.addClass(PresenterWithName.class));
  new PresenterAnnotationsLoader().load(annotedClasses,
                                        configuration);

  annotedClasses.clear();
  annotedClasses.add(oracle.addClass(Events.EventBusWithSameFilter.class));
  try {
    loader.load(annotedClasses,
                configuration);
    fail();
  } catch (Mvp4gAnnotationException e) {
    assertTrue(e.getMessage()
                .contains("Multiple definitions for event filter " + EventFilters.EventFilter1.class.getCanonicalName() + "."));
  }
}
 
Example #9
Source File: EventsAnnotationsLoaderTest.java    From mvp4g with Apache License 2.0 6 votes vote down vote up
@Test(expected = Mvp4gAnnotationException.class)
public void testSameEvent()
  throws Mvp4gAnnotationException {
  try {
    List<JClassType> annotedClasses = new ArrayList<JClassType>();
    annotedClasses.add(oracle.addClass(SimplePresenter01.class));
    new PresenterAnnotationsLoader().load(annotedClasses,
                                          configuration);

    annotedClasses.clear();

    JClassType type = oracle.addClass(Events.EventBusWithSameMethod.class);
    annotedClasses.add(type);
    loader.load(annotedClasses,
                configuration);
  } catch (Mvp4gAnnotationException e) {
    assertTrue(e.getMessage()
                .contains("Duplicate"));
    throw e;
  }
}
 
Example #10
Source File: GssResourceGenerator.java    From gss.gwt with Apache License 2.0 6 votes vote down vote up
private void writeMethods(TreeLogger logger, ResourceContext context, JMethod method,
    SourceWriter sw, ConstantDefinitions constantDefinitions,
    Map<String, String> originalConstantNameMapping, Map<String, String> substitutionMap)
    throws UnableToCompleteException {
  JClassType gssResource = method.getReturnType().isInterface();

  boolean success = true;

  for (JMethod toImplement : gssResource.getOverridableMethods()) {
    if (toImplement == getTextMethod) {
      writeGetText(logger, context, method, sw);
    } else if (toImplement == ensuredInjectedMethod) {
      writeEnsureInjected(sw);
    } else if (toImplement == getNameMethod) {
      writeGetName(method, sw);
    } else {
      success &= writeUserMethod(logger, toImplement, sw, constantDefinitions,
          originalConstantNameMapping, substitutionMap);
    }
  }

  if (!success) {
    throw new UnableToCompleteException();
  }
}
 
Example #11
Source File: EventsAnnotationsLoaderTest.java    From mvp4g with Apache License 2.0 6 votes vote down vote up
@Test
public void testStart()
  throws Mvp4gAnnotationException {
  List<JClassType> annotedClasses = new ArrayList<JClassType>();
  annotedClasses.add(oracle.addClass(SimplePresenter01.class));
  new PresenterAnnotationsLoader().load(annotedClasses,
                                        configuration);

  annotedClasses.clear();
  JClassType type = oracle.addClass(Events.SimpleEventBus.class);
  annotedClasses.add(type);
  loader.load(annotedClasses,
              configuration);
  StartElement start = configuration.getStart();
  assertEquals(configuration.getPresenters()
                            .iterator()
                            .next()
                            .getName(),
               start.getPresenter());
  assertFalse(start.hasHistory());
  assertTrue(configuration.getStart()
                          .hasPresenter());
}
 
Example #12
Source File: PropertyParser.java    From gwt-jackson with Apache License 2.0 6 votes vote down vote up
private static void parse( RebindConfiguration configuration, TreeLogger logger, JClassType type, Map<String,
        PropertyAccessorsBuilder> propertiesMap, boolean mixin ) {
    if ( null == type ) {
        return;
    }

    if ( !mixin ) {
        Optional<JClassType> mixinAnnotation = configuration.getMixInAnnotations( type );
        if ( mixinAnnotation.isPresent() ) {
            parse( configuration, logger, mixinAnnotation.get(), propertiesMap, true );
        }
    }

    parseFields( logger, type, propertiesMap, mixin );
    parseMethods( logger, type, propertiesMap, mixin );

    for ( JClassType interf : type.getImplementedInterfaces() ) {
        parse( configuration, logger, interf, propertiesMap, mixin );
    }

    parse( configuration, logger, type.getSuperclass(), propertiesMap, mixin );
}
 
Example #13
Source File: EventsAnnotationsLoaderTest.java    From mvp4g with Apache License 2.0 6 votes vote down vote up
@Test
public void testLoadChildConfigOk()
  throws Mvp4gAnnotationException {

  List<JClassType> annotedClasses = new ArrayList<JClassType>();
  annotedClasses.add(oracle.addClass(PresenterWithName.class));
  new PresenterAnnotationsLoader().load(annotedClasses,
                                        configuration);

  annotedClasses.clear();

  JClassType type = oracle.addClass(Events.EventBusLoadChildConfig.class);
  annotedClasses.add(type);
  loader.load(annotedClasses,
              configuration);
  ChildModulesElement childModules = configuration.getLoadChildConfig();
  assertEquals("event1",
               childModules.getBeforeEvent());
  assertEquals("event2",
               childModules.getAfterEvent());
  assertEquals("event3",
               childModules.getErrorEvent());

}
 
Example #14
Source File: ServicesAnnotationsLoaderTest.java    From mvp4g with Apache License 2.0 6 votes vote down vote up
@Test
public void testPath()
  throws Mvp4gAnnotationException {
  List<JClassType> annotedClasses = new ArrayList<JClassType>();
  annotedClasses.add(oracle.addClass(getSimpleClass()));
  annotedClasses.add(oracle.addClass(getWithNameClass()));
  Set<ServiceElement> services = getSet();
  assertEquals(services.size(),
               0);
  loader.load(annotedClasses,
              configuration);
  assertEquals(services.size(),
               2);
  for (ServiceElement service : services) {
    assertEquals(service.getPath(),
                 "path");
  }
}
 
Example #15
Source File: EventsAnnotationsLoader.java    From mvp4g with Apache License 2.0 6 votes vote down vote up
private void loadHistoryConfiguration(JClassType c,
                                      Mvp4gConfiguration configuration)
  throws Mvp4gAnnotationException {

  PlaceService historyConfig = c.getAnnotation(PlaceService.class);
  if (historyConfig != null) {
    HistoryElement history = configuration.getHistory();
    if (history == null) {
      history = new HistoryElement();
      configuration.setHistory(history);
    }

    history.setPlaceServiceClass(historyConfig.value()
                                              .getCanonicalName());
  }
}
 
Example #16
Source File: AbstractMvp4gAnnotationsWithServiceLoaderTest.java    From mvp4g with Apache License 2.0 6 votes vote down vote up
@Test
public void testServicesWithName()
  throws Mvp4gAnnotationException {
  List<JClassType> annotedClasses = new ArrayList<JClassType>();
  JClassType       type           = oracle.addClass(getServiceWithName());
  annotedClasses.add(type);
  loader.load(annotedClasses,
              configuration);
  Set<Mvp4gWithServicesElement> elements = getSet();
  List<InjectedElement> injectedServices = elements.iterator()
                                                   .next()
                                                   .getInjectedServices();
  InjectedElement injectedService = injectedServices.get(0);
  assertEquals(injectedServices.size(),
               1);
  assertEquals(injectedService.getSetterName(),
               "setSthg");
  assertEquals(injectedService.getElementName(),
               "name");
  assertEquals(configuration.getServices()
                            .size(),
               0);
}
 
Example #17
Source File: CreatorUtils.java    From gwt-jackson with Apache License 2.0 6 votes vote down vote up
/**
 * <p>filterSubtypesForSerialization</p>
 *
 * @param logger a {@link com.google.gwt.core.ext.TreeLogger} object.
 * @param configuration a {@link com.github.nmorel.gwtjackson.rebind.RebindConfiguration} object.
 * @param type a {@link com.google.gwt.core.ext.typeinfo.JClassType} object.
 * @return a {@link com.google.gwt.thirdparty.guava.common.collect.ImmutableList} object.
 */
public static ImmutableList<JClassType> filterSubtypesForSerialization( TreeLogger logger, RebindConfiguration configuration,
                                                                        JClassType type ) {
    boolean filterOnlySupportedType = isObjectOrSerializable( type );

    ImmutableList.Builder<JClassType> builder = ImmutableList.builder();
    if ( type.getSubtypes().length > 0 ) {
        for ( JClassType subtype : type.getSubtypes() ) {
            if ( null == subtype.isAnnotation()
                    && subtype.isPublic()
                    && (!filterOnlySupportedType || configuration.isTypeSupportedForSerialization( logger, subtype ))
                    && !findFirstEncounteredAnnotationsOnAllHierarchy( configuration, subtype.isClassOrInterface(), JsonIgnoreType.class, Optional.of( type ) ).isPresent()) {
                builder.add( subtype );
            }
        }
    }
    return builder.build();
}
 
Example #18
Source File: EventBinderWriterTest.java    From gwteventbinder with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldFailOnPrimitiveParameter() throws Exception {
  JClassType paramType = mock(JClassType.class);
  when(paramType.isClassOrInterface()).thenReturn(null);

  JMethod method = newMethod("myMethod", paramType);
  when(target.getInheritableMethods()).thenReturn(new JMethod[] {method});

  try {
    writer.writeDoBindEventHandlers(target, output, typeOracle);
    fail("Exception not thrown");
  } catch (UnableToCompleteException expected) {}

  verify(logger).log(
      eq(Type.ERROR), contains("myMethod"), isNull(Throwable.class), isNull(HelpInfo.class));
}
 
Example #19
Source File: AbstractMvp4gAnnotationLoaderTest.java    From mvp4g with Apache License 2.0 6 votes vote down vote up
@Test
public void testSimpleElement()
  throws Mvp4gAnnotationException {
  List<JClassType> annotedClasses = new ArrayList<JClassType>();
  annotedClasses.add(oracle.addClass(getSimpleClass()));
  Set<SimpleMvp4gElement> elements = getSet();
  assertEquals(elements.size(),
               0);
  loader.load(annotedClasses,
              configuration);
  assertEquals(elements.size(),
               1);
  SimpleMvp4gElement element = elements.iterator()
                                       .next();
  assertEquals(element.getName(),
               element.getClassName()
                      .replace('.',
                               '_'));
}
 
Example #20
Source File: ObjectMapperCreator.java    From gwt-jackson with Apache License 2.0 6 votes vote down vote up
/**
 * Build the new deserializer method.
 *
 * @param mappedTypeClass the type to map
 *
 * @return the method
 */
private MethodSpec buildNewDeserializerMethod( JClassType mappedTypeClass ) throws UnableToCompleteException {
    JDeserializerType type;
    try {
        type = getJsonDeserializerFromType( mappedTypeClass );
    } catch ( UnsupportedTypeException e ) {
        logger.log( Type.ERROR, "Cannot generate mapper due to previous errors : " + e.getMessage() );
        throw new UnableToCompleteException();
    }

    return MethodSpec.methodBuilder( "newDeserializer" )
            .addModifiers( Modifier.PROTECTED )
            .addAnnotation( Override.class )
            .returns( parameterizedName( JsonDeserializer.class, mappedTypeClass ) )
            .addStatement( "return $L", type.getInstance() )
            .build();
}
 
Example #21
Source File: ModelCreator.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void createSubModels(TreeLogger logger, GeneratorContext context) {
	for (JType jType : this.imports) {
		if (jType == null) {
			continue;
		}
		if (jType.isEnum() != null) {
			continue;
		}
		if (ModelCreator.DISCARD_MODEL_TYPES.contains(jType.getQualifiedSourceName())) {
			continue;
		}
		if (jType instanceof JClassType) {
			ModelCreator creator = new ModelCreator((JClassType) jType);
			String subModelType = creator.create(logger, context);
			this.subModels.put(jType, subModelType);
		}
	}
}
 
Example #22
Source File: Mvp4gConfigurationFileReaderTest.java    From mvp4g with Apache License 2.0 6 votes vote down vote up
@Test
public void testWriteMultipleImpl() {
  TypeOracleStub     oracle      = (TypeOracleStub) configuration.getOracle();
  JClassType         moduleType  = oracle.addClass(Modules.ModuleWithParent01.class);
  ChildModuleElement childModule = new ChildModuleElement();
  childModule.setClassName(moduleType.getQualifiedSourceName());
  childModule.setName("childModule");
  childModule.setAutoDisplay("false");
  configuration.getChildModules()
               .add(childModule);

  SplitterElement splitter = new SplitterElement();
  splitter.setName("splitter");
  splitter.setClassName("Splitter");
  configuration.getSplitters()
               .add(splitter);

  configuration.setSuffix("suffix");

  assertOutput(getExpectedMultipleImpl(),
               false);
  writer.writeConf();
  assertOutput(getExpectedMultipleImpl(),
               true);
}
 
Example #23
Source File: EventsAnnotationsLoaderTest.java    From mvp4g with Apache License 2.0 6 votes vote down vote up
@Test
public void testOtherEventBus() {
  try {
    configuration.setEventBus(new EventBusElement(Object.class.getName(),
                                                  BaseEventBus.class.getName(),
                                                  false));
    List<JClassType> annotedClasses = new ArrayList<JClassType>();
    JClassType       type           = oracle.addClass(Events.SimpleEventBus.class);
    annotedClasses.add(type);
    loader.load(annotedClasses,
                configuration);
    fail();
  } catch (Mvp4gAnnotationException e) {
    assertEquals(e.getMessage(),
                 Events.SimpleEventBus.class.getCanonicalName() +
                 ": You can define only one event bus by Mvp4g module. Do you already have another EventBus interface for the module " +
                 Mvp4gModule.class.getCanonicalName() +
                 "?");
  }
}
 
Example #24
Source File: ServiceBinderCreator.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ServiceBinderCreator(JClassType serviceBinderType, JClassType serviceType, JClassType handlerType) {
	this.serviceBinderType = serviceBinderType;
	this.serviceType = serviceType;
	this.handlerType = handlerType;
	this.proxyModelQualifiedName =
		this.handlerType.getQualifiedSourceName() + "_" + this.serviceType.getSimpleSourceName() + "_ServiceBinder";
}
 
Example #25
Source File: PresenterCreatorFactory.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void createDelegates(JClassType injectableType, Collection<InjectorCreatorDelegate> delegates) {
	Collection<JMethod> methods = InjectCreatorUtil.listMethod(injectableType, PresentHandler.class);
	delegates.add(new InjectPresenterCreator(methods));
	Collection<JField> services = InjectCreatorUtil.listFields(injectableType, InjectService.class);
	String injectorName = injectableType.getSimpleSourceName() + AbstractInjectorCreator.PROXY_SUFFIX;
	delegates.add(new SuspendServiceOnPresentCreator(injectorName, !services.isEmpty()));
}
 
Example #26
Source File: AbstractMvp4gAnnotationsWithServiceLoaderTest.java    From mvp4g with Apache License 2.0 5 votes vote down vote up
@Test(expected = Mvp4gAnnotationException.class)
public void testWithMoreThanOneParameter()
  throws Mvp4gAnnotationException {
  try {
    List<JClassType> annotedClasses = new ArrayList<JClassType>();
    JClassType       type           = oracle.addClass(getClassWithMoreThanOne());
    annotedClasses.add(type);
    loader.load(annotedClasses,
                configuration);
  } catch (Mvp4gAnnotationException e) {
    assertTrue(e.getMessage()
                .contains("Only setter method with one parameter can be used to inject a service"));
    throw e;
  }
}
 
Example #27
Source File: Mvp4gConfigurationFileReaderTest.java    From mvp4g with Apache License 2.0 5 votes vote down vote up
@Test
public void testWriteParentHistory() {

  TypeOracleStub oracle     = (TypeOracleStub) configuration.getOracle();
  JClassType     moduleType = oracle.addClass(Modules.ModuleWithParent01.class);

  ChildModuleElement childModule = new ChildModuleElement();
  childModule.setClassName(moduleType.getQualifiedSourceName());
  childModule.setName("child");
  childModule.setHistoryName("child");
  childModule.setAutoDisplay("false");
  childModule.setAsync("false");
  configuration.getChildModules()
               .add(childModule);

  EventElement event = new EventElement();
  event.setType("test");
  event.setForwardToModules(new String[] { "child" });
  configuration.getEvents()
               .add(event);
  configuration.getOthersEventBusClassMap()
               .put(Modules.ModuleWithParent01.class.getCanonicalName(),
                    oracle.addClass(EventBusOk.class));

  assertOutput(getExpectedHistoryParent(),
               false);
  writer.writeConf();
  assertOutput(getExpectedHistoryParent(),
               true);

}
 
Example #28
Source File: AbstractHandlerAnnotationsLoaderTest.java    From mvp4g with Apache License 2.0 5 votes vote down vote up
@Test
public void testNotAsync()
  throws Mvp4gAnnotationException {
  List<JClassType> annotedClasses = new ArrayList<JClassType>();
  JClassType       type           = oracle.addClass(getSimpleClass());
  annotedClasses.add(type);
  loader.load(annotedClasses,
              configuration);
  E element = loader.getConfigList(configuration)
                    .iterator()
                    .next();
  assertFalse(element.isAsync());
}
 
Example #29
Source File: ModelCreatorFactory.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void createDelegates(JClassType injectableType, Collection<InjectorCreatorDelegate> delegates) {
	Collection<JField> fields = InjectCreatorUtil.listFields(injectableType, InjectModel.class);
	for (JField field : fields) {
		delegates.add(new InjectModelCreator(field));
	}
}
 
Example #30
Source File: EventsAnnotationsLoaderTest.java    From mvp4g with Apache License 2.0 5 votes vote down vote up
@Test
public void testNoLogger()
  throws Mvp4gAnnotationException {
  List<JClassType> annotedClasses = new ArrayList<JClassType>();
  annotedClasses.add(oracle.addClass(SimplePresenter01.class));
  new PresenterAnnotationsLoader().load(annotedClasses,
                                        configuration);

  annotedClasses.clear();
  annotedClasses.add(oracle.addClass(Events.SimpleEventBus.class));
  loader.load(annotedClasses,
              configuration);
  assertNull(configuration.getDebug());

}