java.lang.Object
org.apache.sling.scripting.sightly.js.impl.rhino.HybridObject
All Implemented Interfaces:
Record<Object>, org.mozilla.javascript.Scriptable

public class HybridObject extends Object implements org.mozilla.javascript.Scriptable, Record<Object>
Instances of this class can be used in both HTL & JavaScript scripts.
  • Constructor Details

    • HybridObject

      public HybridObject(org.mozilla.javascript.Scriptable scriptable, JsValueAdapter jsValueAdapter)
  • Method Details

    • getProperty

      public Object getProperty(String name)
      Description copied from interface: Record
      Gets the value of a specified property.
      Specified by:
      getProperty in interface Record<Object>
      Parameters:
      name - the name of the property
      Returns:
      the value of the property or null if this record does not have the specified property
    • getPropertyNames

      public Set<String> getPropertyNames()
      Description copied from interface: Record
      Gets the set of names for this record's properties.
      Specified by:
      getPropertyNames in interface Record<Object>
      Returns:
      this record's properties' names
    • getClassName

      public String getClassName()
      Specified by:
      getClassName in interface org.mozilla.javascript.Scriptable
    • get

      public Object get(String name, org.mozilla.javascript.Scriptable start)
      Specified by:
      get in interface org.mozilla.javascript.Scriptable
    • get

      public Object get(int index, org.mozilla.javascript.Scriptable start)
      Specified by:
      get in interface org.mozilla.javascript.Scriptable
    • has

      public boolean has(String name, org.mozilla.javascript.Scriptable start)
      Specified by:
      has in interface org.mozilla.javascript.Scriptable
    • has

      public boolean has(int index, org.mozilla.javascript.Scriptable start)
      Specified by:
      has in interface org.mozilla.javascript.Scriptable
    • put

      public void put(String name, org.mozilla.javascript.Scriptable start, Object value)
      Specified by:
      put in interface org.mozilla.javascript.Scriptable
    • put

      public void put(int index, org.mozilla.javascript.Scriptable start, Object value)
      Specified by:
      put in interface org.mozilla.javascript.Scriptable
    • delete

      public void delete(String name)
      Specified by:
      delete in interface org.mozilla.javascript.Scriptable
    • delete

      public void delete(int index)
      Specified by:
      delete in interface org.mozilla.javascript.Scriptable
    • getPrototype

      public org.mozilla.javascript.Scriptable getPrototype()
      Specified by:
      getPrototype in interface org.mozilla.javascript.Scriptable
    • setPrototype

      public void setPrototype(org.mozilla.javascript.Scriptable prototype)
      Specified by:
      setPrototype in interface org.mozilla.javascript.Scriptable
    • getParentScope

      public org.mozilla.javascript.Scriptable getParentScope()
      Specified by:
      getParentScope in interface org.mozilla.javascript.Scriptable
    • setParentScope

      public void setParentScope(org.mozilla.javascript.Scriptable parent)
      Specified by:
      setParentScope in interface org.mozilla.javascript.Scriptable
    • getIds

      public Object[] getIds()
      Specified by:
      getIds in interface org.mozilla.javascript.Scriptable
    • getDefaultValue

      public Object getDefaultValue(Class hint)
      Specified by:
      getDefaultValue in interface org.mozilla.javascript.Scriptable
    • hasInstance

      public boolean hasInstance(org.mozilla.javascript.Scriptable instance)
      Specified by:
      hasInstance in interface org.mozilla.javascript.Scriptable