elemental2.core.JsObject Maven / Gradle / Ivy
/*
* Copyright 2018 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package elemental2.core;
import jsinterop.annotations.JsMethod;
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;
import jsinterop.base.Js;
import jsinterop.base.JsPropertyMap;
@JsType(isNative = true, name = "Object", namespace = JsPackage.GLOBAL)
public class JsObject {
@JsType(isNative = true, name = "?", namespace = JsPackage.GLOBAL)
public interface DefinePropertyPropUnionType {
@JsOverlay
static JsObject.DefinePropertyPropUnionType of(Object o) {
return Js.cast(o);
}
@JsOverlay
default Object asObject() {
return Js.cast(this);
}
@JsOverlay
default String asString() {
return Js.asString(this);
}
@JsOverlay
default boolean isObject() {
return (Object) this instanceof Object;
}
@JsOverlay
default boolean isString() {
return (Object) this instanceof String;
}
}
@JsType(isNative = true, name = "?", namespace = JsPackage.GLOBAL)
public interface EntriesArrayArrayUnionType {
@JsOverlay
static JsObject.EntriesArrayArrayUnionType of(Object o) {
return Js.cast(o);
}
@JsOverlay
default String asString() {
return Js.asString(this);
}
@JsOverlay
default T asT() {
return Js.cast(this);
}
@JsOverlay
default boolean isString() {
return (Object) this instanceof String;
}
}
@JsType(isNative = true, name = "?", namespace = JsPackage.GLOBAL)
public interface GetOwnPropertyDescriptorPropUnionType {
@JsOverlay
static JsObject.GetOwnPropertyDescriptorPropUnionType of(Object o) {
return Js.cast(o);
}
@JsOverlay
default Object asObject() {
return Js.cast(this);
}
@JsOverlay
default String asString() {
return Js.asString(this);
}
@JsOverlay
default boolean isObject() {
return (Object) this instanceof Object;
}
@JsOverlay
default boolean isString() {
return (Object) this instanceof String;
}
}
public static native JsObject assign(JsObject target, JsObject... var_args);
@JsOverlay
public static final JsObject assign(Object target, Object... var_args) {
return assign(Js.uncheckedCast(target), Js.uncheckedCast(var_args));
}
public static native JsObject create(JsObject proto, JsObject properties);
public static native JsObject create(JsObject proto);
@JsOverlay
public static final JsObject create(Object proto, Object properties) {
return create(Js.uncheckedCast(proto), Js.uncheckedCast(properties));
}
@JsOverlay
public static final JsObject create(Object proto) {
return create(Js.uncheckedCast(proto));
}
public static native JsObject defineProperties(JsObject obj, JsObject props);
@JsOverlay
public static final JsObject defineProperties(Object obj, Object props) {
return defineProperties(Js.uncheckedCast(obj), Js.uncheckedCast(props));
}
public static native JsObject defineProperty(
JsObject obj, JsObject.DefinePropertyPropUnionType prop, JsObject descriptor);
@JsOverlay
public static final JsObject defineProperty(JsObject obj, Object prop, JsObject descriptor) {
return defineProperty(
obj, Js.uncheckedCast(prop), descriptor);
}
@JsOverlay
public static final JsObject defineProperty(JsObject obj, String prop, JsObject descriptor) {
return defineProperty(
obj, Js.uncheckedCast(prop), descriptor);
}
@JsOverlay
public static final JsObject defineProperty(
Object obj, JsObject.DefinePropertyPropUnionType prop, Object descriptor) {
return defineProperty(
Js.uncheckedCast(obj), prop, Js.uncheckedCast(descriptor));
}
@JsOverlay
public static final JsObject defineProperty(Object obj, Object prop, Object descriptor) {
return defineProperty(
Js.uncheckedCast(obj), prop, Js.uncheckedCast(descriptor));
}
@JsOverlay
public static final JsObject defineProperty(Object obj, String prop, Object descriptor) {
return defineProperty(
Js.uncheckedCast(obj), prop, Js.uncheckedCast(descriptor));
}
public static native JsArray>> entries(
JsPropertyMap obj);
public static native T freeze(T obj);
public static native JsObject fromEntries(JsIterable
© 2015 - 2025 Weber Informatics LLC | Privacy Policy