當前位置: 首頁>>代碼示例>>Java>>正文


Java NativeArray.getIds方法代碼示例

本文整理匯總了Java中org.mozilla.javascript.NativeArray.getIds方法的典型用法代碼示例。如果您正苦於以下問題:Java NativeArray.getIds方法的具體用法?Java NativeArray.getIds怎麽用?Java NativeArray.getIds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.mozilla.javascript.NativeArray的用法示例。


在下文中一共展示了NativeArray.getIds方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setDatoMultivaluadoElemento

import org.mozilla.javascript.NativeArray; //導入方法依賴的package包/類
/**
 * Mete dato multivaluado para un elemento
 * @param indiceElemento Indice elemento
 * @param column Columna
 * @param data Dato
 */
public void setDatoMultivaluadoElemento(int indiceElemento,String column, NativeArray data){
	if (indiceElemento > elementos.size()) return;
	HashMap dataElemento = (HashMap) elementos.get(indiceElemento - 1);
	
	// Pasamos NativeArray a List
	List dataList = new ArrayList();
	Object [] ids = data.getIds();
	for ( int i = 0; i < ids.length; i++ )
	{
		Object valor = data.get( (( Integer ) ids[i] ).intValue() , data ); 
		dataList.add( valor.toString() );
	}
	
	// Guardamos datos		
	dataElemento.put(column,dataList);		
}
 
開發者ID:GovernIB,項目名稱:sistra,代碼行數:23,代碼來源:DatosListaElementos.java

示例2: expresionAutocalculoCampo

import org.mozilla.javascript.NativeArray; //導入方法依賴的package包/類
/**
 * Devuelve el valor de autocalcular un campo.
 * 
 * Devuelve un string para campos monovaluados o una lista (de strings) para campos multivaluados
 * 
 * @ejb.interface-method
 */
public Object expresionAutocalculoCampo(String nombre) {
    Campo campo = pantallaActual.findCampo(nombre);
    if (campo == null) return new ArrayList();

    String script = campo.getExpresionAutocalculo();
    if (script == null || script.trim().length() == 0) {
        return new ArrayList();
    }

    Object result = ScriptUtil.evalScript(script, variablesScriptActuals());
            
    if (result instanceof NativeArray) {
    	
    	List lstParams = new LinkedList();
    	
    	// Array de strings
    	NativeArray params = (NativeArray) result;        	
		if ( params != null )
		{
			Object [] ids = params.getIds();
			for ( int i = 0; i < ids.length; i++ )
			{
				Object valorParametro = params.get( (( Integer ) ids[i] ).intValue() , params ); 
				lstParams.add( valorParametro.toString() );
			}
		}     
		
		return lstParams;
    }else {
    	// Cadena simple
    	return ((result!=null?result.toString():""));        	
    }
 
}
 
開發者ID:GovernIB,項目名稱:sistra,代碼行數:42,代碼來源:InstanciaProcessorEJB.java

示例3: get_array

import org.mozilla.javascript.NativeArray; //導入方法依賴的package包/類
static Object[] get_array(String path, Object base) throws ObjectNotFoundException {
	NativeArray arr = (NativeArray)get_object(path, base);
	Object[] out = new Object[(int)arr.getLength()];
	int idx;
	for(Object o : arr.getIds()) out[idx = (Integer)o] = arr.get(idx, arr); 
	return out;
}
 
開發者ID:dzhw,項目名稱:metadatamanagement,代碼行數:8,代碼來源:JSHelper.java

示例4: get_string_array

import org.mozilla.javascript.NativeArray; //導入方法依賴的package包/類
static String[] get_string_array(String path, Object base) throws ObjectNotFoundException {
	NativeArray arr = (NativeArray)get_object(path, base);
	String[] out = new String[(int)arr.getLength()];
	int idx;
	for(Object o : arr.getIds()) out[idx = (Integer)o] = arr.get(idx, arr).toString(); 
	return out;
}
 
開發者ID:dzhw,項目名稱:metadatamanagement,代碼行數:8,代碼來源:JSHelper.java

示例5: jsConstructor

import org.mozilla.javascript.NativeArray; //導入方法依賴的package包/類
public static Scriptable jsConstructor(final Context ctx, final Object[] args, final Function ctor, final boolean newExpr) {
    if (args.length == 3 && args[0] instanceof NativeArray) {
        final List<List<Object>> data = new ArrayList<>();
        final NativeArray array = NativeArray.class.cast(args[2]);
        final Object[] ids = array.getIds();
        for (int i = 0; i < array.getLength(); i++) {
            data.add(asList(array.get((int)ids[i], null)));
        }
        return new DataFrameAdapter(
                new DataFrame<Object>(
                        asList(args[0]),
                        asList(args[1]),
                        data
                    )
            );
    } else if (args.length == 2 && args[0] instanceof NativeArray) {
        return new DataFrameAdapter(new DataFrame<Object>(
                asList(args[0]),
                asList(args[1])
            ));
    } else if (args.length == 1 && args[0] instanceof NativeArray) {
        return new DataFrameAdapter(new DataFrame<Object>(
                asList(args[0])
            ));
    } else if (args.length > 0) {
        final String[] columns = new String[args.length];
        for (int i = 0; i < args.length; i++) {
            columns[i] = Context.toString(args[i]);
        }
        return new DataFrameAdapter(new DataFrame<>(columns));
    }
    return new DataFrameAdapter(new DataFrame<>());
}
 
開發者ID:cardillo,項目名稱:joinery,代碼行數:34,代碼來源:DataFrameAdapter.java

示例6: asList

import org.mozilla.javascript.NativeArray; //導入方法依賴的package包/類
private static List<Object> asList(final NativeArray array) {
    final List<Object> list = new ArrayList<>((int)array.getLength());
    for (final Object id : array.getIds()) {
        list.add(array.get((int)id, null));
    }
    return list;
}
 
開發者ID:cardillo,項目名稱:joinery,代碼行數:8,代碼來源:DataFrameAdapter.java

示例7: convertScriptNodesArray

import org.mozilla.javascript.NativeArray; //導入方法依賴的package包/類
/**
 * converts the native array of scriptnodes to a list of noderefs
 *
 * @param scriptNodes
 * @return list of noderefs
 */
private List<NodeRef> convertScriptNodesArray(NativeArray scriptNodes) {
	List<NodeRef> nodes = new ArrayList<>();
	for (Object id : scriptNodes.getIds()) {
		int index = (Integer) id;
                       Object obj = scriptNodes.get(index);
                       if (obj instanceof NativeJavaObject) {
                           obj = ((NativeJavaObject) obj).unwrap();
                       }
		ScriptNode scriptNode = (ScriptNode) obj;
		nodes.add(scriptNode.getNodeRef());
	}
	return nodes;
}
 
開發者ID:jgoldhammer,項目名稱:alfresco-jscript-extensions,代碼行數:20,代碼來源:BatchScriptFacade.java

示例8: convertNodeRefsAsStringsArray

import org.mozilla.javascript.NativeArray; //導入方法依賴的package包/類
/**
 * converts the native array of NodeRef strings to a list of noderefs
 *
 * @param nodeRefsAsStrings
 * @return list of noderefs
 */
private List<NodeRef> convertNodeRefsAsStringsArray(NativeArray nodeRefsAsStrings) {
	List<NodeRef> nodes = new ArrayList<>();
	for (Object id : nodeRefsAsStrings.getIds()) {
		int index = (Integer) id;
                       Object obj = nodeRefsAsStrings.get(index);
                       if (obj instanceof NativeJavaObject) {
                           obj = ((NativeJavaObject) obj).unwrap();
                       }
		String nodeRefAsString = (String) obj;
		nodes.add(new NodeRef(nodeRefAsString));
	}
	return nodes;
}
 
開發者ID:jgoldhammer,項目名稱:alfresco-jscript-extensions,代碼行數:20,代碼來源:BatchScriptFacade.java

示例9: expresionAutorellenableCampo

import org.mozilla.javascript.NativeArray; //導入方法依賴的package包/類
/**
 * Devuelve el valor de autorellenar un campo.
 * 
 * Devuelve:
 * 	-  un string para campos monovaluados
 *  -  una lista de strings para campos multivaluados
 * 
 * @ejb.interface-method
 */
public Object expresionAutorellenableCampo(String nombre) {
    Campo campo = pantallaActual.findCampo(nombre);
    if (campo == null) return new ArrayList();

    String script = campo.getExpresionAutorellenable();
    if (script == null || script.trim().length() == 0) {
        return new ArrayList();
    }

    // Obtenemos vbles actuales
    Map variables = variablesScriptActuals();
    
    // La expresion autorrellenable para un campo lista de elementos s�lo esta 
    // permitida si depende de datos de pantallas anteriores
	if (campo instanceof ListaElementos){
		return "";
	}
	
    Object result = ScriptUtil.evalScript(script, variables);
            
    if (result instanceof NativeArray) {
    	
    	List resultList = new LinkedList();
    	
    	// Array de strings
    	NativeArray params = (NativeArray) result;        	
		if ( params != null )
		{
			Object [] ids = params.getIds();
			for ( int i = 0; i < ids.length; i++ )
			{
				Object valorParametro = params.get( (( Integer ) ids[i] ).intValue() , params ); 
				resultList.add( valorParametro.toString() );
			}
		}    
		
		return resultList;
    }else {
    	// Cadena simple
    	return ((result!=null?result.toString():""));        	
    }
}
 
開發者ID:GovernIB,項目名稱:sistra,代碼行數:52,代碼來源:InstanciaProcessorEJB.java

示例10: convertValueForJava

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

    final NativeArray arr = (NativeArray) value;
    final Object[] ids = arr.getIds();

    final Object result;
    if (expectedClass.isAssignableFrom(List.class) || expectedClass.isArray())
    {
        final Class<?> expectedComponentClass = expectedClass.isArray() ? expectedClass.getComponentType() : Object.class;
        final List<Object> list = new ArrayList<Object>();
        for (int idx = 0; idx < ids.length; idx++)
        {
            if (ids[idx] instanceof Integer)
            {
                final Object element = arr.get(((Integer) ids[idx]).intValue(), arr);
                final Object converted = globalDelegate.convertValueForJava(element, expectedComponentClass);
                list.add(converted);
            }
        }

        if (expectedClass.isArray())
        {
            final Object newArr = Array.newInstance(expectedComponentClass, list.size());
            for (int idx = 0; idx < list.size(); idx++)
            {
                Array.set(newArr, idx, list.get(idx));
            }
            result = newArr;
        }
        else
        {
            result = list;
        }
    }
    else
    {
        final Map<Object, Object> propValues = new HashMap<Object, Object>(ids.length);
        for (final Object propId : ids)
        {
            final Object val = arr.get(propId.toString(), arr);
            final Object convertedKey = globalDelegate.convertValueForJava(propId);
            final Object convertedValue = globalDelegate.convertValueForJava(val);
            propValues.put(convertedKey, convertedValue);
        }
        result = propValues;
    }

    return result;
}
 
開發者ID:AFaust,項目名稱:alfresco-enhanced-script-environment,代碼行數:59,代碼來源:NativeArrayConverter.java


注:本文中的org.mozilla.javascript.NativeArray.getIds方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。