org.graalvm.nativeimage.hosted.RuntimeReflection Java Examples
The following examples show how to use
org.graalvm.nativeimage.hosted.RuntimeReflection.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JdbcFeature.java From micronaut-sql with Apache License 2.0 | 6 votes |
private void handlePostgres(BeforeAnalysisAccess access) { Class<?> postgresDriver = access.findClassByName(POSTGRESQL_DRIVER); if (postgresDriver != null) { RuntimeReflection.register(postgresDriver); RuntimeClassInitialization.initializeAtBuildTime(postgresDriver); initializeAtBuildTime(access, POSTGRESQL_DRIVER, "org.postgresql.util.SharedTimer" ); registerAllFields(access, "org.postgresql.PGProperty"); ResourcesRegistry resourcesRegistry = getResourceRegistry(); if (resourcesRegistry != null) { resourcesRegistry.addResources("META-INF/services/java.sql.Driver"); } } }
Example #2
Source File: JdbcFeature.java From micronaut-sql with Apache License 2.0 | 6 votes |
private void handleMariadb(BeforeAnalysisAccess access) { Class<?> mariaDriver = access.findClassByName(MARIADB_DRIVER); if (mariaDriver != null) { RuntimeReflection.register(mariaDriver); registerAllAccess(mariaDriver); ResourcesRegistry resourcesRegistry = getResourceRegistry(); if (resourcesRegistry != null) { resourcesRegistry.addResources("META-INF/services/java.sql.Driver"); } registerAllIfPresent(access, "org.mariadb.jdbc.util.Options"); RuntimeClassInitialization.initializeAtBuildTime("org.mariadb"); RuntimeClassInitialization.initializeAtRunTime("org.mariadb.jdbc.credential.aws"); initializeAtRuntime(access, "org.mariadb.jdbc.internal.failover.impl.MastersSlavesListener"); initializeAtRuntime(access, "org.mariadb.jdbc.internal.com.send.authentication.SendPamAuthPacket"); } }
Example #3
Source File: JdbcFeature.java From micronaut-sql with Apache License 2.0 | 6 votes |
private void handleSqlServer(BeforeAnalysisAccess access) { Class<?> sqlServerDriver = access.findClassByName(SQL_SERVER_DRIVER); if (sqlServerDriver != null) { RuntimeReflection.register(sqlServerDriver); registerAllAccess(sqlServerDriver); RuntimeClassInitialization.initializeAtBuildTime(SQL_SERVER_DRIVER); initializeAtBuildTime(access, "com.microsoft.sqlserver.jdbc.Util"); initializeAtBuildTime(access, "com.microsoft.sqlserver.jdbc.SQLServerException"); registerAllIfPresent(access, "com.microsoft.sqlserver.jdbc.SQLServerDriver"); ResourcesRegistry resourcesRegistry = getResourceRegistry(); if (resourcesRegistry != null) { resourcesRegistry.addResources("META-INF/services/java.sql.Driver"); resourcesRegistry.addResources("javax.crypto.Cipher.class"); resourcesRegistry.addResourceBundles("com.microsoft.sqlserver.jdbc.SQLServerResource"); } } }
Example #4
Source File: JdbcFeature.java From micronaut-sql with Apache License 2.0 | 5 votes |
private void handleH2(BeforeAnalysisAccess access) { Class<?> h2Driver = access.findClassByName(H2_DRIVER); if (h2Driver != null) { registerAllIfPresent(access, "org.h2.mvstore.db.MVTableEngine"); RuntimeReflection.register(h2Driver); RuntimeClassInitialization.initializeAtBuildTime(h2Driver); ResourcesRegistry resourcesRegistry = getResourceRegistry(); if (resourcesRegistry != null) { resourcesRegistry.addResources("META-INF/services/java.sql.Driver"); resourcesRegistry.addResources("org/h2/util/data.zip"); } } }
Example #5
Source File: JdbcFeature.java From micronaut-sql with Apache License 2.0 | 5 votes |
private void registerAllAccess(Class<?> t) { RuntimeReflection.register(t); RuntimeReflection.registerForReflectiveInstantiation(t); for (Method method : t.getMethods()) { RuntimeReflection.register(method); } Field[] fields = t.getFields(); for (Field field : fields) { RuntimeReflection.register(field); } }
Example #6
Source File: JdbcFeature.java From micronaut-sql with Apache License 2.0 | 5 votes |
private void registerAllForRuntimeReflection(BeforeAnalysisAccess access, String n) { Class<?> t = access.findClassByName(n); if (t != null) { RuntimeReflection.register(t); registerAllFields(access, n); registerAllMethods(access, n); registerAllConstructors(access, n); } }
Example #7
Source File: JdbcFeature.java From micronaut-sql with Apache License 2.0 | 5 votes |
private void registerAllFields(BeforeAnalysisAccess access, String n) { Class<?> t = access.findClassByName(n); if (t != null) { Field[] fields = t.getFields(); for (Field field : fields) { RuntimeReflection.register(field); } } }
Example #8
Source File: JdbcFeature.java From micronaut-sql with Apache License 2.0 | 5 votes |
private void registerAllMethods(BeforeAnalysisAccess access, String n) { Class<?> t = access.findClassByName(n); if (t != null) { for (Method method : t.getMethods()) { RuntimeReflection.register(method); } } }
Example #9
Source File: JdbcFeature.java From micronaut-sql with Apache License 2.0 | 5 votes |
private void registerAllConstructors(BeforeAnalysisAccess access, String n) { Class<?> t = access.findClassByName(n); if (t != null) { for (Constructor constructor : t.getConstructors()) { RuntimeReflection.register(constructor); } } }
Example #10
Source File: HibernateFeature.java From micronaut-sql with Apache License 2.0 | 5 votes |
private void registerIfPresent(BeforeAnalysisAccess access, String name, Class<? extends Dialect>... dialects) { Class<?> driver = access.findClassByName(name); if (driver != null) { for (Class<? extends Dialect> dialect : dialects) { RuntimeReflection.register(dialect); RuntimeReflection.registerForReflectiveInstantiation(dialect); } } }
Example #11
Source File: KafkaSubstitutions.java From micronaut-kafka with Apache License 2.0 | 5 votes |
@Override public void beforeAnalysis(BeforeAnalysisAccess access) { Class<?> c = access.findClassByName("java.util.zip.CRC32C"); if (c != null) { RuntimeReflection.registerForReflectiveInstantiation(c); RuntimeReflection.register(c); } }
Example #12
Source File: SVMSubstitutions.java From reactive-refarch-cloudformation with Apache License 2.0 | 5 votes |
public void beforeAnalysis(BeforeAnalysisAccess access) { try { // json types RuntimeReflection.register(java.util.ArrayList.class.getDeclaredConstructor()); RuntimeReflection.register(java.util.LinkedHashMap.class.getDeclaredConstructor()); // extras (grpc seems to need this) RuntimeReflection.register(io.netty.channel.socket.nio.NioServerSocketChannel.class.getDeclaredConstructor()); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } }