本文整理汇总了Java中com.google.gwt.user.rebind.ClassSourceFileComposerFactory类的典型用法代码示例。如果您正苦于以下问题:Java ClassSourceFileComposerFactory类的具体用法?Java ClassSourceFileComposerFactory怎么用?Java ClassSourceFileComposerFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClassSourceFileComposerFactory类属于com.google.gwt.user.rebind包,在下文中一共展示了ClassSourceFileComposerFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doGetSourceWriter
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入依赖的package包/类
@Override
protected SourceWriter doGetSourceWriter(JClassType classType) {
String packageName = classType.getPackage().getName();
String simpleName = getSimpleUnitName(classType);
ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory(
packageName, simpleName);
composer.setSuperclass(TypeOracleImpl.class.getCanonicalName());
composer.addImport("org.lirazs.gbackbone.reflection.client.*");
composer.addImport("java.util.*");
composer.addImport(classType.getPackage().getName() + ".*");
PrintWriter printWriter = context.tryCreate(logger, packageName, simpleName);
if (printWriter == null) {
return null;
} else {
SourceWriter sw = composer.createSourceWriter(context, printWriter);
return sw;
}
}
示例2: generateImports
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入依赖的package包/类
/**
* Inject imports
*
* @param extensions
* @param composerFactory
*/
private void generateImports(
List<JClassType> extensions, ClassSourceFileComposerFactory composerFactory) {
// imports
composerFactory.addImport(GWT.class.getCanonicalName());
composerFactory.addImport(Extension.class.getCanonicalName());
composerFactory.addImport(ExtensionRegistry.class.getCanonicalName());
composerFactory.addImport(Inject.class.getCanonicalName());
composerFactory.addImport(Provider.class.getCanonicalName());
composerFactory.addImport(List.class.getCanonicalName());
composerFactory.addImport(ArrayList.class.getCanonicalName());
composerFactory.addImport(Map.class.getCanonicalName());
composerFactory.addImport(HashMap.class.getCanonicalName());
// import for extensions
for (JClassType jClassType : extensions) {
composerFactory.addImport(jClassType.getQualifiedSourceName());
}
}
示例3: createModule
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入依赖的package包/类
private String createModule(TreeLogger logger, GeneratorContext context, JClassType requestedType,
String packageName, String requestedName) {
String moduleName = requestedName + "Module";
ClassSourceFileComposerFactory moduleFactory =
new ClassSourceFileComposerFactory(packageName, moduleName);
moduleFactory.setSuperclass(AbstractGinModule.class.getCanonicalName());
moduleFactory.addImport(Names.class.getCanonicalName());
SourceWriter moduleWriter = moduleFactory.createSourceWriter(context,
context.tryCreate(logger, packageName, moduleName));
moduleWriter.println("public void configure() {");
moduleWriter.indent();
for (JMethod method : requestedType.getMethods()) {
if (method.getName().startsWith("set")) {
String name = method.getParameters()[0].getAnnotation(Named.class).value();
moduleWriter.println("bindConstant().annotatedWith(Names.named(\"" + name + "\")).to(\""
+ Math.pow(Integer.parseInt(name), 2) + "\");");
}
}
moduleWriter.outdent();
moduleWriter.println("}");
moduleWriter.commit(logger);
return moduleName;
}
示例4: 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);
}
示例5: 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 );
}
}
示例6: 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());
}
示例7: 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);
}
示例8: 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);
}
示例9: getFactorySourceWriter
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入依赖的package包/类
public SourceWriter getFactorySourceWriter(Class<?> classType,
GeneratorContext context, TreeLogger logger, Collection<String> imports) {
String packageName = classType.getPackage().getName();
String simpleName = classType.getSimpleName() + "FactoryGenerated";
ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory(packageName, simpleName);
// Need to add whatever imports your generated class needs.
composer.addImport("com.google.gwt.xml.client.*");
composer.addImport("com.peterfranza.gwt.jaxb.client.parser.*");
composer.addImport("com.peterfranza.gwt.jaxb.client.parser.utils.*");
composer.addImport("java.util.*");
for(String s: imports) {
composer.addImport(s);
debug("Augmenting Imports: +" + s);
}
PrintWriter printWriter = context.tryCreate(logger, packageName, simpleName);
if (printWriter == null) {
return null;
} else {
SourceWriter sw = composer.createSourceWriter(context, printWriter);
return sw;
}
}
示例10: 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;
}
示例11: 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;
}
示例12: 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);
}
示例13: 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;
}
示例14: GinjectorFragmentOutputter
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入依赖的package包/类
@Inject
GinjectorFragmentOutputter(GeneratorContext ctx, GinjectorFragmentContext.Factory ginjectorFragmentContextFactory, ErrorManager errorManager,
TreeLogger logger, SourceWriteUtil.Factory sourceWriteUtilFactory, @Assisted GinjectorBindings bindings,
@Assisted FragmentPackageName fragmentPackageName, @Assisted("ginjectorPackageName") String ginjectorPackageName,
@Assisted("ginjectorClassName") String ginjectorClassName) {
this.ctx = ctx;
this.errorManager = errorManager;
this.logger = logger;
this.sourceWriteUtil = sourceWriteUtilFactory.create(bindings);
this.fragmentPackageName = fragmentPackageName;
this.ginjectorClassName = ginjectorClassName;
this.nameGenerator = bindings.getNameGenerator();
fragmentClassName = nameGenerator.getFragmentClassName(ginjectorClassName, fragmentPackageName);
if (fragmentClassName.contains(".")) {
errorManager.logError("Internal error: the fragment class name \"%s\" contains a full stop.", fragmentClassName);
}
PrintWriter printWriter = ctx.tryCreate(logger, fragmentPackageName.toString(), fragmentClassName);
if (printWriter == null) {
// Something is very wrong! We already created this fragment, but the
// GinjectorBindingsOutputter should only create each fragment once.
// Something bad will probably happen later on if we continue, so just
// abort.
logger.log(TreeLogger.Type.ERROR, "The fragment " + fragmentPackageName + "." + fragmentClassName + " already exists.");
throw new IllegalStateException("The fragment " + fragmentClassName + " already exists.");
}
ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(fragmentPackageName.toString(), fragmentClassName);
composerFactory.addImport(GWT.class.getCanonicalName());
composerFactory.addImport(ginjectorPackageName + "." + ginjectorClassName);
writer = composerFactory.createSourceWriter(ctx, printWriter);
injectorWriteContext = ginjectorFragmentContextFactory.create(bindings, fragmentPackageName, writer);
}
示例15: 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);
}
}