@Override protected T initialValue() { return module.instance().newTransient( type ); }
@Override protected T initialValue() { return module.instance().newTransient( type ); }
@Override public Object resolveInitialValue( ModuleDescriptor moduleDescriptor ) { return initialValueProvider.apply( moduleDescriptor.instance(), this ); }
@Override @SuppressWarnings( "unchecked" ) public Object map( Composite composite, Type type, String value ) { return PolygeneAPI.FUNCTION_COMPOSITE_INSTANCE_OF.apply( composite ) .module() .instance() .newValueFromSerializedState( (Class<Object>) type, value ); } }
@Override @SuppressWarnings( "unchecked" ) public Object map( Composite composite, Type type, String value ) { return PolygeneAPI.FUNCTION_COMPOSITE_INSTANCE_OF.apply( composite ) .module() .instance() .newValueFromSerializedState( (Class<Object>) type, value ); } }
protected Stream<ServiceReference<Object>> getServiceReferences( final InjectionContext context ) { if( serviceQualifier == null ) { return context.module().instance().findServices( serviceType ); } else { return context.module().instance().findServices( serviceType ).filter( serviceQualifier ); } } }
private ValueType valueTypeOf( ModuleDescriptor module, Class<?> type ) { // TODO Remove (ModuleSpi) cast return ( (ModuleSpi) module.instance() ).valueTypeFactory().valueTypeOf( module, type ); }
private ValueType valueTypeOf( ModuleDescriptor module, Class<?> type ) { // TODO Remove (ModuleSpi) cast return ( (ModuleSpi) module.instance() ).valueTypeFactory().valueTypeOf( module, type ); }
default <T> T fromJson( ModuleDescriptor module, Class<T> type, @Optional JsonValue state ) { // TODO Remove (ModuleSpi) cast ValueType valueType = ( (ModuleSpi) module.instance() ).valueTypeFactory().valueTypeOf( module, type ); return fromJson( module, valueType, state ); }
default <T> T fromXml( ModuleDescriptor module, Class<T> type, @Optional Node state ) { // TODO Remove (ModuleSpi) cast ValueType valueType = ( (ModuleSpi) module.instance() ).valueTypeFactory().valueTypeOf( module, type ); return fromXml( module, valueType, state ); }
default <T> T fromJson( ModuleDescriptor module, Class<T> type, @Optional JsonValue state ) { // TODO Remove (ModuleSpi) cast ValueType valueType = ( (ModuleSpi) module.instance() ).valueTypeFactory().valueTypeOf( module, type ); return fromJson( module, valueType, state ); }
public String toJsonString() { Serializer serialization = ( (ModuleSpi) module().instance() ).serialization(); if( serialization != null ) { return serialization.serialize( Serializer.Options.NO_TYPE_INFO, proxy() ); } return null; }
public T newInstance( ModuleDescriptor module ) { ValueBuilder<T> builder = module.instance().newValueBuilder( type ); build( builder.prototype() ); return builder.newInstance(); } }
@Override public void setUp() throws Exception { super.setUp(); cachePool = module.instance().findService( CachePool.class ).get(); cache = cachePool.fetchCache( "1", String.class ); }
public T newInstance( ModuleDescriptor module ) { ValueBuilder<T> builder = module.instance().newValueBuilder( type ); build( builder.prototype() ); return builder.newInstance(); } }
@Before public void setup() { valueTypeFactory = ( (ModuleSpi) module.instance() ).valueTypeFactory(); }
@Test public void givenServiceWhenInitializingExpectCorrectDeserialization() { ServiceReference<MyService> ref = module.instance().findService( MyService.class ); assertThat( ref, notNullValue() ); assertThat( ref.isAvailable(), equalTo( true ) ); MyService myService = ref.get(); assertThat( myService, notNullValue() ); assertThat( myService.name(), equalTo( "main" ) ); assertThat( myService.hostIp(), equalTo( "12.23.34.45" ) ); assertThat( myService.hostPort(), equalTo( 1234 ) ); }
@Test public void givenServiceWhenInitializingExpectCorrectDeserialization() { ServiceReference<MyService> ref = module.instance().findService( MyService.class ); assertThat( ref, notNullValue() ); assertThat( ref.isAvailable(), equalTo( true ) ); MyService myService = ref.get(); assertThat( myService, notNullValue() ); assertThat( myService.name(), equalTo( "main" ) ); assertThat( myService.hostIp(), equalTo( "12.23.34.45" ) ); assertThat( myService.hostPort(), equalTo( 1234 ) ); }
private SomeValue newSomeValue( String foo, String cathedral ) { ValueBuilder<SomeValue> builder = module.instance().newValueBuilder( SomeValue.class ); SomeValue value = builder.prototype(); value.foo().set( foo ); if( cathedral != null ) { value.cathedral().set( cathedral ); } return builder.newInstance(); }