SOJO基础知识
POJO大家并不陌生,可是SOJO大家知道吗?SOJO英文全称“Simplified Old Java Objects”意即简化你的java对象。SOJO框架的目标是将javaBeans转化为一种简单的表示方式,转换为诸如JSON, XML或者任何易于同非java程式交互的格式。
SOJO通过管理“循环变量”(with cycle detection)来转换和标识复杂的演变的java对象。这个转换设备是可插拔的,所以你可以以自定义的形式实现并使用。
虽然POJOS是如此的重要和有用,可是在有些场景下它必须和非java环境和系统交互,所以POJOS就显得无能为力,这就是SOJO要解决的问题:
-
data interchange (interchange): 数据交换
- JSON (JavaScript Object Notation) a lightweight data-interchange format
- Object To XML - where is XML-RPC a special case
- Comma Separated Values (CSV)
- Java serialization, without implements the interface java.io.Serializable (e.g. cluster, cache, remote communication, ...)
-
operation of complex Java-Objects-graphs (common / navigation): 操作具有继承关系和不同版本的java对象
- copy or clone complex object graph (can manage different versions from one object graph (object history))
- compare complex object graph
- walk over object graph (to traverse)
- extend objects to additional information (e.g.: object-versions (number of changes), data changed date or changed user)
- easy navigate on the complex object graph (with a navigation language)
- mapping from one property to other property (name to name mapping (by naming conflicts) or value to value mapping (to convert values))
- making object-values immutable, for testing concurrent access - multi threading)
-
remote acces/communication: 远程访问和交互
- HTTP protocol - request and response are based on String represantation
- RMI (Java-Object must serializable (marshalling) or deserializable (unmarshalling))
- WebService or XML RPC - convert Java-Object in special String represantation, in XML
- create "value objects" or "transfer objects" to sent objects over the network
-
data access: 数据访问
- object/relational persistence respectively object/relational mapping
- flat files (convert Java-Object-Graph to a flat represantation)
- property files (e.g. convert Strings to Long, Date, ... by reading a property file and map the value to setter from a Bean)
- legacy systems
-
GUI interface: gui接口
- transform business models to GUI-models (DataBinder)
- every changes on the GUI-model must to notice (integrated PropertyChangeListener or VetoableChangeListener)
- and so on ...
SOJO将会比较简单的解决以上问题。
本文地址:http://www.45fan.com/a/question/72770.html