使用GAE生成API(Google Cloud Endpoint)时出错

时间:2014-06-05 21:06:52

标签: java google-app-engine jdo google-cloud-endpoints

我用GAE创建了一个简单的项目,然后我将我的软件包放入' model' PMF.java(Persistence Manager Factory类)和一个类(Employee.java),我可以在这里向您展示:

    @PersistenceCapable
public class Employee {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;

    @Persistent
    private String firstName;

    @Persistent
    private String lastName;

    @Persistent
    private Date hireDate;

    public Employee(String firstName, String lastName, Date hireDate) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.hireDate = hireDate;
    }

    // Accessors for the fields. JDO doesn't use these, but your application does.

    public Key getKey() {
        return key;
    }

    public String getFirstName() {
        return firstName;
    }
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public Date getHireDate() {
        return hireDate;
    }
    public void setHireDate(Date hireDate) {
        this.hireDate = hireDate;
    }
}

当我点击Google->生成Cloud Enpoint客户端库时,我收到以下错误消息: Error in Generating API: this project does not have cloud endpoint classes。这是什么意思?非常感谢你

1 个答案:

答案 0 :(得分:1)

您已经完成了第一部分,即创建了您的模型。

当您尝试生成Cloud Endpoint Client Library时,该工具会查找使用@API注释进行注释的Java类,以便它知道哪些类是您的端点。

您应该尝试的是以下一系列步骤:

  1. 创建一个新项目并添加您的模型,即Employee
  2. 只需右键单击项目中的类并选择Google - >即可为Employee生成端点类。生成Cloud Endpoint类。这将生成Endpoint类EmployeeEndpoint以及PMF。的java。
  3. 现在,右键单击该项目并选择Google - >生成Cloud Endpoint Client Library,您应该很好,因为该工具将找到已正确注释的Endpoint类(EmployeeEndpoint)。
相关问题