Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
djinni
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
djinni
Commits
bf859255
Commit
bf859255
authored
Aug 14, 2015
by
Peter Steinberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implements toString() in the Java generator
parent
79462ca1
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
155 additions
and
0 deletions
+155
-0
src/source/JavaGenerator.scala
src/source/JavaGenerator.scala
+15
-0
test-suite/generated-src/java/com/dropbox/djinni/test/AssortedPrimitives.java
...-src/java/com/dropbox/djinni/test/AssortedPrimitives.java
+21
-0
test-suite/generated-src/java/com/dropbox/djinni/test/ClientReturnedRecord.java
...rc/java/com/dropbox/djinni/test/ClientReturnedRecord.java
+10
-0
test-suite/generated-src/java/com/dropbox/djinni/test/Constants.java
...generated-src/java/com/dropbox/djinni/test/Constants.java
+9
-0
test-suite/generated-src/java/com/dropbox/djinni/test/DateRecord.java
...enerated-src/java/com/dropbox/djinni/test/DateRecord.java
+8
-0
test-suite/generated-src/java/com/dropbox/djinni/test/EmptyRecord.java
...nerated-src/java/com/dropbox/djinni/test/EmptyRecord.java
+7
-0
test-suite/generated-src/java/com/dropbox/djinni/test/ExternRecordWithDerivings.java
...va/com/dropbox/djinni/test/ExternRecordWithDerivings.java
+9
-0
test-suite/generated-src/java/com/dropbox/djinni/test/MapDateRecord.java
...rated-src/java/com/dropbox/djinni/test/MapDateRecord.java
+8
-0
test-suite/generated-src/java/com/dropbox/djinni/test/MapListRecord.java
...rated-src/java/com/dropbox/djinni/test/MapListRecord.java
+8
-0
test-suite/generated-src/java/com/dropbox/djinni/test/MapRecord.java
...generated-src/java/com/dropbox/djinni/test/MapRecord.java
+9
-0
test-suite/generated-src/java/com/dropbox/djinni/test/NestedCollection.java
...ed-src/java/com/dropbox/djinni/test/NestedCollection.java
+8
-0
test-suite/generated-src/java/com/dropbox/djinni/test/PrimitiveList.java
...rated-src/java/com/dropbox/djinni/test/PrimitiveList.java
+8
-0
test-suite/generated-src/java/com/dropbox/djinni/test/RecordWithDerivings.java
...src/java/com/dropbox/djinni/test/RecordWithDerivings.java
+9
-0
test-suite/generated-src/java/com/dropbox/djinni/test/RecordWithDurationAndDerivings.java
...m/dropbox/djinni/test/RecordWithDurationAndDerivings.java
+8
-0
test-suite/generated-src/java/com/dropbox/djinni/test/RecordWithNestedDerivings.java
...va/com/dropbox/djinni/test/RecordWithNestedDerivings.java
+9
-0
test-suite/generated-src/java/com/dropbox/djinni/test/SetRecord.java
...generated-src/java/com/dropbox/djinni/test/SetRecord.java
+9
-0
No files found.
src/source/JavaGenerator.scala
View file @
bf859255
...
...
@@ -340,6 +340,21 @@ class JavaGenerator(spec: Spec) extends Generator(spec) {
}
w
.
wl
w
.
wl
(
"@Override"
)
w
.
w
(
"public String toString()"
).
braced
{
w
.
w
(
s
"return "
).
nestedN
(
2
)
{
w
.
wl
(
s
""""${self}{" +"""
)
for
(
i
<-
0
to
r
.
fields
.
length
-
1
)
{
val
name
=
idJava
.
field
(
r
.
fields
(
i
).
ident
)
val
comma
=
if
(
i
>
0
)
""""," + """
else
""
w
.
wl
(
s
"""${comma}"${name}=" + ${name} +"""
)
}
}
w
.
wl
(
s
""""}";"""
)
}
w
.
wl
if
(
r
.
derivingTypes
.
contains
(
DerivingType
.
Ord
))
{
def
primitiveCompare
(
ident
:
Ident
)
{
w
.
wl
(
s
"if (this.${idJava.field(ident)} < other.${idJava.field(ident)}) {"
).
nested
{
...
...
test-suite/generated-src/java/com/dropbox/djinni/test/AssortedPrimitives.java
View file @
bf859255
...
...
@@ -173,4 +173,25 @@ public final class AssortedPrimitives {
hashCode
=
hashCode
*
31
+
(
mOFsixtyfour
==
null
?
0
:
mOFsixtyfour
.
hashCode
());
return
hashCode
;
}
@Override
public
String
toString
()
{
return
"AssortedPrimitives{"
+
"mB="
+
mB
+
","
+
"mEight="
+
mEight
+
","
+
"mSixteen="
+
mSixteen
+
","
+
"mThirtytwo="
+
mThirtytwo
+
","
+
"mSixtyfour="
+
mSixtyfour
+
","
+
"mFthirtytwo="
+
mFthirtytwo
+
","
+
"mFsixtyfour="
+
mFsixtyfour
+
","
+
"mOB="
+
mOB
+
","
+
"mOEight="
+
mOEight
+
","
+
"mOSixteen="
+
mOSixteen
+
","
+
"mOThirtytwo="
+
mOThirtytwo
+
","
+
"mOSixtyfour="
+
mOSixtyfour
+
","
+
"mOFthirtytwo="
+
mOFthirtytwo
+
","
+
"mOFsixtyfour="
+
mOFsixtyfour
+
"}"
;
}
}
test-suite/generated-src/java/com/dropbox/djinni/test/ClientReturnedRecord.java
View file @
bf859255
...
...
@@ -38,4 +38,14 @@ public final class ClientReturnedRecord {
public
String
getMisc
()
{
return
mMisc
;
}
@Override
public
String
toString
()
{
return
"ClientReturnedRecord{"
+
"mRecordId="
+
mRecordId
+
","
+
"mContent="
+
mContent
+
","
+
"mMisc="
+
mMisc
+
"}"
;
}
}
test-suite/generated-src/java/com/dropbox/djinni/test/Constants.java
View file @
bf859255
...
...
@@ -60,4 +60,13 @@ public final class Constants {
public
String
getSomeString
()
{
return
mSomeString
;
}
@Override
public
String
toString
()
{
return
"Constants{"
+
"mSomeInteger="
+
mSomeInteger
+
","
+
"mSomeString="
+
mSomeString
+
"}"
;
}
}
test-suite/generated-src/java/com/dropbox/djinni/test/DateRecord.java
View file @
bf859255
...
...
@@ -38,6 +38,14 @@ public final class DateRecord implements Comparable<DateRecord> {
return
hashCode
;
}
@Override
public
String
toString
()
{
return
"DateRecord{"
+
"mCreatedAt="
+
mCreatedAt
+
"}"
;
}
@Override
public
int
compareTo
(
@Nonnull
DateRecord
other
)
{
int
tempResult
;
...
...
test-suite/generated-src/java/com/dropbox/djinni/test/EmptyRecord.java
View file @
bf859255
...
...
@@ -17,4 +17,11 @@ public final class EmptyRecord {
public
EmptyRecord
(
)
{
}
@Override
public
String
toString
()
{
return
"EmptyRecord{"
+
"}"
;
}
}
test-suite/generated-src/java/com/dropbox/djinni/test/ExternRecordWithDerivings.java
View file @
bf859255
...
...
@@ -45,6 +45,15 @@ public final class ExternRecordWithDerivings implements Comparable<ExternRecordW
return
hashCode
;
}
@Override
public
String
toString
()
{
return
"ExternRecordWithDerivings{"
+
"mMember="
+
mMember
+
","
+
"mE="
+
mE
+
"}"
;
}
@Override
public
int
compareTo
(
ExternRecordWithDerivings
other
)
{
int
tempResult
;
...
...
test-suite/generated-src/java/com/dropbox/djinni/test/MapDateRecord.java
View file @
bf859255
...
...
@@ -21,4 +21,12 @@ public final class MapDateRecord {
public
HashMap
<
String
,
java
.
util
.
Date
>
getDatesById
()
{
return
mDatesById
;
}
@Override
public
String
toString
()
{
return
"MapDateRecord{"
+
"mDatesById="
+
mDatesById
+
"}"
;
}
}
test-suite/generated-src/java/com/dropbox/djinni/test/MapListRecord.java
View file @
bf859255
...
...
@@ -22,4 +22,12 @@ public final class MapListRecord {
public
ArrayList
<
HashMap
<
String
,
Long
>>
getMapList
()
{
return
mMapList
;
}
@Override
public
String
toString
()
{
return
"MapListRecord{"
+
"mMapList="
+
mMapList
+
"}"
;
}
}
test-suite/generated-src/java/com/dropbox/djinni/test/MapRecord.java
View file @
bf859255
...
...
@@ -30,4 +30,13 @@ public final class MapRecord {
public
HashMap
<
Integer
,
Integer
>
getImap
()
{
return
mImap
;
}
@Override
public
String
toString
()
{
return
"MapRecord{"
+
"mMap="
+
mMap
+
","
+
"mImap="
+
mImap
+
"}"
;
}
}
test-suite/generated-src/java/com/dropbox/djinni/test/NestedCollection.java
View file @
bf859255
...
...
@@ -22,4 +22,12 @@ public final class NestedCollection {
public
ArrayList
<
HashSet
<
String
>>
getSetList
()
{
return
mSetList
;
}
@Override
public
String
toString
()
{
return
"NestedCollection{"
+
"mSetList="
+
mSetList
+
"}"
;
}
}
test-suite/generated-src/java/com/dropbox/djinni/test/PrimitiveList.java
View file @
bf859255
...
...
@@ -21,4 +21,12 @@ public final class PrimitiveList {
public
ArrayList
<
Long
>
getList
()
{
return
mList
;
}
@Override
public
String
toString
()
{
return
"PrimitiveList{"
+
"mList="
+
mList
+
"}"
;
}
}
test-suite/generated-src/java/com/dropbox/djinni/test/RecordWithDerivings.java
View file @
bf859255
...
...
@@ -48,6 +48,15 @@ public final class RecordWithDerivings implements Comparable<RecordWithDerivings
return
hashCode
;
}
@Override
public
String
toString
()
{
return
"RecordWithDerivings{"
+
"mKey1="
+
mKey1
+
","
+
"mKey2="
+
mKey2
+
"}"
;
}
@Override
public
int
compareTo
(
@Nonnull
RecordWithDerivings
other
)
{
int
tempResult
;
...
...
test-suite/generated-src/java/com/dropbox/djinni/test/RecordWithDurationAndDerivings.java
View file @
bf859255
...
...
@@ -38,6 +38,14 @@ public final class RecordWithDurationAndDerivings implements Comparable<RecordWi
return
hashCode
;
}
@Override
public
String
toString
()
{
return
"RecordWithDurationAndDerivings{"
+
"mDt="
+
mDt
+
"}"
;
}
@Override
public
int
compareTo
(
@Nonnull
RecordWithDurationAndDerivings
other
)
{
int
tempResult
;
...
...
test-suite/generated-src/java/com/dropbox/djinni/test/RecordWithNestedDerivings.java
View file @
bf859255
...
...
@@ -48,6 +48,15 @@ public final class RecordWithNestedDerivings implements Comparable<RecordWithNes
return
hashCode
;
}
@Override
public
String
toString
()
{
return
"RecordWithNestedDerivings{"
+
"mKey="
+
mKey
+
","
+
"mRec="
+
mRec
+
"}"
;
}
@Override
public
int
compareTo
(
@Nonnull
RecordWithNestedDerivings
other
)
{
int
tempResult
;
...
...
test-suite/generated-src/java/com/dropbox/djinni/test/SetRecord.java
View file @
bf859255
...
...
@@ -30,4 +30,13 @@ public final class SetRecord {
public
HashSet
<
Integer
>
getIset
()
{
return
mIset
;
}
@Override
public
String
toString
()
{
return
"SetRecord{"
+
"mSet="
+
mSet
+
","
+
"mIset="
+
mIset
+
"}"
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment