Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-2132

consult class attribute on component XML declaration with namespace

    Details

    • Type: Feature Request
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: 2.0.0.CR2
    • Fix Version/s: 2.0.1.CR1
    • Component/s: Core
    • Labels:
      None

      Description

      When a component template class is being configured (such as EntityHome, EntityQuery, etc), the class attribute should be considered prior to deriving the class name from the namespace info + XML element name. By first consulting the class attribute, it can prevent the case where two components are being configured for the same name when the developer intends only to use the XML declaration for component configuration.

      Case in point:

      Let's say I create a class that extends EntityHome to provide some extra behavior.

      @Name("myEntityHome")
      public class MyEntityHome extends EntityHome {
      }

      Now I want to configure the properties of this class in components.xml

      <framework:entity-home name="myEntityHome" class="org.example.model.MyEntityHome">
      <framework:created-message>You created it! Yeah!</framework:created-message>
      <framework:updated-message>You updated it! Yeah!</framework:updated-message>
      <framework:deleted-message>You deleted it! Yeah!</framework:deleted-message>
      </framework:entity-home>

      If the class attribute is not consulted, it will look for a @Name annotation on org.jboss.seam.framework.EntityHome rather than org.example.model.MyEntityHome. When it doesn't find one on the built-in class, it tries to create a new component definition.

      Why would I want to use XML namespace tags in this case? Simple. Tag completion and property recognition support.

      Note that this works if the class resolved from XML namespace + element name is the same as the component class. In the case when the component class extends the built-in class, you get this problem.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                norman.richards Norman Richards
                Reporter:
                dan.j.allen Dan Allen
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 15 minutes
                  15m
                  Remaining:
                  Remaining Estimate - 15 minutes
                  15m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified