@Override public StateHolder stateOf( TransientComposite composite ) { return compositeInstanceOf( composite ).state(); }
public InjectionContext( CompositeInstance compositeInstance, UsesInstance uses, StateHolder state ) { this.module = compositeInstance.module(); this.compositeInstance = compositeInstance; this.uses = uses; this.state = state; }
@Override public boolean test( T model ) { if( current == null ) { current = model.visibility(); return true; } return current == model.visibility(); } }
public View2 createView2( FooModel model ) { TransientBuilder<View2> builder = transientBuilderFactory.newTransientBuilder( View2.class ); builder.use( model ); return builder.newInstance(); } }
public CostPerUnit toCostPer( Unit<?> unit ) { TransientBuilder<CostPerUnitComposite> builder = builderFactory.newTransientBuilder( CostPerUnitComposite.class ); builder.prototype().unit().set( unit ); return builder.newInstance(); } }
private Location createLocation( String locationName ) { TransientBuilder<Location> locationBuilder = transientBuilderFactory.newTransientBuilder( Location.class ); Location locState = locationBuilder.prototypeFor( Location.class ); locState.name().set( locationName ); return locationBuilder.newInstance(); }
@SuppressWarnings( "unchecked" ) @Test( expected = NoSuchTransientTypeException.class ) public void testNewInstanceNotExtendingComposite() throws Exception { Class aClass = FirstComposite.class; TransientBuilder builder = transientBuilderFactory.newTransientBuilder( aClass ); builder.newInstance(); }
@Test public void testMethodParameters() { TransientBuilder<TestCaseComposite> cb = transientBuilderFactory.newTransientBuilder( TestCaseComposite.class ); cb.prototype().testParameters( 15 ); }
public ModuleDescriptor module() { return model.module(); }
public Stream<? extends AssociationDescriptor> namedAssociations() { return model.state().namedAssociations(); } }
public void generic( List<String> list ) { try { _instance.invokeComposite( m6, new Object[]{ list } ); } catch( RuntimeException runtime ) { throw runtime; } catch( Throwable error ) { throw (Error) error; } }
public View1 createView1( FooModel model ) { TransientBuilder<View1> builder = transientBuilderFactory.newTransientBuilder( View1.class ); builder.use( model ); return builder.newInstance(); } // END SNIPPET: create
private TestComposite newInstance( String a, int b ) { TransientBuilder<TestComposite> builder = transientBuilderFactory.newTransientBuilder( TestComposite.class ); TestComposite instance = builder.prototype(); instance.a().set( a ); instance.b().set( b ); return builder.newInstance(); }
private static ValueStateInstance getValueStateInstance( Object value ) { return (ValueStateInstance) compositeInstanceOf( (Composite) value ).state(); } }
String test2() { TransientBuilder<B2> builder = cbf.newTransientBuilder( B2.class ); builder.prototypeFor( B2.class ).b2().set( "abc" ); B2 instance = builder.newInstance(); return instance.b2().get(); } }
public ModuleDescriptor module() { return model.module(); }
public long unwrapResult() { try { return (Long) _instance.invokeComposite( m5, null ); } catch( RuntimeException runtime ) { throw runtime; } catch( Throwable error ) { throw (Error) error; } }
public String testConcern() { try { return (String) _instance.invokeComposite( m7, null ); } catch( RuntimeException runtime ) { throw runtime; } catch( Throwable error ) { throw (Error) error; } }
public String other() { try { return (String) _instance.invokeComposite( m1, null ); } catch( RuntimeException runtime ) { throw runtime; } catch( Throwable error ) { throw (Error) error; } }
@Override public String someMethod( String foo, double x, int y ) { try { return (String) _instance.invokeComposite( m8, new Object[]{ foo, x, y } ); } catch( RuntimeException runtime ) { throw runtime; } catch( Throwable error ) { throw (Error) error; } }