当前位置: 首页>>代码示例>>Java>>正文


Java ClassSourceFileComposerFactory.addImplementedInterface方法代码示例

本文整理汇总了Java中com.google.gwt.user.rebind.ClassSourceFileComposerFactory.addImplementedInterface方法的典型用法代码示例。如果您正苦于以下问题:Java ClassSourceFileComposerFactory.addImplementedInterface方法的具体用法?Java ClassSourceFileComposerFactory.addImplementedInterface怎么用?Java ClassSourceFileComposerFactory.addImplementedInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.user.rebind.ClassSourceFileComposerFactory的用法示例。


在下文中一共展示了ClassSourceFileComposerFactory.addImplementedInterface方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSourceWriter

import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
private SourceWriter getSourceWriter(TreeLogger logger,
                                     GeneratorContext context,
                                     JClassType originalType,
                                     String packageName,
                                     String simpleSourceName)
    throws UnableToCompleteException {

  logger.log(TreeLogger.INFO,
             "Generating writer for " + packageName + "." + simpleSourceName,
             null);

  PrintWriter printWriter = context.tryCreate(logger,
                                              packageName,
                                              simpleSourceName);
  if (printWriter == null) {
    return null;
  }

  ClassSourceFileComposerFactory classFactory = new ClassSourceFileComposerFactory(packageName,
                                                                                   simpleSourceName);
  classFactory.addImplementedInterface(originalType.getName());

  return classFactory.createSourceWriter(context,
                                         printWriter);
}
 
开发者ID:gwt4e,项目名称:gwt4e,代码行数:26,代码来源:BindingPropertyGenerator.java

示例2: getSourceWriter

import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
/**
 * get source writer for the generator.
 *
 * @param pclassType class type
 * @param pcontext generator context
 * @param plogger tree logger
 * @return SourceWriter to write the generated sources to
 */
private SourceWriter getSourceWriter(final JClassType pclassType, final GeneratorContext pcontext,
    final TreeLogger plogger) {
  final String packageName = this.getClassPackage(pclassType);
  final String simpleName = this.getClassName(pclassType);
  final ClassSourceFileComposerFactory composer =
      new ClassSourceFileComposerFactory(packageName, simpleName);
  composer
      .addImplementedInterface("de.knightsoftnet.validators.client.GwtReflectGetterInterface");

  final PrintWriter printWriter = pcontext.tryCreate(plogger, packageName, simpleName);
  if (printWriter == null) {
    return null;
  }
  return composer.createSourceWriter(pcontext, printWriter);
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:24,代码来源:GwtReflectGetterGenerator.java

示例3: generateDataProxyFastJSOClasses

import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
void generateDataProxyFastJSOClasses()
{
	for( JType type : dataProxyFastFactories )
	{
		String jsoPackage = getDataProxyFastImplPackageName( type );
		String jsoSimpleClassName = getDataProxyFastImplSimpleName( type );

		PrintWriter pw2 = context.tryCreate( logger, jsoPackage, jsoSimpleClassName );
		if( pw2 == null )
			continue;

		ClassSourceFileComposerFactory cf2 = new ClassSourceFileComposerFactory( jsoPackage, jsoSimpleClassName );
		cf2.addImport( "fr.lteconsulting.hexa.client.comm.GenericJSO" );
		cf2.addImport( "com.google.gwt.core.client.JavaScriptObject" );
		cf2.addImport( "com.google.gwt.core.client.GWT" );
		cf2.addImport( "fr.lteconsulting.hexa.client.tools.HexaTools" );
		cf2.addImplementedInterface( type.getParameterizedQualifiedSourceName() );
		cf2.setSuperclass( "GenericJSO" );
		SourceWriter sw2 = cf2.createSourceWriter( context, pw2 );
		generateDataProxyFastJSOImpl( jsoSimpleClassName, type, sw2, logger );
		sw2.commit( logger );
	}
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:24,代码来源:ServiceGenerator.java

示例4: initComposer

import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
@Override
public void initComposer(ClassSourceFileComposerFactory composerFactory) {
	composerFactory.addImport(Place.class.getName());
	composerFactory.addImport(Presenter.class.getName());
	for (JMethod presenterMethod : this.presenterMethods) {
		if (presenterMethod.getParameters().length > 0) {
			JType placeType = presenterMethod.getParameters()[0].getType();
			composerFactory.addImport(placeType.getQualifiedSourceName());
			if (placeType instanceof JParameterizedType) {
				JParameterizedType parameterizedType = (JParameterizedType) placeType;
				for (JType paramType : parameterizedType.getTypeArgs()) {
					composerFactory.addImport(paramType.getQualifiedSourceName());
				}
			}
		}
	}

	composerFactory.addImplementedInterface(Presenter.class.getSimpleName());
	composerFactory.addImport(AcceptsOneWidget.class.getName());
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:21,代码来源:InjectPresenterCreator.java

示例5: getSourceWriter

import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
private SourceWriter getSourceWriter(PrintWriter printWriter, GeneratorContext ctx) {

		String packageName = this.binderType.getPackage().getName();
		String className = this.binderProxySimpleName;

		ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(packageName, className);

		composerFactory.addImport(GWT.class.getName());
		composerFactory.addImport(UiBinder.class.getName());
		composerFactory.addImport(UiBinderLocalized.class.getName());
		composerFactory.addImport(UiTemplate.class.getName());

		composerFactory.addImport(this.binderType.getQualifiedSourceName());
		composerFactory.addImport(this.widgetType.getQualifiedSourceName());
		composerFactory.addImport(this.targetType.getQualifiedSourceName());

		composerFactory.addImplementedInterface(UiBinderLocalized.class.getSimpleName() + "<"
			+ this.widgetType.getSimpleSourceName() + "," + this.targetType.getSimpleSourceName() + ">");
		composerFactory.addImplementedInterface(UiBinder.class.getSimpleName() + "<"
			+ this.widgetType.getSimpleSourceName() + "," + this.targetType.getSimpleSourceName() + ">");
		composerFactory.addImplementedInterface(this.binderType.getSimpleSourceName());

		return composerFactory.createSourceWriter(ctx, printWriter);
	}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:25,代码来源:UiBinderLocalizedCreator.java

示例6: createSourceWriter

import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
private SourceWriter createSourceWriter(
    TreeLogger logger,
    GeneratorContext context,
    JClassType eventBinderType,
    JClassType targetType) {
  String simpleName = getSimpleGeneratedClassName(eventBinderType);
  String packageName = eventBinderType.getPackage().getName();
  ClassSourceFileComposerFactory composer =
      new ClassSourceFileComposerFactory(packageName, simpleName);

  composer.setSuperclass(AbstractEventBinder.class.getCanonicalName()
      + "<" + targetType.getQualifiedSourceName() + ">");
  composer.addImplementedInterface(eventBinderType.getName());

  composer.addImport(EventBinder.class.getCanonicalName());
  composer.addImport(EventBus.class.getCanonicalName());
  composer.addImport(GenericEvent.class.getCanonicalName());
  composer.addImport(GenericEventHandler.class.getCanonicalName());
  composer.addImport(HandlerRegistration.class.getCanonicalName());
  composer.addImport(LinkedList.class.getCanonicalName());
  composer.addImport(List.class.getCanonicalName());

  PrintWriter printWriter = context.tryCreate(logger, packageName, simpleName);
  return (printWriter != null) ? composer.createSourceWriter(context, printWriter) : null;
}
 
开发者ID:google,项目名称:gwteventbinder,代码行数:26,代码来源:EventBinderGenerator.java

示例7: createSourceWriter

import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
private SourceWriter createSourceWriter(TreeLogger logger, GeneratorContext context,
    JClassType eventBinderType, JClassType targetType) {
  String simpleName = getSimpleGeneratedClassName(eventBinderType);
  String packageName = eventBinderType.getPackage().getName();
  ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory(
      packageName, simpleName);

  composer.addImplementedInterface(eventBinderType.getName());
  composer.addImport(EventHandlerMethod.class.getCanonicalName());
  composer.addImport(LinkedList.class.getCanonicalName());
  composer.addImport(List.class.getCanonicalName());
  composer.addImport(MultiEvent.class.getCanonicalName());

  PrintWriter printWriter = context.tryCreate(logger, packageName, simpleName);
  return printWriter != null ? composer.createSourceWriter(context, printWriter) : null;
}
 
开发者ID:ekuefler,项目名称:gwt-supereventbus,代码行数:17,代码来源:EventRegistrationGenerator.java

示例8: writeTopSerializer

import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
private void writeTopSerializer(TreeLogger logger,
    GeneratorContext context, JClassType typeFor, JClassType subType) {
    ClassSourceFileComposerFactory mcf = new ClassSourceFileComposerFactory(typeFor.getPackage()
                                                                                   .getName(),
            typeFor.getSimpleSourceName() + "_Impl");
    mcf.addImplementedInterface(typeFor.getParameterizedQualifiedSourceName());
    mcf.setSuperclass(subType.getParameterizedQualifiedSourceName() +
        "_JSONCodec");

    PrintWriter printWriter = context.tryCreate(logger,
            typeFor.getPackage().getName(),
            typeFor.getSimpleSourceName() + "_Impl");

    if (printWriter == null) {
        logger.log(Type.INFO,
            "Already genned " + typeFor.getSimpleSourceName() + "_Impl");

        return;
    }

    SourceWriter writer = mcf.createSourceWriter(context, printWriter);
    writer.println(" public String getMimeType() { return MIME_TYPE; }");
    writer.println("}");
    context.commit(logger, printWriter);
}
 
开发者ID:kebernet,项目名称:gwittir,代码行数:26,代码来源:JSONCodecGenerator.java

示例9: createSourceWriter

import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
private SourceWriter createSourceWriter(TreeLogger logger, GeneratorContext context, JClassType eventBinderType, JClassType targetType) {
    String simpleName = getSimpleGeneratedClassName(eventBinderType);
    String packageName = eventBinderType.getPackage().getName();
    ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory(packageName, simpleName);

    composer.setSuperclass(AbstractDomEventBinder.class.getCanonicalName() + "<" + targetType.getName() + ">");
    composer.addImplementedInterface(eventBinderType.getName());

    composer.addImport(LinkedList.class.getCanonicalName());
    composer.addImport(List.class.getCanonicalName());
    composer.addImport(Element.class.getCanonicalName());
    composer.addImport(HandlerRegistration.class.getCanonicalName());
    composer.addImport(IsWidget.class.getCanonicalName());

    PrintWriter printWriter = context.tryCreate(logger, packageName, simpleName);
    return (printWriter != null) ? composer.createSourceWriter(context, printWriter) : null;
}
 
开发者ID:rfilippone,项目名称:gwt-dom-event-binder,代码行数:18,代码来源:DomEventBinderGenerator.java

示例10: getSourceWriter

import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
private SourceWriter getSourceWriter(TreeLogger logger, GeneratorContext context, JClassType classType) {
	String packageName = packageNameFrom(classType);
	String simpleName = simpleNameFrom(classType);
	ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory(packageName, simpleName);
	composer.addImplementedInterface(classType.getName());
	composer.addImport(classType.getQualifiedSourceName());
	PrintWriter printWriter = context.tryCreate(logger, packageName, simpleName);
	if (printWriter == null) {
		return null; 
	} else {
		return composer.createSourceWriter(context, printWriter);
	} 
}
 
开发者ID:TOMOTON,项目名称:gwt-dagger2,代码行数:14,代码来源:VersionGenerator.java

示例11: generateClass

import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
/**
 * Generate the content of the class
 *
 * @param logger
 * @param context
 * @param packageName
 * @param className
 * @param extensions
 * @throws UnableToCompleteException
 */
private void generateClass(
    TreeLogger logger,
    GeneratorContext context,
    String packageName,
    String className,
    List<JClassType> extensions)
    throws UnableToCompleteException {
  PrintWriter pw = context.tryCreate(logger, packageName, className);
  if (pw == null) {
    return;
  }

  ClassSourceFileComposerFactory composerFactory =
      new ClassSourceFileComposerFactory(packageName, className);
  // generate imports
  generateImports(extensions, composerFactory);

  // interface
  composerFactory.addImplementedInterface(ExtensionRegistry.class.getCanonicalName());

  // get source writer
  SourceWriter sw = composerFactory.createSourceWriter(context, pw);
  // begin class definition
  // fields
  sw.println("private final Map<String, ExtensionDescription> extensions = new HashMap<>();");

  generateConstructor(className, extensions, sw);

  // methods
  generateGetExtensionsMethod(sw);
  // close it out
  sw.outdent();
  sw.println("}");

  context.commit(logger, pw);
}
 
开发者ID:eclipse,项目名称:che,代码行数:47,代码来源:ExtensionRegistryGenerator.java

示例12: createGinjector

import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
private String createGinjector(TreeLogger logger, GeneratorContext context, String packageName,
    String requestedName, String newClassName, String moduleName) {
  String ginjectorName = requestedName + "Ginjector";
  ClassSourceFileComposerFactory ginjectorFactory =
      new ClassSourceFileComposerFactory(packageName, ginjectorName);
  ginjectorFactory.makeInterface();
  ginjectorFactory.addImplementedInterface(Ginjector.class.getCanonicalName());
  ginjectorFactory.addImport(GinModules.class.getCanonicalName());
  ginjectorFactory.addAnnotationDeclaration("@GinModules(" + moduleName + ".class)");
  SourceWriter ginjectorWriter = ginjectorFactory.createSourceWriter(context,
      context.tryCreate(logger, packageName, ginjectorName));
  ginjectorWriter.println("void injectMembers(" + newClassName + " obj);");
  ginjectorWriter.commit(logger);
  return ginjectorName;
}
 
开发者ID:google-code-export,项目名称:google-gin,代码行数:16,代码来源:FrameworkGenerator.java

示例13: generate

import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
/**
 * Generate Java code for factory class capable of returning instance for a class name.
 * <p>
 * It is not true introspection. In fact the whole factory class is a mapper; mapping class name
 * to constructor call. Like {@code if (className=="my.code.Foo1") return new my.code.Foo1();}
 * Only small section of classes can be instantiable this way. Supported classes are filtered
 * based marker interface, annotation or regex. This implementation is uses marker interface
 * {@link EntryPoint}.
 * 
 * @param logger
 * @param context
 *            provides list of all visible classes, see {@link GeneratorContext#getTypeOracle()}
 *            , and stream for printing the Java code, see {@link SourceWriter}.
 * @param typeName
 *            example: "my.code.client.reflection.ClassFromStringFactory" ???
 * @return implementation class name, example:
 *         my.code.client.reflection.ClassFromStringFactoryImpl
 */
@Override
public String generate(TreeLogger logger, GeneratorContext context, String typeName)
  throws UnableToCompleteException
{
  // Filter all classes visible to GWT client side and return only supported ones
  List<JClassType> allInstantiableClasses = getAllInstantiableClassesByThisfactory(context);

  final String genPackageName = EntityFactory.class.getPackage().getName();
  logger.log(Type.INFO, "genPackageName: " + genPackageName);

  final String genClassName = EntityFactory.class.getSimpleName() + "Impl";

  // prepare Composer. Composer prepares shell of the Java code, so we need to set package and class name
  ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory(genPackageName, genClassName);
  
  // register (add) required imports to Composer 
  // but the generated class uses fully qualified names everywhere, no imports required
  
  PrintWriter printWriter = context.tryCreate(logger, genPackageName, genClassName);
  if (printWriter != null) {
    composer.addImplementedInterface(EntityFactory.class.getSimpleName());

    // Get source stream from Composer. It already contains shell of the new class
    // like package, imports and full class signature
    SourceWriter sourceWriter = composer.createSourceWriter(context, printWriter);

    // generate class content, content of the Java file, contructor and factory method
    generateFactoryClass(genClassName, composer, sourceWriter, logger, allInstantiableClasses);
  }
  return composer.getCreatedClassName();
}
 
开发者ID:KnowledgeCaptureAndDiscovery,项目名称:ontosoft,代码行数:50,代码来源:EntityGenerator.java

示例14: getSourceWriter

import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
private SourceWriter getSourceWriter(TreeLogger logger,
                                     GeneratorContext context,
                                     JClassType originalType,
                                     String packageName,
                                     String generatedClassName)
  throws UnableToCompleteException {

  logger.log(TreeLogger.INFO,
             "Generating writer for " + packageName + "." + generatedClassName,
             null);

  PrintWriter printWriter = context.tryCreate(logger,
                                              packageName,
                                              generatedClassName);
  if (printWriter == null) {
    return null;
  }

  ClassSourceFileComposerFactory classFactory = new ClassSourceFileComposerFactory(packageName,
                                                                                   generatedClassName);

  classFactory.addImplementedInterface(originalType.getName());
  String[] classesToImport = getClassesToImport();
  for (String classToImport : classesToImport) {
    classFactory.addImport(classToImport);
  }

  return classFactory.createSourceWriter(context,
                                         printWriter);
}
 
开发者ID:mvp4g,项目名称:mvp4g,代码行数:31,代码来源:Mvp4gGenerator.java

示例15: compose

import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
@Override
protected void compose(final ClassSourceFileComposerFactory composerFactory) {
  this.addImports(composerFactory, Annotation.class, ConstraintViolation.class, GWT.class,
      ValidationGroupsMetadata.class, Group.class, GroupChain.class, PathImpl.class, Node.class,
      GroupChainGenerator.class, GwtBeanDescriptor.class, BeanMetadata.class,
      GwtValidationContext.class, ArrayList.class, HashSet.class, IllegalArgumentException.class,
      Set.class, Collection.class, Iterator.class, List.class, ValidationException.class);
  composerFactory.setSuperclass(AbstractGwtSpecificValidator.class.getCanonicalName() + "<"
      + this.beanType.getQualifiedSourceName() + ">");
  composerFactory.addImplementedInterface(this.validatorType.getName());
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:12,代码来源:GwtSpecificValidatorCreator.java


注:本文中的com.google.gwt.user.rebind.ClassSourceFileComposerFactory.addImplementedInterface方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。