当前位置: 首页>>代码示例>>Java>>正文


Java IdScriptableObject类代码示例

本文整理汇总了Java中org.mozilla.javascript.IdScriptableObject的典型用法代码示例。如果您正苦于以下问题:Java IdScriptableObject类的具体用法?Java IdScriptableObject怎么用?Java IdScriptableObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IdScriptableObject类属于org.mozilla.javascript包,在下文中一共展示了IdScriptableObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isSupportedType

import org.mozilla.javascript.IdScriptableObject; //导入依赖的package包/类
private boolean isSupportedType( Object obValue )
{
	if ( obValue instanceof Scriptable )
	{
		if ( obValue instanceof IdScriptableObject )
		{
			IdScriptableObject jsObject = ( (IdScriptableObject) obValue );
			if ( jsObject.getClassName( ).equals( "Date" ) )
			{
				return true;
			}
			return false;
		}
		else if ( obValue instanceof NativeJavaObject )
		{
			return true;
		}
		return false;
	}
	return IOUtil.getTypeIndex( obValue ) != -1;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:22,代码来源:DynamicTextItemExecutor.java

示例2: getForJavaConversionConfidence

import org.mozilla.javascript.IdScriptableObject; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public int getForJavaConversionConfidence(final Class<?> valueInstanceClass, final Class<?> expectedClass)
{
    final int confidence;

    if (IdScriptableObject.class.isAssignableFrom(valueInstanceClass) && expectedClass.isAssignableFrom(Map.class))
    {
        confidence = LOW_CONFIDENCE;
    }
    else
    {
        confidence = LOWEST_CONFIDENCE;
    }

    return confidence;
}
 
开发者ID:AFaust,项目名称:alfresco-enhanced-script-environment,代码行数:20,代码来源:ScriptableObjectConverter.java

示例3: afterPropertiesSet

import org.mozilla.javascript.IdScriptableObject; //导入依赖的package包/类
/**
 *
 * {@inheritDoc}
 */
@Override
public void afterPropertiesSet()
{
    PropertyCheck.mandatory(this, "registry", this.registry);

    try
    {
        this.consStringClass = Class.forName("org.mozilla.javascript.ConsString");
        this.registry.registerValueInstanceConverter(this.consStringClass, this);
    }
    catch (final ClassNotFoundException cnfe)
    {
        LOGGER.info("Rhino ConsString class is not available - this is normal for an Alfresco release that does not include Rhino 1.7",
                cnfe);
    }

    this.registry.registerValueInstanceConverter(IdScriptableObject.class, this);
    this.registry.registerValueInstanceConverter(CharSequence.class, this);
}
 
开发者ID:AFaust,项目名称:alfresco-enhanced-script-environment,代码行数:24,代码来源:NativeAndConsStringConverter.java

示例4: getForJavaConversionConfidence

import org.mozilla.javascript.IdScriptableObject; //导入依赖的package包/类
/**
 *
 * {@inheritDoc}
 */
@Override
public int getForJavaConversionConfidence(final Class<?> valueInstanceClass, final Class<?> expectedClass)
{
    final int confidence;
    if ((IdScriptableObject.class.isAssignableFrom(valueInstanceClass) || (this.consStringClass != null && this.consStringClass
            .isAssignableFrom(valueInstanceClass))) && expectedClass.isAssignableFrom(String.class))
    {
        confidence = HIGHEST_CONFIDENCE;
    }
    else
    {
        confidence = LOWEST_CONFIDENCE;
    }
    return confidence;
}
 
开发者ID:AFaust,项目名称:alfresco-enhanced-script-environment,代码行数:20,代码来源:NativeAndConsStringConverter.java

示例5: preBasicDummy

import org.mozilla.javascript.IdScriptableObject; //导入依赖的package包/类
/**
 * @throws BirtException
 */
private void preBasicDummy( ) throws BirtException
{
	IQueryResults qr = myPreDataEngine.getQueryResults( queryResultID );
	assert ( qr.getResultMetaData( ) != null );

	IResultIterator ri = qr.getResultIterator( );
	assert ( ri.getResultMetaData( ) != null );

	Iterator it = this.expectedValue.iterator( );

	while ( ri.next( ) )
	{
		String str = "";
		Object ob1 = it.next( );
		Object ob2 = ri.getValue( dummyRowExprName );
		
		if ( ob1 instanceof IdScriptableObject )
		{
			ob1 = JavascriptEvalUtil.convertJavascriptValue( ob1 );
			ob2 = JavascriptEvalUtil.convertJavascriptValue( ob2 );
		}
		
		assertEquals( ob1, ob2 );
		str += " " + ob2.toString( );
		this.testOut.println( "row result set: " + str );
	}

	assertTrue( ri.getResultMetaData( ) != null );
	ri.close( );
	myPreDataEngine.shutdown( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:35,代码来源:ReportDocumentTest.java

示例6: testNativeDate

import org.mozilla.javascript.IdScriptableObject; //导入依赖的package包/类
/**
 * Test java script object I/O
 * @throws IOException
 */
@Test
   public void testNativeDate( ) throws IOException
{
	final int size = 1000;
	ByteArrayOutputStream bos = null;
	DataOutputStream dos = null;
	byte[] content = null;
	ByteArrayInputStream bis = null;
	DataInputStream dis = null;
	
	bos = new ByteArrayOutputStream( size );
	dos = new DataOutputStream( bos );
	
	Context cx = Context.enter( );
	Scriptable sharedScope = new ImporterTopLevel( cx );		
	Object ob = cx.evaluateString( sharedScope, "new Date", null, -1, null );
			
	IOUtil.writeObject( dos, ob );
	content = bos.toByteArray( );
	bis = new ByteArrayInputStream( content );
	dis = new DataInputStream( bis );
	Object ob2 = IOUtil.readObject( dis );
	
	assertTrue( ob instanceof IdScriptableObject );
	assertTrue( ob2 instanceof IdScriptableObject );
	
	assertEquals( JavascriptEvalUtil.convertJavascriptValue( ob ),
			JavascriptEvalUtil.convertJavascriptValue( ob2 ) );
	
	Context.exit( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:36,代码来源:IOUtilTest.java

示例7: afterPropertiesSet

import org.mozilla.javascript.IdScriptableObject; //导入依赖的package包/类
/**
 *
 * {@inheritDoc}
 */
@Override
public void afterPropertiesSet()
{
    PropertyCheck.mandatory(this, "registry", this.registry);

    this.registry.registerValueInstanceConverter(Date.class, this);
    this.registry.registerValueInstanceConverter(IdScriptableObject.class, this);
}
 
开发者ID:AFaust,项目名称:alfresco-enhanced-script-environment,代码行数:13,代码来源:DateConverter.java

示例8: getForJavaConversionConfidence

import org.mozilla.javascript.IdScriptableObject; //导入依赖的package包/类
/**
 *
 * {@inheritDoc}
 */
@Override
public int getForJavaConversionConfidence(final Class<?> valueInstanceClass, final Class<?> expectedClass)
{
    final int confidence;
    if (IdScriptableObject.class.isAssignableFrom(valueInstanceClass) && expectedClass.isAssignableFrom(Date.class))
    {
        confidence = MEDIUM_CONFIDENCE;
    }
    else
    {
        confidence = LOWEST_CONFIDENCE;
    }
    return confidence;
}
 
开发者ID:AFaust,项目名称:alfresco-enhanced-script-environment,代码行数:19,代码来源:DateConverter.java

示例9: canConvertValueForJava

import org.mozilla.javascript.IdScriptableObject; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public boolean canConvertValueForJava(final Object value, final ValueConverter globalDelegate, final Class<?> expectedClass)
{
    final boolean canConvert = value instanceof IdScriptableObject && TYPE_DATE.equals(((IdScriptableObject) value).getClassName())
            && expectedClass.isAssignableFrom(Date.class);
    return canConvert;
}
 
开发者ID:AFaust,项目名称:alfresco-enhanced-script-environment,代码行数:11,代码来源:DateConverter.java

示例10: getForScriptConversionConfidence

import org.mozilla.javascript.IdScriptableObject; //导入依赖的package包/类
/**
 *
 * {@inheritDoc}
 */
@Override
public int getForScriptConversionConfidence(final Class<?> valueInstanceClass, final Class<?> expectedClass)
{
    final int confidence;
    if (Date.class.isAssignableFrom(valueInstanceClass) && expectedClass.isAssignableFrom(IdScriptableObject.class))
    {
        confidence = MEDIUM_CONFIDENCE;
    }
    else
    {
        confidence = LOWEST_CONFIDENCE;
    }
    return confidence;
}
 
开发者ID:AFaust,项目名称:alfresco-enhanced-script-environment,代码行数:19,代码来源:DateConverter.java

示例11: canConvertValueForScript

import org.mozilla.javascript.IdScriptableObject; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public boolean canConvertValueForScript(final Object value, final ValueConverter globalDelegate, final Class<?> expectedClass)
{
    final boolean canConvert = value instanceof Date && expectedClass.isAssignableFrom(IdScriptableObject.class);
    return canConvert;
}
 
开发者ID:AFaust,项目名称:alfresco-enhanced-script-environment,代码行数:10,代码来源:DateConverter.java

示例12: afterPropertiesSet

import org.mozilla.javascript.IdScriptableObject; //导入依赖的package包/类
/**
 *
 * {@inheritDoc}
 */
@Override
public void afterPropertiesSet()
{
    PropertyCheck.mandatory(this, "registry", this.registry);

    this.registry.registerValueInstanceConverter(IdScriptableObject.class, this);
}
 
开发者ID:AFaust,项目名称:alfresco-enhanced-script-environment,代码行数:12,代码来源:ScriptableObjectConverter.java

示例13: canConvertValueForJava

import org.mozilla.javascript.IdScriptableObject; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public boolean canConvertValueForJava(final Object value, final ValueConverter globalDelegate, final Class<?> expectedClass)
{
    boolean canConvert = value instanceof IdScriptableObject && expectedClass.isAssignableFrom(Map.class);

    if (canConvert)
    {
        final IdScriptableObject object = (IdScriptableObject) value;
        final Object[] propIds = object.getIds();
        for (int i = 0; i < propIds.length; i++)
        {
            // work on each key in turn
            final Object propId = propIds[i];

            // we are only interested in keys that indicate a list of values
            if (propId instanceof String)
            {
                // get the value out for the specified key
                final Object val = object.get((String) propId, object);
                canConvert = canConvert && globalDelegate.canConvertValueForJava(val);
            }
        }
    }

    return canConvert;
}
 
开发者ID:AFaust,项目名称:alfresco-enhanced-script-environment,代码行数:30,代码来源:ScriptableObjectConverter.java

示例14: convertValueForJava

import org.mozilla.javascript.IdScriptableObject; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Object convertValueForJava(final Object value, final ValueConverter globalDelegate, final Class<?> expectedClass)
{
    if (!(value instanceof IdScriptableObject))
    {
        throw new IllegalArgumentException("value must be a IdScriptableObject");
    }

    final IdScriptableObject object = (IdScriptableObject) value;

    final Object[] propIds = object.getIds();
    final Map<String, Object> propValues = new HashMap<String, Object>(propIds.length);
    for (int i = 0; i < propIds.length; i++)
    {
        // work on each key in turn
        final Object propId = propIds[i];

        // we are only interested in keys that indicate a list of values
        if (propId instanceof String)
        {
            // get the value out for the specified key
            final Object val = object.get((String) propId, object);
            // recursively call this method to convert the value
            propValues.put((String) propId, globalDelegate.convertValueForJava(val));
        }
    }

    return propValues;
}
 
开发者ID:AFaust,项目名称:alfresco-enhanced-script-environment,代码行数:33,代码来源:ScriptableObjectConverter.java

示例15: canConvertValueForJava

import org.mozilla.javascript.IdScriptableObject; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public boolean canConvertValueForJava(final Object value, final ValueConverter globalDelegate, final Class<?> expectedClass)
{
    final boolean canConvert = (((value instanceof IdScriptableObject && "String".equals(((IdScriptableObject) value).getClassName())) || (this.consStringClass != null && this.consStringClass
            .isInstance(value)))) && expectedClass.isAssignableFrom(String.class);
    return canConvert;
}
 
开发者ID:AFaust,项目名称:alfresco-enhanced-script-environment,代码行数:11,代码来源:NativeAndConsStringConverter.java


注:本文中的org.mozilla.javascript.IdScriptableObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。