@Library(name = "MyLibrary")
public class MyLibrary {
@Method(name = "hello", returnType = "void")
public static void hello(String name) {
System.out.println("Hello, " + name + "!");
}
}
Class<?> libraryClass = Class.forName("com.example.MyLibrary");
Method method = libraryClass.getMethod("hello", String.class);
method.invoke(null, "JSilver");
Config config = new Config();
config.setClassLoadingStrategy(new CustomClassLoaderStrategy());
config.setPackageScanRule("com.example.*");
config.setAnnotationProcessor(new CustomAnnotationProcessor());
JSilver.init(config);
Database db = new Database("jdbc:mysql://localhost:3306/mydb", "username", "password");
db.connect();
String sql = "SELECT * FROM users";
List<Map<String, Object>> result = db.query(sql);
for (Map<String, Object> row : result) {
System.out.println(row.get("name"));
}
db.disconnect();