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


Java SourceWriter.indent方法代码示例

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


在下文中一共展示了SourceWriter.indent方法的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: 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("}");
}
 
开发者ID:liraz,项目名称:gwt-backbone,代码行数:21,代码来源:SourceVisitor.java

示例3: 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("}");
}
 
开发者ID:liraz,项目名称:gwt-backbone,代码行数:18,代码来源:ReflectionCreator.java

示例4: generateGetExtensionsMethod

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
/**
 * Generate the code for {@link ExtensionRegistry#getExtensionDescriptions()}
 *
 * @param sw
 */
private void generateGetExtensionsMethod(SourceWriter sw) {
  /*
       @Override
       public StringMap<ExtensionDescription> getExtensionDescriptions()
       {
          return extensions;
       }
  */

  sw.println("@Override");
  sw.println("public Map<String, ExtensionDescription> getExtensionDescriptions()");

  sw.println("{");
  sw.indent();

  sw.println("return extensions;");

  sw.outdent();
  sw.println("}");
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:ExtensionRegistryGenerator.java

示例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;
}
 
开发者ID:google-code-export,项目名称:google-gin,代码行数:25,代码来源:FrameworkGenerator.java

示例6: generate

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
public static void generate( JType type, SourceWriter sw, TreeLogger logger )
{
	sw.println( "public <T> T getData( JavaScriptObject obj )" );
	sw.println( "{" );
	sw.indent();

	// sw.println( "GWT.log( \"A Casting obj : \" + obj.toString() );" );
	// sw.println( "GWT.log( \"Jsoncontent:\"+HexaTools.toJSON(obj) );" );
	// sw.println( type.getSimpleSourceName() +
	// "ImplStd impl = "+type.getSimpleSourceName() + "ImplStd.as( obj );"
	// );
	sw.println( "return (T)obj;" );

	sw.outdent();
	sw.println( "}" );
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:17,代码来源:DataProxyFastFactoryGenerator.java

示例7: create

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
public String create(TreeLogger logger, GeneratorContext context) {
	PrintWriter printWriter = context.tryCreate(logger, this.packageName, this.viewProxySimpleName);
	if (printWriter == null) {
		return this.viewProxyQualifiedName;
	}

	SourceWriter srcWriter = this.getSourceWriter(printWriter, context);

	srcWriter.indent();
	this.generateProxy(logger, srcWriter);
	srcWriter.println();
	this.generateTokenPrefixes(logger, srcWriter);
	srcWriter.println();
	if (this.placeTokenizerClass == null) {
		this.generateInternalTokenizer(logger, srcWriter);
	} else {
		this.generateDelegateTokenizer(logger, srcWriter);
	}
	this.generateActivityFactory(logger, srcWriter);
	srcWriter.outdent();

	srcWriter.commit(logger);
	return this.viewProxyQualifiedName;
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:25,代码来源:ProxyViewCreator.java

示例8: writeExpandDefaultAndValidateClassGroups

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private void writeExpandDefaultAndValidateClassGroups(final SourceWriter sw)
    throws UnableToCompleteException {
  // public <T> void expandDefaultAndValidateClassGroups(
  sw.println("public <T> void expandDefaultAndValidateClassGroups(");

  // GwtValidationContext<T> context, BeanType object,
  // Set<ConstraintViolation<T>> violations, Group... groups) {
  sw.indent();
  sw.indent();
  sw.println("GwtValidationContext<T> context,");
  sw.println(this.beanHelper.getTypeCanonicalName() + " object,");
  sw.println("Set<ConstraintViolation<T>> violations,");
  sw.println("Group... groups) {");
  sw.outdent();

  this.writeExpandDefaultAndValidate(sw, Stage.OBJECT);

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

示例9: writeExpandDefaultAndValidatePropertyGroups

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private void writeExpandDefaultAndValidatePropertyGroups(final SourceWriter sw)
    throws UnableToCompleteException {
  // public <T> void expandDefaultAndValidatePropertyGroups(
  sw.println("public <T> void expandDefaultAndValidatePropertyGroups(");

  // GwtValidationContext<T> context, BeanType object, String propertyName,
  // Set<ConstraintViolation<T>> violations, Group... groups) {
  sw.indent();
  sw.indent();
  sw.println("GwtValidationContext<T> context,");
  sw.println(this.beanHelper.getTypeCanonicalName() + " object,");
  sw.println("String propertyName,");
  sw.println("Set<ConstraintViolation<T>> violations,");
  sw.println("Group... groups) {");
  sw.outdent();

  this.writeExpandDefaultAndValidate(sw, Stage.PROPERTY);

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

示例10: writeExpandDefaultAndValidateValueGroups

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private void writeExpandDefaultAndValidateValueGroups(final SourceWriter sw)
    throws UnableToCompleteException {
  // public <T> void expandDefaultAndValidateValueGroups(
  sw.println("public <T> void expandDefaultAndValidateValueGroups(");

  // GwtValidationContext<T> context, Class<Author> beanType, String propertyName,
  // Object value, Set<ConstraintViolation<T>> violations, Group... groups) {
  sw.indent();
  sw.indent();
  sw.println("GwtValidationContext<T> context,");
  sw.println("Class<" + this.beanHelper.getTypeCanonicalName() + "> beanType,");
  sw.println("String propertyName,");
  sw.println("Object value,");
  sw.println("Set<ConstraintViolation<T>> violations,");
  sw.println("Group... groups) {");
  sw.outdent();

  this.writeExpandDefaultAndValidate(sw, Stage.VALUE);

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

示例11: writeValidateAllNonInheritedProperties

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private void writeValidateAllNonInheritedProperties(final SourceWriter sw) {
  // private <T> void validateAllNonInheritedProperties(
  sw.println("private <T> void validateAllNonInheritedProperties(");
  sw.indent();
  sw.indent();

  // GwtValidationContext<T> context, BeanType object,
  // Set<ConstraintViolation<T>> violations, Class<?>... groups) {
  sw.println("GwtValidationContext<T> context,");
  sw.println(this.beanHelper.getTypeCanonicalName() + " object,");
  sw.println("Set<ConstraintViolation<T>> violations,");
  sw.println("Class<?>... groups) {");
  sw.outdent();

  for (final PropertyDescriptor p : this.beanHelper.getBeanDescriptor()
      .getConstrainedProperties()) {
    this.writeValidatePropertyCall(sw, p, false, true);
  }

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

示例12: writePresent

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
@Override
public void writePresent(SourceWriter srcWriter) {
	srcWriter
		.println("final HandlerRegistrationCollection mayStopRegistrations = new HandlerRegistrationCollection();");
	for (JMethod mayStopMethod : this.presenterMethods) {
		srcWriter.println("mayStopRegistrations.add(EventBus.get()"
			+ ".addHandlerToSource(MayStopActivityEvent.TYPE, place, new MayStopActivityEvent.Handler() {");
		srcWriter.indent();
		srcWriter.println("@Override public void onMayStopActivity(MayStopActivityEvent event) {");
		srcWriter.indent();
		srcWriter.println("if (event.getMessage() == null) { event.setMessage(%s.this.%s()); }", this.injectorName,
			mayStopMethod.getName());
		srcWriter.outdent();
		srcWriter.outdent();
		srcWriter.println("}}));");
	}
	srcWriter.println("mayStopRegistrations.add(EventBus.get()"
		+ ".addHandlerToSource(StopActivityEvent.TYPE, place, new StopActivityEvent.Handler() {");
	srcWriter.indent();
	srcWriter.println("@Override public void onStopActivity(StopActivityEvent event) {");
	srcWriter.indent();
	srcWriter.println("mayStopRegistrations.removeHandler();");
	srcWriter.outdent();
	srcWriter.outdent();
	srcWriter.println("}}));");
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:27,代码来源:InjectMayStopActivityCreator.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: printMockMethods

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
/**
 * Generates and prints the actual mock versions of the methods.
 */
private void printMockMethods(SourceWriter sourceWriter, List<JMethod> methodsToMock,
                              String newClassName) {
  int methodNo = 0;
  for (JMethod method : methodsToMock) {
    sourceWriter.println("%s {", method.getReadableDeclaration(false, true, false, false, true));
    sourceWriter.indent();
    printMockMethodBody(sourceWriter, method, methodNo++, newClassName);
    sourceWriter.outdent();
    sourceWriter.println("}");
    sourceWriter.println();
  }
}
 
开发者ID:google,项目名称:easy-gwt-mock,代码行数:16,代码来源: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.indent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。