[
https://jira.jboss.org/jira/browse/DNA-293?page=com.atlassian.jira.plugin...
]
Randall Hauch commented on DNA-293:
-----------------------------------
I guess one argument for using PropertyType.STRING as the property type is that every
property value can be converted to a String, meaning that if the property has multiple
values of differing types, and code is using Property.getType() to determine how to deal
with the value, they'd expect a String and always get a value. If, however,
Property.getType() returned PropertyType.URI but there was a value that didn't convert
to a URI (for example, maybe a String containing a malformed URI), they'd get a
ValueFormatException.
So, given this, should we just use PropertyType.STRING as the default? Maybe. Thoughts?
JcrSession creates Property instances that use the
PropertyType.UNDEFINED, which is not allowed
-----------------------------------------------------------------------------------------------
Key: DNA-293
URL:
https://jira.jboss.org/jira/browse/DNA-293
Project: DNA
Issue Type: Bug
Components: JCR
Affects Versions: 0.3
Reporter: Randall Hauch
Assignee: Randall Hauch
Fix For: 0.4
The "undefined" property type is only allowed in property definitions.
According to the JSR-170 specification (Section, 6.2.5):
"This constant can be used within a property definition (see 6.7.6 Property
Definitions) to specify that the property in
question may be of any type. However, it cannot be the actual type of any property
instance. For example it will
never be returned by Property.getType and (in level 2 implementations) it cannot be
assigned as the type when
creating a new property."
When the property definition has a type of "undefined", then we'll need to
choose what actual type to use. There doesn't appear to be any guidance on this in
the spec (anybody?), so barring that the most logical approach is probably to look at the
first property value.
Note that this is one reason why the DNA graph API was designed with the value factories
to allow (or encourage) the client to convert the property values to the type desired by
the client. Because of this, it doesn't matter so much what type the value actually
is, but rather that it can be converted to the type needed by the user. So this should
make the above assumption (about choosing the property type based upon value) a pretty
decent one.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira