Jabsorb Notes _ Several small examples 1th/2 page _js Object oriented

Source: Internet
Author: User
Tags getmessage
Studied the Jabsorb, wrote a few simple examples, hoping to help rookie quick start.
First reference Jabsorb-1.2.2.jar,slf4j-api-1.4.2.jar,slf4j-jdk14-1.4.2.jar,jsonrpc.js
class file:
Package com.test;

Import Java.util.HashMap;
Import Java.util.Iterator;
Import java.util.LinkedList;
Import java.util.List;
Import Java.util.Map;
Import Java.util.Set;



public class Testjabsorb {
public string GetMessage (string s) {
Return "Hello:" + S;
}

Public String GetMessage () {
Return "no parameters";
}

Public String GetMessage (List al) {
String res= "list parameter:";
for (Iterator it = Al.iterator (); It.hasnext ();) {
Object next = It.next ();
Res+=next+ ",";
}
return res;
}

Public String getMessage (string[] array) {
String res= "Array parameters:";
for (int i=0;i<array.length;i++) {
Res+=array[i]+ ",";
}
return res;
}

Public String getMessage (map map) {
String res= "map parameter:";
Set EntrySet = Map.entryset ();
for (Iterator it = Entryset.iterator (); It.hasnext ();) {
Object next = It.next ();
Res+=next+ ",";
}
return res;
}

Public String getMessage (Test2 T2) {
String res= "Test2 (Bean) parameter:";
Res+=t2.p1+ ",";
Res+=t2.p2+ ",";
return res;
}

Public String getMessage (Test3 T2) {
String res= "Test3 (Bean) parameter:";
Res+=t2.p1+ ",";
Res+=t2.p2+ ",";
return res;
}

Public Test2 GetMessage2 () {
Test2 res=new Test2 ();
res.p1= "11";
Res.p2= "22";
return res;
}

Public Test3 GetMessage3 () {
Test3 res=new Test3 ();
res.p1= "11";
Res.p2= "22";
return res;
}

Public List getlist ()
{
List List = new LinkedList ();
List.add ("China");
List.add (1234);
return list;
}

Public Map Getmap ()
{
Map map = new HashMap ();
Map.put ("Bird", "bird");
Map.put ("Human", "human");
return map;
}

}


Package com.test;


public class test2{
Public String p1;
Public String p2;
Public String getP1 () {
return p1;
}
public void setP1 (String p1) {
This.p1 = p1;
}
Public String getP2 () {
return p2;
}
public void setP2 (String p2) {
THIS.P2 = p2;
}

}

Current 1/2 page 12 Next read the full text

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.