Package org.teavm.jso

Annotation Interface JSProperty


@Retention(RUNTIME) @Target({METHOD,FIELD}) public @interface JSProperty

Marks abstract member method as either a getter or a setter.

Getter's name may conform the Java Beans specification, i.e. start with get prefix (or is in case of boolean getter), or use record-style accessor naming where the method name is the property name. It must not take any parameters and must return a value. For getter annotation is equivalent to the following:

 @JSBody(params = {}, script = "return this.propertyName;")
 

Setter's name must conform the Java Beans specification, i.e. start with set prefix It must take exactly one parameter and must not return a value. For setter annotation is equivalent to the following:

 @JSBody(params = "value", script = "this.propertyName = value;")
 

By default propertyName is calculated from method's name according to Java Beans specification when it has a getter or setter prefix. Otherwise, a getter method's name is used as is. The name specified by annotation overrides this computation.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
     
  • Element Details

    • value

      String value
      Default:
      ""