• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JConstructor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.gwt.core.ext.typeinfo.JConstructor的典型用法代码示例。如果您正苦于以下问题:Java JConstructor类的具体用法?Java JConstructor怎么用?Java JConstructor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JConstructor类属于com.google.gwt.core.ext.typeinfo包,在下文中一共展示了JConstructor类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: printMatchingSuperCall

import com.google.gwt.core.ext.typeinfo.JConstructor; //导入依赖的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


示例2: checkForConstructorInject

import com.google.gwt.core.ext.typeinfo.JConstructor; //导入依赖的package包/类
private void checkForConstructorInject(Key<?> clazz) throws UnableToCompleteException {
    JClassType clazzType = generatorContext.getTypeOracle().findType(clazz.getClassName());
    if (clazzType != null && clazzType.getConstructors() != null) {
        for (JConstructor constructor : clazzType.getConstructors()) {
            if (constructor.isAnnotationPresent(Inject.class)) {
                injectConstructor = constructor;
                // Make sure we process all of the constructor args so they can be generated
                for (JType type : constructor.getParameterTypes()) {
                    Class<?> typeClass = binder.classFromType(type);
                    binder.bind(typeClass);
                    binder.processAnnotations(type, true);
                }
            }
        }
    }
}
 
开发者ID:jyavu,项目名称:jytsu,代码行数:17,代码来源:JytsuBindingBase.java


示例3: printConstructors

import com.google.gwt.core.ext.typeinfo.JConstructor; //导入依赖的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


示例4: printMatchingParameters

import com.google.gwt.core.ext.typeinfo.JConstructor; //导入依赖的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


示例5: hasPublicDefaultConstructor

import com.google.gwt.core.ext.typeinfo.JConstructor; //导入依赖的package包/类
public static boolean hasPublicDefaultConstructor(JClassType classType){
	for (JConstructor constructor : classType.getConstructors()){
		if ((constructor.getParameters().length == 0) && constructor.isPublic())
			return true;
	}
	
	return false;
}
 
开发者ID:liraz,项目名称:gwt-backbone,代码行数:9,代码来源:GenUtils.java


示例6: getModelConstructorType

import com.google.gwt.core.ext.typeinfo.JConstructor; //导入依赖的package包/类
private ModelConstructorType getModelConstructorType(JConstructor constructor) {
    ModelConstructorType modelConstructorType = ModelConstructorType.EMPTY;

    JType[] parameterTypes = constructor.getParameterTypes();

    int optionsParameterCount = 0;
    int jsonObjectParameterCount = 0;

    for (JType parameterType : parameterTypes) {

        if(parameterType.getQualifiedSourceName().equals("org.lirazs.gbackbone.client.core.data.Options"))
            optionsParameterCount++;

        if(parameterType.getQualifiedSourceName().equals("com.google.gwt.json.client.JSONObject"))
            jsonObjectParameterCount++;
    }

    if(optionsParameterCount == 2) {
        modelConstructorType = ModelConstructorType.ATTRIBUTES_AND_OPTIONS;
    } else if(optionsParameterCount == 1) {
        if(jsonObjectParameterCount == 1) {
            modelConstructorType = ModelConstructorType.JSON_OBJECT_AND_OPTIONS;
        } else {
            modelConstructorType = ModelConstructorType.ATTRIBUTES;
        }
    } else if(jsonObjectParameterCount == 1) {
        modelConstructorType = ModelConstructorType.JSON_OBJECT;
    }

    return modelConstructorType;
}
 
开发者ID:liraz,项目名称:gwt-backbone,代码行数:32,代码来源:ReflectionGenerator.java


示例7: generateDependenciesForExtension

import com.google.gwt.core.ext.typeinfo.JConstructor; //导入依赖的package包/类
/**
 * Writes dependency gathering code, like:
 *
 * <p>Array<DependencyDescription> deps = Collections.<DependencyDescription> createArray();
 * deps.add(new DependencyDescription("ide.api.ui.menu", "")); deps.add(new
 * DependencyDescription("extension.demo", "1.0.0-alpha"));
 *
 * @param sw
 * @param extension
 * @throws UnableToCompleteException
 */
private void generateDependenciesForExtension(SourceWriter sw, JClassType extension)
    throws UnableToCompleteException {
  // expected code
  /*
        Array<DependencyDescription> deps = Collections.<DependencyDescription> createArray();
        deps.add(new DependencyDescription("ide.api.ui.menu", ""));
  */
  if (extension.getConstructors().length == 0) {
    throw new UnableToCompleteException();
  }
  sw.println("List<DependencyDescription> deps = new ArrayList<>();");

  JConstructor jConstructor = extension.getConstructors()[0];
  JType[] parameterTypes = jConstructor.getParameterTypes();

  for (JType jType : parameterTypes) {
    JClassType argType = jType.isClassOrInterface();
    if (argType != null
        && (argType.isAnnotationPresent(SDK.class)
            || argType.isAnnotationPresent(Extension.class))) {
      String id = "";
      String version = "";
      if (argType.isAnnotationPresent(SDK.class)) {
        id = argType.getAnnotation(SDK.class).title();
      } else if (argType.isAnnotationPresent(Extension.class)) {
        id = argType.getQualifiedSourceName();
        version = argType.getAnnotation(Extension.class).version();
      }
      sw.println(
          "deps.add(new DependencyDescription(\"%s\", \"%s\"));", escape(id), escape(version));
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:45,代码来源:ExtensionRegistryGenerator.java


示例8: generateInternalTokenizer

import com.google.gwt.core.ext.typeinfo.JConstructor; //导入依赖的package包/类
private void generateInternalTokenizer(TreeLogger logger, SourceWriter srcWriter) {
	boolean hasTokeConstructor = false;
	for (JConstructor constructor : this.placeType.getConstructors()) {
		if (constructor.getParameters().length == 1
			&& constructor.getParameters()[0].getType().getSimpleSourceName().equals(String.class.getSimpleName())) {
			hasTokeConstructor = true;
		}
	}
	srcWriter.println("@Override");
	srcWriter.println("public %s getPlace(String token) {", this.placeType.getSimpleSourceName());
	srcWriter.indent();
	if (hasTokeConstructor) {
		srcWriter.println("return new %s(token);", this.placeType.getSimpleSourceName());
	} else {
		srcWriter.println("%s place = new %s();",
			this.placeType.getSimpleSourceName(), this.placeType.getSimpleSourceName());
		srcWriter.println("place.setToken(token);");
		srcWriter.println("return place;");
	}
	srcWriter.outdent();
	srcWriter.println("}");
	srcWriter.println("@Override");
	srcWriter.println("public String getToken(%s place) {", this.placeType.getSimpleSourceName());
	srcWriter.indent();
	srcWriter.println("if(place instanceof ViewPlace){");
	srcWriter.indent();
	srcWriter.println("return ((ViewPlace)place).getToken();");
	srcWriter.outdent();
	srcWriter.println("}");
	srcWriter.println("return null;");
	srcWriter.outdent();
	srcWriter.println("}");
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:34,代码来源:ProxyViewCreator.java


示例9: visitConstructor

import com.google.gwt.core.ext.typeinfo.JConstructor; //导入依赖的package包/类
public ConstructorVisitor visitConstructor(JConstructor constructor) {
	// TODO Auto-generated method stub
	return null;
}
 
开发者ID:liraz,项目名称:gwt-backbone,代码行数:5,代码来源:TypesLogVisitor.java


示例10: getInjectConstructor

import com.google.gwt.core.ext.typeinfo.JConstructor; //导入依赖的package包/类
public JConstructor getInjectConstructor() {
    return injectConstructor;
}
 
开发者ID:jyavu,项目名称:jytsu,代码行数:4,代码来源:JytsuBindingBase.java


示例11: visitConstructor

import com.google.gwt.core.ext.typeinfo.JConstructor; //导入依赖的package包/类
ConstructorVisitor visitConstructor(JConstructor constructor); 
开发者ID:liraz,项目名称:gwt-backbone,代码行数:2,代码来源:TypesVisitor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MaterialAboutItemOnClickAction类代码示例发布时间:2022-05-23
下一篇:
Java StatsAppState类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap