src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeRegExpExecResult.java

Print this page




  71      * @param self self reference
  72      * @return length property value
  73      */
  74     @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
  75     public static Object length(final Object self) {
  76         if (self instanceof ScriptObject) {
  77             return JSType.toUint32(((ScriptObject)self).getArray().length());
  78         }
  79 
  80         return 0;
  81     }
  82 
  83     /**
  84      * Length setter
  85      * @param self self reference
  86      * @param length property value
  87      */
  88     @Setter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
  89     public static void length(final Object self, final Object length) {
  90         if (self instanceof ScriptObject) {
  91             ((ScriptObject)self).setLength(NativeArray.validLength(length, true));
  92         }
  93     }
  94 }


  71      * @param self self reference
  72      * @return length property value
  73      */
  74     @Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
  75     public static Object length(final Object self) {
  76         if (self instanceof ScriptObject) {
  77             return JSType.toUint32(((ScriptObject)self).getArray().length());
  78         }
  79 
  80         return 0;
  81     }
  82 
  83     /**
  84      * Length setter
  85      * @param self self reference
  86      * @param length property value
  87      */
  88     @Setter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
  89     public static void length(final Object self, final Object length) {
  90         if (self instanceof ScriptObject) {
  91             ((ScriptObject)self).setLength(NativeArray.validLength(length));
  92         }
  93     }
  94 }