本文整理汇总了Java中jsinterop.base.Js.isTripleEqual方法的典型用法代码示例。如果您正苦于以下问题:Java Js.isTripleEqual方法的具体用法?Java Js.isTripleEqual怎么用?Java Js.isTripleEqual使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jsinterop.base.Js
的用法示例。
在下文中一共展示了Js.isTripleEqual方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isObjectShallowModified
import jsinterop.base.Js; //导入方法依赖的package包/类
/**
* We assume the two objects passed are js objects and we compare the objects have the same key-value
* pairs skipping keys in the skip list.
*
* @param o1 the first object.
* @param o2 the second object.
* @param skipList an array of keys to ignore during comparison.
* @return true if the two objects are considered modified.
*/
public static boolean isObjectShallowModified( @Nullable final Object o1,
@Nullable final Object o2,
@Nonnull final String... skipList )
{
if ( null == o1 || null == o2 || !Js.typeof( o1 ).equals( "object" ) || !Js.typeof( o2 ).equals( "object" ) )
{
return !Js.isTripleEqual( o1, o2 );
}
final String[] keys = JsObject.keys( Js.uncheckedCast( o1 ) );
if ( 0 == skipList.length && JsObject.keys( Js.uncheckedCast( o2 ) ).length != keys.length )
{
return true;
}
for ( final String key : keys )
{
if ( !shouldSkip( key, skipList ) &&
!Js.isTripleEqual( Js.asPropertyMap( o1 ).get( key ), Js.asPropertyMap( o2 ).get( key ) ) )
{
return true;
}
}
return false;
}
示例2: shouldComponentUpdate
import jsinterop.base.Js; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected boolean shouldComponentUpdate( @Nullable final P nextProps,
@Nullable final BaseState nextState,
@Nullable final C nextContext )
{
if ( hasRenderDepsChanged() )
{
return true;
}
//noinspection SimplifiableIfStatement
if ( !Js.isTripleEqual( super.state(), nextState ) )
{
// If state is not identical then we need to re-render ...
// Previously we chose not to re-render if only AREZ_STATE_KEY that was updated but that
// meant deps in DevTools would not be update so now we just re-render anyway.
return true;
}
else
{
/*
* We just compare the props shallowly and avoid a re-render if the props have not changed.
*/
final boolean modified = JsUtil.isObjectShallowModified( super.props(), nextProps );
if ( modified )
{
reportPropsChanged();
}
return modified;
}
}
示例3: handleValue
import jsinterop.base.Js; //导入方法依赖的package包/类
/**
* Return the transformed value for key-value pair.
*
* @param key the name of the field.
* @param value the value to transform.
* @return the transformed value.
*/
@Nullable
public Object handleValue( @Nonnull final String key, @Nullable final Object value )
{
if ( null == value )
{
return null;
}
else if ( isJavaClass( value ) )
{
return String.valueOf( value );
}
else if ( Js.typeof( value ).equals( "function" ) )
{
return Js.asPropertyMap( value ).get( "name" );
}
else if ( !Js.typeof( value ).equals( "object" ) )
{
return value;
}
else
{
for ( int i = 0; i < _array.getLength(); i++ )
{
if ( Js.isTripleEqual( value, _array.getAnyAt( i ) ) )
{
return "[Circular]";
}
}
_array.setAt( _array.getLength(), value );
final String[] propertyNames = getPropertyNames( value );
final JsPropertyMap<Object> map = JsPropertyMap.of();
for ( final String propertyName : propertyNames )
{
map.set( propertyName, Js.asPropertyMap( value ).getAny( propertyName ) );
}
return map;
}
}