Java Doc for Property.java in  » Portal » mypersonalizer » es » udc » mypersonalizer » kernel » model » properties » 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 » Portal » mypersonalizer » es.udc.mypersonalizer.kernel.model.properties 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


es.udc.mypersonalizer.kernel.model.properties.Property

All known Subclasses:   es.udc.mypersonalizer.kernel.model.properties.SimpleProperty,  es.udc.mypersonalizer.kernel.model.properties.AbstractProperty,  es.udc.mypersonalizer.kernel.model.properties.CompoundProperty,
Property
public interface Property extends java.io.Serializable(Code)
Defines common operations to all Property implementations, and in principle, represents a particular personalizable aspect, even though, the concept is general enough to represent any kind of structured information. Property corresponds to the "Component" participant in the "Composite" pattern, that is, the root interface declaring all common operations to derived classes/interfaces. Concrete implementations will either be leaf or composite classes.

All properties have a simple name, that is, a String (example: "numberOfHeadlines") and a value (univalued) or a number of them (multivalued), even though the interface hides such a diference by using a Object[] when refering to the value (an array with only one element) or the values (an array with potentially more than one value). In case of multivalued properties, all values are supposed to be of the same type, and deep copies are never done when setting or getting values (this is the usual semantics in Java).

In case of leaf properties, also called simple properties, in general, their values are not properties (however, nothing prevents it, because properties, of course, are also objects). The type of all values must be the same. In case of composite classes, also called compound properties, each value is a PropertyStructure , which contains a number of properties, which in turn can be leaf or composite properties. All values must be a PropertyStructure with the same properties (with possibly different values). In both cases, when needing to represent a property not taking any value, the special value Object[0] (or a subtype) must be used, and not the null value. Properties taking the special value Object[0] are referred to as optionally valued properties along the documentation.

Property interface has been maximized in order to increase transparency, that is, it declares operations applicable to leaf and composite objects (even though some of them could have no sense, and in consequence, may be not implemented), and hides the difference between univalued and multivalued properties, both in leaf and compound properties. Two standard implementations of this interface are provided: SimpleProperty and CompoundProperty , with the standard semantics.

As an example of a univalued compound property, you might consider the personalizable properties of a news service. Such a property could be called "newsServiceProperties", and its only value would be a property structure with two simple properties, one for representing the number of headlines and the other one for representing the names of the news sources where to search. The former could be a univalued simple property with simple name "numberOfHeadlines" and its value would be an Integer (a particular case of Object[] with only one integer). The latter could be a multivalued simple property with simple name "sources" and its value would be an array of String (a particular case of Object[]). This example also allows to introduce the concept of full property name. The full names of these last properties would be "newsServiceProperties.0.numberOfHeadlines" and "newsServiceProperties.0.sources". Note that a "." is used for separating simple names, and that a "0" is used between "newsServiceProperties" and "numberOfHeadlines". This is because values are always treated as an array of Object. So, when refering to the ist-elment (starting from 0) of a compound property, a ".i" must be used for specifying such an element. In case of univalued compound properties, the array has only one element, so you must refer to it with ".0". Note that the interface does not allow you to refer to a concrete value of property. You must get or set all of them, maybe removing or adding values with some auxiliary data structure (probably a java.util.List). So, in the above example, it does not make sense the name "newsServiceProperties.0". A name may also be relative to another one (examples: "0.sources" is relative to "newsServiceProperties"). Note also that a full name never begins with a ".".

As an example of a multivalued compound property, you might consider the personalizable properties of a "saved searches" service, that is, a service that mantains a list of predefined searches. Each saved search could specify its name and a number of keywords to take into account when searching. The personalizable properties of such a service could be represented with a multivalued compound property, with simple name "savedSearchesProperties". Each value of such a property is a structure of two simple properties: (1) the saved search name (simple name: "savedSearchName") containing a String (a particular case of Object[] with only one String), and (2) the keywords (simple name: "keywords") containing a String[] (a particular case of Object[]). Assuming that the array has at least two elements, the full name "savedSearchesProperties.1.keywords" refers to the "keywords" property of the second value of the compound property "savedSearchesProperties".

Name resolution, finding a property from another one, is always relative to the second one. So, for example, considering the second example, if you want to refer to the property "keywords" of the second element of the multivalued compound property "savedSearchesProperties", you must use the relative name "1.keywords" when looking for such a property from "savedSearchesProperties".

Due to values will be specified and displayed as human-readable strings of characters (tipically in HTML forms), Property defines operations for setting the values from strings and viceversa.

NOTE: all implementation of this interface must redefine hashCode() and equals(Object) in order to handle property comparisons properly. Two properties are equal if their names and their values are equal.
author:
   Fernando Bellas
since:
   1.0





Method Summary
 PropertyfindProperty(String relativeName)
     Returns the property specified by the relative name relativeName.
 StringgetSimpleName()
     Returns the simple name of the property.
 Object[]getValuesAsObject()
     Returns the values of the property as an array of Object.
 String[]getValuesAsString()
     Returns the values of the property as an array of String.
 voidsetSimpleName(String simpleName)
     Sets the simple name of the property.
 voidsetValuesAsObject(Object[] values)
     Sets the values of the property as an array of Object.
 voidsetValuesAsString(String[] valuesAsString)
     Sets the values of the property as an array of String.



Method Detail
findProperty
Property findProperty(String relativeName) throws PropertyNotFoundException(Code)
Returns the property specified by the relative name relativeName. The first simple name (the string before the first ".", if any) must be an index for refering to the ist-element. So, in the second example (see above), the relative name "1.keywords", applied to the multivalued compound property "savedSearchesProperties", returns the simple property "keywords" of the second value of "savedSearchesProperties".

If the relative name passed as a parameter is "", the method returns this same property.
Parameters:
  relativeName - the relative name of the property the named property
throws:
  java.lang.UnsupportedOperationException - if the operation is notsupported by this property
throws:
  PropertyNotFoundException - if there not exist a property withthis name




getSimpleName
String getSimpleName()(Code)
Returns the simple name of the property. the simple name of the property



getValuesAsObject
Object[] getValuesAsObject()(Code)
Returns the values of the property as an array of Object. the values of the property as an array of Object
throws:
  java.lang.UnsupportedOperationException - if the operation is notsupported by this property



getValuesAsString
String[] getValuesAsString()(Code)
Returns the values of the property as an array of String. the values of the property as an array of String
throws:
  java.lang.UnsupportedOperationException - if the operation is notsupported by this property



setSimpleName
void setSimpleName(String simpleName)(Code)
Sets the simple name of the property.
Parameters:
  simpleName - the simple name of the property



setValuesAsObject
void setValuesAsObject(Object[] values)(Code)
Sets the values of the property as an array of Object. It is possible to pass an array of 0 elements.
Parameters:
  values - the values of the property as an array ofObject
throws:
  java.lang.IllegalArgumentException - if the type of the valuesin the array values is not consistent (seeconcrete implementations)
throws:
  java.lang.UnsupportedOperationException - if the operation is notsupported by this property



setValuesAsString
void setValuesAsString(String[] valuesAsString) throws IllegalStringValuesException(Code)
Sets the values of the property as an array of String. It is possible to pass an array of 0 elements. (setValuesAsString(new String[0]) is legal).
Parameters:
  valuesAsString - the values of the property as an array ofString
throws:
  java.lang.UnsupportedOperationException - if the operation is notsupported by this property
throws:
  IllegalStringValuesException - if one or more strings in valuesAsString are illegal



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