org.apache.polygene.api.structure.Module.typeLookup()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(76)

本文整理了Java中org.apache.polygene.api.structure.Module.typeLookup()方法的一些代码示例,展示了Module.typeLookup()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Module.typeLookup()方法的具体详情如下:
包路径:org.apache.polygene.api.structure.Module
类名称:Module
方法名:typeLookup

Module.typeLookup介绍

[英]Returns the TypeLookup for the Module. TypeLookup handles all the types visible from within this Module.
[中]返回模块的TypeLookup。TypeLookup处理该模块中所有可见的类型。

代码示例

代码示例来源:origin: apache/attic-polygene-java

public ScriptMixin( @Structure PolygeneSPI spi,
          @This Object thisComposite,
          @State StateHolder state,
          @Structure Layer layer,
          @Structure Module module,
          @Structure Application application )
{
  descriptor = spi.compositeDescriptorFor( thisComposite );
  engine = createNewEngine();
  Bindings mixinBindings = engine.getBindings( ScriptContext.ENGINE_SCOPE );
  mixinBindings.put( "Polygene", spi );
  mixinBindings.put( "application", application );
  mixinBindings.put( "layer", layer );
  mixinBindings.put( "module", module );
  mixinBindings.put( "This", thisComposite );
  mixinBindings.put( "state", state );
  mixinBindings.put( "objectFactory", module.objectFactory() );
  mixinBindings.put( "unitOfWorkFactory", module.unitOfWorkFactory() );
  mixinBindings.put( "valueBuilderFactory", module.valueBuilderFactory() );
  mixinBindings.put( "transientBuilderFactory", module.transientBuilderFactory() );
  mixinBindings.put( "serviceFinder", module.serviceFinder() );
  mixinBindings.put( "typeLookup", module.typeLookup() );
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.api

@SuppressWarnings( "unchecked" )
public <V> V findConfigurationInstanceFor( ServiceDescriptor serviceModel, Identity serviceIdentity, UnitOfWork uow )
  throws InstantiationException
{
  Class<V> configurationType = serviceModel.configurationType();
  V configuration;
  try
  {
    configuration = uow.get( configurationType, serviceIdentity );
    uow.pause();
  }
  catch( NoSuchEntityException | NoSuchEntityTypeException e )
  {
    EntityDescriptor entityDescriptor = module.typeLookup().lookupEntityModel( configurationType );
    if( entityDescriptor == null )
    {
      throw new NoSuchConfigurationTypeException( configurationType, module.descriptor() );
    }
    return (V) initializeConfigurationInstance( entityDescriptor, uow, serviceModel, serviceIdentity );
  }
  return configuration;
}

代码示例来源:origin: apache/attic-polygene-java

@SuppressWarnings( "unchecked" )
public <V> V findConfigurationInstanceFor( ServiceDescriptor serviceModel, Identity serviceIdentity, UnitOfWork uow )
  throws InstantiationException
{
  Class<V> configurationType = serviceModel.configurationType();
  V configuration;
  try
  {
    configuration = uow.get( configurationType, serviceIdentity );
    uow.pause();
  }
  catch( NoSuchEntityException | NoSuchEntityTypeException e )
  {
    EntityDescriptor entityDescriptor = module.typeLookup().lookupEntityModel( configurationType );
    if( entityDescriptor == null )
    {
      throw new NoSuchConfigurationTypeException( configurationType, module.descriptor() );
    }
    return (V) initializeConfigurationInstance( entityDescriptor, uow, serviceModel, serviceIdentity );
  }
  return configuration;
}

相关文章