本文整理汇总了Java中com.google.gwt.user.rebind.ClassSourceFileComposerFactory.setSuperclass方法的典型用法代码示例。如果您正苦于以下问题:Java ClassSourceFileComposerFactory.setSuperclass方法的具体用法?Java ClassSourceFileComposerFactory.setSuperclass怎么用?Java ClassSourceFileComposerFactory.setSuperclass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.rebind.ClassSourceFileComposerFactory
的用法示例。
在下文中一共展示了ClassSourceFileComposerFactory.setSuperclass方法的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: 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;
}
示例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 );
}
}
示例4: 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;
}
示例5: 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);
}
示例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(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;
}
示例7: generate
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
@Override
public String generate(TreeLogger logger, GeneratorContext context, String typeName)
throws UnableToCompleteException {
JClassType requestedType = context.getTypeOracle().findType(typeName);
String packageName = requestedType.getPackage().getName();
String requestedName = requestedType.getSimpleSourceName();
String newClassName = requestedName + "Impl";
String moduleName = createModule(logger, context, requestedType, packageName, requestedName);
String ginjectorName =
createGinjector(logger, context, packageName, requestedName, newClassName, moduleName);
ClassSourceFileComposerFactory composerFactory =
new ClassSourceFileComposerFactory(packageName, newClassName);
composerFactory.setSuperclass(requestedType.getQualifiedSourceName());
composerFactory.addImport(GWT.class.getCanonicalName());
SourceWriter writer = composerFactory
.createSourceWriter(context, context.tryCreate(logger, packageName, newClassName));
writer.println("public void initialize() {");
writer.indent();
writer.println(
"((" + ginjectorName + ") GWT.create(" + ginjectorName + ".class)).injectMembers(this);");
writer.outdent();
writer.println("}");
writer.commit(logger);
return packageName + "." + newClassName;
}
示例8: 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());
}
示例9: compose
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
@Override
protected void compose(final ClassSourceFileComposerFactory composerFactory) {
this.addImports(composerFactory, GWT.class, GwtBeanDescriptor.class, GwtSpecificValidator.class,
GwtValidationContext.class, ValidationGroupsMetadata.class, Set.class, HashSet.class,
Map.class, HashMap.class, Default.class, ConstraintViolation.class, BeanDescriptor.class);
composerFactory.setSuperclass(AbstractGwtValidator.class.getCanonicalName());
composerFactory.addImplementedInterface(this.validatorType.getQualifiedSourceName());
}
示例10: buildClassInfo
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
private void buildClassInfo()
{
// get print writer that receives the source code
PrintWriter printWriter;
printWriter = context.tryCreate( logger, packageName, generatedClassName );
// print writer if null, source code has ALREADY been generated, return
if( printWriter == null )
return;
// init composer, set class properties, create source writer
ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory( packageName, generatedClassName );
// output a class "typeName" + "Impl"
// which extends the asked type
composer.setSuperclass( "fr.lteconsulting.hexa.classinfo.internal.ClazzBase<" + reflectedTypeName + ">" );
composer.addImport( "java.util.List" );
composer.addImport( "java.util.ArrayList" );
composer.addImport( "fr.lteconsulting.hexa.classinfo.Field" );
composer.addImport( "fr.lteconsulting.hexa.classinfo.Method" );
SourceWriter sourceWriter = composer.createSourceWriter( context, printWriter );
// generate the List<String> getMethods(); method
buildClassInfo(sourceWriter);
// close generated class
sourceWriter.outdent();
sourceWriter.println( "}" );
// commit generated class
context.commit( logger, printWriter );
}
示例11: getSourceWriter
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
private SourceWriter getSourceWriter(PrintWriter printWriter, GeneratorContext ctx) {
String packageName =
this.proxyModelQualifiedName.indexOf('.') == -1 ? "" : this.proxyModelQualifiedName.substring(0,
this.proxyModelQualifiedName.lastIndexOf('.'));
String className =
this.proxyModelQualifiedName.indexOf('.') == -1 ? this.proxyModelQualifiedName
: this.proxyModelQualifiedName
.substring(this.proxyModelQualifiedName.lastIndexOf('.') + 1,
this.proxyModelQualifiedName.length());
ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(packageName, className);
composerFactory.addImport(Map.class.getName());
composerFactory.addImport(Maps.class.getName());
composerFactory.addImport(GWT.class.getName());
composerFactory.addImport(Model.class.getName());
composerFactory.addImport(AbstractModel.class.getName());
composerFactory.addImport(ModelCollection.class.getName());
composerFactory.addImport(PropertyDescription.class.getName());
composerFactory.addImport(PrimitiveUtils.class.getName());
composerFactory.addImport(this.beanType.getQualifiedSourceName());
composerFactory.addImport("fr.putnami.pwt.core.editor.client.validator.*");
for (JType jType : this.imports) {
if (jType.isPrimitive() != null) {
continue;
}
composerFactory.addImport(jType.getQualifiedSourceName());
}
for (String submodel : this.subModels.values()) {
composerFactory.addImport(submodel);
}
composerFactory
.setSuperclass(AbstractModel.class.getSimpleName() + "<" + this.beanType.getSimpleSourceName() + ">");
return composerFactory.createSourceWriter(ctx, printWriter);
}
示例12: getSourceWriter
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
private SourceWriter getSourceWriter(PrintWriter printWriter, GeneratorContext ctx) {
ClassSourceFileComposerFactory composerFactory =
new ClassSourceFileComposerFactory(this.packageName, this.viewProxySimpleName);
composerFactory.setSuperclass(this.placeType.getSimpleSourceName());
composerFactory.addImport(GWT.class.getName());
composerFactory.addImport(RunAsyncCallback.class.getName());
composerFactory.addImport(ViewProxy.class.getName());
composerFactory.addImport(Place.class.getName());
composerFactory.addImport(ViewPlace.class.getName());
composerFactory.addImport(Activity.class.getName());
composerFactory.addImport(ViewActivity.class.getName());
composerFactory.addImport(ApplicationUnreachableException.class.getName());
composerFactory.addImport(this.placeType.getQualifiedSourceName());
composerFactory.addImport(this.activityDescrition.view().getCanonicalName());
if (this.placeTokenizerClass != null) {
composerFactory.addImport(this.placeTokenizerClass.getCanonicalName());
}
if (this.viewDecoratorClass != null) {
composerFactory.addImport(this.viewDecoratorClass.getCanonicalName());
}
composerFactory.addImplementedInterface(
ViewProxy.class.getSimpleName() + "<" + this.placeType.getSimpleSourceName() + ">");
return composerFactory.createSourceWriter(ctx, printWriter);
}
示例13: getSourceWriter
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
private SourceWriter getSourceWriter(PrintWriter printWriter, GeneratorContext ctx) {
String packageName = this.handlerType.getPackage().getName();
String className =
this.proxyModelQualifiedName.indexOf('.') == -1 ?
this.proxyModelQualifiedName : this.proxyModelQualifiedName.substring(
this.proxyModelQualifiedName.lastIndexOf('.') + 1, this.proxyModelQualifiedName.length());
ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(packageName, className);
composerFactory.addImport(AsyncCallback.class.getName());
composerFactory.addImport(AbstractServiceBinder.class.getName());
composerFactory.addImport(Arrays.class.getName());
composerFactory.addImport(Lists.class.getName());
composerFactory.addImport(CommandDefinition.class.getName());
composerFactory.addImport(CommandParam.class.getName());
composerFactory.addImport(CallbackAdapter.class.getName());
composerFactory.addImport(CommandController.class.getName());
composerFactory.addImport(this.serviceType.getQualifiedSourceName());
composerFactory.addImport(this.serviceBinderType.getQualifiedSourceName());
for (JType jType : this.imports) {
if (jType.isPrimitive() != null) {
continue;
}
composerFactory.addImport(jType.getQualifiedSourceName());
}
composerFactory.setSuperclass(AbstractServiceBinder.class.getSimpleName()
+ "<" + this.handlerType.getSimpleSourceName() + ", " + this.serviceType.getSimpleSourceName() + ">");
composerFactory.addImplementedInterface(this.serviceType.getSimpleSourceName());
composerFactory.addImplementedInterface(this.serviceBinderType.getSimpleSourceName());
return composerFactory.createSourceWriter(ctx, printWriter);
}
示例14: getSourceWriter
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
private SourceWriter getSourceWriter(PrintWriter printWriter, GeneratorContext ctx) {
ClassSourceFileComposerFactory composerFactory =
new ClassSourceFileComposerFactory(this.packageName, this.proxyName);
composerFactory.addImport(GWT.class.getName());
composerFactory.addImport(this.injectableType.getQualifiedSourceName());
composerFactory.setSuperclass(this.injectableType.getSimpleSourceName());
for (InjectorWritterInit delegate : Iterables.filter(this.delegates, InjectorWritterInit.class)) {
delegate.initComposer(composerFactory);
}
return composerFactory.createSourceWriter(ctx, printWriter);
}
示例15: getSourceWriter
import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; //导入方法依赖的package包/类
private SourceWriter getSourceWriter(PrintWriter printWriter, GeneratorContext ctx) {
String packageName = this.handlerType.getPackage().getName();
String className =
this.proxyModelQualifiedName.indexOf('.') == -1 ?
this.proxyModelQualifiedName : this.proxyModelQualifiedName.substring(
this.proxyModelQualifiedName.lastIndexOf('.') + 1, this.proxyModelQualifiedName.length());
ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(packageName, className);
composerFactory.addImport(AbstractServiceBinder.class.getName());
composerFactory.addImport(Arrays.class.getName());
composerFactory.addImport(Lists.class.getName());
composerFactory.addImport(MethodCallbackAdapter.class.getName());
composerFactory.addImport(Method.class.getName());
composerFactory.addImport(CompositeMethodCallback.class.getName());
composerFactory.addImport(CallbackAdapter.class.getName());
composerFactory.addImport(REST.class.getName());
composerFactory.addImport(GWT.class.getName());
composerFactory.addImport(this.serviceType.getQualifiedSourceName());
composerFactory.addImport(this.serviceBinderType.getQualifiedSourceName());
for (JType jType : this.imports) {
if (jType.isPrimitive() != null) {
continue;
}
composerFactory.addImport(jType.getQualifiedSourceName());
}
composerFactory.setSuperclass(AbstractServiceBinder.class.getSimpleName()
+ "<" + this.handlerType.getSimpleSourceName() + ", " + this.serviceType.getSimpleSourceName() + ">");
composerFactory.addImplementedInterface(this.serviceType.getSimpleSourceName());
composerFactory.addImplementedInterface(this.serviceBinderType.getSimpleSourceName());
return composerFactory.createSourceWriter(ctx, printWriter);
}