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


Java SourceWriter.print方法代码示例

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


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

示例1: printFactoryMethod

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private void printFactoryMethod(SourceWriter out, JMethod methodToImplement,
    JClassType mockControlInterface, String classToCreate) {
  out.println("%s {", methodToImplement.getReadableDeclaration(false, false, false, false, true));
  out.indent();
  if (isNiceMock(methodToImplement, mockControlInterface)) {
    out.print("return this.setToNice(new %s(", classToCreate);
    printMatchingParameters(out, methodToImplement);
    out.println(").__mockInit(this));");
  } else {
    out.print("return new %s(", classToCreate);
    printMatchingParameters(out, methodToImplement);
    out.println(").__mockInit(this);");
  }
  out.outdent();
  out.println("}");
}
 
开发者ID:google,项目名称:easy-gwt-mock,代码行数:17,代码来源:MocksControlGenerator.java

示例2: printMatchingParameters

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private void printMatchingParameters(SourceWriter out, JMethod methodToImplement) {
  JParameter[] params = methodToImplement.getParameters();
  for (int i = 0; i < params.length; i++) {
    if (i > 0) {
      out.print(", ");
    }
    out.print(params[i].getName());
  }
}
 
开发者ID:google,项目名称:easy-gwt-mock,代码行数:10,代码来源:MocksControlGenerator.java

示例3: 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(");");
}
 
开发者ID:google,项目名称:easy-gwt-mock,代码行数:17,代码来源:MocksGenerator.java

示例4: addAnnotations_AnnotationImpl

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
public static void addAnnotations_AnnotationImpl(TypeOracle typeOracle,
    String dest, SourceWriter source, Annotation[] annotations, TreeLogger logger){

  if (annotations.length <= 0)
	  return;
	
  for (Annotation annotation : annotations) {
  	JClassType classType = typeOracle.findType(ReflectionUtils.getQualifiedSourceName(annotation.annotationType()));
  	if (classType != null){
  		source.print(dest + ".addAnnotation(" + createAnnotationValues(typeOracle, annotation, logger) + ");");
			
  	}else{
  		logger.log(Type.ERROR, "Annotation (" + ReflectionUtils.getQualifiedSourceName(annotation.annotationType()) + ") not exists in compiled client source code, please ensure this class is exists and included in your module(.gwt.xml) file. GWTENT reflection process will ignore it and continue. ");
  	}
   }
}
 
开发者ID:liraz,项目名称:gwt-backbone,代码行数:17,代码来源:GeneratorHelper.java

示例5: writeBindingContext

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
/**
 * Writes out a binding context, followed by a newline.
 *
 * <p>Binding contexts may contain newlines; this routine translates those for
 * the SourceWriter to ensure that indents, Javadoc comments, etc are handled
 * properly.
 */
public void writeBindingContext(SourceWriter writer, Context context) {
  // Avoid a trailing \n -- the GWT class source file composer will output an
  // ugly extra newline if we do that.
  String text = context.toString();
  boolean first = true;
  for (String line : text.split("\n")) {
    if (first) {
      first = false;
    } else {
      writer.println();
    }
    // Indent the line relative to its current location.  writer.indent()
    // won't work, since it does the wrong thing in Javadoc.
    writer.print("  ");
    writer.print(line);
  }
}
 
开发者ID:google-code-export,项目名称:google-gin,代码行数:25,代码来源:SourceWriteUtil.java

示例6: 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("}");
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:22,代码来源:ValidatorCreator.java

示例7: 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("}-*/;");
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:25,代码来源:GwtSpecificValidatorCreator.java

示例8: writeValidate

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private void writeValidate(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();

  // .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("}");
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:24,代码来源:ValidatorCreator.java

示例9: writeGetterWrapperMethod

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private void writeGetterWrapperMethod(final SourceWriter sw, final JMethod method) {
  this.writeUnsafeNativeLongIfNeeded(sw, method.getReturnType());

  // private native fieldType _getter(Bean object) /*={
  sw.print("private native ");
  sw.print(method.getReturnType().getQualifiedSourceName());
  sw.print(" ");
  sw.print(this.toWrapperName(method));
  sw.print("(");
  sw.print(this.beanType.getName());
  sw.println(" object) /*-{");
  sw.indent();

  // return [email protected]::myMethod()();
  sw.print("return object.");
  sw.print(method.getJsniSignature());
  sw.println("();");

  // }-*/;
  sw.outdent();
  sw.println("}-*/;");
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:23,代码来源:GwtSpecificValidatorCreator.java

示例10: writeThrowIllegalArgumnet

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private void writeThrowIllegalArgumnet(final SourceWriter sourceWriter,
    final String getClassName) {
  // throw new IllegalArgumentException("MyValidator can not validate ",
  sourceWriter.print("throw new IllegalArgumentException(\"");
  sourceWriter.print(this.validatorType.getName() + " can not  validate \"");
  sourceWriter.indent();
  sourceWriter.indent();

  // + object.getClass().getName() +". "
  sourceWriter.print("+ ");
  sourceWriter.print(getClassName);
  sourceWriter.println("+ \". \"");

  // + "Valid values are {Foo.clas, Bar.class}
  sourceWriter.print("+ \"Valid types are ");
  sourceWriter.print(this.beansToValidate.toString());
  sourceWriter.println("\");");
  sourceWriter.outdent();
  sourceWriter.outdent();
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:21,代码来源:ValidatorCreator.java

示例11: 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("}");
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:24,代码来源:ValidatorCreator.java

示例12: 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; } ");
}
 
开发者ID:czyzby,项目名称:uedi,代码行数:12,代码来源:ReflectionPoolGenerator.java

示例13: printConstructors

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
/**
 * Prints each constructor for the mock class, and a hidden init method.
 */
private void printConstructors(SourceWriter out, String newClassName,
    JConstructor[] constructors) {

  if (constructors.length == 0) {
    // probably an interface
    out.print("public  %s() {}", newClassName);
  }

  for (JConstructor constructor : constructors) {
    out.print("public  %s(", newClassName);
    printMatchingParameters(out, constructor);
    out.println(") {");

    out.indent();
    printMatchingSuperCall(out, constructor);
    out.outdent();

    out.println("}");
    out.println();
  }

  out.println("public %s __mockInit(MocksControlBase newValue) {", newClassName);
  out.indent();
  out.println("this.mocksControl = newValue;");
  out.println("return this;");
  out.outdent();
  out.println("}");
  out.println();
}
 
开发者ID:google,项目名称:easy-gwt-mock,代码行数:33,代码来源:MocksGenerator.java

示例14: printMatchingParameters

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private void printMatchingParameters(SourceWriter out, JConstructor constructorToCall) {
  JParameter[] params = constructorToCall.getParameters();
  for (int i = 0; i < params.length; i++) {
    if (i > 0) {
      out.print(", ");
    }
    JParameter param = params[i];
    out.print(param.getType().getParameterizedQualifiedSourceName());
    out.print(" ");
    out.print(param.getName());
  }
}
 
开发者ID:google,项目名称:easy-gwt-mock,代码行数:13,代码来源:MocksGenerator.java

示例15: createSource

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
@Override
	public void createSource(SourceWriter source, JClassType classType) {
		//ClassType -->> the interface name created automatically
		Map<JClassType, String> typeNameMap = new HashMap<JClassType, String>();

		genAllClasses(source, typeNameMap);
		
//		source.println("public " + getSimpleUnitName(classType) + "(){");
//		source.indent();
//		
//		for (String classname : allGeneratedClassNames){
//			source.println("new " + classname + "();");
//		}
//		source.outdent();
//		source.println("}");
		
		source.println("public org.lirazs.gbackbone.reflection.client.Type doGetType(String name) {");
		source.indent();
		//source.println("org.lirazs.gbackbone.reflection.client.Type resultType = super.doGetType(name);");
		//source.println("if (resultType != null) {return resultType;}");
		
		for (JClassType type : typeNameMap.keySet()){
			source.println("if (name.equals( \"" + type.getQualifiedSourceName() + "\")){return GWT.create(" + typeNameMap.get(type) + ".class);}");
		}
		source.println();
		source.println("return null;");
		
		source.outdent();
		source.print("}");
		
	}
 
开发者ID:liraz,项目名称:gwt-backbone,代码行数:32,代码来源:ReflectAllInOneCreator.java


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