You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Allowed the name of the constructor argument to be derived from the
java name. This requires passing the '-parameters' flag to javac,
otherwise the argument names get stripped out and become arg0, arg1,
etc.
- Updated the documentation to reflect this change.
Copy file name to clipboardExpand all lines: README.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -294,7 +294,10 @@ public class ConstructedClass {
294
294
}
295
295
```
296
296
297
-
As it stands, this class cannot be used with the AeroMapper because there is no valid constructor to invoke when an object needs to be created. There is a constructor but it does not contain enough information to map the record on the database to the parameters of the constructor. (Remember that at runtime method and argument names are typically lost and become "arg1", "arg2" and so on). We can use this constructor, but we need to provide this missing information with annotations:
297
+
As it stands, this class cannot be used with the AeroMapper because there is no valid constructor to invoke when an object needs to be created. There is a constructor but it does not contain enough information to map the record on the database to the parameters of the constructor. (Remember that at runtime method and argument names are typically lost and become "arg1", "arg2" and so on). We can use this constructor in one of two ways:
298
+
299
+
1. We specify '-parameters' to javac, which will prevent it stripping out the names to the constructor
300
+
2. We can to provide this missing information with annotations:
298
301
299
302
```java
300
303
@AerospikeRecord(namespace = "test", set = "testSet")
@@ -318,7 +321,7 @@ public class ConstructedClass {
318
321
}
319
322
```
320
323
321
-
Now there is enough information to be able to construct an instance of this class from a database record. Note that the names of the @ParamFrom annotation are the bin names, not the underlying field names. So if you have a field declared as
324
+
Now there is enough information to be able to construct an instance of this class from a database record. Note that the names of the @ParamFrom annotation (or the argument names if using -parameters) are the bin names, not the underlying field names. So if you have a field declared as
thrownewAerospikeException("Class " + clazz.getSimpleName() + " has a preferred constructor of " + desiredConstructor.toString()+ ". However, parameter " + count +
364
-
" is mapped to bin \"" + binName + "\" which is not one of the values on the class, which are: " + valueList);
367
+
Stringmessage = String.format("Class %s has a preferred constructor of %s. However, parameter %d is mapped to bin \"%s\" %s which is not one of the values on the class, which are: %s%s",
0 commit comments