/** * Implements the [[DefaultValue]] internal method. * * <p>Note that the toPrimitive conversion is a no-op for * every type other than Object, for which [[DefaultValue]] * is called. See ECMA 9.1.<p> * * A <code>hint</code> of null means "no hint". * * @param typeHint the type hint * @return the default value for the object * * See ECMA 8.6.2.6. */ public Object getDefaultValue(Class<?> typeHint) { return getDefaultValue(this, typeHint); }
/** * {@inheritDoc} * @see ScriptableObject#getDefaultValue(java.lang.Class) */ @Override public Object getDefaultValue(final Class<?> hint) { if (String.class.equals(hint) || hint == null) { return jsToString(); } return super.getDefaultValue(hint); }
/** * {@inheritDoc} * @see ScriptableObject#getDefaultValue(java.lang.Class) */ @Override public Object getDefaultValue(final Class< ? > hint) { if (String.class.equals(hint) || hint == null) { return jsToString(); } return super.getDefaultValue(hint); }
/** * {@inheritDoc} * @see ScriptableObject#getDefaultValue(java.lang.Class) */ @Override public Object getDefaultValue(final Class< ? > hint) { if (String.class.equals(hint) || hint == null) { return jsToString(); } return super.getDefaultValue(hint); }
/** * {@inheritDoc} * @see ScriptableObject#getDefaultValue(java.lang.Class) */ @Override public Object getDefaultValue(final Class< ? > hint) { if (String.class.equals(hint) || hint == null) { return jsToString(); } return super.getDefaultValue(hint); }
/** * {@inheritDoc} * @see ScriptableObject#getDefaultValue(java.lang.Class) */ @Override public Object getDefaultValue(final Class<?> hint) { if (String.class.equals(hint) || hint == null) { return jsToString(); } return super.getDefaultValue(hint); }
/** * Returns the JavaScript default value of this object. This is the JavaScript equivalent of a toString() in Java. * * @param hint a hint as to the format of the default value (ignored in this case) * @return the default value */ @Override public Object getDefaultValue(final Class< ? > hint) { if (String.class.equals(hint) || hint == null) { // TODO: shouldn't we handle this with BrowserVersion.hasFeature? if (getBrowserVersion().isIE()) { return "[object]"; // the super helpful IE solution } else if (getBrowserVersion().getBrowserVersionNumeric() >= 3) { // Firefox 3 return "[object " + getClassName() + "]"; } else { // Firefox2 is not fully coherent here (see WindowTest#windowProperties) final Window window = (Window) getTopLevelScope(this); if (ScriptableObject.getProperty(window, getClassName()) == this) { return "[" + getClassName() + "]"; } return "[object " + getClassName() + "]"; } } return super.getDefaultValue(hint); }
/** * Returns the JavaScript default value of this object. This is the JavaScript equivalent of a toString() in Java. * * @param hint a hint as to the format of the default value (ignored in this case) * @return the default value */ @Override public Object getDefaultValue(final Class< ? > hint) { if (String.class.equals(hint) || hint == null) { // TODO: shouldn't we handle this with BrowserVersion.hasFeature? if (getBrowserVersion().isIE()) { return "[object]"; // the super helpful IE solution } else if (getBrowserVersion().getBrowserVersionNumeric() >= 3) { // Firefox 3 return "[object " + getClassName() + "]"; } else { // Firefox2 is not fully coherent here (see WindowTest#windowProperties) final Window window = (Window) getTopLevelScope(this); if (ScriptableObject.getProperty(window, getClassName()) == this) { return "[" + getClassName() + "]"; } return "[object " + getClassName() + "]"; } } return super.getDefaultValue(hint); }
/** * Returns the JavaScript default value of this object. This is the JavaScript equivalent of a toString() in Java. * * @param hint a hint as to the format of the default value (ignored in this case) * @return the default value */ @Override public Object getDefaultValue(final Class< ? > hint) { if (String.class.equals(hint) || hint == null) { // TODO: shouldn't we handle this with BrowserVersion.hasFeature? if (getBrowserVersion().isIE()) { return "[object]"; // the super helpful IE solution } else if (getBrowserVersion().getBrowserVersionNumeric() >= 3) { // Firefox 3 return "[object " + getClassName() + "]"; } else { // Firefox2 is not fully coherent here (see WindowTest#windowProperties) final Window window = (Window) getTopLevelScope(this); if (ScriptableObject.getProperty(window, getClassName()) == this) { return "[" + getClassName() + "]"; } return "[object " + getClassName() + "]"; } } return super.getDefaultValue(hint); }