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


Java GeneratorContext.getTypeOracle方法代碼示例

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


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

示例1: getTestCases

import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的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.GeneratorContext; //導入方法依賴的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.GeneratorContext; //導入方法依賴的package包/類
@Override
public String generate (TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException {
	TypeOracle oracle = context.getTypeOracle();
	assert (oracle != null);
	JClassType type = oracle.findType(typeName);
	if (type == null) {
		logger.log(ERROR, "Couldn't find type '" + typeName + "'");
		throw new UnableToCompleteException();
	}

	if (type.isInterface() == null) {
		logger.log(ERROR, "Type '" + typeName + "' must be an interface");
		throw new UnableToCompleteException();
	}

	ReflectionCacheSourceCreator source = new ReflectionCacheSourceCreator(logger, context, type);
	return source.create();
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:19,代碼來源:ReflectionCacheGenerator.java

示例4: generate

import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
@Override
public String generate( TreeLogger logger, GeneratorContext context, String typeName ) throws UnableToCompleteException
{
	this.logger = logger;
	this.context = context;
	this.typeName = typeName;
	
	if( typeName == null )
		return null;
	
	typeOracle = context.getTypeOracle();
	
	try
	{
		type = typeOracle.getType( typeName );
	}
	catch( NotFoundException e )
	{
		e.printStackTrace();
		throw new RuntimeException( e );
	}
	
	return generate();
}
 
開發者ID:ltearno,項目名稱:hexa.tools,代碼行數:25,代碼來源:HexaCssGenerator.java

示例5: generate

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

	// get the "reflection" machine of GWT compiler
	TypeOracle typeOracle = context.getTypeOracle();
	try
	{
		reflectedType = getReflectedType( typeOracle, typeName );
		ClazzInfoBuilder builder = new ClazzInfoBuilder( logger, context );

		return builder.buildClassInfoFor(reflectedType);
	}
	catch( Exception e )
	{
		// record to logger that Map generation threw an exception
		logger.log( TreeLogger.ERROR, "ERROR when generating " + generatedClassName + " for " + typeName, e );
		return null;
	}
}
 
開發者ID:ltearno,項目名稱:hexa.tools,代碼行數:24,代碼來源:ClazzGenerator.java

示例6: generate

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

        SourceWriter writer = createSourceWriter(logger, context, eventBinderType, targetType);
        if (writer != null) {

            write_doBindEventHandlers(targetType, typeOracle, writer, logger);

            writer.commit(logger);
        }
        return getFullyQualifiedGeneratedClassName(eventBinderType);
    } catch (NotFoundException e) {
        logger.log(Type.ERROR, "Error generating " + typeName, e);
        throw new UnableToCompleteException();
    }
}
 
開發者ID:rfilippone,項目名稱:gwt-dom-event-binder,代碼行數:21,代碼來源:DomEventBinderGenerator.java

示例7: generate

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

    ClassName componentTypeName = ClassName.bestGuess(typeName.substring(0,
        typeName.length() - COMPONENT_TEMPLATE_SUFFIX.length()));

    JClassType componentJsType;
    try
    {
        componentJsType =
            types.getType(componentJsTypeName(componentTypeName).reflectionName());
    }
    catch (NotFoundException nfe)
    {
        logger.log(Type.ERROR, "Not Found", nfe);
        throw new UnableToCompleteException();
    }

    ClassName templateImplTypeName = componentTemplateImplName(componentTypeName);
    PrintWriter printWriter = generatorContext.tryCreate(logger,
        templateImplTypeName.packageName(),
        templateImplTypeName.simpleName());

    if (printWriter != null)
    {
        generateOnce(printWriter, logger, generatorContext, componentJsType, componentTypeName);
    }

    return templateImplTypeName.reflectionName();
}
 
開發者ID:Axellience,項目名稱:vue-gwt,代碼行數:34,代碼來源:TemplateGwtGenerator.java

示例8: LogableSourceCreator

import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
public LogableSourceCreator(TreeLogger logger, GeneratorContext context,
		String typeName) {
	this.logger = logger;
	this.context = context;
	this.typeOracle = context.getTypeOracle();
	this.typeName = typeName;
}
 
開發者ID:liraz,項目名稱:gwt-backbone,代碼行數:8,代碼來源:LogableSourceCreator.java

示例9: generate

import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public String generate(TreeLogger logger, GeneratorContext context, String typeName)
    throws UnableToCompleteException {
  TypeOracle typeOracle = context.getTypeOracle();
  JClassType extensionManager = typeOracle.findType(typeName);
  if (extensionManager == null) {
    logger.log(TreeLogger.ERROR, "Can't find interface type '" + typeName + "'", null);
    throw new UnableToCompleteException();
  }
  if (extensionManager.isInterface() == null) {
    logger.log(
        TreeLogger.ERROR,
        extensionManager.getQualifiedSourceName() + " is not an interface",
        null);
    throw new UnableToCompleteException();
  }

  List<JClassType> extensions = new ArrayList<>();
  for (JClassType type : typeOracle.getTypes()) {
    if (type.isAnnotationPresent(Extension.class)) {
      extensions.add(type);
    }
  }

  String packageName = extensionManager.getPackage().getName();
  String className = extensionManager.getSimpleSourceName() + "Impl";

  generateClass(logger, context, packageName, className, extensions);

  return packageName + "." + className;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:33,代碼來源:ExtensionRegistryGenerator.java

示例10: generateIncrementally

import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
@Override
public RebindResult generateIncrementally(TreeLogger logger,
                                          GeneratorContext generatorContext,
                                          String typeName)
  throws UnableToCompleteException {

  TypeOracle typeOracle = generatorContext.getTypeOracle();
  assert (typeOracle != null);

  JClassType originalType = typeOracle.findType(typeName);
  if (originalType == null) {
    logger.log(TreeLogger.ERROR,
               "Unable to find metadata for type '" + typeName + "'");
    throw new UnableToCompleteException();
  }

  if (originalType.isInterface() == null) {
    logger.log(TreeLogger.ERROR,
               "'" + typeName + "' is not a interface");
    throw new UnableToCompleteException();
  }

  TreeLogger moduleLogger = logger.branch(TreeLogger.DEBUG,
                                          "Generating client proxy for remote service interface '" + originalType.getQualifiedSourceName() + "'",
                                          null);

  return create(originalType,
                moduleLogger,
                generatorContext,
                typeName);
}
 
開發者ID:mvp4g,項目名稱:mvp4g,代碼行數:32,代碼來源:Mvp4gRunAsyncGenerator.java

示例11: generateIncrementally

import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
@Override
public RebindResult generateIncrementally(TreeLogger logger,
                                          GeneratorContext generatorContext,
                                          String moduleClass)
  throws UnableToCompleteException {

  TypeOracle typeOracle = generatorContext.getTypeOracle();
  assert (typeOracle != null);

  JClassType module = typeOracle.findType(moduleClass);
  if (module == null) {
    logger.log(TreeLogger.ERROR,
               "Unable to find metadata for module class '" + moduleClass + "'");
    throw new UnableToCompleteException();
  }

  if (module.isInterface() == null) {
    logger.log(TreeLogger.ERROR,
               "'" + moduleClass + "' is not a interface");
    throw new UnableToCompleteException();
  }

  TreeLogger moduleLogger = logger.branch(TreeLogger.DEBUG,
                                          "Generating mvp4g configuration for module class '" + module.getQualifiedSourceName() + "'",
                                          null);

  return create(moduleLogger,
                generatorContext,
                moduleClass);
}
 
開發者ID:mvp4g,項目名稱:mvp4g,代碼行數:31,代碼來源:Mvp4gGenerator.java

示例12: Mvp4gConfiguration

import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
/**
 * Contruct a Mvp4gConfiguration object
 *
 * @param logger  logger of the GWT compiler
 * @param context context of the GWT compiler
 */
public Mvp4gConfiguration(TreeLogger logger,
                          GeneratorContext context) {
  this.logger = logger;
  this.oracle = context.getTypeOracle();
  this.propertyOracle = context.getPropertyOracle();
}
 
開發者ID:mvp4g,項目名稱:mvp4g,代碼行數:13,代碼來源:Mvp4gConfiguration.java

示例13: generate

import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
@Override
public String generate(TreeLogger logger, GeneratorContext context, String typeName)
        throws UnableToCompleteException {
    TypeOracle typeOracle = context.getTypeOracle();
    JClassType subsystemExtensionManager = typeOracle.findType(typeName);
    if (subsystemExtensionManager == null) {
        logger.log(TreeLogger.ERROR, "Unable to find metadata for type '" + typeName + "'", null);
        throw new UnableToCompleteException();
    }
    if (subsystemExtensionManager.isInterface() == null) {
        logger.log(TreeLogger.ERROR, subsystemExtensionManager.getQualifiedSourceName() + " is not an interface",
                null);
        throw new UnableToCompleteException();
    }

    List<SubsystemExtension> subsystemExtensions = new ArrayList<SubsystemExtension>();
    for (JClassType type : typeOracle.getTypes()) {
        if (type.isAnnotationPresent(SubsystemExtension.class)) {
            subsystemExtensions.add(type.getAnnotation(SubsystemExtension.class));
        }
    }

    String packageName = subsystemExtensionManager.getPackage().getName();
    String className = subsystemExtensionManager.getSimpleSourceName() + "Impl";

    generateClass(logger, context, packageName, className, subsystemExtensions);

    return packageName + "." + className;
}
 
開發者ID:jboss-switchyard,項目名稱:switchyard,代碼行數:30,代碼來源:SubsystemExtensionProcessorGenerator.java

示例14: getClassType

import com.google.gwt.core.ext.GeneratorContext; //導入方法依賴的package包/類
protected JClassType getClassType(GeneratorContext context, String qualifiedClassName) throws RebindException {

        final String METHOD = "getClassType(GeneratorContext, String)";
        
        JClassType classType = null;
        try {
            TypeOracle typeOracle = context.getTypeOracle();
            classType = typeOracle.getType(qualifiedClassName);
        } catch (NotFoundException e) {
            String m = qualifiedClassName + " was not found";
            LOG.logp(Level.SEVERE, CLASS, METHOD, m);
            throw new RebindException(m);
        }
        return classType;
    }
 
開發者ID:kyoken74,項目名稱:gwt-angular,代碼行數:16,代碼來源:AbstractGenerator.java

示例15: generate

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

	try
	{
		// get classType and save instance variables
		askedType = typeOracle.getType( typeName );

		WithEntityClasses withEntityClassesAnnotation = askedType.getAnnotation( WithEntityClasses.class );

		entityClasses = withEntityClassesAnnotation.classes();

		generatedClassPackageName = askedType.getPackage().getName();
		generatedClassName = askedType.getSimpleSourceName() + "_EntityConfigurationFactoryImpl";

		// Generate class source code
		generateClass();
	}
	catch( Exception e )
	{
		// record to logger that Map generation threw an exception
		logger.log( TreeLogger.ERROR, "ERROR when generating " + generatedClassName + " for " + typeName, e );
	}

	// return the fully qualifed name of the class generated
	return generatedClassPackageName + "." + generatedClassName;
}
 
開發者ID:ltearno,項目名稱:hexa.tools,代碼行數:32,代碼來源:PersistenceConfigurationFactoryGenerator.java


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