congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
DBI.registerArgumentFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
registerArgumentFactory
method
in
org.skife.jdbi.v2.DBI

Best Java code snippets using org.skife.jdbi.v2.DBI.registerArgumentFactory (Showing top 20 results out of 315)

origin: jooby-project/jooby

@Override
public void registerArgumentFactory(final ArgumentFactory<?> argumentFactory) {
 factories.add(argumentFactory);
 super.registerArgumentFactory(argumentFactory);
}
origin: dropwizard/dropwizard

dbi.registerArgumentFactory(new GuavaOptionalArgumentFactory(driverClazz));
dbi.registerArgumentFactory(new OptionalArgumentFactory(driverClazz));
dbi.registerArgumentFactory(new OptionalDoubleArgumentFactory());
dbi.registerArgumentFactory(new OptionalIntArgumentFactory());
dbi.registerArgumentFactory(new OptionalLongArgumentFactory());
dbi.registerColumnMapper(new OptionalDoubleMapper());
dbi.registerColumnMapper(new OptionalIntMapper());
dbi.registerArgumentFactory(new JodaDateTimeArgumentFactory(timeZone));
dbi.registerArgumentFactory(new LocalDateArgumentFactory());
dbi.registerArgumentFactory(new LocalDateTimeArgumentFactory());
dbi.registerArgumentFactory(new InstantArgumentFactory(timeZone));
dbi.registerArgumentFactory(new OffsetDateTimeArgumentFactory(timeZone));
dbi.registerArgumentFactory(new ZonedDateTimeArgumentFactory(timeZone));
dbi.registerArgumentFactory(new GuavaOptionalJodaTimeArgumentFactory(timeZone));
dbi.registerArgumentFactory(new GuavaOptionalLocalDateArgumentFactory());
dbi.registerArgumentFactory(new GuavaOptionalLocalDateTimeArgumentFactory());
dbi.registerArgumentFactory(new GuavaOptionalInstantArgumentFactory(timeZone));
dbi.registerArgumentFactory(new GuavaOptionalOffsetTimeArgumentFactory(timeZone));
dbi.registerArgumentFactory(new GuavaOptionalZonedTimeArgumentFactory(timeZone));
dbi.registerArgumentFactory(new OptionalJodaTimeArgumentFactory(timeZone));
dbi.registerArgumentFactory(new OptionalLocalDateArgumentFactory());
dbi.registerArgumentFactory(new OptionalLocalDateTimeArgumentFactory());
dbi.registerArgumentFactory(new OptionalInstantArgumentFactory(timeZone));
dbi.registerArgumentFactory(new OptionalOffsetDateTimeArgumentFactory(timeZone));
dbi.registerArgumentFactory(new OptionalZonedDateTimeArgumentFactory(timeZone));
origin: jooby-project/jooby

@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public void configure(final Env env, final Config config, final Binder binder) {
 Key<DataSource> dskey = Key.get(DataSource.class, Names.named(name));
 DataSource ds = env.get(dskey)
   .orElseThrow(() -> new NoSuchElementException("DataSource missing: " + dskey));
 DBI dbi = new DBI2(ds);
 dbi.setSQLLog(new SLF4JLog());
 dbi.registerArgumentFactory(new OptionalArgumentFactory());
 dbi.registerArgumentFactory(new IterableArgumentFactory());
 dbi.registerContainerFactory(new OptionalContainerFactory());
 dbi.setStatementRewriter(new ExpandedStmtRewriter());
 ServiceKey serviceKey = env.serviceKey();
 serviceKey.generate(DBI.class, name, k -> binder.bind(k).toInstance(dbi));
 serviceKey.generate(Handle.class, name, k -> binder.bind(k).toProvider(() -> dbi.open()));
 sqlObjects.forEach(sqlObject -> binder.bind(sqlObject)
   .toProvider((Provider) () -> dbi.open(sqlObject)));
 if (callback != null) {
  callback.accept(dbi, config);
 }
}
origin: signalapp/Signal-Server

 @Override
 protected void run(Bootstrap<WhisperServerConfiguration> bootstrap,
           Namespace namespace,
           WhisperServerConfiguration config)
   throws Exception
 {
  DataSourceFactory messageDbConfig = config.getMessageStoreConfiguration();
  DBI               messageDbi      = new DBI(messageDbConfig.getUrl(), messageDbConfig.getUser(), messageDbConfig.getPassword());

  messageDbi.registerArgumentFactory(new OptionalArgumentFactory(messageDbConfig.getDriverClass()));
  messageDbi.registerContainerFactory(new ImmutableListContainerFactory());
  messageDbi.registerContainerFactory(new ImmutableSetContainerFactory());
  messageDbi.registerContainerFactory(new OptionalContainerFactory());

  Messages messages  = messageDbi.onDemand(Messages.class);
  long     timestamp = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(90);

  logger.info("Trimming old messages: " + timestamp + "...");
  messages.removeOld(timestamp);

  Thread.sleep(3000);
  System.exit(0);
 }
}
origin: signalapp/Signal-Server

dbi.registerArgumentFactory(new OptionalArgumentFactory(dbConfig.getDriverClass()));
dbi.registerContainerFactory(new ImmutableListContainerFactory());
dbi.registerContainerFactory(new ImmutableSetContainerFactory());
origin: signalapp/Signal-Server

DBI               dbi      = new DBI(dbConfig.getUrl(), dbConfig.getUser(), dbConfig.getPassword());
dbi.registerArgumentFactory(new OptionalArgumentFactory(dbConfig.getDriverClass()));
dbi.registerContainerFactory(new ImmutableListContainerFactory());
dbi.registerContainerFactory(new ImmutableSetContainerFactory());
origin: signalapp/Signal-Server

DBI               messageDbi      = new DBI(messageDbConfig.getUrl(), messageDbConfig.getUser(), messageDbConfig.getPassword());
dbi.registerArgumentFactory(new OptionalArgumentFactory(dbConfig.getDriverClass()));
dbi.registerContainerFactory(new ImmutableListContainerFactory());
dbi.registerContainerFactory(new ImmutableSetContainerFactory());
dbi.registerContainerFactory(new OptionalContainerFactory());
messageDbi.registerArgumentFactory(new OptionalArgumentFactory(dbConfig.getDriverClass()));
messageDbi.registerContainerFactory(new ImmutableListContainerFactory());
messageDbi.registerContainerFactory(new ImmutableSetContainerFactory());
origin: signalapp/Signal-Server

DBI               dbi      = new DBI(dbConfig.getUrl(), dbConfig.getUser(), dbConfig.getPassword());
dbi.registerArgumentFactory(new OptionalArgumentFactory(dbConfig.getDriverClass()));
dbi.registerContainerFactory(new ImmutableListContainerFactory());
dbi.registerContainerFactory(new ImmutableSetContainerFactory());
origin: org.jooby/jooby-jdbi

@Override
public void registerArgumentFactory(final ArgumentFactory<?> argumentFactory) {
 factories.add(argumentFactory);
 super.registerArgumentFactory(argumentFactory);
}
origin: com.intuit.wasabi/wasabi-database

@Inject
public DBITransactionFactory(BoneCPConfig config, HealthCheckRegistry healthChecks) {
  super();
  // Register for health check
  healthChecks.register("MySql", new PrivateMySqlHealthCheck(this));
  LOGGER.debug("Creating BoneCPDataSource");
  this.dataSource = new BoneCPDataSource(config);
  this.dbi = new DBI(dataSource);
  // Register JDBI argument factories
  dbi.registerArgumentFactory(new UUIDArgumentFactory());
  dbi.registerArgumentFactory(new ExperimentIDArgumentFactory());
  dbi.registerArgumentFactory(new BucketLabelArgumentFactory());
}
origin: org.kill-bill.commons/killbill-queue

@VisibleForTesting
public static void setupDBI(final DBI dbi) {
  dbi.registerArgumentFactory(new UUIDArgumentFactory());
  dbi.registerArgumentFactory(new DateTimeZoneArgumentFactory());
  dbi.registerArgumentFactory(new DateTimeArgumentFactory());
  dbi.registerArgumentFactory(new LocalDateArgumentFactory());
  dbi.registerMapper(new UUIDMapper());
  dbi.registerMapper(new LowerToCamelBeanMapperFactory(BusEventModelDao.class));
  dbi.registerMapper(new LowerToCamelBeanMapperFactory(NotificationEventModelDao.class));
}
origin: org.kill-bill.commons/killbill-jdbi

@Test(groups = "slow")
public void testWithArgument() throws Exception {
  dbi.registerArgumentFactory(new DateTimeArgumentFactory());
  final SomethingSqlDao somethingSqlDao = dbi.onDemand(SomethingSqlDao.class);
  final DateTime dateTimePierre = new DateTime(2012, 10, 5, 8, 10, DateTimeZone.UTC);
  somethingSqlDao.create(1, "pierre", dateTimePierre);
  final DateTime dateTimeStephane = new DateTime(2009, 3, 1, 0, 1, DateTimeZone.UTC);
  somethingSqlDao.create(2, "stephane", dateTimeStephane);
  final Timestamp datePierre = somethingSqlDao.getCreatedDt(1);
  Assert.assertEquals(datePierre.getTime(), dateTimePierre.getMillis());
  final Timestamp dateStephane = somethingSqlDao.getCreatedDt(2);
  Assert.assertEquals(dateStephane.getTime(), dateTimeStephane.getMillis());
}
origin: com.ning.billing.commons/killbill-jdbi

@Test(groups = "slow")
public void testWithArgument() throws Exception {
  dbi.registerArgumentFactory(new DateTimeArgumentFactory());
  final SomethingSqlDao somethingSqlDao = dbi.onDemand(SomethingSqlDao.class);
  final DateTime dateTimePierre = new DateTime(2012, 10, 5, 8, 10, DateTimeZone.UTC);
  somethingSqlDao.create(1, "pierre", dateTimePierre);
  final DateTime dateTimeStephane = new DateTime(2009, 3, 1, 0, 1, DateTimeZone.UTC);
  somethingSqlDao.create(2, "stephane", dateTimeStephane);
  final Timestamp datePierre = somethingSqlDao.getCreatedDt(1);
  Assert.assertEquals(datePierre.getTime(), dateTimePierre.getMillis());
  final Timestamp dateStephane = somethingSqlDao.getCreatedDt(2);
  Assert.assertEquals(dateStephane.getTime(), dateTimeStephane.getMillis());
}
origin: org.kill-bill.commons/killbill-jdbi

@Test(groups = "slow")
public void testWithArgument() throws Exception {
  dbi.registerArgumentFactory(new UUIDArgumentFactory());
  final SomethingSqlDao somethingSqlDao = dbi.onDemand(SomethingSqlDao.class);
  final UUID idPierre = UUID.randomUUID();
  somethingSqlDao.create(1, "pierre", idPierre);
  final UUID idStephane = UUID.randomUUID();
  somethingSqlDao.create(2, "stephane", idStephane);
  final String idStringPierre = somethingSqlDao.getUniqueId(1);
  Assert.assertEquals(idStringPierre, idPierre.toString());
  final String idStringStephane = somethingSqlDao.getUniqueId(2);
  Assert.assertEquals(idStringStephane, idStephane.toString());
}
origin: com.ning.billing.commons/killbill-jdbi

@Test(groups = "slow")
public void testWithArgument() throws Exception {
  dbi.registerArgumentFactory(new UUIDArgumentFactory());
  final SomethingSqlDao somethingSqlDao = dbi.onDemand(SomethingSqlDao.class);
  final UUID idPierre = UUID.randomUUID();
  somethingSqlDao.create(1, "pierre", idPierre);
  final UUID idStephane = UUID.randomUUID();
  somethingSqlDao.create(2, "stephane", idStephane);
  final String idStringPierre = somethingSqlDao.getUniqueId(1);
  Assert.assertEquals(idStringPierre, idPierre.toString());
  final String idStringStephane = somethingSqlDao.getUniqueId(2);
  Assert.assertEquals(idStringStephane, idStephane.toString());
}
origin: com.ning.billing.commons/killbill-jdbi

@Test(groups = "slow")
public void testWithArgument() throws Exception {
  dbi.registerArgumentFactory(new LocalDateArgumentFactory());
  final SomethingSqlDao somethingSqlDao = dbi.onDemand(SomethingSqlDao.class);
  final LocalDate localDatePierre = new LocalDate(2012, 5, 12);
  somethingSqlDao.create(1, "pierre", localDatePierre);
  final LocalDate localDateStephane = new LocalDate(2009, 3, 9);
  somethingSqlDao.create(2, "stephane", localDateStephane);
  final String localDateStringPierre = somethingSqlDao.getCreatedDt(1);
  Assert.assertEquals(localDateStringPierre, localDatePierre.toString());
  final String localDateStringStephane = somethingSqlDao.getCreatedDt(2);
  Assert.assertEquals(localDateStringStephane, localDateStephane.toString());
}
origin: org.kill-bill.commons/killbill-jdbi

@Test(groups = "slow")
public void testWithArgument() throws Exception {
  dbi.registerArgumentFactory(new LocalDateArgumentFactory());
  final SomethingSqlDao somethingSqlDao = dbi.onDemand(SomethingSqlDao.class);
  final LocalDate localDatePierre = new LocalDate(2012, 5, 12);
  somethingSqlDao.create(1, "pierre", localDatePierre);
  final LocalDate localDateStephane = new LocalDate(2009, 3, 9);
  somethingSqlDao.create(2, "stephane", localDateStephane);
  final String localDateStringPierre = somethingSqlDao.getCreatedDt(1);
  Assert.assertEquals(localDateStringPierre, localDatePierre.toString());
  final String localDateStringStephane = somethingSqlDao.getCreatedDt(2);
  Assert.assertEquals(localDateStringStephane, localDateStephane.toString());
}
origin: org.kill-bill.commons/killbill-jdbi

@Test(groups = "slow")
public void testWithArgument() throws Exception {
  dbi.registerArgumentFactory(new DateTimeZoneArgumentFactory());
  final SomethingSqlDao somethingSqlDao = dbi.onDemand(SomethingSqlDao.class);
  final DateTimeZone dateTimeZonePierre = DateTimeZone.UTC;
  somethingSqlDao.create(1, "pierre", dateTimeZonePierre);
  final DateTimeZone dateTimeZoneStephane = DateTimeZone.forID("Europe/London");
  somethingSqlDao.create(2, "stephane", dateTimeZoneStephane);
  final String tzStringPierre = somethingSqlDao.getCreatedTZ(1);
  Assert.assertEquals(tzStringPierre, dateTimeZonePierre.toString());
  final String tzStringStephane = somethingSqlDao.getCreatedTZ(2);
  Assert.assertEquals(tzStringStephane, dateTimeZoneStephane.toString());
}
origin: org.jdbi/jdbi

@Test
public void testRegisterOnDBI() throws Exception
{
  dbi.registerArgumentFactory(new NameAF());
  Handle h2 = dbi.open();
  h2.createStatement("insert into something (id, name) values (:id, :name)")
   .bind("id", 7)
   .bind("name", new Name("Brian", "McCallister"))
   .execute();
  String full_name = h.createQuery("select name from something where id = 7").mapTo(String.class).first();
  assertThat(full_name, equalTo("Brian McCallister"));
  h2.close();
}
origin: org.kill-bill.commons/killbill-jdbi

@Test
@Category(JDBITests.class)
public void testRegisterOnDBI() throws Exception
{
  dbi.registerArgumentFactory(new NameAF());
  Handle h2 = dbi.open();
  h2.createStatement("insert into something (id, name) values (:id, :name)")
   .bind("id", 7)
   .bind("name", new Name("Brian", "McCallister"))
   .execute();
  String full_name = h.createQuery("select name from something where id = 7").map(StringMapper.FIRST).first();
  assertThat(full_name, equalTo("Brian McCallister"));
  h2.close();
}
org.skife.jdbi.v2DBIregisterArgumentFactory

Popular methods of DBI

  • <init>
    Constructor used to allow for obtaining a Connection in a customized manner. The org.skife.jdbi.v2.t
  • open
  • onDemand
    Create a new sql object which will obtain and release connections from this dbi instance, as it need
  • registerMapper
    Register a result set mapper which will have its parameterized type inspected to determine what it m
  • withHandle
    A convenience function which manages the lifecycle of a handle and yields it to a callback for use b
  • inTransaction
  • setSQLLog
    Specify the class used to log sql statements. Will be passed to all handles created from this instan
  • registerContainerFactory
  • setStatementLocator
    Use a non-standard StatementLocator to look up named statements for all handles created from this DB
  • setStatementRewriter
    Use a non-standard StatementRewriter to transform SQL for all Handle instances created by this DBI.
  • setTransactionHandler
    Specify the TransactionHandler instance to use. This allows overriding transaction semantics, or map
  • setTimingCollector
    Add a callback to accumulate timing information about the queries running from this data source.
  • setTransactionHandler,
  • setTimingCollector,
  • useHandle,
  • define,
  • close,
  • getStatementLocator,
  • getTransactionHandler,
  • registerColumnMapper

Popular in Java

  • Finding current android device location
  • getContentResolver (Context)
  • getApplicationContext (Context)
  • scheduleAtFixedRate (Timer)
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Notification (javax.management)
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • BoxLayout (javax.swing)
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top PhpStorm plugins
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