Create an update request and store the contents of the object into it.
@param function the remote function name
@param object the object to store.
@return the request XML
18663
public static XNElement createUpdate(String function, XNSerializable object) {
        XNElement result = new XNElement(function);
        object.save(result);
        return result;
    }
232746
@SuppressWarnings("unchecked")
   public static <T> T unwrap(Object object)
   {
      T result = (T) object;

      if (object != null)
      {
         while (isForgeProxy(result))
         {
            try
            {
               Method method = result.getClass().getMethod("getDelegate");
               method.setAccessible(true);
               result = (T) method.invoke(result);
            }
            catch (Exception e)
            {
               break;
            }
         }

         if (result == null)
            result = (T) object;
      }
      return result;
   }
860319
function serialize(root) {
        // Stores a pointer to the most-recently encountered node representing a function or a
        // top-level script.  We need this stored pointer since a function expression or declaration
        // has no associated IID, but we'd like to have the ASTs as entries in the table.  Instead,
        // we associate the AST with the IID for the corresponding function-enter or script-enter IID.
        // We don't need a stack here since we only use this pointer at the next function-enter or script-enter,
        // and there cannot be a nested function declaration in-between.
        var parentFunOrScript = root;
        var iidToAstTable = {};

        function handleFun(node) {
            parentFunOrScript = node;
        }

        var visitorPre = {
            'Program':handleFun,
            'FunctionDeclaration':handleFun,
            'FunctionExpression':handleFun
        };

        function canMakeSymbolic(node) {
            if (node.callee.object) {
                var callee = node.callee;
                // we can replace calls to J$ functions with a SymbolicReference iff they have an IID as their first
                // argument.  'instrumentCode', 'getConcrete', and 'I' do not take an IID.
                // TODO are we missing other cases?
                if (callee.object.name === 'J$' && callee.property.name !== "instrumentCode" &&
                    callee.property.name !== "getConcrete" &&
                    callee.property.name !== "I" && node.arguments[0]) {
                    return true;
                }
            }
            return false;
        }

        function setSerializedAST(iid, ast) {
            var entry = iidToAstTable[iid];
            if (!entry) {
                entry = {};
                iidToAstTable[iid] = entry;
            }
            entry.serializedAST = ast;
        }
        var visitorPost = {
            'CallExpression':function (node) {
                try {
                    if (node.callee.object && node.callee.object.name === 'J$' && (node.callee.property.name === 'Se' || node.callee.property.name === 'Fe')) {
                        // associate IID with the AST of the containing function / script
                        setSerializedAST(node.arguments[0].value, parentFunOrScript);
                        return node;
                    } else if (canMakeSymbolic(node)) {
                        setSerializedAST(node.arguments[0].value, node);
                        return {type:"SymbolicReference", value:node.arguments[0].value};
                    }
                    return node;
                } catch (e) {
                    console.log(JSON.stringify(node));
                    throw e;
                }
            }
        };

        transformAst(root, visitorPost, visitorPre);
        return iidToAstTable;
    }
1284002
private List<Type> executeCall(
            Function function) throws IOException {
        String encodedFunction = FunctionEncoder.encode(function);
        org.web3j.protocol.core.methods.response.EthCall ethCall = web3j.ethCall(
                Transaction.createEthCallTransaction(
                        transactionManager.getFromAddress(), contractAddress, encodedFunction),
                defaultBlockParameter)
                .send();

        String value = ethCall.getValue();
        return FunctionReturnDecoder.decode(value, function.getOutputParameters());
    }
181211
static
	public void putFunction(String name, Function function){
		FunctionRegistry.functions.put(Objects.requireNonNull(name), function);
	}
1203415
public static String[] getParameters(String function){
        if(function==null){return new String[]{};}
        function = function.substring(function.indexOf("(",5)+1, function.indexOf(")",1));
        return function.split(",");
    }
997193
function(funcID, args)
    {
        var result;
        var func = this.localFunctionCache[funcID];

        if(func != undefined)
        {
            result = this.serialize(func.apply(null, this.deserialize(args)));
        }

        return result;
    }
338944
function proxyFunctionProperties (remoteMemberFunction, metaId, name) {
  let loaded = false

  // Lazily load function properties
  const loadRemoteProperties = () => {
    if (loaded) return
    loaded = true
    const command = 'ELECTRON_BROWSER_MEMBER_GET'
    const meta = ipcRendererInternal.sendSync(command, contextId, metaId, name)
    setObjectMembers(remoteMemberFunction, remoteMemberFunction, meta.id, meta.members)
  }

  return new Proxy(remoteMemberFunction, {
    set: (target, property, value, receiver) => {
      if (property !== 'ref') loadRemoteProperties()
      target[property] = value
      return true
    },
    get: (target, property, receiver) => {
      if (!target.hasOwnProperty(property)) loadRemoteProperties()
      const value = target[property]
      if (property === 'toString' && typeof value === 'function') {
        return value.bind(target)
      }
      return value
    },
    ownKeys: (target) => {
      loadRemoteProperties()
      return Object.getOwnPropertyNames(target)
    },
    getOwnPropertyDescriptor: (target, property) => {
      const descriptor = Object.getOwnPropertyDescriptor(target, property)
      if (descriptor) return descriptor
      loadRemoteProperties()
      return Object.getOwnPropertyDescriptor(target, property)
    }
  })
}
268696
protected void execute(Connection tx, String query, ExecuteFunction function) {
        try (Query q = new Query(objectMapper, tx, query)) {
            function.apply(q);
        } catch (SQLException ex) {
            throw new ApplicationException(ApplicationException.Code.BACKEND_ERROR, ex);
        }
    }
1367047
public static <T, U> Function<T, U> memoize(final Function<T, U> function) {
    return new Memoizer<T, U>().doMemoize(function);
  }
410133
protected String createFunctionFragment(Function function, int level, @Nullable Class<?> domainType) {

		StringBuilder sb = new StringBuilder();
		if (level <= 0) {
			sb.append("{!func}");
		}

		sb.append(function.getOperation());
		sb.append('(');
		if (function.hasArguments()) {
			List<String> solrReadableArguments = new ArrayList<>();
			for (Object arg : function.getArguments()) {
				Assert.notNull(arg, "Unable to parse 'null' within function arguments.");
				if (arg instanceof Function) {
					solrReadableArguments.add(createFunctionFragment((Function) arg, level + 1, domainType));
				} else if (arg instanceof Criteria) {
					solrReadableArguments.add(createQueryStringFromNode((Criteria) arg, domainType));
				} else if (arg instanceof Field) {
					solrReadableArguments.add(getMappedFieldName((Field) arg, domainType));
				} else if (arg instanceof Query) {
					solrReadableArguments.add(getQueryString((Query) arg, domainType));
				} else if (arg instanceof String || !conversionService.canConvert(arg.getClass(), String.class)) {
					solrReadableArguments.add(arg.toString());
				} else {
					solrReadableArguments.add(conversionService.convert(arg, String.class));
				}
			}
			sb.append(StringUtils.join(solrReadableArguments, ','));
		}
		sb.append(')');
		return sb.toString();
	}
1193381
public <T> T update(T entity) {
		if (entity == null) {
			throw new ApitraryOrmException("Cannot update null entity");
		}

		log.debug("Updating " + entity.getClass());

		PutRequest request = new PutRequest();
		request.setEntity(resolveApitraryEntity(entity));
		request.setId(resolveApitraryEntityId(entity));

		String payload = marshall(entity);

		request.setRequestPayload(payload);

		PutResponse response = resolveApitraryClient().send(request);

		if (HttpStatus.No_Content.ordinal() != response.getStatusCode()) {
			if (HttpStatus.Not_Found.ordinal() == response.getStatusCode()) {
				throw new ApitraryOrmUpdateException("Cannot update object: object with given id does not exist.");
			} else {
				String statusMessage = (String) new PutResponseUnmarshaller().unMarshall(response, entity);
				throw new ApitraryOrmUpdateException(statusMessage);
			}
		}
		return entity;
	}
1202735
@SuppressWarnings("deprecation")
    public static void updateLegacyDatastreams(DigitalObject obj) {
        final String xml = "text/xml";
        final String rdf = "application/rdf+xml";
        updateLegacyDatastream(obj, "DC", xml, OAI_DC2_0.uri);
        updateLegacyDatastream(obj, "RELS-EXT", rdf, RELS_EXT1_0.uri);
        updateLegacyDatastream(obj, "RELS-INT", rdf, RELS_INT1_0.uri);
        updateLegacyDatastream(obj, "POLICY", xml, XACML_POLICY1_0.uri);
        String fType = obj.getExtProperty(RDF.TYPE.uri);
        if (MODEL.BDEF_OBJECT.looselyMatches(fType, false)) {
            updateLegacyDatastream(obj,
                                   "METHODMAP",
                                   xml,
                                   SDEF_METHOD_MAP1_0.uri);
        } else if (MODEL.BMECH_OBJECT.looselyMatches(fType, false)) {
            updateLegacyDatastream(obj,
                                   "METHODMAP",
                                   xml,
                                   SDEP_METHOD_MAP1_1.uri);
            updateLegacyDatastream(obj,
                                   "DSINPUTSPEC",
                                   xml,
                                   DS_INPUT_SPEC1_1.uri);
            updateLegacyDatastream(obj,
                                   "WSDL",
                                   xml,
                                   WSDL.uri);
        }
    }
227530
public static <T> T callAsCollection(T obj, Consumer<Collection<T>> function) {
		if (obj == null)
			return null;
		List<T> list = new ArrayList<T>();
		list.add(obj);
		function.accept(list);
		return obj;
	}
1359572
public static <T, F> Function<F, T> bind(final Function<F, T> function) {
        return new Function<F, T>() {
            @Override
            public T apply(F arg) {
                return function.apply(arg);
            }
        };
    }
1185199
@SuppressWarnings("unchecked")
	public <T> T update(String jsonString, T object) {
		try {
			return (T) mapper.readerForUpdating(object).readValue(jsonString);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
1342797
public static XNElement createRequest(String function, Object... nameValue) {
        XNElement result = new XNElement(function);
        for (int i = 0; i < nameValue.length; i += 2) {
            result.set((String)nameValue[i], nameValue[i + 1]);
        }
        return result;
    }