Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EclipseLink/Development/Dynamic/Design PublicAPI"
Line 1: | Line 1: | ||
+ | <css> | ||
+ | .source-java5 {padding:4px;border:1px solid black;} | ||
+ | </css> | ||
__NOTOC__ | __NOTOC__ | ||
== Public API == | == Public API == | ||
Line 5: | Line 8: | ||
[[Image:Dynpersist.png|678px|middle]] | [[Image:Dynpersist.png|678px|middle]] | ||
− | * | + | ; public interface '''DynamicEntity''' |
− | + | * Primary interface of a dynamic persistent entity. This is the API an application uses to interact with an entity. | |
+ | <code>DynamicEntity</code> is the public interface for dealing with dynamic persistent objects. | ||
+ | The purpose of dynamic persistent objects is to enable (simple) data access when only mapping information is available <br /> and no concrete Java model is present (specifically, no <tt>.class</tt> files .) | ||
+ | |||
+ | Applications using <code>DynamicEntity</code>'s can access the persistent state using property names which correspond <br /> to the mapped attributes in the underlying EclipseLink descriptors. For properties mapped to containers (<code>Collection</code>,<br /><code>Map</code>, etc.), the property is retrieved then the resulting container can be manipulated. | ||
+ | <source lang="java5"> | ||
+ | ... | ||
+ | DynamicEntity de = ...; // retrieve from database | ||
+ | Collection<String> myListOfGroups = de.<Collection<String>>get("myListOfGroups"); | ||
+ | if (!myListOfGroups.isEmpty()) { | ||
+ | myListOfGroups.add("FabFour"); | ||
+ | } | ||
+ | </source> | ||
+ | To discover meta-data about a DynamicEntity's properties, see the <code>DynamicHelper</code> class | ||
+ | ; '''Since:''' | ||
+ | : EclipseLink 2.0 | ||
+ | ; '''Author:''' | ||
+ | : dclarke, mnorman | ||
+ | {| width="50%" border="1" cellpadding="3" | ||
+ | |- class="TableHeadingColor" bgcolor="#CCCCFF" | ||
+ | ! colspan="2" align="left" | <font size="+1"> '''Method Summary'''</font> | ||
+ | |- class="TableRowColor" bgcolor="white" | ||
+ | | width="1%" align="right" valign="top" | <font size="-1"> | ||
+ | {| | ||
+ | |- align="right" | ||
+ | | nowrap="NOWRAP" | <font size="-1"> <code><T> T</code></font> | ||
+ | |} | ||
+ | </font> | ||
+ | | <code>'''get'''(java.lang.String propertyPath)</code><br />Return the persistence value for the given property as the specified type. | ||
+ | |- class="TableRowColor" bgcolor="white" | ||
+ | | width="1%" align="right" valign="top" | <font size="-1"> <code>boolean</code></font> | ||
+ | | <code>'''isSet'''(java.lang.String propertyPath)</code><br />Discover if a property has a persistent value | ||
+ | |- class="TableRowColor" bgcolor="white" | ||
+ | | width="1%" align="right" valign="top" | <font size="-1"> <code>DynamicEntity</code></font> | ||
+ | | <code>'''set'''(java.lang.String propertyPath, java.lang.Object value)</code><br />Set the persistence value for the given property to the specified value | ||
+ | |} | ||
* [http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/incubator/dynamic/branches/1.1.0/org.eclipse.persistence.core.dynamic/src/org/eclipse/persistence/dynamic/EntityType.java EntityType.java ] | * [http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/incubator/dynamic/branches/1.1.0/org.eclipse.persistence.core.dynamic/src/org/eclipse/persistence/dynamic/EntityType.java EntityType.java ] |
Revision as of 14:31, 17 September 2009
Public API
This page captures the design of the public API - introduced in the new package org.eclipse.persistence.dynamic
- that allows developers to define and use dynamic entities.
- public interface DynamicEntity
- Primary interface of a dynamic persistent entity. This is the API an application uses to interact with an entity.
DynamicEntity
is the public interface for dealing with dynamic persistent objects.
The purpose of dynamic persistent objects is to enable (simple) data access when only mapping information is available
and no concrete Java model is present (specifically, no .class files .)
Applications using DynamicEntity
's can access the persistent state using property names which correspond
to the mapped attributes in the underlying EclipseLink descriptors. For properties mapped to containers (Collection
,Map
, etc.), the property is retrieved then the resulting container can be manipulated.
... DynamicEntity de = ...; // retrieve from database Collection<String> myListOfGroups = de.<Collection<String>>get("myListOfGroups"); if (!myListOfGroups.isEmpty()) { myListOfGroups.add("FabFour"); }
To discover meta-data about a DynamicEntity's properties, see the DynamicHelper
class
- Since:
- EclipseLink 2.0
- Author:
- dclarke, mnorman
Method Summary | ||
---|---|---|
|
get(java.lang.String propertyPath) Return the persistence value for the given property as the specified type. | |
boolean
|
isSet(java.lang.String propertyPath) Discover if a property has a persistent value | |
DynamicEntity
|
set(java.lang.String propertyPath, java.lang.Object value) Set the persistence value for the given property to the specified value |
- EntityType.java
- Provides access to the type information (meta-model) as well as functioning as a factory for new instances
- DynamicHelper.java
- Helper to lookup types
- EntityTypeBuilder.java
- Factory for creating dynamic types and bootstrapping using XML
- DynamicException.java (org.eclipse.persistence.exceptions)
- Dynamic usage exception
- DynamicSchemaManager.java (org.eclipse.persistence.tools.schemaframework)
- Extended SchemaManager for allowing incremental schema generation for new dynamic types
Internal Design
New package org.eclipse.persistence.internal.dynamic