Jabsorb note_small Example page 1/2 _ js object-oriented

Source: Internet
Author: User
I studied jabsorb and wrote a few simple examples, hoping to help cainiao get started quickly. I studied jabsorb and wrote a few simple examples, hoping to help cainiao get started quickly.
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. Collections list;
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 parameter ";
}

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 parameter :";
For (int I = 0; ires + = 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 vertex List ();
List. add ("China ");
List. add (1, 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;
}

}

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.