<< Back to previous view

[JDATA-1] Handle primitive types and arrays Created: 01/Oct/11  Updated: 04/Oct/11

Status: Open
Project: java.data
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Major
Reporter: Herwig Hochleitner Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Attachments: Text File java.data-primitive-array-support.patch    
Patch: Code and Test

 Description   

Right now, there is no special handling for methods with primitive or array parameters.
This results in errors, when trying to use bean classes, that have such methods, with to-java and from-java.

The attached patch implements handling of primitives and arrays in the following manner:

  • When the :default methods of from-java and to-java see an array type, they extend the multimethods for that array type.
    Issue: Is Iterable the right interface to extend the multimethod to? Sequential also came to mind, but Iterable was used elsewhere.
  • Values that hit a numeric primitive slot (in to-java) are manually boxed, so they aren't passed as longs.


 Comments   
Comment by Cosmin Stejerean [ 04/Oct/11 7:35 AM ]

Committed in https://github.com/clojure/java.data/commit/487db7420ae07ca4b527b38c39064d3b139ce78d





[JDATA-3] Simplify use cases / split up to-java Created: 03/Sep/13  Updated: 03/Sep/13

Status: Open
Project: java.data
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Major
Reporter: Herwig Hochleitner Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Issues with a single compound to-java method

The common to-java implementation for [Object Map], hard codes:

  • no constructor args
  • setters with java bean convention
    Often times, classes need special treatment during construction. E.g. if the constructor(s) take parameters, or the setters are non-standard.
    The to-java method can be specialized to achive that, however, at this point one is bound to reimplementing (or pasting) parts from java.data source, since all the helpers in java.data are private.

Proposed Enhancements

  • API to call a bunch of setters a la carte
  • a well known keyword :java.data/constructor to pass constructor args
  • other functionality might be made public, if it's useful in its own right





[JDATA-4] to-java not working on some setters Created: 09/Oct/13  Updated: 09/Oct/13

Status: Open
Project: java.data
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Peter Gillard-Moss Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Environment:

clojure 1.5.1
org.clojure/java.data 0.1.1



 Description   

In this example the last test fails.

I have used org.codehause.mojo.rpm.Mapping[1] as the example as this is where I discovered the bug.

[1] http://mojo.codehaus.org/rpm-maven-plugin/apidocs/org/codehaus/mojo/rpm/Mapping.html

Tests:

(do
(use 'clojure.java.data
'clojure.test)
(import '[org.codehaus.mojo.rpm Mapping])

(testing "setting normally"

(let [mapping (Mapping.)]
(.setConfiguration mapping "a value")
(.setDirectory mapping "/tmp")

(is (= (.getDirectory mapping) "/tmp"))
(is (= (.getConfiguration mapping) "a value"))))

(testing "setting via java-data"
(let [mapping (to-java Mapping {:configuration "a value" :directory "/tmp"})]
(is (= (.getDirectory mapping) "/tmp"))
(is (= (.getConfiguration mapping) "a value")))))






[JDATA-2] Eliminate many occurrences of Clojure reflection in java.data Created: 28/Oct/12  Updated: 28/Oct/12

Status: Open
Project: java.data
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Andy Fingerhut Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Attachments: Text File jdata-2-eliminate-reflection-v1.txt    

 Description   

There are many warnings the Clojure compiler gives about reflection in the java.data library. Many can be eliminated with suitable type hints.



 Comments   
Comment by Andy Fingerhut [ 28/Oct/12 7:11 PM ]

jdata-2-eliminate-reflection-v1.txt dated Oct 28 2012 eliminates many uses of Clojure reflection in java.data, but not all. Only the ones that appeared to be straightforward to eliminate via adding a type hint or two were fixed.





Generated at Thu Apr 24 09:56:32 CDT 2014 using JIRA 4.4#649-r158309.