如何在Delphi中包装Java枚举?

时间:2018-11-28 14:32:48

标签: delphi firemonkey

我在Java中有此类:

public class SessionDescription {

  public static enum Type {
    OFFER,
    PRANSWER,
    ANSWER;

    public String canonicalForm() {
      return name().toLowerCase(Locale.US);
    }

    @CalledByNative("Type")
    public static Type fromCanonicalForm(String canonical) {
      return Type.valueOf(Type.class, canonical.toUpperCase(Locale.US));
    }
  }

  public final Type type;
  public final String description;

  @CalledByNative
  public SessionDescription(Type type, String description) {
    this.type = type;
    this.description = description;
  }

  @CalledByNative
  String getDescription() {
    return description;
  }

  @CalledByNative
  String getTypeInCanonicalForm() {
    return type.canonicalForm();
  }
}

如何在Delphi中为Typepublic static enum Type {...})定义接口?

0 个答案:

没有答案