关于[managed]、[transient]、[RemoteClass]的解释 当在使用Flex

关于[managed]、[transient]、[RemoteClass]的解释

当在使用Flex并结合BlazeDS或LCDS进行企业应用开发时,经常会碰到[managed] [transient] [RemoteClass]这三个元标签(metadata tag)的使用,但似乎相关的文档很少([RemoteClass]稍微多点),通过一番搜索,找到了比较细致的解释,附上链接及相关原文,备查:

http://weblogs.macromedia.com/lin/archives/2007/02/how_to_get_sing.html

1. To represent a server-side Java object in a client application, you use the [RemoteClass(alias=" ")] metadata tag to create an ActionScript object that maps directly to the Java object. You specify the fully qualified class name of the Java class as the value of alias. This is the same technique that you use to map to Java objects when using RemoteObject components.

2. You can use the [RemoteClass] metadata tag without an alias if you do not map to a Java object on the server, but you do send back your object type from the server. Your ActionScript object is serialized to a Map object when it is sent to the server, but the object returned from the server to the clients is your original ActionScript type.

3. To create a managed association between client-side and server-side objects, you also use the [Managed] metadata tag or explicitly implement the mx.data.IManaged interface. The [Managed] metadata tag ensures that the managed Contact object supports the proper change events to propagate changes between the client-based object and the server-based object.

More info about this:

http://www.mail-archive.com/[email protected]/msg57899.html

You could simply declare that a particular concrete property on your client type was "transient" using [Transient] metadata - these properties wouldn’t be included when instances were sent back to the server.

http://www.mail-archive.com/[email protected]/msg38984.html

Try tagging the properties that you don’t want managed in your [Managed] AS class as [Transient]. This should prevent changes to them from being logged/committed.

你可能感兴趣的:(html,Flex,企业应用,actionscript)