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

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

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

Module.newTransientBuilder介绍

暂无

代码示例

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

@Override
public void aboveLayerVisible()
{
  TransientBuilder<AboveLayerVisible> builder = module.newTransientBuilder( AboveLayerVisible.class );
  builder.newInstance();
}

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

@Override
public void moduleApplicationVisible()
{
  TransientBuilder<ModuleApplicationVisible> builder = module.newTransientBuilder( ModuleApplicationVisible.class );
  builder.newInstance();
}

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

@Override
public void belowLayerVisible()
{
  TransientBuilder<BelowLayerVisible> builder = module.newTransientBuilder( BelowLayerVisible.class );
  builder.newInstance();
}

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

@Override
public void besideApplicationVisible()
{
  TransientBuilder<BesideApplicationVisible> builder = module.newTransientBuilder( BesideApplicationVisible.class );
  builder.newInstance();
}

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

@Override
public void besideLayerVisible()
{
  TransientBuilder<BesideLayerVisible> builder = module.newTransientBuilder( BesideLayerVisible.class );
  builder.newInstance();
}

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

@Override
public void besideModuleVisible()
{
  TransientBuilder<BesideModuleVisible> builder = module.newTransientBuilder( BesideModuleVisible.class );
  builder.newInstance();
}

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

@Override
public void belowApplicationVisible()
{
  TransientBuilder<BelowApplicationVisible> builder = module.newTransientBuilder( BelowApplicationVisible.class );
  builder.newInstance();
}

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

@Override
public void belowModuleVisible()
{
  TransientBuilder<BelowModuleVisible> builder = module.newTransientBuilder( BelowModuleVisible.class );
  builder.newInstance();
}

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

@Override
  public void aboveModuleVisible()
  {
    TransientBuilder<AboveModuleVisible> builder = module.newTransientBuilder( AboveModuleVisible.class );
    builder.newInstance();
  }
}

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

@Override
public void moduleLayerVisible()
{
  TransientBuilder<ModuleLayerVisible> builder = module.newTransientBuilder( ModuleLayerVisible.class );
  builder.newInstance();
}

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

@Override
public void moduleModuleVisible()
{
  TransientBuilder<ModuleModuleVisible> builder = module.newTransientBuilder( ModuleModuleVisible.class );
  builder.newInstance();
}

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

@Override
public void aboveApplicationVisible()
{
  TransientBuilder<AboveApplicationVisible> builder = module.newTransientBuilder( AboveApplicationVisible.class );
  builder.newInstance();
}

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

/**
 * Tests that an object builder can be created for an registered object.
 */
@Test
public void newBuilderForRegisteredComposite()
  throws ActivationException, AssemblyException
{
  SingletonAssembler assembler = new SingletonAssembler()
  {
    public void assemble( ModuleAssembly module )
      throws AssemblyException
    {
      module.transients( AnyComposite.class );
    }
  };
  assembler.module().newTransientBuilder( AnyComposite.class );
}

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

/**
 * Tests that an transient builder cannot be created for an unregistered object.
 *
 * @throws Exception expected
 */
@Test( expected = NoSuchTransientTypeException.class )
public void newBuilderForUnregisteredComposite()
  throws Exception
{
  SingletonAssembler assembler = new SingletonAssembler()
  {
    public void assemble( ModuleAssembly module )
      throws AssemblyException
    {
    }
  };
  assembler.module().newTransientBuilder( AnyComposite.class );
}

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

/**
 * Tests that an object can be created for an registered object class.
 */
@Test
public void newInstanceForRegisteredComposite()
  throws ActivationException, AssemblyException
{
  SingletonAssembler assembler = new SingletonAssembler()
  {
    public void assemble( ModuleAssembly module )
      throws AssemblyException
    {
      module.transients( AnyComposite.class );
    }
  };
  assembler.module().newTransientBuilder( AnyComposite.class );
}

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

/**
 * Tests that an transient builder cannot be created for a 'null' type.
 *
 * @throws Exception expected
 */
@Test( expected = NullPointerException.class )
public void newBuilderForNullType()
  throws Exception
{
  SingletonAssembler assembler = new SingletonAssembler()
  {
    public void assemble( ModuleAssembly module )
      throws AssemblyException
    {
    }
  };
  assembler.module().newTransientBuilder( null );
}

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

@Test
public void transientsAmbiguousDeclaration()
  throws ActivationException, AssemblyException
{
  Module module = new SingletonAssembler()
  {
    @Override
    public void assemble( ModuleAssembly module )
      throws AssemblyException
    {
      module.transients( SomeOtherFoo.class, BasicFoo.class );
    }
  }.module();
  assertEquals( CATHEDRAL, module.newTransientBuilder( SomeOtherFoo.class ).newInstance().bar() );
  assertEquals( BAZAR, module.newTransientBuilder( BasicFoo.class ).newInstance().bar() );
  try
  {
    module.newTransientBuilder( Foo.class );
    fail( "Ambiguous type exception not detected for Transients" );
  }
  catch( AmbiguousTypeException expected )
  {
  }
}

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

public Book create()
  {
// START SNIPPET: create
    TransientBuilder<Book> builder = module.newTransientBuilder( Book.class );
    Book prototype = builder.prototype();
    prototype.title().set( "The Death of POJOs" );
    prototype.author().set( "Niclas Hedhman" );
    Book book = builder.newInstance();
    String title = book.title().get();     // Retrieves the title.
    book.title().set( "Long Live POJOs" ); // throws an IllegalStateException
// END SNIPPET: create
    return book;
  }
}

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

@Test
public void transients()
  throws ActivationException, AssemblyException
{
  Module module = new SingletonAssembler()
  {
    @Override
    public void assemble( ModuleAssembly module )
      throws AssemblyException
    {
      module.transients( SomeOtherFoo.class );
    }
  }.module();
  assertEquals( CATHEDRAL, module.newTransientBuilder( SomeOtherFoo.class ).newInstance().bar() );
  assertEquals( CATHEDRAL, module.newTransientBuilder( BasicFoo.class ).newInstance().bar() );
  assertEquals( CATHEDRAL, module.newTransientBuilder( Foo.class ).newInstance().bar() );
}

相关文章