本文整理汇总了Java中com.google.gwt.user.rebind.SourceWriter.println方法的典型用法代码示例。如果您正苦于以下问题:Java SourceWriter.println方法的具体用法?Java SourceWriter.println怎么用?Java SourceWriter.println使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.rebind.SourceWriter
的用法示例。
在下文中一共展示了SourceWriter.println方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generate
import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
@Override public String generate(TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException {
String result = null;
try {
String version = findVersion(logger, context);
JClassType classType = context.getTypeOracle().getType(typeName);
String packageName = packageNameFrom(classType);
String simpleName = simpleNameFrom(classType);
result = packageName + '.' + simpleName;
SourceWriter source = getSourceWriter(logger, context, classType);
if(source != null) { //? Otherwise, work needs to be done.
source.println();
source.println("private String value;");
source.println();
source.println("public " + simpleName + "() {");
populateInstanceFactory(logger, context, typeName, source, version);
source.println("}");
source.println();
source.println("@Override");
source.println("public String getValue() {");
source.println(" return value;");
source.println("}");
source.println(); source.commit(logger);
//emitVersionArtifact(logger, context, version);
}
} catch (NotFoundException nfe) {
logger.log(Type.ERROR, "Could not find extension point type '" + typeName + "'!", nfe);
throw new UnableToCompleteException();
}
return result;
}
示例2: printMatchingSuperCall
import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private void printMatchingSuperCall(SourceWriter out, JConstructor constructorToCall) {
if (constructorToCall.getParameters().length == 0) {
return; // will be added automatically
}
out.print("super(");
JParameter[] params = constructorToCall.getParameters();
for (int i = 0; i < params.length; i++) {
if (i > 0) {
out.print(", ");
}
out.print(params[i].getName());
}
out.println(");");
}
示例3: createSource
import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
@Override
protected void createSource(SourceWriter source, JClassType classType) {
source.println("public " + getSimpleUnitName(classType) + "(){");
source.indent();
List<JClassType> types = allReflectionClasses();
for(JClassType type : types){
ReflectionProxyGenerator gen = new ReflectionProxyGenerator();
try {
String classname = gen.generate(this.logger, context, type.getQualifiedSourceName());
source.println("new " + classname + "();");
} catch (UnableToCompleteException e) {
throw new CheckedExceptionWrapper(e);
}
}
source.outdent();
source.println("}");
}
示例4: addClassAnnotation
import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
protected void addClassAnnotation(JClassType classType,
SourceWriter source) {
source.println();
source.println("protected void addAnnotations(){");
source.indent();
if (this.reflectable.classAnnotations()) {
Annotation[] annotations = AnnotationsHelper
.getAnnotations(classType);
GeneratorHelper.addAnnotations_AnnotationImpl(this.typeOracle,
"this", source, annotations, logger);
}
source.outdent();
source.println("}");
}
示例5: createModule
import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的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;
}
示例6: writeEntryPoint
import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
@Override
public void writeEntryPoint(SourceWriter srcWriter) {
srcWriter.println("MvpController mvpController = MvpController.get();");
srcWriter.println("AcceptsOneWidget mvpDisplay = null;");
if (this.display != null && !AcceptsOneWidget.class.equals(this.display)) {
srcWriter.println("mvpDisplay = GWT.create(%s.class);", InjectCreatorUtil.toClassName(this.display));
}
srcWriter.println("if(mvpDisplay != null){");
srcWriter.indent();
srcWriter.println("mvpController.setDisplay(mvpDisplay);");
srcWriter.outdent();
srcWriter.println("}");
srcWriter.println("if(mvpDisplay instanceof IsWidget){");
srcWriter.indent();
srcWriter.println("RootPanel.get().add((IsWidget) mvpDisplay);");
srcWriter.outdent();
srcWriter.println("}");
if (this.defaultPlace != null && !Place.class.equals(this.defaultPlace)) {
srcWriter.println("mvpController.setDefaultPlace(new %s());", InjectCreatorUtil.toClassName(this.defaultPlace));
}
for (Class<?> activity : this.activities) {
srcWriter.println("mvpController.registerActivity(GWT.<ActivityFactory> create(%s.class));",
InjectCreatorUtil.toClassName(activity));
}
}
示例7: writeValidateProperty
import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private void writeValidateProperty(final SourceWriter sw, final BeanHelper bean) {
this.writeIfInstanceofBeanType(sw, bean);
sw.indent();
this.writeContext(sw, bean, "object");
// return PersonValidator.INSTANCE
sw.print("return ");
sw.println(bean.getFullyQualifiedValidatorName() + ".INSTANCE");
sw.indent();
sw.indent();
// .validateProperty(context, (MyBean) object, propertyName, groups);
sw.print(".validateProperty(context, (");
sw.print(bean.getTypeCanonicalName());
sw.print(") object, propertyName, ");
sw.println("groups);");
sw.outdent();
sw.outdent();
// }
sw.outdent();
sw.println("}");
}
示例8: writeClassBundleInterface
import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private void writeClassBundleInterface( SourceWriter sourceWriter, String classBundleInterfaceName )
{
StringBuilder sb = new StringBuilder();
for( int i=0; i<entityClasses.length; i++ )
{
if( i > 0 )
sb.append( ", " );
sb.append( entityClasses[i].getName() );
sb.append( ".class" );
}
sourceWriter.println( "interface "+classBundleInterfaceName+" extends ClazzBundle {" );
sourceWriter.println( "@ReflectedClasses( classes = { "+sb.toString()+" } )" );
sourceWriter.println( "void register();" );
sourceWriter.println( "}" );
}
示例9: writeFieldWrapperMethod
import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private void writeFieldWrapperMethod(final SourceWriter sw, final JField field) {
this.writeUnsafeNativeLongIfNeeded(sw, field.getType());
// private native fieldType _fieldName(com.example.Bean object) /*-{
sw.print("private native ");
sw.print(field.getType().getQualifiedSourceName());
sw.print(" ");
sw.print(this.toWrapperName(field));
sw.print("(");
sw.print(field.getEnclosingType().getQualifiedSourceName());
sw.println(" object) /*-{");
sw.indent();
// return [email protected]::myMethod();
sw.print("return [email protected]");
sw.print(field.getEnclosingType().getQualifiedSourceName());
sw.print("::" + field.getName());
sw.println(";");
// }-*/;
sw.outdent();
sw.println("}-*/;");
}
示例10: writeGwtValidate
import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private void writeGwtValidate(final SourceWriter sw, final BeanHelper bean) {
this.writeIfInstanceofBeanType(sw, bean);
sw.indent();
// return PersonValidator.INSTANCE
sw.print("return ");
sw.println(bean.getFullyQualifiedValidatorName() + ".INSTANCE");
sw.indent();
sw.indent();
// .validate(context, (<<MyBean>>) object, groups);
sw.print(".validate(context, ");
sw.print("(" + bean.getTypeCanonicalName() + ") object, ");
sw.println("groups);");
sw.outdent();
sw.outdent();
// }
sw.outdent();
sw.println("}");
}
示例11: writeIfPropertyNameNotFound
import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private void writeIfPropertyNameNotFound(final SourceWriter sw) {
// if (!ALL_PROPERTY_NAMES.contains(propertyName)) {
sw.println(" if (!ALL_PROPERTY_NAMES.contains(propertyName)) {");
sw.indent();
// throw new IllegalArgumentException(propertyName
// +"is not a valid property of myClass");
sw.print("throw new ");
sw.print(IllegalArgumentException.class.getCanonicalName());
sw.print("( propertyName +\" is not a valid property of ");
sw.print(this.beanType.getQualifiedSourceName());
sw.println("\");");
// }
sw.outdent();
sw.println("}");
}
示例12: writePresent
import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
@Override
public void writePresent(SourceWriter srcWriter) {
srcWriter.println("final HandlerRegistrationCollection stopRegistrations = new HandlerRegistrationCollection();");
for (JMethod mayStopMethod : this.presenterMethods) {
srcWriter.println("stopRegistrations.add(EventBus.get()"
+ ".addHandlerToSource(StopActivityEvent.TYPE, place, new StopActivityEvent.Handler() {");
srcWriter.indent();
srcWriter.println("@Override public void onStopActivity(StopActivityEvent event) {");
srcWriter.indent();
srcWriter.println("%s.this.%s();", this.injectorName, mayStopMethod.getName());
srcWriter.outdent();
srcWriter.outdent();
srcWriter.println("}}));");
}
srcWriter.println("stopRegistrations.add(EventBus.get()"
+ ".addHandlerToSource(StopActivityEvent.TYPE, place, new StopActivityEvent.Handler() {");
srcWriter.indent();
srcWriter.println("@Override public void onStopActivity(StopActivityEvent event) {");
srcWriter.indent();
srcWriter.println("stopRegistrations.removeHandler();");
srcWriter.outdent();
srcWriter.outdent();
srcWriter.println("}}));");
}
示例13: composeBindMethod
import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
/**
* Generate method bind
*/
private void composeBindMethod(TreeLogger logger, SourceWriter sourceWriter) {
logger.log(TreeLogger.INFO, "");
String line = "public void bind("
+ parameterizedType1.getQualifiedSourceName() + " text, "
+ parameterizedType2.getQualifiedSourceName() + " obj){";
sourceWriter.println(line);
logger.log(TreeLogger.INFO, line);
line = " System.out.println(\"Implement it now:)\");";
sourceWriter.println(line);
logger.log(TreeLogger.INFO, line);
ArrayList<JField> fields = new ArrayList<JField>();
JClassType curtype = parameterizedType2;
do {
for (JField filed : curtype.getFields()) {
fields.add(filed);
}
curtype = curtype.getSuperclass();
} while (!curtype.getName().equals("Object"));
for (JField field : fields) {
String name = field.getName();
String Name = name.substring(0, 1).toUpperCase() + name.substring(1);
line = " text.setText(\"" + name + "\", obj.get" + Name
+ "().toString() );";
sourceWriter.println(line);
logger.log(TreeLogger.INFO, line);
}
line = "}";
sourceWriter.println(line);
logger.log(TreeLogger.INFO, line);
}
示例14: appendClassBody
import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private static void appendClassBody(final SourceWriter sourceWriter, final Set<JType> reflectedClasses,
final TreeLogger logger) {
sourceWriter.println("private static final Class<?>[] POOL = new Class<?>[] { ");
logger.log(Type.INFO, "UEDI: Found the following UEDI components:");
for (final JType reflectedClass : reflectedClasses) {
logger.log(Type.INFO, reflectedClass.getQualifiedSourceName());
sourceWriter.print(reflectedClass.getQualifiedSourceName() + ".class, ");
}
sourceWriter.println(" };");
sourceWriter.println("@Override public Class<?>[] getReflectedClasses() { return POOL; } ");
}
示例15: appendClassBody
import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private static void appendClassBody(final SourceWriter sourceWriter, final Set<JType> reflectedClasses) {
sourceWriter.println("private static final Class<?>[] POOL = new Class<?>[] { ");
for (final JType reflectedClass : reflectedClasses) {
sourceWriter.print(reflectedClass.getQualifiedSourceName() + ".class, ");
}
sourceWriter.println(" };");
sourceWriter.println("@Override public Class<?>[] getReflectedClasses() { return POOL; } ");
}