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

The following are top voted examples for showing how to use jdk.nashorn.internal.objects.annotations.Getter. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenJSharp   File: NativeRegExpExecResult.java   Source Code and License 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 JSType.toUint32(((ScriptObject)self).getArray().length());
    }

    return 0;
}
 
Example 2
Project: OpenJSharp   File: NativeArray.java   Source Code and License 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 3
Project: openjdk-jdk10   File: NativeRegExpExecResult.java   Source Code and License 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 4
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 5
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 6
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 7
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 8
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 9
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 10
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 11
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 12
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 13
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 14
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 15
Project: openjdk-jdk10   File: Global.java   Source Code and License 5 votes vote down vote up
/**
 * Getter for the Uint8ClampedArray property.
 * @param self self reference
 * @return the value of the Uint8ClampedArray property
 */
@Getter(name = "Uint8ClampedArray", attributes = Attribute.NOT_ENUMERABLE)
public static Object getUint8ClampedArray(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.uint8ClampedArray == LAZY_SENTINEL) {
        global.uint8ClampedArray = global.getBuiltinUint8ClampedArray();
    }
    return global.uint8ClampedArray;
}
 
Example 16
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 17
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 18
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 19
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 20
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 21
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 22
Project: openjdk-jdk10   File: Global.java   Source Code and License 5 votes vote down vote up
/**
 * Getter for the Symbol property.
 *
 * @param self self reference
 * @return  the value of the Symbol property
 */
@Getter(name = "Symbol", attributes = Attribute.NOT_ENUMERABLE)
public static Object getSymbol(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.symbol == LAZY_SENTINEL) {
        global.symbol = global.getBuiltinSymbol();
    }
    return global.symbol;
}
 
Example 23
Project: openjdk-jdk10   File: Global.java   Source Code and License 5 votes vote down vote up
/**
 * Getter for the Map property.
 *
 * @param self self reference
 * @return  the value of the Map property
 */
@Getter(name = "Map", attributes = Attribute.NOT_ENUMERABLE)
public static Object getMap(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.map == LAZY_SENTINEL) {
        global.map = global.getBuiltinMap();
    }
    return global.map;
}
 
Example 24
Project: openjdk-jdk10   File: Global.java   Source Code and License 5 votes vote down vote up
/**
 * Getter for the WeakMap property.
 *
 * @param self self reference
 * @return  the value of the WeakMap property
 */
@Getter(name = "WeakMap", attributes = Attribute.NOT_ENUMERABLE)
public static Object getWeakMap(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.weakMap == LAZY_SENTINEL) {
        global.weakMap = global.getBuiltinWeakMap();
    }
    return global.weakMap;
}
 
Example 25
Project: openjdk-jdk10   File: Global.java   Source Code and License 5 votes vote down vote up
/**
 * Getter for the Set property.
 *
 * @param self self reference
 * @return  the value of the Set property
 */
@Getter(name = "Set", attributes = Attribute.NOT_ENUMERABLE)
public static Object getSet(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.set == LAZY_SENTINEL) {
        global.set = global.getBuiltinSet();
    }
    return global.set;
}
 
Example 26
Project: openjdk-jdk10   File: Global.java   Source Code and License 5 votes vote down vote up
/**
 * Getter for the WeakSet property.
 *
 * @param self self reference
 * @return  the value of the WeakSet property
 */
@Getter(name = "WeakSet", attributes = Attribute.NOT_ENUMERABLE)
public static Object getWeakSet(final Object self) {
    final Global global = Global.instanceFrom(self);
    if (global.weakSet == LAZY_SENTINEL) {
        global.weakSet = global.getBuiltinWeakSet();
    }
    return global.weakSet;
}
 
Example 27
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 28
Project: openjdk-jdk10   File: Global.java   Source Code and License 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 29
Project: openjdk-jdk10   File: NativeArray.java   Source Code and License 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 30
Project: openjdk9   File: Global.java   Source Code and License 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 31
Project: openjdk9   File: Global.java   Source Code and License 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 32
Project: openjdk9   File: Global.java   Source Code and License 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 33
Project: openjdk9   File: Global.java   Source Code and License 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 34
Project: openjdk9   File: Global.java   Source Code and License 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 35
Project: openjdk9   File: Global.java   Source Code and License 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 36
Project: jdk8u_nashorn   File: NativeRegExpExecResult.java   Source Code and License 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 37
Project: lookaside_java-1.8.0-openjdk   File: Global.java   Source Code and License 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 38
Project: openjdk9   File: Global.java   Source Code and License 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 39
Project: openjdk9   File: Global.java   Source Code and License 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 40
Project: openjdk9   File: Global.java   Source Code and License 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;
}