示例#1
0
  public String getAnnotation() {
    StringBuilder annotation = new StringBuilder("@ManyToOne(");

    if (fetchType != null) {
      annotation.append("fetch = FetchType.").append(fetchType.toString()).append(", ");
      super.addPackage(fetchType.getClass().getPackage().toString());
    }

    if (cascadeType != null) {
      annotation.append("cascade = CascadeType.").append(cascadeType.toString()).append(", ");
      super.addPackage(cascadeType.getClass().getPackage().toString());
    }

    if (optional != null) annotation.append("orphanRemoval = ").append(optional).append("\"");

    annotation.append(")");

    String value = annotation.toString();
    value = value.replace(", )", ")");
    return value;
  }