
main.java.com.dragome.web.dispatcher.EventDispatcherExtraUtils Maven / Gradle / Ivy
/*
* Copyright (c) 2011-2014 Fernando Petrola
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.dragome.web.dispatcher;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import com.dragome.commons.compiler.annotations.MethodAlias;
import com.dragome.commons.javascript.ScriptHelper;
import com.dragome.services.ServiceInvocation;
import com.dragome.services.ServiceLocator;
import com.dragome.web.debugging.JsVariableCreationInMethod;
import com.dragome.web.debugging.ReferenceHolder;
import com.dragome.web.debugging.ScriptCrossExecutionCommand;
public class EventDispatcherExtraUtils
{
@MethodAlias(alias= "EventDispatcher.equalsFunction")
private static boolean equalsFunction(Object o1, Object o2)
{
return o1.equals(o2);
}
@MethodAlias(alias= "EventDispatcher.hashCodeFunction")
private static int hashCodeFunction(Object o1)
{
return o1.hashCode();
}
@MethodAlias(alias= "EventDispatcher.njeim")
private static ScriptCrossExecutionCommand njeim(String methodName, ReferenceHolder caller, String script, String type)
{
ScriptCrossExecutionCommand scriptCrossExecutionCommand= (ScriptCrossExecutionCommand) ServiceLocator.getInstance().getReflectionService().createClassInstance(type);
scriptCrossExecutionCommand.setCallerReferenceHolder(caller);
scriptCrossExecutionCommand.setScript(script);
scriptCrossExecutionCommand.setMethodName(methodName);
return scriptCrossExecutionCommand;
}
@MethodAlias(alias= "EventDispatcher.ns")
private static String ns(String string)
{
ScriptHelper.put("string2", string, null);
return (String) ScriptHelper.eval("'null' == string2 ? null: string2", null);
}
@MethodAlias(alias= "EventDispatcher.nrh")
private static ReferenceHolder nrh(String id, String value, Boolean booleanValue, String type)
{
Boolean booleanValue2= ScriptHelper.evalBoolean("booleanValue", null);
ScriptHelper.put("booleanValue2", booleanValue2, null);
booleanValue2= (Boolean) ScriptHelper.eval("booleanValue != null ? booleanValue2 : null", null);
ReferenceHolder referenceHolder= new ReferenceHolder(id, ServiceLocator.getInstance().getReflectionService().forName(type), value, booleanValue2);
return referenceHolder;
}
@MethodAlias(alias= "EventDispatcher.njvcim")
private static JsVariableCreationInMethod njvcim(String methodName, ReferenceHolder caller, String name, ReferenceHolder value)
{
return new JsVariableCreationInMethod(caller, name, value, methodName);
}
@MethodAlias(alias= "EventDispatcher.nsi")
private static ServiceInvocation nsi(String type, String methodName, String id, List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy