uCosminexus Application Server, Web Service Development Guide
![[Contents]](FIGURE/CONTENT.GIF)
![[Glossary]](FIGURE/GLOSS.GIF)
![[Index]](FIGURE/INDEX.GIF)
![[Back]](FIGURE/FRONT.GIF)
- Define the POJO class as a public or package scope. You can also specify the final modifier.
- The POJO class must have a default constructor. Declaring a default constructor explicitly is optional. You can also use any of the public, private, protected, or package scopes. If the POJO class does not have a default constructor, the JsonMappingException exception is thrown. As per the Java language specifications, you must declare the default constructor explicitly if you declare a constructor with a parameter. For details on exception handling, see 18.3.3 Exception handling.
- The POJO class might have a Bean property or a field of the types declared as an inner class. Do not use an inner class as an interface or a non-static class. For a Bean property or a field of a type declared as an inner class that is an interface or a non-static class, the JsonMappingException exception is thrown. For details on exception handling, see 18.3.3 Exception handling.
- If a value that cannot be mapped to a POJO is in the JSON format, the JsonMappingException exception is thrown. For exception handling, see 18.3.3 Exception handling.
- If a field name is same as that of a Bean property name, the Bean property is preferred.
- Only when the JSON format is blank, error does not occur even if the JSON format has no fields or Bean properties to be mapped to the POJO.
- Define the field as public scope. Otherwise the JsonMappingException exception is thrown. For details on exception handling, see 18.3.3 Exception handling.
- Do not specify a static, transient, or final modifier in the field. These modifiers will not be mapped.
- The fields that do not have a value corresponding to the JSON format will not be initialized (exception will not be thrown).
(3) Bean property
- We recommend that you define the setter method of the Bean property as a public scope. You can also use private, protected, or package scope to declare the setter method of the Bean property.
- Do not declare multiple setter methods with the same name in upper and lower case. If you declare, the JsonMappingException exception is thrown. For details on exception handling, see 18.3.3 Exception handling.
- Do not specify static for the Bean property. static will not be mapped.
- Specifying the final modifier is optional.
- The Bean property need not be readable. For details on the Bean property, see the JavaBeans specifications.
- The setter method of a Bean property that does not have a value corresponding to the JSON format will not be called (exception will not be thrown).
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.