Added ScriptableObject.equivalentValues to allow for custom equality operator support.

This commit is contained in:
igor%mir2.org 2004-07-28 15:23:11 +00:00
Родитель eca6887020
Коммит 104a577692
1 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -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.
*