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


Java JClassType.getSuperclass方法代碼示例

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


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

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

示例2: composeBindMethod

import com.google.gwt.core.ext.typeinfo.JClassType; //導入方法依賴的package包/類
/**
 * Generate method bind
 */
private void composeBindMethod(TreeLogger logger, SourceWriter sourceWriter) {

	logger.log(TreeLogger.INFO, "");
	String line = "public void bind("
			+ parameterizedType1.getQualifiedSourceName() + " text, "
			+ parameterizedType2.getQualifiedSourceName() + " obj){";
	sourceWriter.println(line);
	logger.log(TreeLogger.INFO, line);

	line = "  System.out.println(\"Implement it now:)\");";
	sourceWriter.println(line);
	logger.log(TreeLogger.INFO, line);

	ArrayList<JField> fields = new ArrayList<JField>();

	JClassType curtype = parameterizedType2;
	do {

		for (JField filed : curtype.getFields()) {
			fields.add(filed);
		}
		curtype = curtype.getSuperclass();
	} while (!curtype.getName().equals("Object"));

	for (JField field : fields) {
		String name = field.getName();
		String Name = name.substring(0, 1).toUpperCase() + name.substring(1);
		line = " text.setText(\"" + name + "\", obj.get" + Name
				+ "().toString() );";
		sourceWriter.println(line);
		logger.log(TreeLogger.INFO, line);

	}
	line = "}";

	sourceWriter.println(line);
	logger.log(TreeLogger.INFO, line);

}
 
開發者ID:ICT-BDA,項目名稱:EasyML,代碼行數:43,代碼來源:TextBinderGenerator.java

示例3: findField

import com.google.gwt.core.ext.typeinfo.JClassType; //導入方法依賴的package包/類
/**
 * Find a field, if not found in current classtype, then search it in supper classs
 * @param classType
 * @param fieldName
 * @return
 */
public static JField findField(JClassType classType, String fieldName){
  JField result = null;
   JClassType parent = classType;
   while (parent != null){
     result = parent.findField(fieldName);
     if (result != null)
       return result;
     
     parent = parent.getSuperclass();
   }
   
   return null;
 }
 
開發者ID:liraz,項目名稱:gwt-backbone,代碼行數:20,代碼來源:GenUtils.java

示例4: findMethod

import com.google.gwt.core.ext.typeinfo.JClassType; //導入方法依賴的package包/類
/**
 * Find a method, if not found in current classType, then find it in super class.
 * @param classType
 * @param name
 * @param paramTypes
 * @return
 */
public static JMethod findMethod(JClassType classType, String name, JType[] paramTypes){
  JMethod result = null;
   JClassType parent = classType;
   while (parent != null){
     result = parent.findMethod(name, paramTypes);
     if (result != null)
       return result;
     
     parent = parent.getSuperclass();
   }
   
   return null;
}
 
開發者ID:liraz,項目名稱:gwt-backbone,代碼行數:21,代碼來源:GenUtils.java

示例5: getClassTypeAnnotation

import com.google.gwt.core.ext.typeinfo.JClassType; //導入方法依賴的package包/類
/**
 * Return annotation instance of classType which match annotation class.
 * NOTE: this function will check classType and all it's parent to see if annotation class exists
 * @param <T>  the type of annotation
 * @param classType 
 * @param annotationClass
 * @return
 */
public static <T extends Annotation> T getClassTypeAnnotation(JClassType classType, Class<T> annotationClass){
  JClassType parent = classType;
  while (parent != null){
    if (parent.getAnnotation(annotationClass) != null)
      return parent.getAnnotation(annotationClass);
    
    parent = parent.getSuperclass();
  }
  
  return null;
}
 
開發者ID:liraz,項目名稱:gwt-backbone,代碼行數:20,代碼來源:GenUtils.java

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

示例7: composeSyncMethod

import com.google.gwt.core.ext.typeinfo.JClassType; //導入方法依賴的package包/類
/**
 * Generate method sync
 */
private void composeSyncMethod(TreeLogger logger, SourceWriter sourceWriter) {

	logger.log(TreeLogger.INFO, "");
	String line = "public void sync("
			+ parameterizedType1.getQualifiedSourceName() + " text, "
			+ parameterizedType2.getQualifiedSourceName() + " obj){";
	sourceWriter.println(line);
	logger.log(TreeLogger.INFO, line);

	line = "  System.out.println(\"Implement it now:)\");";
	sourceWriter.println(line);
	logger.log(TreeLogger.INFO, line);

	ArrayList<JField> fields = new ArrayList<JField>();

	JClassType curtype = parameterizedType2;
	do {

		for (JField filed : curtype.getFields()) {
			fields.add(filed);
		}
		curtype = curtype.getSuperclass();
	} while (!curtype.getName().equals("Object"));

	for (JField field : fields) {
		String name = field.getName();
		String Name = name.substring(0, 1).toUpperCase() + name.substring(1);
		String type = field.getType().getQualifiedSourceName();
		String simType = field.getType().getSimpleSourceName();
		if ("java.lang.String".equals(type))
			line = " if( text.getText(\"" + name + "\") != null )obj.set" + Name
			+ "( text.getText(\"" + name + "\") );";
		else
			line = " if( text.getText(\"" + name + "\") != null )obj.set" + Name
			+ "( " + type + ".parse" + simType + "( text.getText(\"" + name
			+ "\")) );";

		sourceWriter.println(line);
		logger.log(TreeLogger.INFO, line);

	}
	line = "}";

	sourceWriter.println(line);
	logger.log(TreeLogger.INFO, line);

}
 
開發者ID:ICT-BDA,項目名稱:EasyML,代碼行數:51,代碼來源:TextBinderGenerator.java


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