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


Java JClassType.equals方法代碼示例

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


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

示例1: getTestCases

import com.google.gwt.core.ext.typeinfo.JClassType; //導入方法依賴的package包/類
public static List<TestCase> getTestCases(TreeLogger logger, GeneratorContext context)
        throws UnableToCompleteException {
    if (DEBUG) logger = logger.branch(TreeLogger.WARN, "Getting test cases", null, null);
    TypeOracle oracle = context.getTypeOracle();
    JClassType jsTestCaseClass = oracle.findType(JsTestCase.class.getName());

    List<TestCase> testCases = new ArrayList<TestCase>();

    for (JClassType classType : oracle.getTypes()) {
        if (classType.equals(jsTestCaseClass) || !classType.isAssignableTo(jsTestCaseClass)) {
            continue;
        }

        if (classType.getEnclosingType() != null) {
            if (DEBUG) logger.log(TreeLogger.WARN, "Skipping nested class: " +
                    classType.getEnclosingType().getName() + "." + classType.getName());
            continue;
        }

        if (DEBUG) logger.log(TreeLogger.WARN, "Found class: " + classType.getName());
        testCases.add(new TestCase(classType, findTests(logger, context, classType)));
    }
    return testCases;
}
 
開發者ID:chromium,項目名稱:dom-distiller,代碼行數:25,代碼來源:JsTestEntryGenerator.java

示例2: getAllInstantiableClassesByThisfactory

import com.google.gwt.core.ext.typeinfo.JClassType; //導入方法依賴的package包/類
/**
 * Filter all classes visible to GWT client side and return only those deemed instantiable
 * through the factory class we are generating (that is EntityInputFactoryImpl).
 * <p>
 * Allowing all classes to be instantiable would potentially generate too huge class method
 * perhaps even too huge to compile. There must be some sub-selection. Classes can be filtered
 * based on marker interface, or class annotation see {@link JClassType#getAnnotation(Class)},
 * or some regex matching based on package or class name.
 * 
 * @param context
 * @return Filter all classes visible to GWT client side and return only those deemed
 *         instantiable
 */
private List<JClassType> getAllInstantiableClassesByThisfactory(GeneratorContext context) {
  TypeOracle oracle = context.getTypeOracle();
  JClassType markerInterface1 = oracle.findType(IEntityInput.class.getName());
  JClassType markerInterface2 = oracle.findType(Entity.class.getName());
  List<JClassType> allInstantiableClasses = new LinkedList<JClassType>();

  for (JClassType classType : oracle.getTypes()) {
    if (!classType.equals(markerInterface1) && classType.isAssignableTo(markerInterface1)) {
      allInstantiableClasses.add(classType);
    }
    else if (!classType.equals(markerInterface2) && classType.isAssignableTo(markerInterface2)) {
      allInstantiableClasses.add(classType);
    }
  }

  return allInstantiableClasses;
}
 
開發者ID:KnowledgeCaptureAndDiscovery,項目名稱:ontosoft,代碼行數:31,代碼來源:EntityGenerator.java

示例3: generate

import com.google.gwt.core.ext.typeinfo.JClassType; //導入方法依賴的package包/類
@Override
public String generate( TreeLogger logger, GeneratorContext context, String typeName ) throws UnableToCompleteException
{
    TypeOracle oracle = context.getTypeOracle( );

    JClassType instantiableType = oracle.findType( Reflectable.class.getName( ) );

    List<JClassType> clazzes = new ArrayList<JClassType>( );

    PropertyOracle propertyOracle = context.getPropertyOracle( );

    for ( JClassType classType : oracle.getTypes( ) )
    {
        if ( !classType.equals( instantiableType ) && classType.isAssignableTo( instantiableType ) )
            clazzes.add( classType );
    }

    final String genPackageName = "org.lirazs.gbackbone.client.generator";
    final String genClassName = "ReflectionImpl";

    ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory( genPackageName, genClassName );
    composer.addImplementedInterface( Reflection.class.getCanonicalName( ) );

    composer.addImport( "org.lirazs.gbackbone.client.generator.*" );
    composer.addImport( "org.lirazs.gbackbone.client.core.data.Options" );
    composer.addImport( "com.google.gwt.json.client.JSONObject" );

    PrintWriter printWriter = context.tryCreate( logger, genPackageName, genClassName );

    if ( printWriter != null )
    {
        SourceWriter sourceWriter = composer.createSourceWriter( context, printWriter );
        sourceWriter.println( "ReflectionImpl( ) {" );
        sourceWriter.println( "}" );

        printFactoryMethod(clazzes, sourceWriter);
        printJSONFactoryMethod(clazzes, sourceWriter);
        printArrayFactoryMethod( clazzes, sourceWriter );

        sourceWriter.commit( logger );
    }

    return composer.getCreatedClassName( );
}
 
開發者ID:liraz,項目名稱:gwt-backbone,代碼行數:45,代碼來源:ReflectionGenerator.java


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