Tabnine Logo
Supplier
Code IndexAdd Tabnine to your IDE (free)

How to use
Supplier
in
colesico.framework.ioc

Best Java code snippets using colesico.framework.ioc.Supplier (Showing top 3 results out of 315)

origin: net.colesico.framework/colesico-hikaricp

/**
 * Produces HikariDataSource for default HikariCP configuration
 * defined in file META-INF/hikaricp.properties
 *
 * @param hdsFactory
 * @return
 */
@Singleton
@Classed(HikariProperties.class)
public DataSource propertiesBasedHikariDataSource(@Classed(HikariConfiguration.class) Supplier<DataSource> hdsFactory) {
  return hdsFactory.get(new HikariProperties());
}
origin: net.colesico.framework/colesico-restlet

@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);
  }
}
origin: net.colesico.framework/colesico-restlet

@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);
  }
}
colesico.framework.iocSupplier

Javadoc

Basic supplier interface. Supplier is used to obtain instances from IoC container with support of message pass to the factory that creates that instance

Most used methods

  • get
    Should returns instance of T

Popular in Java

  • Making http post requests using okhttp
  • runOnUiThread (Activity)
  • getSystemService (Context)
  • scheduleAtFixedRate (Timer)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • JButton (javax.swing)
  • JTextField (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now