Changes between Version 2 and Version 3 of ExampleUsingXmlRpcBeans


Ignore:
Timestamp:
10/09/06 14:43:03 (18 years ago)
Author:
lauer
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ExampleUsingXmlRpcBeans

    v2 v3  
    1 == Using XmlRpcBeans in you API == 
     1== Using !XmlRpcBeans in you API == 
    22 
    3 What are XmlRpcBeans?? 
    4  
     3What are !XmlRpcBeans?? 
    54 
    65Sometimes parameter conversion is a straight-forward task which can be handed over to the XML-RPC runtime system. 
    76When a java class fulfills certain conditions (roughly, being a java bean with complatible types) it can be turned into a XmlRpcBean 
    8 by annotating it with the @!XmlRpcBean annotation. It then can be used in every XML-RPC call without restriction. 
     7by annotating it with the @!XmlRpcBean annotation. It then can be used in every XML-RPC call without restriction.[[BR]] 
     8 
    99A XmlRpcBean must have 
    1010 
     
    1313  - like a java bean: for each property which is supposed to be transported over XML-RPC there has to exist a public getter and setter method 
    1414 
    15   - each peroperty type has to be XML-RPC compliant, that is it has to have one of the follwoing properties: 
     15  - each property type has to be a XML-RPC compliant type, that is it has to have one of the follwoing properties: 
     16    - it is a standard XML-RPC type 
     17    - it is annotated with a @!XmlRpc annotation and defines proper conversion methods 
     18    - a conversion mapping for that type is put at the XmlRpcBean (which then acts as an API itself) 
     19    - it is an XmlRpcBean (that is, XmlRpcBeans can be nested) 
    1620 
    17    - it is a standard XML-RPC type 
     21Technically, an !XmlRpcBean is converted into a XML-RPC STRUCT. The field names of the tranfered map are the property names derived from the bean class. 
    1822 
    19    - it is annotated with a @!XmlRpc annotation and defines proper conversion methods 
    2023 
    21    - a conversion mapping for that type is put at the XmlRpcBean (which then acts as an API itself) 
    22  
    23    - it is an XmlRpcBean (that is, XmlRpcBeans can be nested) 
     24Lets look at an example !XmlRpcBean (note that this bean also defines a converter mapping for type ''URL''): 
     25{{{ 
     26@XmlRpcBean 
     27@ConverterMappings( @Mapping(type=URL.class,converter=URLConverter.class) ) 
     28public class CoffeeBean 
     29{ 
     30    public URL getOrigin() 
     31    { 
     32        return mOrigin; 
     33    } 
     34    public void setOrigin( URL origin ) 
     35    { 
     36        mOrigin = origin; 
     37    } 
     38    public String getType() 
     39    { 
     40        return mType; 
     41    } 
     42    public void setType( String type ) 
     43    { 
     44        mType = type; 
     45    } 
     46     
     47    public String toString() 
     48    { 
     49        return( "CoffeeBean(" + getType() + ") comming from '" + getOrigin() + "'" ); 
     50    } 
     51    private String mType; 
     52    private URL mOrigin; 
     53} 
     54}}} 
    2455 
    2556See also [http://delight.opendfki.de/wiki/ExampleUsingOwnConceteTypes#UsingowntypesinCollectionsandMaps How to use own types in Collections an Maps].