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


Java SourceWriter.outdent方法代码示例

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


在下文中一共展示了SourceWriter.outdent方法的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: 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

示例7: 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));
	}
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:27,代码来源:InjectMvpDescriptionCreator.java

示例8: 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

示例9: writeGetDescriptor

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
private void writeGetDescriptor(final SourceWriter sw) {
  // public GwtBeanDescriptor<beanType>
  // getConstraints(ValidationGroupsMetadata validationGroupsMetadata) {
  sw.print("public ");
  sw.print("GwtBeanDescriptor<" + this.beanHelper.getTypeCanonicalName() + "> ");
  sw.println("getConstraints(ValidationGroupsMetadata validationGroupsMetadata) {");
  sw.indent();

  // beanDescriptor.setValidationGroupsMetadata(validationGroupsMetadata);
  sw.println("beanDescriptor.setValidationGroupsMetadata(validationGroupsMetadata);");

  // return beanDescriptor;
  sw.println("return beanDescriptor;");

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

示例10: 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

示例11: 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

示例12: 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

示例13: writeAfterPresent

import com.google.gwt.user.rebind.SourceWriter; //导入方法依赖的package包/类
@Override
public void writeAfterPresent(SourceWriter srcWriter) {
	if (!this.hasService) {
		srcWriter.println("displayer.setWidget(%s.this);", this.injectorName);
	} else {
		srcWriter.println("commandController.flush(new CallbackAdapter<List<CommandResponse>>() {");
		srcWriter.indent();
		srcWriter.println("@Override");
		srcWriter.println("public void onSuccess(List<CommandResponse> result) {");
		srcWriter.indent();
		srcWriter.println("displayer.setWidget(%s.this);", this.injectorName);
		srcWriter.outdent();
		srcWriter.println("};");
		srcWriter.outdent();
		srcWriter.println("});");
		srcWriter.println("commandController.setSuspended(isSuspended);");
	}
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:19,代码来源:SuspendServiceOnPresentCreator.java

示例14: 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

示例15: 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


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