Help me [ helper blocks ]

I'm still a beginner trying to understand how I can return a value through helper blocks
I make simple extension to understand it but it doesn't work

    public int plus(@Options(Numbers.class) int num1,@Options(Numbers.class) int num2) {
        return num1 + num2;

' Numbers Class '

public enum Numbers implements OptionList<Integer> {

    private int number;

    Numbers(int num) {
        this.number = num;

    public Integer toUnderlyingValue() {
        return number;

And i want to know what is the benfit of that code

 private static final Map<String, Animal> lookup = new HashMap<>();

  static {
    for(Animal anim : Animal.values()) {
      lookup.put(anim.toUnderlyingValue(), anim);

  public static Animal fromUnderlyingValue(String anim) {
    return lookup.get(anim);

I took it from How to Add a Dropdown Block to a Component - Google Docs

This thread might help

@BeksOmega, the author of the helper blocks might want to answer this question ...


The use of @Options is mainly intended for backward compatibility where users might have used a publicly available block with other YAIL types and you are migrating the API to the new helper block. For new extensions, it's probably just easier to use the type directly in the parameter rather than annotating with @Options. fromUnderlyingValue is not needed in this case since the enum entries are used directly. However, there is an issue in the ComponentProcessor where it is enforced, but really only needed for helper blocks provided by App Inventor itself.