@Override public final void setup(final AdvancedIoc ioc) { this.hdsFactoryFac=ioc.factory(new ClassedKey(DataSource.class,HikariConfiguration.class)); }
@Override public <V> void write(Class<V> type, V value, WriterContext context) { final WebletTeleWriter<V> writer = ioc.instance(new ClassedKey<>(WebletTeleWriter.class, type), null); writer.write(value, context); }
@Override public <V> V read(Class<V> type, ReaderContext context) { final WebletTeleReader<V> reader = ioc.instance(new ClassedKey<>(WebletTeleReader.class, type), null); return reader.read(context); }
@Override public <V> V read(Class<V> type, ReaderContext context) { // try get accurate reader final Supplier<RestletTeleReader> supplier = ioc.supplierOrNull(new ClassedKey<>(RestletTeleReader.class, type)); if (supplier != null) { final TeleReader<V, ReaderContext> reader = supplier.get(null); return reader.read(context); } // no accurate reader. read as json HttpContext httpContext = httpContextProv.get(); try (InputStream is = httpContext.getRequest().getInputStream()) { return jsonConverter.fromJson(is, type); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public <V> void write(Class<V> type, V value, WriterContext context) { final Supplier<RestletTeleWriter> supplier = ioc.supplierOrNull(new ClassedKey<>(RestletTeleWriter.class, type)); if (supplier != null) { final TeleWriter<V, WriterContext> writer = supplier.get(null); writer.write(value, context); return; } HttpContext httpContext = httpContextProv.get(); HttpResponse httpResponse = httpContext.getResponse(); String json = jsonConverter.toJson(value); if (json == null) { httpResponse.sendText("", RESPONSE_CONTENT_TYPE, 204); } else { httpResponse.sendData(ByteBuffer.wrap(json.getBytes()), RESPONSE_CONTENT_TYPE, 200); } }
@Override public final void addFactories(final Catalog catalog) { if(catalog.accept(Catalog.Entry.of(new ClassedKey("javax.sql.DataSource","colesico.framework.hikaricp.HikariConfiguration"),false))){ catalog.add(hikariDataSourceFactoryFactory0()); } if(catalog.accept(Catalog.Entry.of(new ClassedKey("javax.sql.DataSource","colesico.framework.hikaricp.HikariProperties"),false))){ catalog.add(propertiesBasedHikariDataSourceFactory1()); } } }
@Override public final RouterImpl create(final Object message) { final Factory<TeleFacade> teleFacadesSuppVar=ioc.factoryOrNull(new ClassedKey(TeleFacade.class,Router.class)); return new RouterImpl(new DefaultPolysupplier(teleFacadesSuppVar),this.threadScopeFac.get(message)); } };
@Override public final void addFactories(final Catalog catalog) { if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.restlet.teleapi.RestletTeleWriter","colesico.framework.weblet.TextResponse"),false))){ catalog.add(getTextResponseWriterFactory0()); } if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.restlet.teleapi.RestletTeleWriter","colesico.framework.weblet.HtmlResponse"),false))){ catalog.add(getHtmlResponseWriterFactory1()); } if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.restlet.teleapi.RestletTeleWriter","colesico.framework.weblet.NavigationResponse"),false))){ catalog.add(getNavigationResponseWriterFactory2()); } if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.restlet.teleapi.RestletTeleWriter","colesico.framework.weblet.VariousResponse"),false))){ catalog.add(getVariousResponseWriterFactory3()); } if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.restlet.teleapi.RestletTeleWriter","colesico.framework.security.Principal"),false))){ catalog.add(getPrincipalWriterFactory4()); } if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.restlet.teleapi.RestletTeleWriter","colesico.framework.profile.Profile"),false))){ catalog.add(getProfileWriterFactory5()); } } }
@Override public final void addFactories(final Catalog catalog) { if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.restlet.teleapi.RestletTeleReader","java.lang.Boolean"),false))){ catalog.add(getBooleanReaderFactory0()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.restlet.teleapi.RestletTeleReader","java.lang.String"),false))){ catalog.add(getStringReaderFactory1()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.restlet.teleapi.RestletTeleReader","java.lang.Byte"),false))){ catalog.add(getByteReaderFactory2()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.restlet.teleapi.RestletTeleReader","java.lang.Integer"),false))){ catalog.add(getIntegerReaderFactory3()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.restlet.teleapi.RestletTeleReader","java.lang.Long"),false))){ catalog.add(getLongReaderFactory4()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.restlet.teleapi.RestletTeleReader","java.lang.Float"),false))){ catalog.add(getFloatReaderFactory5()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.restlet.teleapi.RestletTeleReader","java.lang.Double"),false))){ catalog.add(getDoubleReaderFactory6()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.restlet.teleapi.RestletTeleReader","java.util.Date"),false))){ catalog.add(getDateReaderFactory7()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.restlet.teleapi.RestletTeleReader","java.time.LocalDate"),false))){ catalog.add(getLocalDateReaderFactory8()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.restlet.teleapi.RestletTeleReader","java.time.LocalTime"),false))){
@Override public final void addFactories(final Catalog catalog) { if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.weblet.teleapi.WebletTeleWriter","colesico.framework.weblet.TextResponse"),false))){ catalog.add(getTextResponseWriterFactory0()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.weblet.teleapi.WebletTeleWriter","colesico.framework.weblet.HtmlResponse"),false))){ catalog.add(getHtmlResponseWriterFactory1()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.weblet.teleapi.WebletTeleWriter","colesico.framework.weblet.NavigationResponse"),false))){ catalog.add(getNavigationResponseWriterFactory2()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.weblet.teleapi.WebletTeleWriter","colesico.framework.weblet.VariousResponse"),false))){ catalog.add(getVariousResponseWriterFactory3()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.weblet.teleapi.WebletTeleWriter","colesico.framework.security.Principal"),false))){ catalog.add(getPrincipalWriterFactory4()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.weblet.teleapi.WebletTeleWriter","colesico.framework.profile.Profile"),false))){ catalog.add(getProfileWriterFactory5());
@Override public final void addFactories(final Catalog catalog) { if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.weblet.teleapi.WebletTeleReader","java.lang.Boolean"),false))){ catalog.add(getBooleanReaderFactory0()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.weblet.teleapi.WebletTeleReader","java.lang.String"),false))){ catalog.add(getStringReaderFactory1()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.weblet.teleapi.WebletTeleReader","java.lang.Byte"),false))){ catalog.add(getByteReaderFactory2()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.weblet.teleapi.WebletTeleReader","java.lang.Integer"),false))){ catalog.add(getIntegerReaderFactory3()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.weblet.teleapi.WebletTeleReader","java.lang.Long"),false))){ catalog.add(getLongReaderFactory4()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.weblet.teleapi.WebletTeleReader","java.lang.Float"),false))){ catalog.add(getFloatReaderFactory5()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.weblet.teleapi.WebletTeleReader","java.lang.Double"),false))){ catalog.add(getDoubleReaderFactory6()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.weblet.teleapi.WebletTeleReader","java.util.Date"),false))){ catalog.add(getDateReaderFactory7()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.weblet.teleapi.WebletTeleReader","java.time.LocalDate"),false))){ catalog.add(getLocalDateReaderFactory8()); if(catalog.accept(Catalog.Entry.of(new ClassedKey("colesico.framework.weblet.teleapi.WebletTeleReader","java.time.LocalTime"),false))){