如何运行所有接口方法?

时间:2016-06-19 07:51:47

标签: java interface

我想为我的游戏制作api并在你必须拥有的部分中运行api:

@GameApi
public void run(){
    // what you want to do with my game
 }


GameApi类如下:

public @interface GameApi {


}

并且我不知道如何使用GameApi注释使main方法运行项目中的每个方法。我也尝试将@Retention(RetentionPolicy.RUNTIME)〓放在public @interface GameApi上方 但是当我导入它时,它表示RetentionPolicy无法解析为变量

1 个答案:

答案 0 :(得分:2)

您将使用以下反射执行此操作:

std::vector<pcl::PointIndices> cluster_indices;
pcl::PCA<pcl::PointXYZ> cpca = new pcl::PCA<pcl::PointXYZ>;
cpca.setInputCloud(input);
Eigen::Vector3f pca_vector(3,3);
// and now iterating with a for loop over the clusters, but having issues using setIndices already
for (std::vector<pcl::PointIndices>::const_iterator it = cluster_indices.begin (); it != cluster_indices.end (); ++it, n++)
{
    cpca.setIndices(it->indices); //not sure what to put in brackets, everything I thought of returns an error!
    pca_vector = cpca.getEigenVectors();
}