How to pass custom function in xml

How can I reference a user-defined function in xml? Suppose I have a function written in Java and want it to refer to an xml tag, how is this possible?

Current senario: I am using XACML2.0, which contains xml tags, and I want to pass some function to Java that will talk to the backend data, I cannot reference the function in xacml. could you help me?

+3
source share
2 answers

You should read Reflection in Java.

The following example calls the method

myObjectThatContainsMethod # methodNameAsString (Integer arg1, Integer arg2)

Integer[] params = {new Integer(123),new Integer(567)}; 
Class cl=Class.forName("stringParsedFromYourXML"); 
Class[] par=new Class[2]; 
par[0]=Integer.TYPE; 
par[1]=Integer.TYPE; 
Method mthd=cl.getMethod("methodNameAsString", parameterTypes); 
mthd.invoke(new myObjectThatContainsMethod(), params);

hope this helps ..

+1
source

XACML. , Java, .

. , . , .

0

Source: https://habr.com/ru/post/1699346/


All Articles