jdk.nashorn.internal.objects.annotations.Getter Java Examples

The following examples show how to use jdk.nashorn.internal.objects.annotations.Getter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Global.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the Int16Array property.
 * @param self self reference
 * @return the value of the Int16Array property
 */
@Getter(name = "Int16Array", attributes = Attribute.NOT_ENUMERABLE)
public static Object getInt16Array(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.int16Array == LAZY_SENTINEL) {
        global.int16Array = global.getBuiltinInt16Array();
    }
    return global.int16Array;
}
 
Example #2
Source File: Global.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the Nashorn extension: global.Java property.
 *
 * @param self self reference
 * @return the value of the Java property
 */
@Getter(name = "Java", attributes = Attribute.NOT_ENUMERABLE)
public static Object getJavaApi(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.javaApi == LAZY_SENTINEL) {
        global.javaApi = global.getBuiltinJavaApi();
    }
    return global.javaApi;
}
 
Example #3
Source File: Global.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the Uint16Array property.
 * @param self self reference
 * @return the value of the Uint16Array property
 */
@Getter(name = "Uint16Array", attributes = Attribute.NOT_ENUMERABLE)
public static Object getUint16Array(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.uint16Array == LAZY_SENTINEL) {
        global.uint16Array = global.getBuiltinUint16Array();
    }
    return global.uint16Array;
}
 
Example #4
Source File: NativeArray.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Length getter
 * @param self self reference
 * @return the length of the object
 */
@Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
public static Object length(final Object self) {
    if (isArray(self)) {
        return JSType.toUint32(((ScriptObject) self).getArray().length());
    }

    return 0;
}
 
Example #5
Source File: NativeArray.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Length getter
 * @param self self reference
 * @return the length of the object
 */
@Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
public static Object length(final Object self) {
    if (isArray(self)) {
        final long length = ((ScriptObject) self).getArray().length();
        assert length >= 0L;
        // Cast to the narrowest supported numeric type to help optimistic type calculator
        if (length <= Integer.MAX_VALUE) {
            return (int) length;
        }
        return (double) length;
    }

    return 0;
}
 
Example #6
Source File: Global.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for ECMA 15.1.4.7 Date property
 *
 * @param self self reference
 * @return Date property value
 */
@Getter(name = "Date", attributes = Attribute.NOT_ENUMERABLE)
public static Object getDate(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.date == LAZY_SENTINEL) {
        global.date = global.getBuiltinDate();
    }
    return global.date;
}
 
Example #7
Source File: Global.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for ECMA 15.1.4.8 RegExp property
 *
 * @param self self reference
 * @return RegExp property value
 */
@Getter(name = "RegExp", attributes = Attribute.NOT_ENUMERABLE)
public static Object getRegExp(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.regexp == LAZY_SENTINEL) {
        global.regexp = global.getBuiltinRegExp();
    }
    return global.regexp;
}
 
Example #8
Source File: Global.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the Nashorn extension: Java access - global.javaImporter.
 *
 * @param self self reference
 * @return the value of the JavaImporter property
 */
@Getter(name = "JavaImporter", attributes = Attribute.NOT_ENUMERABLE)
public static Object getJavaImporter(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.javaImporter == LAZY_SENTINEL) {
        global.javaImporter = global.getBuiltinJavaImporter();
    }
    return global.javaImporter;
}
 
Example #9
Source File: Global.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for ECMA 15.1.4.7 Date property
 *
 * @param self self reference
 * @return Date property value
 */
@Getter(name = "Date", attributes = Attribute.NOT_ENUMERABLE)
public static Object getDate(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.date == LAZY_SENTINEL) {
        global.date = global.getBuiltinDate();
    }
    return global.date;
}
 
Example #10
Source File: Global.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter of the Uint32Array property.
 *
 * @param self self reference
 * @return the value of the Uint32Array property
 */
@Getter(name = "Uint32Array", attributes = Attribute.NOT_ENUMERABLE)
public static Object getUint32Array(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.uint32Array == LAZY_SENTINEL) {
        global.uint32Array = global.getBuiltinUint32Array();
    }
    return global.uint32Array;
}
 
Example #11
Source File: Global.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter of the Uint32Array property.
 *
 * @param self self reference
 * @return the value of the Uint32Array property
 */
@Getter(name = "Uint32Array", attributes = Attribute.NOT_ENUMERABLE)
public static Object getUint32Array(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.uint32Array == LAZY_SENTINEL) {
        global.uint32Array = global.getBuiltinUint32Array();
    }
    return global.uint32Array;
}
 
Example #12
Source File: Global.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the Float32Array property.
 *
 * @param self self reference
 * @return the value of the Float32Array property
 */
@Getter(name = "Float32Array", attributes = Attribute.NOT_ENUMERABLE)
public static Object getFloat32Array(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.float32Array == LAZY_SENTINEL) {
        global.float32Array = global.getBuiltinFloat32Array();
    }
    return global.float32Array;
}
 
Example #13
Source File: Global.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the Float64Array property.
 *
 * @param self self reference
 * @return the value of the Float64Array property
 */
@Getter(name = "Float64Array", attributes = Attribute.NOT_ENUMERABLE)
public static Object getFloat64Array(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.float64Array == LAZY_SENTINEL) {
        global.float64Array = global.getBuiltinFloat64Array();
    }
    return global.float64Array;
}
 
Example #14
Source File: Global.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the Int16Array property.
 * @param self self reference
 * @return the value of the Int16Array property
 */
@Getter(name = "Int16Array", attributes = Attribute.NOT_ENUMERABLE)
public static Object getInt16Array(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.int16Array == LAZY_SENTINEL) {
        global.int16Array = global.getBuiltinInt16Array();
    }
    return global.int16Array;
}
 
Example #15
Source File: Global.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the Nashorn extension: global.Java property.
 *
 * @param self self reference
 * @return the value of the Java property
 */
@Getter(name = "Java", attributes = Attribute.NOT_ENUMERABLE)
public static Object getJavaApi(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.javaApi == LAZY_SENTINEL) {
        global.javaApi = global.getBuiltinJavaApi();
    }
    return global.javaApi;
}
 
Example #16
Source File: Global.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the Int32Array property.
 *
 * @param self self reference
 * @return the value of the Int32Array property
 */
@Getter(name = "Int32Array", attributes = Attribute.NOT_ENUMERABLE)
public static Object getInt32Array(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.int32Array == LAZY_SENTINEL) {
        global.int32Array = global.getBuiltinInt32Array();
    }
    return global.int32Array;
}
 
Example #17
Source File: NativeArray.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Length getter
 * @param self self reference
 * @return the length of the object
 */
@Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
public static Object length(final Object self) {
    if (isArray(self)) {
        final long length = ((ScriptObject) self).getArray().length();
        assert length >= 0L;
        // Cast to the narrowest supported numeric type to help optimistic type calculator
        if (length <= Integer.MAX_VALUE) {
            return (int) length;
        }
        return (double) length;
    }

    return 0;
}
 
Example #18
Source File: Global.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the Uin8Array property.
 * @param self self reference
 * @return the value of the Uint8Array property
 */
@Getter(name = "Uint8Array", attributes = Attribute.NOT_ENUMERABLE)
public static Object getUint8Array(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.uint8Array == LAZY_SENTINEL) {
        global.uint8Array = global.getBuiltinUint8Array();
    }
    return global.uint8Array;
}
 
Example #19
Source File: Global.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for ECMA 15.12 - The JSON property
 * @param self self reference
 * @return the value of JSON property
 */
@Getter(name = "JSON", attributes = Attribute.NOT_ENUMERABLE)
public static Object getJSON(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.json == LAZY_SENTINEL) {
        global.json = global.getBuiltinJSON();
    }
    return global.json;
}
 
Example #20
Source File: Global.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the Int8Array property.
 * @param self self reference
 * @return the value of the Int8Array property.
 */
@Getter(name = "Int8Array", attributes = Attribute.NOT_ENUMERABLE)
public static Object getInt8Array(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.int8Array == LAZY_SENTINEL) {
        global.int8Array = global.getBuiltinInt8Array();
    }
    return global.int8Array;
}
 
Example #21
Source File: Global.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the DataView property.
 * @param self self reference
 * @return the value of the DataView property
 */
@Getter(name = "DataView", attributes = Attribute.NOT_ENUMERABLE)
public static Object getDataView(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.dataView == LAZY_SENTINEL) {
        global.dataView = global.getBuiltinDataView();
    }
    return global.dataView;
}
 
Example #22
Source File: Global.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the ArrayBuffer property.
 * @param self self reference
 * @return the value of the ArrayBuffer property
 */
@Getter(name = "ArrayBuffer", attributes = Attribute.NOT_ENUMERABLE)
public static Object getArrayBuffer(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.arrayBuffer == LAZY_SENTINEL) {
        global.arrayBuffer = global.getBuiltinArrayBuffer();
    }
    return global.arrayBuffer;
}
 
Example #23
Source File: Global.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the URIError property.
 * @param self self reference
 * @return the value of URIError property
 */
@Getter(name = "URIError", attributes = Attribute.NOT_ENUMERABLE)
public static Object getURIError(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.uriError == LAZY_SENTINEL) {
        global.uriError = global.getBuiltinURIError();
    }
    return global.uriError;
}
 
Example #24
Source File: Global.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the DataView property.
 * @param self self reference
 * @return the value of the DataView property
 */
@Getter(name = "DataView", attributes = Attribute.NOT_ENUMERABLE)
public static Object getDataView(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.dataView == LAZY_SENTINEL) {
        global.dataView = global.getBuiltinDataView();
    }
    return global.dataView;
}
 
Example #25
Source File: Global.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the RangeError property.
 * @param self self reference
 * @return the value of RangeError property
 */
@Getter(name = "RangeError", attributes = Attribute.NOT_ENUMERABLE)
public static Object getRangeError(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.rangeError == LAZY_SENTINEL) {
        global.rangeError = global.getBuiltinRangeError();
    }
    return global.rangeError;
}
 
Example #26
Source File: Global.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the EvalError property
 * @param self self reference
 * @return the value of EvalError property
 */
@Getter(name = "EvalError", attributes = Attribute.NOT_ENUMERABLE)
public static Object getEvalError(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.evalError == LAZY_SENTINEL) {
        global.evalError = global.getBuiltinEvalError();
    }
    return global.evalError;
}
 
Example #27
Source File: Global.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for Nashorn extension: global.JSAdapter
 * @param self self reference
 * @return value of the JSAdapter property
 */
@Getter(name = "JSAdapter", attributes = Attribute.NOT_ENUMERABLE)
public static Object getJSAdapter(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.jsadapter == LAZY_SENTINEL) {
        global.jsadapter = global.getBuiltinJSAdapter();
    }
    return global.jsadapter;
}
 
Example #28
Source File: Global.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for ECMA 15.12 - The JSON property
 * @param self self reference
 * @return the value of JSON property
 */
@Getter(name = "JSON", attributes = Attribute.NOT_ENUMERABLE)
public static Object getJSON(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.json == LAZY_SENTINEL) {
        global.json = global.getBuiltinJSON();
    }
    return global.json;
}
 
Example #29
Source File: NativeRegExpExecResult.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Length getter
 * @param self self reference
 * @return length property value
 */
@Getter(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
public static Object length(final Object self) {
    if (self instanceof ScriptObject) {
        return (double) JSType.toUint32(((ScriptObject)self).getArray().length());
    }

    return 0;
}
 
Example #30
Source File: Global.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Getter for the Uin8Array property.
 * @param self self reference
 * @return the value of the Uint8Array property
 */
@Getter(name = "Uint8Array", attributes = Attribute.NOT_ENUMERABLE)
public static Object getUint8Array(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.uint8Array == LAZY_SENTINEL) {
        global.uint8Array = global.getBuiltinUint8Array();
    }
    return global.uint8Array;
}