How to load (static nested) enumeration value from YAML devices in Play Framework?

public class Request extends Model {
    public static enum Category {
        First, Second, Third
    }
        public Category category;
}

It seems that I cannot correctly create a query with a category in my test fixtures / YAML source data. I tried things like:

Request(areq):
    category: Request.Category.Third

And a few more options. Nothing really works. The SnakeYAML page gives me some painful hints, but I don’t see how to properly link to my application packages. What is the correct syntax for this?

+3
source share
3 answers

Why don't you just use

...
category: Third

SnakeYAML .

+5

Play1.2.x :

:

EnumTest(enumtest01):
  status: ${models.EnumTest.Status.ACTIVE}

EnumTest(enumtest02):
  status: ${models.EnumTest.Status.DELETED}

:

@Entity
public class EnumTest extends Model {

    public enum Status {
        ACTIVE, DELETED
    }

    public Status status;

}

Groovy ​​ application.conf, yml.

+1

, , , Request - , . . . , models.Request.Category.Third.

0

Source: https://habr.com/ru/post/1779668/


All Articles