elemental2.core.JsObject Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elemental2-core Show documentation
Show all versions of elemental2-core Show documentation
Thin Java abstractions for the standard built-in objects for Javascript.
The newest version!
/*
* 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;
}
}
@JsType(isNative = true, name = "?", namespace = JsPackage.GLOBAL)
public interface HasOwnPropertyNameUnionType {
@JsOverlay
static JsObject.HasOwnPropertyNameUnionType 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 PropertyIsEnumerablePropertyNameUnionType {
@JsOverlay
static JsObject.PropertyIsEnumerablePropertyNameUnionType 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, JsPropertyMap> properties);
public static native JsObject create(JsObject proto);
@JsOverlay
public static final JsObject create(
Object proto, JsPropertyMap> properties) {
return create(Js.uncheckedCast(proto), properties);
}
@JsOverlay
public static final JsObject create(Object proto) {
return create(Js.uncheckedCast(proto));
}
public static native T defineProperties(
T obj, JsPropertyMap> props);
public static native T defineProperty(
T obj, JsObject.DefinePropertyPropUnionType prop, ObjectPropertyDescriptor descriptor);
@JsOverlay
public static final T defineProperty(
T obj, Object prop, ObjectPropertyDescriptor descriptor) {
return defineProperty(
obj, Js.uncheckedCast(prop), descriptor);
}
@JsOverlay
public static final T defineProperty(
T obj, String prop, ObjectPropertyDescriptor descriptor) {
return defineProperty(
obj, Js.uncheckedCast(prop), 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