Java Doc for ElementImpl.java in  » Inversion-of-Control » JICE » org » jicengine » element » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Inversion of Control » JICE » org.jicengine.element 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jicengine.element.AbstractElement
      org.jicengine.element.ElementImpl

ElementImpl
public class ElementImpl extends AbstractElement (Code)

ElementImpl encapsulates the common properties and behaviour of an element.

Common Element Structure

An Element consists of:

  • max 1 constructor together with * VariableElement-children as constructor parameters.
  • * ActionElement-children
  • max 1 action together with * VariableElement-children as action parameters.

Common processing procedures

ElementImpl defines the common procedures for processing these sub-components. The details of the processing can be tricky - an Element might or might not have a constructor, it might or might not have an element, etc.

Lack of the exact runtime-behaviour

the runtime-behaviour of an Element is defined by interfaces VariableElement and ActionElement. Whether an Element becomes an VariableElement or an ActionElement depends on the state of the Element.

ElementImpl can be initialized little-by-little, it is designed to be used together with ElementCompiler. because of this approach, the runtime-behaviour of the Element is known only when the Element is completely initialized.

After an ElementImpl-object is completely initialized, its runtime-version (VariableElement or ActionElement) can be obtained with method toRuntimeElement().

id binding

the object is added to the global-context only after it is created. this way, the child-elements that are constructor parameters are processed before the element has used its id-attribute. therefore, if a child has a same id than the parent, the duplicate-id-exceptions will blame the wrong element for the id - the parent.

Copyright (C) 2004 Timo Laitinen


author:
   .timo

Inner Class :public class VariableElementImpl implements VariableElement
Inner Class :public class ActionElementImpl implements ActionElement

Field Summary
final protected static  intCHILD_TYPE_ACTION
    
final protected static  intCHILD_TYPE_ACTION_ARG
    
final protected static  intCHILD_TYPE_CONSTRUCTOR_ARG
    
final protected static  intCHILD_TYPE_VARIABLE
    

Constructor Summary
public  ElementImpl(String name, Location location)
    

Method Summary
public  voidaddChildElement(Element child)
     adds a child element into this element.
throws:
  ElementException - if the child is a VariableElement that is not neededby the action nor the constructor.
public  voiddeleteConstructor()
     Removes a pre-set constructor so that a new one can be set with setConstructor.
protected  Objectexecute(Context outerContext, Object parentInstance)
    

executes this element.

public  OperationgetAction()
    
public  OperationgetConstructor()
    
public  OperationgetIf()
    
public  ClassgetInstanceClass()
    
public  booleanisActionVariable(String elementName)
    
public  booleanisConstructorVariable(String elementName)
    
public  booleanisElementVariable(String elementName)
    
public  booleanisExecuted(Context outerContext, Object parentInstance)
    
protected  booleanisOverridden(Context context)
    
public  booleanisUsed(VariableElement child)
     true if the child element is needed i.e.
public  voidsetAction(Operation operation)
    
public  voidsetConstructor(Operation operation)
    
public  voidsetIf(Operation condition)
    
public  voidsetInstanceClass(Class instanceClass)
    
public  voidsetOverridableBy(String overridingId)
    
public  voidsetVariableNames(String[] elementNames)
    
public  ElementtoRuntimeElement()
    

Returns the runtime-version of this Element.

public  StringtoString()
    
protected  voidvalidateInstance(Object instance, boolean isOverridingObject)
     validates the instance.
protected  voidvariablePublished(String name)
     stores the information that a variable has been found and published to the context.
protected  voidverifyVariablesHaveBeenFound()
    

Field Detail
CHILD_TYPE_ACTION
final protected static int CHILD_TYPE_ACTION(Code)



CHILD_TYPE_ACTION_ARG
final protected static int CHILD_TYPE_ACTION_ARG(Code)



CHILD_TYPE_CONSTRUCTOR_ARG
final protected static int CHILD_TYPE_CONSTRUCTOR_ARG(Code)



CHILD_TYPE_VARIABLE
final protected static int CHILD_TYPE_VARIABLE(Code)




Constructor Detail
ElementImpl
public ElementImpl(String name, Location location)(Code)




Method Detail
addChildElement
public void addChildElement(Element child) throws ElementException(Code)
adds a child element into this element.
throws:
  ElementException - if the child is a VariableElement that is not neededby the action nor the constructor. unsused child elements without a purpose(without action) are not allowed because.. their value would be createdand the result would be ignored.



deleteConstructor
public void deleteConstructor()(Code)
Removes a pre-set constructor so that a new one can be set with setConstructor.



execute
protected Object execute(Context outerContext, Object parentInstance) throws ElementException(Code)

executes this element. this includes:

  • processing of all child elements, both value and action
  • executing the constructor (if there is one)
  • validating the instace (if there is one)
  • handling the overriding-issues: instance not created and only action-parameter child-elements are executed if this element is overridden.
  • handling the id-attribute: the instance is added to the context, if necessary.
  • executing the action (if there is one)
the instance of this element, if any, or null. the caller ofthis method should know whether the returned value is usable or not.if this element has an action, the returned value should not be used!!and note: the returned value won't be the result of the action. it willbe the result of the constructor.



getAction
public Operation getAction()(Code)



getConstructor
public Operation getConstructor()(Code)



getIf
public Operation getIf()(Code)



getInstanceClass
public Class getInstanceClass()(Code)



isActionVariable
public boolean isActionVariable(String elementName)(Code)



isConstructorVariable
public boolean isConstructorVariable(String elementName)(Code)



isElementVariable
public boolean isElementVariable(String elementName)(Code)



isExecuted
public boolean isExecuted(Context outerContext, Object parentInstance) throws ElementException(Code)



isOverridden
protected boolean isOverridden(Context context)(Code)



isUsed
public boolean isUsed(VariableElement child)(Code)
true if the child element is needed i.e. used by either the actionor the constructor.



setAction
public void setAction(Operation operation) throws ElementException(Code)



setConstructor
public void setConstructor(Operation operation) throws ElementException(Code)



setIf
public void setIf(Operation condition) throws ElementException(Code)



setInstanceClass
public void setInstanceClass(Class instanceClass) throws ElementException(Code)



setOverridableBy
public void setOverridableBy(String overridingId)(Code)



setVariableNames
public void setVariableNames(String[] elementNames) throws ElementException(Code)

throws:
  ElementException - if variables were already set.



toRuntimeElement
public Element toRuntimeElement() throws ElementException(Code)

Returns the runtime-version of this Element. Call this method after the Element is completely initialized.

either an instance of VariableElement orActionElement.
throws:
  ElementException - Description of the Exception



toString
public String toString()(Code)



validateInstance
protected void validateInstance(Object instance, boolean isOverridingObject) throws ElementException(Code)
validates the instance. an exception is thrown, if the instance is not valid. currently, only the class of the instance is validated against the 'instanceClass'-property.
Parameters:
  isOverridingObject - for more better error messages..
throws:
  Exception - if the instance is not valid. since this method doesn'tknow where the instance came from, the caller must catch this exceptionand throw a new exception with a better error message.



variablePublished
protected void variablePublished(String name)(Code)
stores the information that a variable has been found and published to the context. this way we may later validate that all the necessary variables have been found.
Parameters:
  name - String



verifyVariablesHaveBeenFound
protected void verifyVariablesHaveBeenFound() throws ElementException(Code)



Methods inherited from org.jicengine.element.AbstractElement
public Location getLocation()(Code)(Java Doc)
public String getName()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.