當前位置: 首頁>>代碼示例>>Java>>正文


Java JClassType.getMethods方法代碼示例

本文整理匯總了Java中com.google.gwt.core.ext.typeinfo.JClassType.getMethods方法的典型用法代碼示例。如果您正苦於以下問題:Java JClassType.getMethods方法的具體用法?Java JClassType.getMethods怎麽用?Java JClassType.getMethods使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.core.ext.typeinfo.JClassType的用法示例。


在下文中一共展示了JClassType.getMethods方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getMethodNames

import com.google.gwt.core.ext.typeinfo.JClassType; //導入方法依賴的package包/類
private Set<String> getMethodNames(String className, TreeLogger logger,
                             TypeOracle typeOracle) throws UnableToCompleteException {
  
  JClassType baseClass = typeOracle.findType(className);
  if (baseClass == null) {
    logger.log(TreeLogger.ERROR, "Unable to find metadata for type '" + baseClass + "'", null);
    throw new UnableToCompleteException();
  }
  
  Set<String> result = new HashSet<String>();
  for (JMethod method : baseClass.getMethods()) {
    if (!method.isPrivate()) {
      result.add(method.getName());
    }
  }
  
  return result;
}
 
開發者ID:google,項目名稱:easy-gwt-mock,代碼行數:19,代碼來源:MocksControlGenerator.java

示例2: processRelationClasses

import com.google.gwt.core.ext.typeinfo.JClassType; //導入方法依賴的package包/類
private void processRelationClasses(List<JClassType> types, JClassType classType){
	if (classType.getSuperclass() != null){
		processRelationClasses(types, classType.getSuperclass());
		addClassIfNotExists(types, classType.getSuperclass());
	}
	
	for (JClassType type : classType.getImplementedInterfaces()){
		addClassIfNotExists(types, type);
	}
	
	for (JField field : classType.getFields()) {
		addClassIfNotExists(types, field.getType().isClassOrInterface());
	}
	
	for (JMethod method : classType.getMethods()){
		if (method.getReturnType() != null)
			addClassIfNotExists(types, method.getReturnType().isClassOrInterface());
		
		//TODO How about parameters?
	}
}
 
開發者ID:liraz,項目名稱:gwt-backbone,代碼行數:22,代碼來源:SourceVisitor.java

示例3: createModule

import com.google.gwt.core.ext.typeinfo.JClassType; //導入方法依賴的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

示例4: findTests

import com.google.gwt.core.ext.typeinfo.JClassType; //導入方法依賴的package包/類
public static List<JMethod> findTests(
        TreeLogger logger, GeneratorContext context, JClassType classType)
        throws UnableToCompleteException {
    if (DEBUG) logger = logger.branch(TreeLogger.WARN,
            "Finding tests for class: " + classType.getName());

    List<JMethod> tests = new ArrayList<JMethod>();
    for (JMethod method : classType.getMethods()) {
        if (method.getName().startsWith("test")) {
            if (DEBUG) logger.log(TreeLogger.WARN, "Found test: " + method.getName());
            verifyTestSignature(logger, classType, method);
            tests.add(method);
        }
    }
    return tests;
}
 
開發者ID:chromium,項目名稱:dom-distiller,代碼行數:17,代碼來源:JsTestEntryGenerator.java

示例5: getAllAnnotations

import com.google.gwt.core.ext.typeinfo.JClassType; //導入方法依賴的package包/類
/**
 * Get All annotations from classType
 * NOTE: This is ordered by ParentClass to DevidedClass
 * The parentclass's annotation comes first
 * @param <T>
 * @param classType
 * @param annotationClass
 * @return
 */
public static <T extends Annotation> Map<Object, T> getAllAnnotations(JClassType classType, Class<T> annotationClass){
	Map<Object, T> results = new HashMap<Object, T>();
	
	JClassType parent = classType.getSuperclass();
	if (parent != null){
		results.putAll(getAllAnnotations(parent, annotationClass));
	}
	
	T a = classType.getAnnotation(annotationClass);
	if (a != null){
		results.put(classType, a);
	}
	
	for (JField field : classType.getFields()){
		a = field.getAnnotation(annotationClass);
		if (a != null)
			results.put(field, a);
	}
	
	for (JMethod method : classType.getMethods()){
		a = method.getAnnotation(annotationClass);
		if (a != null)
			results.put(method, a);
	}

	return results;
}
 
開發者ID:liraz,項目名稱:gwt-backbone,代碼行數:37,代碼來源:GenUtils.java

示例6: generateExtendedProxy

import com.google.gwt.core.ext.typeinfo.JClassType; //導入方法依賴的package包/類
/**
 * Generates a wrapper around the proxy generated by
 * {@link ServiceInterfaceProxyGenerator}.
 *
 * @param logger log interface
 * @param context generator context
 * @param typeName name of the interface that was passed to
 *        {@link com.google.gwt.core.client.GWT#create(Class)}
 * @param proxyTypeName the name of the wrapped proxy class
 * @return the name of the extended proxy class
 */
private String generateExtendedProxy(TreeLogger logger, GeneratorContext context,
    String typeName, String proxyTypeName) {
  JClassType type = context.getTypeOracle().findType(typeName);
  String packageName = type.getPackage().getName();
  String className = type.getSimpleSourceName() + PROXY_SUFFIX;
  String asyncName = typeName + ASYNC_SUFFIX;

  String classNameExtendedServiceProxy = "com.google.appinventor.client.ExtendedServiceProxy";

  // The generator can be invoked for the same class name more than once.
  // In this case the GeneratorContext.tryCreate method will return null to
  // indicate that the file already exists. This is not an error.
  PrintWriter out = context.tryCreate(logger, packageName, className);
  if (out != null) {
    out.println("package " + packageName + ";");
    out.println("class " + className);
    out.println("    extends " + classNameExtendedServiceProxy + "<" + typeName + ">");
    out.println("    implements " + ServiceDefTarget.class.getName() + ", " + asyncName + " {");
    out.println("  private " + proxyTypeName + " proxy = new " + proxyTypeName + "();");
    out.println("  public String getServiceEntryPoint() {");
    out.println("    return proxy.getServiceEntryPoint();");
    out.println("  }");
    out.println("  public void setRpcRequestBuilder(" + RpcRequestBuilder.class.getName() +
        " builder) {");
    out.println("    proxy.setRpcRequestBuilder(builder);");
    out.println("  }");
    out.println("  public void setServiceEntryPoint(String address) {");
    out.println("    proxy.setServiceEntryPoint(address);");
    out.println("  }");
    out.println("  public String getSerializationPolicyName() {");
    out.println("    return proxy.getSerializationPolicyName();");
    out.println("  }");

    for (JMethod method : type.getMethods()) {
      printMethod(out, method, typeName);
    }

    out.println("}");

    context.commit(logger, out);
  }

  return packageName + "." + className;
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:56,代碼來源:ExtendedServiceProxyGenerator.java


注:本文中的com.google.gwt.core.ext.typeinfo.JClassType.getMethods方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。