зеркало из https://github.com/mozilla/pjs.git
Added ScriptableObject.equivalentValues to allow for custom equality operator support.
This commit is contained in:
Родитель
eca6887020
Коммит
104a577692
|
@ -636,6 +636,23 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
|
|||
return ScriptRuntime.jsDelegatesTo(instance, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom <tt>==</tt> operator.
|
||||
* Should return <tt>null</tt> if this object does not have custom equality
|
||||
* operator for the given value,
|
||||
* <tt>Boolean.TRUE</tt> if this object is equivalent to <tt>value</tt>,
|
||||
* <tt>Boolean.FALSE</tt> if this object is not equivalent to
|
||||
* <tt>value</tt>.
|
||||
* <p>
|
||||
* The default implementation returns Boolean.TRUE
|
||||
* if <tt>this == value</tt> or null otherwise to indicate no custom
|
||||
* equality is available unless <tt>value</tt> is <tt>this</tt>.
|
||||
*/
|
||||
public Boolean equivalentValues(Object value)
|
||||
{
|
||||
return (this == value) ? Boolean.TRUE : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines JavaScript objects from a Java class that implements Scriptable.
|
||||
*
|
||||
|
|
Загрузка…
Ссылка в новой задаче