[jnigen] File-per-class and single file bindings (https://github.com/dart-lang/jnigen/issues/98)
diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml index 554577f..6e252d8 100644 --- a/.github/workflows/test-package.yml +++ b/.github/workflows/test-package.yml
@@ -331,11 +331,11 @@ - run: flutter build apk working-directory: ./pkgs/jnigen/example/notification_plugin/example - name: re-generate bindings - run: flutter pub run jnigen -Doutput.dart.path=_dart -Doutput.c.path=_c --config jnigen.yaml + run: flutter pub run jnigen -Doutput.dart.path=_temp.dart -Doutput.c.path=_c/ --config jnigen.yaml - name: compare generated dart bindings - run: diff -qr lib/ _dart + run: diff lib/notifications.dart _temp.dart - name: compare generated C bindings - run: diff -qr src/ _c + run: diff -r src/ _c build_in_app_java_example: runs-on: ubuntu-latest @@ -361,11 +361,11 @@ - run: flutter analyze - run: flutter build apk - name: re-generate bindings - run: flutter pub run jnigen -Doutput.dart.path=_dart -Doutput.c.path=_c --config jnigen.yaml + run: flutter pub run jnigen -Doutput.dart.path=_temp.dart -Doutput.c.path=_c/ --config jnigen.yaml - name: compare generated dart bindings - run: diff -qr lib/android_utils _dart + run: diff lib/android_utils.dart _temp.dart - name: compare generated C bindings - run: diff -qr src/android_utils _c + run: diff -r src/android_utils _c run_pdfbox_example_linux: runs-on: ubuntu-latest @@ -390,13 +390,13 @@ - run: dart pub get - name: Generate bindings run: | - dart run jnigen -Doutput.c.path=_c -Doutput.dart.path=_dart --config jnigen.yaml + dart run jnigen -Doutput.c.path=_c/ -Doutput.dart.path=_dart/ --config jnigen.yaml - name: Compare generated bindings run: | - diff -qr _c src/ - diff -qr _dart lib/src/third_party + diff -r _c src/ + diff -r _dart lib/src/third_party - name: Generate full bindings - run: dart run jnigen --config jnigen.yaml --override classes="org.apache.pdfbox.pdmodel;org.apache.pdfbox.text" + run: dart run jnigen --config jnigen.yaml --override classes="org.apache.pdfbox" - name: Analyze generated bindings run: | flutter pub get # dart-analyze errors on flutter example
diff --git a/pkgs/jnigen/example/in_app_java/jnigen.yaml b/pkgs/jnigen/example/in_app_java/jnigen.yaml index 3c700ab..58bd7d9 100644 --- a/pkgs/jnigen/example/in_app_java/jnigen.yaml +++ b/pkgs/jnigen/example/in_app_java/jnigen.yaml
@@ -4,9 +4,10 @@ output: c: library_name: android_utils - path: src/android_utils + path: src/android_utils/ dart: - path: lib/android_utils + path: lib/android_utils.dart + structure: single_file source_path: - 'android/app/src/main/java'
diff --git a/pkgs/jnigen/example/in_app_java/lib/android_utils/com/example/in_app_java.dart b/pkgs/jnigen/example/in_app_java/lib/android_utils.dart similarity index 84% rename from pkgs/jnigen/example/in_app_java/lib/android_utils/com/example/in_app_java.dart rename to pkgs/jnigen/example/in_app_java/lib/android_utils.dart index 1f119c6..0706f8f 100644 --- a/pkgs/jnigen/example/in_app_java/lib/android_utils/com/example/in_app_java.dart +++ b/pkgs/jnigen/example/in_app_java/lib/android_utils.dart
@@ -1,6 +1,8 @@ // Autogenerated by jnigen. DO NOT EDIT! // ignore_for_file: camel_case_types +// ignore_for_file: file_names +// ignore_for_file: unused_import // ignore_for_file: non_constant_identifier_names // ignore_for_file: constant_identifier_names // ignore_for_file: annotate_overrides @@ -11,7 +13,10 @@ import "package:jni/internal_helpers_for_jnigen.dart"; import "package:jni/jni.dart" as jni; -import "../../_init.dart" show jniLookup; +// Auto-generated initialization code. + +final ffi.Pointer<T> Function<T extends ffi.NativeType>(String sym) jniLookup = + ProtectedJniExtensions.initGeneratedLibrary("android_utils"); /// from: com.example.in_app_java.AndroidUtils class AndroidUtils extends jni.JniObject {
diff --git a/pkgs/jnigen/example/in_app_java/lib/android_utils/_init.dart b/pkgs/jnigen/example/in_app_java/lib/android_utils/_init.dart deleted file mode 100644 index 656ca5a..0000000 --- a/pkgs/jnigen/example/in_app_java/lib/android_utils/_init.dart +++ /dev/null
@@ -1,5 +0,0 @@ -import "dart:ffi"; -import "package:jni/internal_helpers_for_jnigen.dart"; - -final Pointer<T> Function<T extends NativeType>(String sym) jniLookup = - ProtectedJniExtensions.initGeneratedLibrary("android_utils");
diff --git a/pkgs/jnigen/example/in_app_java/lib/main.dart b/pkgs/jnigen/example/in_app_java/lib/main.dart index 4ca151f..37e8676 100644 --- a/pkgs/jnigen/example/in_app_java/lib/main.dart +++ b/pkgs/jnigen/example/in_app_java/lib/main.dart
@@ -6,9 +6,8 @@ import 'package:jni/jni.dart'; // The hierarchy created in generated code will mirror the java package -// structure. This is an implementation convenience and we may allow -// more customization in future. -import 'android_utils/com/example/in_app_java.dart'; +// structure. +import 'android_utils.dart'; JniObject activity = JniObject.fromRef(Jni.getCurrentActivity());
diff --git a/pkgs/jnigen/example/notification_plugin/example/lib/main.dart b/pkgs/jnigen/example/notification_plugin/example/lib/main.dart index 277ba34..18b3363 100644 --- a/pkgs/jnigen/example/notification_plugin/example/lib/main.dart +++ b/pkgs/jnigen/example/notification_plugin/example/lib/main.dart
@@ -8,7 +8,7 @@ // The hierarchy created in generated code will mirror the java package // structure. This is an implementation convenience and we may allow // more customization in future. -import 'package:notification_plugin/com/example/notification_plugin.dart'; +import 'package:notification_plugin/notifications.dart'; JniObject activity = JniObject.fromRef(Jni.getCurrentActivity());
diff --git a/pkgs/jnigen/example/notification_plugin/jnigen.yaml b/pkgs/jnigen/example/notification_plugin/jnigen.yaml index cd38a3a..21f4106 100644 --- a/pkgs/jnigen/example/notification_plugin/jnigen.yaml +++ b/pkgs/jnigen/example/notification_plugin/jnigen.yaml
@@ -17,4 +17,8 @@ path: 'src/' library_name: notification_plugin dart: - path: 'lib/' + path: 'lib/notifications.dart' + ## Output to single file instead of recreating source's file structure. + ## This will be useful to reduce clutter when binding a small number of + ## classes. + structure: 'single_file'
diff --git a/pkgs/jnigen/example/notification_plugin/lib/_init.dart b/pkgs/jnigen/example/notification_plugin/lib/_init.dart deleted file mode 100644 index b45c5c3..0000000 --- a/pkgs/jnigen/example/notification_plugin/lib/_init.dart +++ /dev/null
@@ -1,9 +0,0 @@ -// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import "dart:ffi"; -import "package:jni/internal_helpers_for_jnigen.dart"; - -final Pointer<T> Function<T extends NativeType>(String sym) jniLookup = - ProtectedJniExtensions.initGeneratedLibrary("notification_plugin");
diff --git a/pkgs/jnigen/example/notification_plugin/lib/com/example/notification_plugin.dart b/pkgs/jnigen/example/notification_plugin/lib/notifications.dart similarity index 87% rename from pkgs/jnigen/example/notification_plugin/lib/com/example/notification_plugin.dart rename to pkgs/jnigen/example/notification_plugin/lib/notifications.dart index f2334b7..6000af1 100644 --- a/pkgs/jnigen/example/notification_plugin/lib/com/example/notification_plugin.dart +++ b/pkgs/jnigen/example/notification_plugin/lib/notifications.dart
@@ -5,6 +5,8 @@ // Autogenerated by jnigen. DO NOT EDIT! // ignore_for_file: camel_case_types +// ignore_for_file: file_names +// ignore_for_file: unused_import // ignore_for_file: non_constant_identifier_names // ignore_for_file: constant_identifier_names // ignore_for_file: annotate_overrides @@ -15,7 +17,10 @@ import "package:jni/internal_helpers_for_jnigen.dart"; import "package:jni/jni.dart" as jni; -import "../../_init.dart" show jniLookup; +// Auto-generated initialization code. + +final ffi.Pointer<T> Function<T extends ffi.NativeType>(String sym) jniLookup = + ProtectedJniExtensions.initGeneratedLibrary("notification_plugin"); /// from: com.example.notification_plugin.Notifications class Notifications extends jni.JniObject {
diff --git a/pkgs/jnigen/example/pdfbox_plugin/jnigen.yaml b/pkgs/jnigen/example/pdfbox_plugin/jnigen.yaml index eb4b674..426b042 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/jnigen.yaml +++ b/pkgs/jnigen/example/pdfbox_plugin/jnigen.yaml
@@ -43,6 +43,11 @@ - 'org.apache.pdfbox.pdmodel.PDDocumentInformation' - 'org.apache.pdfbox.text.PDFTextStripper' +## Exclude a problematic field +exclude: + fields: + - 'org.apache.pdfbox.contentstream.operator.OperatorName#SHOW_TEXT_LINE_AND_SPACE' + ## Dependencies to be downloaded using Maven (Invokes `mvn` command). These ## dependencies are always downloaded along with their transitive dependencies. ##
diff --git a/pkgs/jnigen/example/pdfbox_plugin/lib/pdfbox_plugin.dart b/pkgs/jnigen/example/pdfbox_plugin/lib/pdfbox_plugin.dart index edf3508..3cdeeff 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/lib/pdfbox_plugin.dart +++ b/pkgs/jnigen/example/pdfbox_plugin/lib/pdfbox_plugin.dart
@@ -1,5 +1,6 @@ /// File merely exporting the generated bindings from lib/src/third_party library pdfbox_plugin; -export 'src/third_party/org/apache/pdfbox/pdmodel.dart'; -export 'src/third_party/org/apache/pdfbox/text.dart'; +export 'src/third_party/org/apache/pdfbox/pdmodel/PDDocument.dart'; +export 'src/third_party/org/apache/pdfbox/pdmodel/PDDocumentInformation.dart'; +export 'src/third_party/org/apache/pdfbox/text/PDFTextStripper.dart';
diff --git a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/_init.dart b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/_init.dart index 86170ee..57aea60 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/_init.dart +++ b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/_init.dart
@@ -16,8 +16,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -import "dart:ffi"; +import "dart:ffi" as ffi; import "package:jni/internal_helpers_for_jnigen.dart"; -final Pointer<T> Function<T extends NativeType>(String sym) jniLookup = +// Auto-generated initialization code. + +final ffi.Pointer<T> Function<T extends ffi.NativeType>(String sym) jniLookup = ProtectedJniExtensions.initGeneratedLibrary("pdfbox_plugin");
diff --git a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel.dart b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocument.dart similarity index 82% rename from pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel.dart rename to pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocument.dart index 304a95c..8d0f1a1 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel.dart +++ b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocument.dart
@@ -19,6 +19,8 @@ // Autogenerated by jnigen. DO NOT EDIT! // ignore_for_file: camel_case_types +// ignore_for_file: file_names +// ignore_for_file: unused_import // ignore_for_file: non_constant_identifier_names // ignore_for_file: constant_identifier_names // ignore_for_file: annotate_overrides @@ -29,7 +31,8 @@ import "package:jni/internal_helpers_for_jnigen.dart"; import "package:jni/jni.dart" as jni; -import "../../../_init.dart" show jniLookup; +import "PDDocumentInformation.dart" as pddocumentinformation_; +import "../../../../_init.dart" show jniLookup; /// from: org.apache.pdfbox.pdmodel.PDDocument /// @@ -92,8 +95,9 @@ /// from: private org.apache.pdfbox.pdmodel.PDDocumentInformation documentInformation /// The returned object must be deleted after use, by calling the `delete` method. - PDDocumentInformation get documentInformation => - PDDocumentInformation.fromRef(_get_documentInformation(reference).object); + pddocumentinformation_.PDDocumentInformation get documentInformation => + pddocumentinformation_.PDDocumentInformation.fromRef( + _get_documentInformation(reference).object); static final _set_documentInformation = jniLookup< ffi.NativeFunction< jni.JThrowable Function(jni.JObject, ffi.Pointer<ffi.Void>)>>( @@ -103,7 +107,7 @@ /// from: private org.apache.pdfbox.pdmodel.PDDocumentInformation documentInformation /// The returned object must be deleted after use, by calling the `delete` method. - set documentInformation(PDDocumentInformation value) => + set documentInformation(pddocumentinformation_.PDDocumentInformation value) => _set_documentInformation(reference, value.reference); static final _get_documentCatalog = jniLookup< @@ -844,8 +848,9 @@ /// document level metadata, a metadata stream should be used instead, see /// PDDocumentCatalog\#getMetadata(). ///@return The documents /Info dictionary, never null. - PDDocumentInformation getDocumentInformation() => - PDDocumentInformation.fromRef(_getDocumentInformation(reference).object); + pddocumentinformation_.PDDocumentInformation getDocumentInformation() => + pddocumentinformation_.PDDocumentInformation.fromRef( + _getDocumentInformation(reference).object); static final _setDocumentInformation = jniLookup< ffi.NativeFunction< @@ -863,7 +868,8 @@ /// document level metadata, a metadata stream should be used instead, see /// PDDocumentCatalog\#setMetadata(org.apache.pdfbox.pdmodel.common.PDMetadata) PDDocumentCatalog\#setMetadata(PDMetadata). ///@param info The updated document information. - void setDocumentInformation(PDDocumentInformation info) => + void setDocumentInformation( + pddocumentinformation_.PDDocumentInformation info) => _setDocumentInformation(reference, info.reference).check(); static final _getDocumentCatalog = jniLookup< @@ -1817,409 +1823,3 @@ void setResourceCache(jni.JniObject resourceCache) => _setResourceCache(reference, resourceCache.reference).check(); } - -/// from: org.apache.pdfbox.pdmodel.PDDocumentInformation -/// -/// This is the document metadata. Each getXXX method will return the entry if -/// it exists or null if it does not exist. If you pass in null for the setXXX -/// method then it will clear the value. -///@author Ben Litchfield -///@author Gerardo Ortiz -class PDDocumentInformation extends jni.JniObject { - PDDocumentInformation.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); - - static final _get_info = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - jni.JObject, - )>>("get_PDDocumentInformation__info") - .asFunction< - jni.JniResult Function( - jni.JObject, - )>(); - - /// from: private final org.apache.pdfbox.cos.COSDictionary info - /// The returned object must be deleted after use, by calling the `delete` method. - jni.JniObject get info => jni.JniObject.fromRef(_get_info(reference).object); - - static final _ctor = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "PDDocumentInformation__ctor") - .asFunction<jni.JniResult Function()>(); - - /// from: public void <init>() - /// - /// Default Constructor. - PDDocumentInformation() : super.fromRef(_ctor().object); - - static final _ctor1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__ctor1") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public void <init>(org.apache.pdfbox.cos.COSDictionary dic) - /// - /// Constructor that is used for a preexisting dictionary. - ///@param dic The underlying dictionary. - PDDocumentInformation.ctor1(jni.JniObject dic) - : super.fromRef(_ctor1(dic.reference).object); - - static final _getCOSObject = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( - "PDDocumentInformation__getCOSObject") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public org.apache.pdfbox.cos.COSDictionary getCOSObject() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// This will get the underlying dictionary that this object wraps. - ///@return The underlying info dictionary. - jni.JniObject getCOSObject() => - jni.JniObject.fromRef(_getCOSObject(reference).object); - - static final _getPropertyStringValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( - "PDDocumentInformation__getPropertyStringValue") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.Object getPropertyStringValue(java.lang.String propertyKey) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Return the properties String value. - /// - /// Allows to retrieve the - /// low level date for validation purposes. - /// - /// - ///@param propertyKey the dictionaries key - ///@return the properties value - jni.JniObject getPropertyStringValue(jni.JniString propertyKey) => - jni.JniObject.fromRef( - _getPropertyStringValue(reference, propertyKey.reference).object); - - static final _getTitle = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__getTitle") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.String getTitle() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// This will get the title of the document. This will return null if no title exists. - ///@return The title of the document. - jni.JniString getTitle() => - jni.JniString.fromRef(_getTitle(reference).object); - - static final _setTitle = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__setTitle") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public void setTitle(java.lang.String title) - /// - /// This will set the title of the document. - ///@param title The new title for the document. - void setTitle(jni.JniString title) => - _setTitle(reference, title.reference).check(); - - static final _getAuthor = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__getAuthor") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.String getAuthor() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// This will get the author of the document. This will return null if no author exists. - ///@return The author of the document. - jni.JniString getAuthor() => - jni.JniString.fromRef(_getAuthor(reference).object); - - static final _setAuthor = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__setAuthor") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public void setAuthor(java.lang.String author) - /// - /// This will set the author of the document. - ///@param author The new author for the document. - void setAuthor(jni.JniString author) => - _setAuthor(reference, author.reference).check(); - - static final _getSubject = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__getSubject") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.String getSubject() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// This will get the subject of the document. This will return null if no subject exists. - ///@return The subject of the document. - jni.JniString getSubject() => - jni.JniString.fromRef(_getSubject(reference).object); - - static final _setSubject = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__setSubject") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public void setSubject(java.lang.String subject) - /// - /// This will set the subject of the document. - ///@param subject The new subject for the document. - void setSubject(jni.JniString subject) => - _setSubject(reference, subject.reference).check(); - - static final _getKeywords = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__getKeywords") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.String getKeywords() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// This will get the keywords of the document. This will return null if no keywords exists. - ///@return The keywords of the document. - jni.JniString getKeywords() => - jni.JniString.fromRef(_getKeywords(reference).object); - - static final _setKeywords = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__setKeywords") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public void setKeywords(java.lang.String keywords) - /// - /// This will set the keywords of the document. - ///@param keywords The new keywords for the document. - void setKeywords(jni.JniString keywords) => - _setKeywords(reference, keywords.reference).check(); - - static final _getCreator = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__getCreator") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.String getCreator() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// This will get the creator of the document. This will return null if no creator exists. - ///@return The creator of the document. - jni.JniString getCreator() => - jni.JniString.fromRef(_getCreator(reference).object); - - static final _setCreator = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__setCreator") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public void setCreator(java.lang.String creator) - /// - /// This will set the creator of the document. - ///@param creator The new creator for the document. - void setCreator(jni.JniString creator) => - _setCreator(reference, creator.reference).check(); - - static final _getProducer = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__getProducer") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.String getProducer() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// This will get the producer of the document. This will return null if no producer exists. - ///@return The producer of the document. - jni.JniString getProducer() => - jni.JniString.fromRef(_getProducer(reference).object); - - static final _setProducer = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__setProducer") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public void setProducer(java.lang.String producer) - /// - /// This will set the producer of the document. - ///@param producer The new producer for the document. - void setProducer(jni.JniString producer) => - _setProducer(reference, producer.reference).check(); - - static final _getCreationDate = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( - "PDDocumentInformation__getCreationDate") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.util.Calendar getCreationDate() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// This will get the creation date of the document. This will return null if no creation date exists. - ///@return The creation date of the document. - jni.JniObject getCreationDate() => - jni.JniObject.fromRef(_getCreationDate(reference).object); - - static final _setCreationDate = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( - "PDDocumentInformation__setCreationDate") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public void setCreationDate(java.util.Calendar date) - /// - /// This will set the creation date of the document. - ///@param date The new creation date for the document. - void setCreationDate(jni.JniObject date) => - _setCreationDate(reference, date.reference).check(); - - static final _getModificationDate = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( - "PDDocumentInformation__getModificationDate") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.util.Calendar getModificationDate() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// This will get the modification date of the document. This will return null if no modification date exists. - ///@return The modification date of the document. - jni.JniObject getModificationDate() => - jni.JniObject.fromRef(_getModificationDate(reference).object); - - static final _setModificationDate = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( - "PDDocumentInformation__setModificationDate") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public void setModificationDate(java.util.Calendar date) - /// - /// This will set the modification date of the document. - ///@param date The new modification date for the document. - void setModificationDate(jni.JniObject date) => - _setModificationDate(reference, date.reference).check(); - - static final _getTrapped = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__getTrapped") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.String getTrapped() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// This will get the trapped value for the document. - /// This will return null if one is not found. - ///@return The trapped value for the document. - jni.JniString getTrapped() => - jni.JniString.fromRef(_getTrapped(reference).object); - - static final _getMetadataKeys = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( - "PDDocumentInformation__getMetadataKeys") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.util.Set<java.lang.String> getMetadataKeys() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// This will get the keys of all metadata information fields for the document. - ///@return all metadata key strings. - ///@since Apache PDFBox 1.3.0 - jni.JniObject getMetadataKeys() => - jni.JniObject.fromRef(_getMetadataKeys(reference).object); - - static final _getCustomMetadataValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( - "PDDocumentInformation__getCustomMetadataValue") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.String getCustomMetadataValue(java.lang.String fieldName) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// This will get the value of a custom metadata information field for the document. - /// This will return null if one is not found. - ///@param fieldName Name of custom metadata field from pdf document. - ///@return String Value of metadata field - jni.JniString getCustomMetadataValue(jni.JniString fieldName) => - jni.JniString.fromRef( - _getCustomMetadataValue(reference, fieldName.reference).object); - - static final _setCustomMetadataValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( - "PDDocumentInformation__setCustomMetadataValue") - .asFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>(); - - /// from: public void setCustomMetadataValue(java.lang.String fieldName, java.lang.String fieldValue) - /// - /// Set the custom metadata value. - ///@param fieldName The name of the custom metadata field. - ///@param fieldValue The value to the custom metadata field. - void setCustomMetadataValue( - jni.JniString fieldName, jni.JniString fieldValue) => - _setCustomMetadataValue( - reference, fieldName.reference, fieldValue.reference) - .check(); - - static final _setTrapped = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__setTrapped") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public void setTrapped(java.lang.String value) - /// - /// This will set the trapped of the document. This will be - /// 'True', 'False', or 'Unknown'. - ///@param value The new trapped value for the document. - ///@throws IllegalArgumentException if the parameter is invalid. - void setTrapped(jni.JniString value) => - _setTrapped(reference, value.reference).check(); -}
diff --git a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocumentInformation.dart b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocumentInformation.dart new file mode 100644 index 0000000..1b15fe0 --- /dev/null +++ b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/PDDocumentInformation.dart
@@ -0,0 +1,440 @@ +// Generated from Apache PDFBox library which is licensed under the Apache License 2.0. +// The following copyright from the original authors applies. +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: camel_case_types +// ignore_for_file: file_names +// ignore_for_file: unused_import +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: constant_identifier_names +// ignore_for_file: annotate_overrides +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: unused_element + +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; +import "package:jni/jni.dart" as jni; + +import "../../../../_init.dart" show jniLookup; + +/// from: org.apache.pdfbox.pdmodel.PDDocumentInformation +/// +/// This is the document metadata. Each getXXX method will return the entry if +/// it exists or null if it does not exist. If you pass in null for the setXXX +/// method then it will clear the value. +///@author Ben Litchfield +///@author Gerardo Ortiz +class PDDocumentInformation extends jni.JniObject { + PDDocumentInformation.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); + + static final _get_info = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + jni.JObject, + )>>("get_PDDocumentInformation__info") + .asFunction< + jni.JniResult Function( + jni.JObject, + )>(); + + /// from: private final org.apache.pdfbox.cos.COSDictionary info + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JniObject get info => jni.JniObject.fromRef(_get_info(reference).object); + + static final _ctor = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "PDDocumentInformation__ctor") + .asFunction<jni.JniResult Function()>(); + + /// from: public void <init>() + /// + /// Default Constructor. + PDDocumentInformation() : super.fromRef(_ctor().object); + + static final _ctor1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__ctor1") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public void <init>(org.apache.pdfbox.cos.COSDictionary dic) + /// + /// Constructor that is used for a preexisting dictionary. + ///@param dic The underlying dictionary. + PDDocumentInformation.ctor1(jni.JniObject dic) + : super.fromRef(_ctor1(dic.reference).object); + + static final _getCOSObject = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "PDDocumentInformation__getCOSObject") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public org.apache.pdfbox.cos.COSDictionary getCOSObject() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// This will get the underlying dictionary that this object wraps. + ///@return The underlying info dictionary. + jni.JniObject getCOSObject() => + jni.JniObject.fromRef(_getCOSObject(reference).object); + + static final _getPropertyStringValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( + "PDDocumentInformation__getPropertyStringValue") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Object getPropertyStringValue(java.lang.String propertyKey) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Return the properties String value. + /// + /// Allows to retrieve the + /// low level date for validation purposes. + /// + /// + ///@param propertyKey the dictionaries key + ///@return the properties value + jni.JniObject getPropertyStringValue(jni.JniString propertyKey) => + jni.JniObject.fromRef( + _getPropertyStringValue(reference, propertyKey.reference).object); + + static final _getTitle = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__getTitle") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String getTitle() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// This will get the title of the document. This will return null if no title exists. + ///@return The title of the document. + jni.JniString getTitle() => + jni.JniString.fromRef(_getTitle(reference).object); + + static final _setTitle = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__setTitle") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setTitle(java.lang.String title) + /// + /// This will set the title of the document. + ///@param title The new title for the document. + void setTitle(jni.JniString title) => + _setTitle(reference, title.reference).check(); + + static final _getAuthor = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__getAuthor") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String getAuthor() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// This will get the author of the document. This will return null if no author exists. + ///@return The author of the document. + jni.JniString getAuthor() => + jni.JniString.fromRef(_getAuthor(reference).object); + + static final _setAuthor = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__setAuthor") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setAuthor(java.lang.String author) + /// + /// This will set the author of the document. + ///@param author The new author for the document. + void setAuthor(jni.JniString author) => + _setAuthor(reference, author.reference).check(); + + static final _getSubject = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__getSubject") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String getSubject() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// This will get the subject of the document. This will return null if no subject exists. + ///@return The subject of the document. + jni.JniString getSubject() => + jni.JniString.fromRef(_getSubject(reference).object); + + static final _setSubject = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__setSubject") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setSubject(java.lang.String subject) + /// + /// This will set the subject of the document. + ///@param subject The new subject for the document. + void setSubject(jni.JniString subject) => + _setSubject(reference, subject.reference).check(); + + static final _getKeywords = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__getKeywords") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String getKeywords() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// This will get the keywords of the document. This will return null if no keywords exists. + ///@return The keywords of the document. + jni.JniString getKeywords() => + jni.JniString.fromRef(_getKeywords(reference).object); + + static final _setKeywords = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__setKeywords") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setKeywords(java.lang.String keywords) + /// + /// This will set the keywords of the document. + ///@param keywords The new keywords for the document. + void setKeywords(jni.JniString keywords) => + _setKeywords(reference, keywords.reference).check(); + + static final _getCreator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__getCreator") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String getCreator() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// This will get the creator of the document. This will return null if no creator exists. + ///@return The creator of the document. + jni.JniString getCreator() => + jni.JniString.fromRef(_getCreator(reference).object); + + static final _setCreator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__setCreator") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setCreator(java.lang.String creator) + /// + /// This will set the creator of the document. + ///@param creator The new creator for the document. + void setCreator(jni.JniString creator) => + _setCreator(reference, creator.reference).check(); + + static final _getProducer = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__getProducer") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String getProducer() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// This will get the producer of the document. This will return null if no producer exists. + ///@return The producer of the document. + jni.JniString getProducer() => + jni.JniString.fromRef(_getProducer(reference).object); + + static final _setProducer = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__setProducer") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setProducer(java.lang.String producer) + /// + /// This will set the producer of the document. + ///@param producer The new producer for the document. + void setProducer(jni.JniString producer) => + _setProducer(reference, producer.reference).check(); + + static final _getCreationDate = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "PDDocumentInformation__getCreationDate") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.util.Calendar getCreationDate() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// This will get the creation date of the document. This will return null if no creation date exists. + ///@return The creation date of the document. + jni.JniObject getCreationDate() => + jni.JniObject.fromRef(_getCreationDate(reference).object); + + static final _setCreationDate = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( + "PDDocumentInformation__setCreationDate") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setCreationDate(java.util.Calendar date) + /// + /// This will set the creation date of the document. + ///@param date The new creation date for the document. + void setCreationDate(jni.JniObject date) => + _setCreationDate(reference, date.reference).check(); + + static final _getModificationDate = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "PDDocumentInformation__getModificationDate") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.util.Calendar getModificationDate() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// This will get the modification date of the document. This will return null if no modification date exists. + ///@return The modification date of the document. + jni.JniObject getModificationDate() => + jni.JniObject.fromRef(_getModificationDate(reference).object); + + static final _setModificationDate = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( + "PDDocumentInformation__setModificationDate") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setModificationDate(java.util.Calendar date) + /// + /// This will set the modification date of the document. + ///@param date The new modification date for the document. + void setModificationDate(jni.JniObject date) => + _setModificationDate(reference, date.reference).check(); + + static final _getTrapped = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__getTrapped") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String getTrapped() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// This will get the trapped value for the document. + /// This will return null if one is not found. + ///@return The trapped value for the document. + jni.JniString getTrapped() => + jni.JniString.fromRef(_getTrapped(reference).object); + + static final _getMetadataKeys = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "PDDocumentInformation__getMetadataKeys") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.util.Set<java.lang.String> getMetadataKeys() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// This will get the keys of all metadata information fields for the document. + ///@return all metadata key strings. + ///@since Apache PDFBox 1.3.0 + jni.JniObject getMetadataKeys() => + jni.JniObject.fromRef(_getMetadataKeys(reference).object); + + static final _getCustomMetadataValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( + "PDDocumentInformation__getCustomMetadataValue") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String getCustomMetadataValue(java.lang.String fieldName) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// This will get the value of a custom metadata information field for the document. + /// This will return null if one is not found. + ///@param fieldName Name of custom metadata field from pdf document. + ///@return String Value of metadata field + jni.JniString getCustomMetadataValue(jni.JniString fieldName) => + jni.JniString.fromRef( + _getCustomMetadataValue(reference, fieldName.reference).object); + + static final _setCustomMetadataValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( + "PDDocumentInformation__setCustomMetadataValue") + .asFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>(); + + /// from: public void setCustomMetadataValue(java.lang.String fieldName, java.lang.String fieldValue) + /// + /// Set the custom metadata value. + ///@param fieldName The name of the custom metadata field. + ///@param fieldValue The value to the custom metadata field. + void setCustomMetadataValue( + jni.JniString fieldName, jni.JniString fieldValue) => + _setCustomMetadataValue( + reference, fieldName.reference, fieldValue.reference) + .check(); + + static final _setTrapped = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("PDDocumentInformation__setTrapped") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setTrapped(java.lang.String value) + /// + /// This will set the trapped of the document. This will be + /// 'True', 'False', or 'Unknown'. + ///@param value The new trapped value for the document. + ///@throws IllegalArgumentException if the parameter is invalid. + void setTrapped(jni.JniString value) => + _setTrapped(reference, value.reference).check(); +}
diff --git a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/_package.dart b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/_package.dart new file mode 100644 index 0000000..d2b3929 --- /dev/null +++ b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/_package.dart
@@ -0,0 +1,2 @@ +export "PDDocument.dart"; +export "PDDocumentInformation.dart";
diff --git a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text.dart b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text/PDFTextStripper.dart similarity index 98% rename from pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text.dart rename to pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text/PDFTextStripper.dart index 4adb7f1..b4ac7ac 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text.dart +++ b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text/PDFTextStripper.dart
@@ -19,6 +19,8 @@ // Autogenerated by jnigen. DO NOT EDIT! // ignore_for_file: camel_case_types +// ignore_for_file: file_names +// ignore_for_file: unused_import // ignore_for_file: non_constant_identifier_names // ignore_for_file: constant_identifier_names // ignore_for_file: annotate_overrides @@ -29,8 +31,8 @@ import "package:jni/internal_helpers_for_jnigen.dart"; import "package:jni/jni.dart" as jni; -import "pdmodel.dart" as pdmodel_; -import "../../../_init.dart" show jniLookup; +import "../pdmodel/PDDocument.dart" as pddocument_; +import "../../../../_init.dart" show jniLookup; /// from: org.apache.pdfbox.text.PDFTextStripper /// @@ -762,8 +764,8 @@ /// from: protected org.apache.pdfbox.pdmodel.PDDocument document /// The returned object must be deleted after use, by calling the `delete` method. - pdmodel_.PDDocument get document => - pdmodel_.PDDocument.fromRef(_get_document(reference).object); + pddocument_.PDDocument get document => + pddocument_.PDDocument.fromRef(_get_document(reference).object); static final _set_document = jniLookup< ffi.NativeFunction< jni.JThrowable Function(jni.JObject, @@ -773,7 +775,7 @@ /// from: protected org.apache.pdfbox.pdmodel.PDDocument document /// The returned object must be deleted after use, by calling the `delete` method. - set document(pdmodel_.PDDocument value) => + set document(pddocument_.PDDocument value) => _set_document(reference, value.reference); static final _get_output = jniLookup< @@ -934,7 +936,7 @@ ///@param doc The document to get the text from. ///@return The text of the PDF document. ///@throws IOException if the doc state is invalid or it is encrypted. - jni.JniString getText(pdmodel_.PDDocument doc) => + jni.JniString getText(pddocument_.PDDocument doc) => jni.JniString.fromRef(_getText(reference, doc.reference).object); static final _resetEngine = jniLookup< @@ -962,7 +964,7 @@ ///@param doc The document to get the data from. ///@param outputStream The location to put the text. ///@throws IOException If the doc is in an invalid state. - void writeText(pdmodel_.PDDocument doc, jni.JniObject outputStream) => + void writeText(pddocument_.PDDocument doc, jni.JniObject outputStream) => _writeText(reference, doc.reference, outputStream.reference).check(); static final _processPages = jniLookup< @@ -994,7 +996,7 @@ /// This method is available for subclasses of this class. It will be called before processing of the document start. ///@param document The PDF document that is being processed. ///@throws IOException If an IO error occurs. - void startDocument(pdmodel_.PDDocument document) => + void startDocument(pddocument_.PDDocument document) => _startDocument(reference, document.reference).check(); static final _endDocument = jniLookup< @@ -1011,7 +1013,7 @@ /// finishes. ///@param document The PDF document that is being processed. ///@throws IOException If an IO error occurs. - void endDocument(pdmodel_.PDDocument document) => + void endDocument(pddocument_.PDDocument document) => _endDocument(reference, document.reference).check(); static final _processPage = jniLookup<
diff --git a/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text/_package.dart b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text/_package.dart new file mode 100644 index 0000000..07c57f7 --- /dev/null +++ b/pkgs/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text/_package.dart
@@ -0,0 +1 @@ +export "PDFTextStripper.dart";
diff --git a/pkgs/jnigen/lib/src/bindings/c_bindings.dart b/pkgs/jnigen/lib/src/bindings/c_bindings.dart index 701a66b..3dda13a 100644 --- a/pkgs/jnigen/lib/src/bindings/c_bindings.dart +++ b/pkgs/jnigen/lib/src/bindings/c_bindings.dart
@@ -71,17 +71,17 @@ final s = StringBuffer(); final name = m.finalName; - final functionName = memberNameInC(c, name); + final functionName = getMemberNameInC(c, name); final methodID = '${methodVarPrefix}_$functionName'; s.write('jmethodID $methodID = NULL;\n'); - final cMethodName = memberNameInC(c, name); + final cMethodName = getMemberNameInC(c, name); final cParams = _formalArgs(m); s.write('FFI_PLUGIN_EXPORT\n'); s.write('$jniResultType $cMethodName($cParams) {\n'); final classVar = '${classVarPrefix}_$classNameInC'; - final jniSignature = getJniSignature(m); + final jniSignature = getJniSignatureForMethod(m); s.write(_loadEnvCall); s.write(_loadClassCall(classVar, getInternalName(c.binaryName))); @@ -125,7 +125,7 @@ final s = StringBuffer(); final fieldName = f.finalName; - final fieldNameInC = memberNameInC(c, fieldName); + final fieldNameInC = getMemberNameInC(c, fieldName); final fieldVar = "${fieldVarPrefix}_$fieldNameInC"; s.write('jfieldID $fieldVar = NULL;\n'); final classVar = '${classVarPrefix}_$cClassName';
diff --git a/pkgs/jnigen/lib/src/bindings/common.dart b/pkgs/jnigen/lib/src/bindings/common.dart index 5e40605..690dbc8 100644 --- a/pkgs/jnigen/lib/src/bindings/common.dart +++ b/pkgs/jnigen/lib/src/bindings/common.dart
@@ -7,14 +7,13 @@ import 'symbol_resolver.dart'; -/// Implements the methods used by both Pure dart & C+Dart generators. +/// Base class of both C based and Dart-only binding generators. Implements +/// Many methods used commonly by both of them. /// /// These methods are in a superclass since they usually require access /// to resolver, or for consistency with similar methods which require /// the resolver. -class BindingsGenerator { - SymbolResolver resolver; - BindingsGenerator(this.resolver); +abstract class BindingsGenerator { // Name for reference in base class. static const selfPointer = 'reference'; static final indent = ' ' * 2; @@ -35,13 +34,40 @@ static const String jniResultType = '${jni}JniResult'; - /// Formal parameters list of the generated function. + /// Generate bindings string for given class declaration. + String generateBindings(ClassDecl decl, SymbolResolver resolver); + + /// Get common initialization code for bindings. + /// + /// if this method returns an empty String, no init file is created. + String getInitFileContents(); + + /// Get boilerplate to be pasted on a file before any imports. + /// + /// [initFilePath], if provided, shall point to the _init.dart file where + /// initialization code is stored. If this is null, the method should provide + /// standalone boilerplate which doesn't need an init file. + /// + /// This method should return an empty string if no such boilerplate is + /// required. + String getPreImportBoilerplate([String? initFilePath]); + + /// Get boilerplate to be pasted on a file before any imports. + /// + /// See [getPreImportBoilerplate] for an explanation of [initFilePath]. + /// + /// This method should return an empty String if no such boilerplate is + /// required. + String getPostImportBoilerplate([String? initFilePath]); + + /// Returns the formal parameters list of the generated function. /// /// This is the signature seen by the user. - String formalArgs(Method m) { + String formalArgs(Method m, SymbolResolver resolver) { final List<String> args = []; for (var param in m.params) { - args.add('${dartOuterType(param.type)} ${kwRename(param.name)}'); + args.add( + '${getDartOuterType(param.type, resolver)} ${kwRename(param.name)}'); } return args.join(', '); } @@ -58,7 +84,7 @@ String dartSigForField(Field f, {bool isSetter = false, required bool isFfiSig}) { - final conv = isFfiSig ? dartFfiType : dartInnerType; + final conv = isFfiSig ? getDartFfiType : getDartInnerType; final ref = f.modifiers.contains('static') ? '' : '$jobjectType, '; if (isSetter) { return '$jthrowableType Function($ref${conv(f.type)})'; @@ -67,7 +93,7 @@ } String dartSigForMethod(Method m, {required bool isFfiSig}) { - final conv = isFfiSig ? dartFfiType : dartInnerType; + final conv = isFfiSig ? getDartFfiType : getDartInnerType; final argTypes = [if (hasSelfParam(m)) voidPointer]; for (var param in m.params) { argTypes.add(conv(param.type)); @@ -110,8 +136,8 @@ } } - // Type for FFI Function signature - String dartFfiType(TypeUsage t) { + // Get corresponding Dart FFI type of Java type. + String getDartFfiType(TypeUsage t) { const primitives = { 'byte': 'Int8', 'short': 'Int16', @@ -136,10 +162,11 @@ } } - String dartInnerType(TypeUsage t) => _dartType(t); - String dartOuterType(TypeUsage t) => _dartType(t, resolver: resolver); + String getDartInnerType(TypeUsage t) => _dartType(t); + String getDartOuterType(TypeUsage t, SymbolResolver resolver) => + _dartType(t, resolver: resolver); - String literal(dynamic value) { + String getDartLiteral(dynamic value) { if (value is String) { // TODO(#31): escape string literal. return '"$value"'; @@ -168,12 +195,12 @@ return 'object'; } - String originalFieldDecl(Field f) { + String getOriginalFieldDecl(Field f) { final declStmt = '${f.type.shorthand} ${f.name}'; return [...f.modifiers, declStmt].join(' '); } - String originalMethodHeader(Method m) { + String getOriginalMethodHeader(Method m) { final args = <String>[]; for (var p in m.params) { args.add('${p.type.shorthand} ${p.name}'); @@ -227,7 +254,7 @@ return decl.uniqueName; } -String memberNameInC(ClassDecl decl, String name) => +String getMemberNameInC(ClassDecl decl, String name) => "${getUniqueClassName(decl)}__$name"; String getCType(String binaryName) { @@ -280,7 +307,8 @@ } } -String getInternalNameOfUsage(TypeUsage usage) { +String getInternalNameOfUsage(TypeUsage usage, + {bool escapeDollarSign = false}) { switch (usage.kind) { case Kind.declared: return getInternalName((usage.type as DeclaredType).binaryName); @@ -371,7 +399,7 @@ } /// Returns the JNI signature of the method. -String getJniSignature(Method m) { +String getJniSignatureForMethod(Method m) { final s = StringBuffer(); s.write('('); for (var param in m.params) {
diff --git a/pkgs/jnigen/lib/src/bindings/dart_bindings.dart b/pkgs/jnigen/lib/src/bindings/dart_bindings.dart index f7741e5..5096b83 100644 --- a/pkgs/jnigen/lib/src/bindings/dart_bindings.dart +++ b/pkgs/jnigen/lib/src/bindings/dart_bindings.dart
@@ -9,26 +9,29 @@ import 'symbol_resolver.dart'; import 'common.dart'; -class DartBindingsGenerator extends BindingsGenerator { - // symbol lookup function for generated code. +class CBasedDartBindingsGenerator extends BindingsGenerator { static const selfPointer = BindingsGenerator.selfPointer; - static const _jniLookup = 'jniLookup'; - static final indent = ' ' * 2; + + /// Symbol lookup function for generated code. + static const lookup = 'jniLookup'; // import prefixes static const ffi = BindingsGenerator.ffi; static const jni = BindingsGenerator.jni; + static final indent = ' ' * 2; + static const voidPointer = BindingsGenerator.voidPointer; static const ffiVoidType = BindingsGenerator.ffiVoidType; static const jniObjectType = BindingsGenerator.jniObjectType; - DartBindingsGenerator(this.config, SymbolResolver resolver) : super(resolver); + CBasedDartBindingsGenerator(this.config); Config config; - String generateBinding(ClassDecl decl) { + @override + String generateBindings(ClassDecl decl, SymbolResolver resolver) { if (!decl.isPreprocessed) { throw StateError('Java class declaration must be preprocessed before' 'being passed to bindings generator'); @@ -36,17 +39,17 @@ if (!decl.isIncluded) { return ''; } - final bindings = _class(decl); + final bindings = _class(decl, resolver); log.finest('generated bindings for class ${decl.binaryName}'); return bindings; } - String _class(ClassDecl decl) { + String _class(ClassDecl decl, SymbolResolver resolver) { final s = StringBuffer(); s.write('/// from: ${decl.binaryName}\n'); s.write(breakDocComment(decl.javadoc, depth: '')); - final name = _getSimpleName(decl.binaryName); + final name = decl.finalName; var superName = jniObjectType; if (decl.superclass != null) { @@ -66,7 +69,7 @@ continue; } try { - s.write(_field(decl, field)); + s.write(_field(decl, field, resolver)); s.writeln(); } on SkipException catch (e) { log.fine('skip field ${decl.binaryName}#${field.name}: ' @@ -79,7 +82,7 @@ continue; } try { - s.write(_method(decl, method)); + s.write(_method(decl, method, resolver)); s.writeln(); } on SkipException catch (e) { log.fine('skip field ${decl.binaryName}#${method.name}: ' @@ -90,20 +93,20 @@ return s.toString(); } - String _method(ClassDecl c, Method m) { + String _method(ClassDecl c, Method m, SymbolResolver resolver) { final name = m.finalName; - final cName = memberNameInC(c, name); + final cName = getMemberNameInC(c, name); final s = StringBuffer(); final sym = '_$name'; final ffiSig = dartSigForMethod(m, isFfiSig: true); final dartSig = dartSigForMethod(m, isFfiSig: false); - s.write('${indent}static final $sym = $_jniLookup' + s.write('${indent}static final $sym = $lookup' '<${ffi}NativeFunction<$ffiSig>>("$cName")\n' '.asFunction<$dartSig>();\n'); // Different logic for constructor and method; // For constructor, we want return type to be new object. - final returnType = dartOuterType(m.returnType); - s.write('$indent/// from: ${originalMethodHeader(m)}\n'); + final returnType = getDartOuterType(m.returnType, resolver); + s.write('$indent/// from: ${getOriginalMethodHeader(m)}\n'); if (!isPrimitive(m.returnType)) { s.write(BindingsGenerator.deleteInstruction); } @@ -116,9 +119,9 @@ if (isCtor(m)) { final wrapperExpr = '$sym(${actualArgs(m)})'; - final className = _getSimpleName(c.binaryName); + final className = c.finalName; final ctorFnName = name == 'ctor' ? className : '$className.$name'; - s.write('$ctorFnName(${formalArgs(m)}) : ' + s.write('$ctorFnName(${formalArgs(m, resolver)}) : ' 'super.fromRef($wrapperExpr.object);\n'); return s.toString(); } @@ -126,17 +129,17 @@ final resultGetter = getJValueAccessor(m.returnType); var wrapperExpr = '$sym(${actualArgs(m)}).$resultGetter'; wrapperExpr = toDartResult(wrapperExpr, m.returnType, returnType); - s.write('$returnType $name(${formalArgs(m)}) => '); + s.write('$returnType $name(${formalArgs(m, resolver)}) => '); s.write('$wrapperExpr;\n'); return s.toString(); } - String _field(ClassDecl c, Field f) { + String _field(ClassDecl c, Field f, SymbolResolver resolver) { final name = f.finalName; final s = StringBuffer(); void writeDocs({bool writeDeleteInstruction = true}) { - s.write('$indent/// from: ${originalFieldDecl(f)}\n'); + s.write('$indent/// from: ${getOriginalFieldDecl(f)}\n'); if (!isPrimitive(f.type) && writeDeleteInstruction) { s.write(BindingsGenerator.deleteInstruction); } @@ -145,17 +148,18 @@ if (isStaticField(f) && isFinalField(f) && f.defaultValue != null) { writeDocs(writeDeleteInstruction: false); - s.write('${indent}static const $name = ${literal(f.defaultValue)};\n'); + s.write( + '${indent}static const $name = ${getDartLiteral(f.defaultValue)};\n'); return s.toString(); } - final cName = memberNameInC(c, name); + final cName = getMemberNameInC(c, name); void writeAccessor({bool isSetter = false}) { final symPrefix = isSetter ? 'set' : 'get'; final sym = '_${symPrefix}_$name'; final ffiSig = dartSigForField(f, isSetter: isSetter, isFfiSig: true); final dartSig = dartSigForField(f, isSetter: isSetter, isFfiSig: false); - s.write('${indent}static final $sym = $_jniLookup' + s.write('${indent}static final $sym = $lookup' '<${ffi}NativeFunction<$ffiSig>>("${symPrefix}_$cName")\n' '.asFunction<$dartSig>();\n'); // write original type @@ -163,7 +167,8 @@ s.write(indent); if (isStaticField(f)) s.write('static '); if (isSetter) { - s.write('set $name(${dartOuterType(f.type)} value) => $sym('); + s.write( + 'set $name(${getDartOuterType(f.type, resolver)} value) => $sym('); if (!isStaticField(f)) { s.write('$selfPointer, '); } @@ -172,7 +177,7 @@ } else { // getter final self = isStaticField(f) ? '' : selfPointer; - final outer = dartOuterType(f.type); + final outer = getDartOuterType(f.type, resolver); final resultGetter = getJValueAccessor(f.type); final callExpr = '$sym($self).$resultGetter'; final resultExpr = toDartResult(callExpr, f.type, outer); @@ -185,17 +190,19 @@ return s.toString(); } - String _getSimpleName(String binaryName) { - final components = binaryName.split("."); - return components.last.replaceAll("\$", "_"); - } + static const _importsForInitCode = 'import "dart:ffi" as ffi;\n' + 'import "package:jni/internal_helpers_for_jnigen.dart";\n'; - static String initFile(String libraryName) => 'import "dart:ffi";\n' - 'import "package:jni/internal_helpers_for_jnigen.dart";\n' + /// Initialization code for C based bindings. + /// + /// Should be called once in a package. In package-structured bindings + /// this is placed in _init.dart in package root. + String _initCode() => '// Auto-generated initialization code.\n' '\n' - 'final Pointer<T> Function<T extends NativeType>(String sym) ' - 'jniLookup = ProtectedJniExtensions.initGeneratedLibrary("$libraryName");\n' - '\n'; + 'final ffi.Pointer<T> Function<T extends ffi.NativeType>(String sym)\n' + 'jniLookup = ProtectedJniExtensions.initGeneratedLibrary' + '("${config.outputConfig.cConfig.libraryName}");' + '\n\n'; static const autoGeneratedNotice = '// Autogenerated by jnigen. ' 'DO NOT EDIT!\n\n'; static const defaultImports = 'import "dart:ffi" as ffi;\n' @@ -203,12 +210,34 @@ 'import "package:jni/jni.dart" as jni;\n\n'; static const defaultLintSuppressions = '// ignore_for_file: camel_case_types\n' + '// ignore_for_file: file_names\n' + '// ignore_for_file: unused_import\n' '// ignore_for_file: non_constant_identifier_names\n' '// ignore_for_file: constant_identifier_names\n' '// ignore_for_file: annotate_overrides\n' '// ignore_for_file: no_leading_underscores_for_local_identifiers\n' '// ignore_for_file: unused_element\n' '\n'; - static const bindingFileHeaders = + static const preImportBoilerplate = autoGeneratedNotice + defaultLintSuppressions + defaultImports; + + @override + String getPostImportBoilerplate([String? initFilePath]) { + if (config.outputConfig.dartConfig.structure == + OutputStructure.singleFile) { + return _initCode(); + } else { + return 'import "${initFilePath!}" show jniLookup;\n\n'; + } + } + + @override + String getPreImportBoilerplate([String? initFilePath]) { + return preImportBoilerplate; + } + + @override + String getInitFileContents() { + return '$_importsForInitCode\n${_initCode()}'; + } }
diff --git a/pkgs/jnigen/lib/src/config/config.dart b/pkgs/jnigen/lib/src/config/config.dart index 0fad9ad..d1b9dca 100644 --- a/pkgs/jnigen/lib/src/config/config.dart +++ b/pkgs/jnigen/lib/src/config/config.dart
@@ -125,12 +125,42 @@ doclet, } +T _getEnumValueFromString<T>( + Map<String, T> values, String? name, T defaultVal) { + if (name == null) return defaultVal; + final value = values[name]; + if (value == null) throw ArgumentError('Got: $name, allowed: ${values.keys}'); + return value; +} + +void _ensureIsDirectory(String name, Uri path) { + if (!path.toFilePath().endsWith(Platform.pathSeparator)) { + throw ArgumentError('$name must be a directory path. If using YAML ' + 'config, please ensure the path ends with a slash (/).'); + } +} + +enum OutputStructure { packageStructure, singleFile } + +OutputStructure getOutputStructure(String? name, OutputStructure defaultVal) { + const values = { + 'package_structure': OutputStructure.packageStructure, + 'single_file': OutputStructure.singleFile, + }; + return _getEnumValueFromString(values, name, defaultVal); +} + class CCodeOutputConfig { CCodeOutputConfig({ required this.path, required this.libraryName, this.subdir, - }); + }) { + _ensureIsDirectory('C output path', path); + if (subdir != null) { + _ensureIsDirectory('C subdirectory', path.resolve(subdir!)); + } + } /// Directory to write JNI C Bindings, in C+Dart mode. /// @@ -152,10 +182,25 @@ class DartCodeOutputConfig { // TODO(#90): Support output_structure = single_file | package_structure. - DartCodeOutputConfig({required this.path}); + DartCodeOutputConfig({ + required this.path, + this.structure = OutputStructure.packageStructure, + }) { + if (structure == OutputStructure.singleFile) { + if (!path.toFilePath().endsWith('.dart')) { + throw ArgumentError( + 'output path must end with ".dart" in single file mode'); + } + } else { + _ensureIsDirectory('Dart output path', path); + } + } /// Path to write generated Dart bindings. Uri path; + + /// File structure of the generated Dart bindings. + OutputStructure structure; } class OutputConfig { @@ -320,11 +365,15 @@ outputConfig: OutputConfig( cConfig: CCodeOutputConfig( libraryName: must(prov.getString, '', _Props.libraryName), - path: Uri.directory(must(prov.getString, '.', _Props.cRoot)), + path: Uri.file(must(prov.getString, '.', _Props.cRoot)), subdir: prov.getString(_Props.cSubdir), ), dartConfig: DartCodeOutputConfig( - path: Uri.directory(must(prov.getString, '.', _Props.dartRoot)), + path: Uri.file(must(prov.getString, '.', _Props.dartRoot)), + structure: getOutputStructure( + prov.getString(_Props.outputStructure), + OutputStructure.packageStructure, + ), ), ), preamble: prov.getString(_Props.preamble), @@ -397,6 +446,7 @@ static const cRoot = '$cCodeOutputConfig.path'; static const cSubdir = '$cCodeOutputConfig.subdir'; static const dartRoot = '$dartCodeOutputConfig.path'; + static const outputStructure = '$dartCodeOutputConfig.structure'; static const libraryName = '$cCodeOutputConfig.library_name'; static const preamble = 'preamble'; static const logLevel = 'log_level';
diff --git a/pkgs/jnigen/lib/src/generate_bindings.dart b/pkgs/jnigen/lib/src/generate_bindings.dart index 1c51b68..e372d45 100644 --- a/pkgs/jnigen/lib/src/generate_bindings.dart +++ b/pkgs/jnigen/lib/src/generate_bindings.dart
@@ -11,7 +11,7 @@ import 'summary/summary.dart'; import 'config/config.dart'; import 'tools/tools.dart'; -import 'writers/files_writer.dart'; +import 'writers/writers.dart'; import 'logging/logging.dart'; Future<void> generateJniBindings(Config config) async { @@ -98,9 +98,16 @@ return; } final list = json as List; - final outputWriter = FilesWriter(config); + final outputStructure = config.outputConfig.dartConfig.structure; + BindingsWriter outputWriter; + if (outputStructure == OutputStructure.packageStructure) { + outputWriter = FilesWriter(config); + } else { + outputWriter = SingleFileWriter(config); + } try { - await outputWriter.writeBindings(list.map((c) => ClassDecl.fromJson(c))); + await outputWriter + .writeBindings(list.map((c) => ClassDecl.fromJson(c)).toList()); } on Exception catch (e, trace) { stderr.writeln(trace); log.fatal('Error while writing bindings: $e');
diff --git a/pkgs/jnigen/lib/src/writers/bindings_writer.dart b/pkgs/jnigen/lib/src/writers/bindings_writer.dart index f437492..68bbfcf 100644 --- a/pkgs/jnigen/lib/src/writers/bindings_writer.dart +++ b/pkgs/jnigen/lib/src/writers/bindings_writer.dart
@@ -6,19 +6,85 @@ import 'package:jnigen/jnigen.dart'; import 'package:jnigen/src/logging/logging.dart'; +import 'package:jnigen/src/util/find_package.dart'; +import 'package:jnigen/src/bindings/c_bindings.dart'; abstract class BindingsWriter { - Future<void> writeBindings(Iterable<ClassDecl> classes); + Future<void> writeBindings(List<ClassDecl> classes); +} - /// Run dart format command on [path]. - static Future<void> runDartFormat(String path) async { - log.info('Running dart format...'); - final formatRes = await Process.run('dart', ['format', path]); - // if negative exit code, likely due to an interrupt. - if (formatRes.exitCode > 0) { - log.fatal('Dart format completed with exit code ${formatRes.exitCode} ' - 'This usually means there\'s a syntax error in bindings.\n' - 'Please look at the generated files and report a bug.'); +/// Run dart format command on [path]. +Future<void> runDartFormat(String path) async { + log.info('Running dart format...'); + final formatRes = await Process.run('dart', ['format', path]); + // if negative exit code, likely due to an interrupt. + if (formatRes.exitCode > 0) { + log.fatal('Dart format completed with exit code ${formatRes.exitCode} ' + 'This usually means there\'s a syntax error in bindings.\n' + 'Please look at the generated files and report a bug.'); + } +} + +Future<void> _copyFileFromPackage(String package, String relPath, Uri target, + {String Function(String)? transform}) async { + final packagePath = await findPackageRoot(package); + if (packagePath != null) { + final sourceFile = File.fromUri(packagePath.resolve(relPath)); + final targetFile = await File.fromUri(target).create(recursive: true); + var source = await sourceFile.readAsString(); + if (transform != null) { + source = transform(source); } + await targetFile.writeAsString(source); + } else { + log.warning('package $package not found! ' + 'skipped copying ${target.toFilePath()}'); + } +} + +Future<void> writeCBindings(Config config, List<ClassDecl> classes) async { + // write C file and init file + final cRoot = config.outputConfig.cConfig.path; + final preamble = config.preamble; + log.info("Using c root = $cRoot"); + final libraryName = config.outputConfig.cConfig.libraryName; + log.info('Creating dart init file ...'); + // Create C file + final subdir = config.outputConfig.cConfig.subdir ?? '.'; + final cFileRelativePath = '$subdir/$libraryName.c'; + final cFile = await File.fromUri(cRoot.resolve(cFileRelativePath)) + .create(recursive: true); + final cFileStream = cFile.openWrite(); + // Write C Bindings + if (preamble != null) { + cFileStream.writeln(preamble); + } + cFileStream.write(CPreludes.prelude); + final cgen = CBindingGenerator(config); + final cBindings = classes.map(cgen.generateBinding).toList(); + log.info('writing c bindings to $cFile'); + cBindings.forEach(cFileStream.write); + await cFileStream.close(); + log.info('Copying auxiliary files...'); + await _copyFileFromPackage( + 'jni', 'src/dartjni.h', cRoot.resolve('$subdir/dartjni.h')); + await _copyFileFromPackage( + 'jni', 'src/.clang-format', cRoot.resolve('$subdir/.clang-format')); + await _copyFileFromPackage( + 'jnigen', 'cmake/CMakeLists.txt.tmpl', cRoot.resolve('CMakeLists.txt'), + transform: (s) { + return s + .replaceAll('{{LIBRARY_NAME}}', libraryName) + .replaceAll('{{SUBDIR}}', subdir); + }); + log.info('Running clang-format on C bindings'); + try { + final clangFormat = Process.runSync('clang-format', ['-i', cFile.path]); + if (clangFormat.exitCode != 0) { + printError(clangFormat.stderr); + log.warning('clang-format exited with $exitCode'); + } + } on ProcessException catch (e) { + log.warning('cannot run clang-format: $e'); } }
diff --git a/pkgs/jnigen/lib/src/writers/files_writer.dart b/pkgs/jnigen/lib/src/writers/files_writer.dart index d26d9c4..3b8964c 100644 --- a/pkgs/jnigen/lib/src/writers/files_writer.dart +++ b/pkgs/jnigen/lib/src/writers/files_writer.dart
@@ -9,27 +9,45 @@ import 'package:jnigen/src/logging/logging.dart'; import 'package:jnigen/src/elements/elements.dart'; import 'package:jnigen/src/config/config.dart'; -import 'package:jnigen/src/util/find_package.dart'; import 'package:jnigen/src/util/name_utils.dart'; import 'package:jnigen/src/writers/bindings_writer.dart'; +String getFileClassName(String binaryName) { + final dollarSign = binaryName.indexOf('\$'); + if (dollarSign != -1) { + return binaryName.substring(0, dollarSign); + } + return binaryName; +} + /// Resolver for file-per-package mapping, in which the java package hierarchy /// is mirrored. -class PackagePathResolver implements SymbolResolver { - PackagePathResolver(this.importMap, this.currentPackage, this.inputClassNames, - {this.predefined = const {}}); +class FilePathResolver implements SymbolResolver { + FilePathResolver( + this.importMap, + this.currentClass, + this.inputClassNames, + ); - final String currentPackage; + static const Map<String, String> predefined = { + 'java.lang.String': 'jni.JniString', + }; + + /// Class corresponding to currently writing file. + final String currentClass; + + /// Explicit import mappings. final Map<String, String> importMap; - final Map<String, String> predefined; + + /// Names of all classes in input. final Set<String> inputClassNames; final List<String> importStrings = []; - final Set<String> relativeImportedPackages = {}; + final Set<String> _relativeImportedClasses = {}; - final Map<String, String> _importedNameToPackage = {}; - final Map<String, String> _packageToImportedName = {}; + final Map<String, String> _importedNameToClass = {}; + final Map<String, String> _classToImportedName = {}; /// Returns the dart name of the [binaryName] in current translation context, /// or `null` if the name cannot be resolved. @@ -38,33 +56,33 @@ if (predefined.containsKey(binaryName)) { return predefined[binaryName]; } + final target = getFileClassName(binaryName); final parts = cutFromLast(binaryName, '.'); - final package = parts[0]; final typename = parts[1]; final simpleTypeName = typename.replaceAll('\$', '_'); - if (package == currentPackage && inputClassNames.contains(binaryName)) { + if (target == currentClass && inputClassNames.contains(binaryName)) { return simpleTypeName; } - if (_packageToImportedName.containsKey(package)) { + if (_classToImportedName.containsKey(target)) { // This package was already resolved // but we still need to check if it was a relative import, in which case // the class not in inputClassNames cannot be mapped here. - if (!relativeImportedPackages.contains(package) || + if (!_relativeImportedClasses.contains(target) || inputClassNames.contains(binaryName)) { - final importedName = _packageToImportedName[package]; + final importedName = _classToImportedName[target]; return '$importedName.$simpleTypeName'; } } - final packageImport = getImport(package, binaryName); - log.finest('$package resolved to $packageImport for $binaryName'); - if (packageImport == null) { + final classImport = getImport(target, binaryName); + log.finest('$target resolved to $classImport for $binaryName'); + if (classImport == null) { return null; } - final pkgName = cutFromLast(package, '.')[1]; + final pkgName = cutFromLast(target, '.')[1].toLowerCase(); if (pkgName.isEmpty) { throw UnsupportedError('No package could be deduced from ' 'qualified binaryName'); @@ -74,25 +92,25 @@ // never shadowed by a parameter or local variable. var importedName = '${pkgName}_'; int suffix = 0; - while (_importedNameToPackage.containsKey(importedName)) { + while (_importedNameToClass.containsKey(importedName)) { suffix++; importedName = '$pkgName${suffix}_'; } - _importedNameToPackage[importedName] = package; - _packageToImportedName[package] = importedName; - importStrings.add('import "$packageImport" as $importedName;\n'); + _importedNameToClass[importedName] = target; + _classToImportedName[target] = importedName; + importStrings.add('import "$classImport" as $importedName;\n'); return '$importedName.$simpleTypeName'; } - /// Returns import string for [packageToResolve], or `null` if package not + /// Returns import string for [classToResolve], or `null` if the class is not /// found. /// /// [binaryName] is the class name trying to be resolved. This parameter is /// requested so that classes included in current bindings can be resolved /// using relative path. - String? getImport(String packageToResolve, String binaryName) { - var prefix = packageToResolve; + String? getImport(String classToResolve, String binaryName) { + var prefix = classToResolve; // short circuit if the requested class is specified directly in import map. if (importMap.containsKey(binaryName)) { @@ -103,8 +121,8 @@ throw UnsupportedError('unexpected: empty package name.'); } - final dest = packageToResolve.split('.'); - final src = currentPackage.split('.'); + final dest = classToResolve.split('.'); + final src = currentClass.split('.'); // Use relative import when the required class is included in current set // of bindings. if (inputClassNames.contains(binaryName)) { @@ -115,12 +133,14 @@ for (int i = 0; i < src.length - 1 && i < dest.length - 1; i++) { if (src[i] == dest[i]) { common++; + } else { + break; } } final pathToCommon = '../' * ((src.length - 1) - common); - final pathToPackage = dest.sublist(max(common, 0)).join('/'); - relativeImportedPackages.add(packageToResolve); - return '$pathToCommon$pathToPackage.dart'; + final pathToClass = dest.sublist(max(common, 0)).join('/'); + _relativeImportedClasses.add(classToResolve); + return '$pathToCommon$pathToClass.dart'; } while (prefix.isNotEmpty) { @@ -167,115 +187,92 @@ Config config; @override - Future<void> writeBindings(Iterable<ClassDecl> classes) async { + Future<void> writeBindings(List<ClassDecl> classes) async { final preamble = config.preamble; - final Map<String, List<ClassDecl>> packages = {}; + final Map<String, List<ClassDecl>> files = {}; final Map<String, ClassDecl> classesByName = {}; + final Map<String, Set<String>> packages = {}; for (var c in classes) { classesByName.putIfAbsent(c.binaryName, () => c); - packages.putIfAbsent(c.packageName, () => <ClassDecl>[]); - packages[c.packageName]!.add(c); - } - final classNames = classesByName.keys.toSet(); + final fileClass = getFileClassName(c.binaryName); - final cRoot = config.outputConfig.cConfig.path; - log.info("Using c root = $cRoot"); + files.putIfAbsent(fileClass, () => <ClassDecl>[]); + files[fileClass]!.add(c); + + packages.putIfAbsent(c.packageName, () => {}); + // TODO(PR): Is the order deterministic in Set<T>? + packages[c.packageName]!.add(fileClass.split('.').last); + } + + final classNames = classesByName.keys.toSet(); + ApiPreprocessor.preprocessAll(classesByName, config); + final dartRoot = config.outputConfig.dartConfig.path; log.info("Using dart root = $dartRoot"); - final libraryName = config.outputConfig.cConfig.libraryName; + final generator = CBasedDartBindingsGenerator(config); - log.info('Creating dart init file ...'); - final initFileUri = dartRoot.resolve(_initFileName); - final initFile = await File.fromUri(initFileUri).create(recursive: true); - var initCode = DartBindingsGenerator.initFile(libraryName); - if (preamble != null) { - initCode = '$preamble\n$initCode'; + await writeCBindings(config, classes); + + // Write init file + final initFileUri = dartRoot.resolve("_init.dart"); + var initCode = generator.getInitFileContents(); + if (initCode.isNotEmpty) { + if (preamble != null) { + initCode = '$preamble\n$initCode'; + } + final initFile = File.fromUri(initFileUri); + await initFile.create(recursive: true); + await initFile.writeAsString(initCode); } - await initFile.writeAsString(initCode, flush: true); - final subdir = config.outputConfig.cConfig.subdir ?? '.'; - final cFileRelativePath = '$subdir/$libraryName.c'; - final cFile = await File.fromUri(cRoot.resolve(cFileRelativePath)) - .create(recursive: true); - final cFileStream = cFile.openWrite(); - if (preamble != null) { - cFileStream.writeln(preamble); - } - cFileStream.write(CPreludes.prelude); - ApiPreprocessor.preprocessAll(classesByName, config); - for (var packageName in packages.keys) { - final relativeFileName = '${packageName.replaceAll('.', '/')}.dart'; + + for (var fileClassName in files.keys) { + final relativeFileName = '${fileClassName.replaceAll('.', '/')}.dart'; final dartFileUri = dartRoot.resolve(relativeFileName); - log.fine('Writing bindings for $packageName...'); final dartFile = await File.fromUri(dartFileUri).create(recursive: true); - final resolver = PackagePathResolver( - config.importMap ?? const {}, packageName, classNames, - predefined: {'java.lang.String': 'jni.JniString'}); - final cgen = CBindingGenerator(config); - final dgen = DartBindingsGenerator(config, resolver); + log.fine('$fileClassName -> ${dartFile.path}'); + final resolver = FilePathResolver( + config.importMap ?? const {}, + fileClassName, + classNames, + ); - final package = packages[packageName]!; - final cBindings = package.map(cgen.generateBinding).toList(); - final dartBindings = package.map(dgen.generateBinding).toList(); - // write imports from bindings + final classesInFile = files[fileClassName]!; + final dartBindings = classesInFile + .map((decl) => generator.generateBindings(decl, resolver)) + .toList(); final dartFileStream = dartFile.openWrite(); - final initImportPath = ('../' * + if (preamble != null) { + dartFileStream.writeln(preamble); + } + + final initFilePath = ('../' * relativeFileName.codeUnits .where((cu) => '/'.codeUnitAt(0) == cu) .length) + _initFileName; - if (preamble != null) { - dartFileStream.writeln(preamble); - } + dartFileStream - ..write(DartBindingsGenerator.bindingFileHeaders) + ..write(generator.getPreImportBoilerplate(initFilePath)) ..write(resolver.getImportStrings().join('\n')) - ..write('import "$initImportPath" show jniLookup;\n\n'); + ..write(generator.getPostImportBoilerplate(initFilePath)); + // write dart bindings only after all imports are figured out dartBindings.forEach(dartFileStream.write); - cBindings.forEach(cFileStream.write); await dartFileStream.close(); } - await cFileStream.close(); - await BindingsWriter.runDartFormat(dartRoot.toFilePath()); - log.info('Copying auxiliary files...'); - await _copyFileFromPackage( - 'jni', 'src/dartjni.h', cRoot.resolve('$subdir/dartjni.h')); - await _copyFileFromPackage( - 'jni', 'src/.clang-format', cRoot.resolve('$subdir/.clang-format')); - await _copyFileFromPackage( - 'jnigen', 'cmake/CMakeLists.txt.tmpl', cRoot.resolve('CMakeLists.txt'), - transform: (s) { - return s - .replaceAll('{{LIBRARY_NAME}}', libraryName) - .replaceAll('{{SUBDIR}}', subdir); - }); - log.info('Running clang-format on C bindings'); - try { - final clangFormat = Process.runSync('clang-format', ['-i', cFile.path]); - if (clangFormat.exitCode != 0) { - printError(clangFormat.stderr); - log.warning('clang-format exited with $exitCode'); - } - } on ProcessException catch (e) { - log.warning('cannot run clang-format: $e'); - } - log.info('Completed.'); - } - Future<void> _copyFileFromPackage(String package, String relPath, Uri target, - {String Function(String)? transform}) async { - final packagePath = await findPackageRoot(package); - if (packagePath != null) { - final sourceFile = File.fromUri(packagePath.resolve(relPath)); - final targetFile = await File.fromUri(target).create(recursive: true); - var source = await sourceFile.readAsString(); - if (transform != null) { - source = transform(source); - } - await targetFile.writeAsString(source); - } else { - log.warning('package $package not found! ' - 'skipped copying ${target.toFilePath()}'); + // write _package.dart export files + for (var package in packages.keys) { + final dirUri = dartRoot.resolve('${package.replaceAll('.', '/')}/'); + final exportFileUri = dirUri.resolve("_package.dart"); + final exportFile = File.fromUri(exportFileUri); + exportFile.createSync(recursive: true); + final exports = + packages[package]!.map((cls) => 'export "$cls.dart";').join('\n'); + exportFile.writeAsStringSync(exports); } + + await runDartFormat(dartRoot.toFilePath()); + log.info('Completed.'); } }
diff --git a/pkgs/jnigen/lib/src/writers/single_file_writer.dart b/pkgs/jnigen/lib/src/writers/single_file_writer.dart new file mode 100644 index 0000000..2e526aa --- /dev/null +++ b/pkgs/jnigen/lib/src/writers/single_file_writer.dart
@@ -0,0 +1,72 @@ +// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:io'; + +import 'package:jnigen/jnigen.dart'; +import 'package:jnigen/src/bindings/bindings.dart'; +import 'package:jnigen/src/logging/logging.dart'; +import 'package:jnigen/src/writers/bindings_writer.dart'; + +/// Resolver for single-file mapping of input classes. +class SingleFileResolver implements SymbolResolver { + static const predefined = { + 'java.lang.String': 'jni.JniString', + }; + Map<String, ClassDecl> inputClasses; + SingleFileResolver(this.inputClasses); + @override + List<String> getImportStrings() { + return []; + } + + @override + String? resolve(String binaryName) { + if (predefined.containsKey(binaryName)) return predefined[binaryName]; + return inputClasses[binaryName]?.finalName; + } +} + +class SingleFileWriter extends BindingsWriter { + SingleFileWriter(this.config); + Config config; + @override + Future<void> writeBindings(List<ClassDecl> classes) async { + final preamble = config.preamble; + final Map<String, List<ClassDecl>> packages = {}; + final Map<String, ClassDecl> classesByName = {}; + + for (var c in classes) { + classesByName.putIfAbsent(c.binaryName, () => c); + packages.putIfAbsent(c.packageName, () => <ClassDecl>[]); + packages[c.packageName]!.add(c); + } + + ApiPreprocessor.preprocessAll(classesByName, config, renameClasses: true); + await writeCBindings(config, classes); + final generator = CBasedDartBindingsGenerator(config); + final file = File.fromUri(config.outputConfig.dartConfig.path); + await file.create(recursive: true); + final fileStream = file.openWrite(); + final resolver = SingleFileResolver(classesByName); + + // Have to generate bindings beforehand so that imports are all figured + // out. + final bindings = classesByName.values + .map((decl) => generator.generateBindings(decl, resolver)) + .join("\n"); + + fileStream + ..writeln(preamble ?? '') + ..writeln(generator.getPreImportBoilerplate()) + ..writeln(resolver.getImportStrings().join('\n')) + ..writeln(generator.getPostImportBoilerplate()) + ..writeln(bindings); + + await fileStream.close(); + await runDartFormat(file.path); + log.info('Completed'); + return; + } +}
diff --git a/pkgs/jnigen/lib/src/writers/writers.dart b/pkgs/jnigen/lib/src/writers/writers.dart new file mode 100644 index 0000000..0d2ca44 --- /dev/null +++ b/pkgs/jnigen/lib/src/writers/writers.dart
@@ -0,0 +1,3 @@ +export 'bindings_writer.dart'; +export 'single_file_writer.dart'; +export 'files_writer.dart';
diff --git a/pkgs/jnigen/test/bindings_test.dart b/pkgs/jnigen/test/bindings_test.dart index 799add7..2ba5e5e 100644 --- a/pkgs/jnigen/test/bindings_test.dart +++ b/pkgs/jnigen/test/bindings_test.dart
@@ -16,9 +16,8 @@ import 'package:test/test.dart'; // ignore_for_file: avoid_relative_lib_imports -import 'simple_package_test/lib/com/github/dart_lang/jnigen/simple_package.dart'; -import 'simple_package_test/lib/com/github/dart_lang/jnigen/pkg2.dart' as pkg2; -import 'jackson_core_test/third_party/lib/com/fasterxml/jackson/core.dart'; +import 'simple_package_test/lib/simple_package.dart'; +import 'jackson_core_test/third_party/lib/com/fasterxml/jackson/core/_package.dart'; import 'test_util/test_util.dart'; @@ -75,7 +74,7 @@ final aux = Example.aux; expect(aux.value, equals(true)); aux.delete(); - expect(pkg2.C2.CONSTANT, equals(12)); + expect(C2.CONSTANT, equals(12)); }); test('static methods', () { @@ -96,7 +95,7 @@ test("Check bindings for same-named classes", () { expect(Example().whichExample(), 0); - expect(pkg2.Example().whichExample(), 1); + expect(Example1().whichExample(), 1); }); test('simple json parsing test', () {
diff --git a/pkgs/jnigen/test/config_test.dart b/pkgs/jnigen/test/config_test.dart index c0589d2..eb6178e 100644 --- a/pkgs/jnigen/test/config_test.dart +++ b/pkgs/jnigen/test/config_test.dart
@@ -75,8 +75,8 @@ final config = Config.parseArgs([ '--config', join(jacksonCoreTests, 'jnigen.yaml'), - '-Doutput.c.path=$testSrc', - '-Doutput.dart.path=$testLib', + '-Doutput.c.path=$testSrc/', + '-Doutput.dart.path=$testLib/', ]); test('compare configuration values', () {
diff --git a/pkgs/jnigen/test/jackson_core_test/jnigen.yaml b/pkgs/jnigen/test/jackson_core_test/jnigen.yaml index d432067..2b553fa 100644 --- a/pkgs/jnigen/test/jackson_core_test/jnigen.yaml +++ b/pkgs/jnigen/test/jackson_core_test/jnigen.yaml
@@ -6,9 +6,9 @@ output: dart: - path: test/jackson_core_test/third_party/lib + path: test/jackson_core_test/third_party/lib/ c: - path: test/jackson_core_test/third_party/src + path: test/jackson_core_test/third_party/src/ library_name: jackson_core_test classes:
diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/lib/_init.dart b/pkgs/jnigen/test/jackson_core_test/third_party/lib/_init.dart index 5c602fd..4f96469 100644 --- a/pkgs/jnigen/test/jackson_core_test/third_party/lib/_init.dart +++ b/pkgs/jnigen/test/jackson_core_test/third_party/lib/_init.dart
@@ -15,8 +15,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -import "dart:ffi"; +import "dart:ffi" as ffi; import "package:jni/internal_helpers_for_jnigen.dart"; -final Pointer<T> Function<T extends NativeType>(String sym) jniLookup = +// Auto-generated initialization code. + +final ffi.Pointer<T> Function<T extends ffi.NativeType>(String sym) jniLookup = ProtectedJniExtensions.initGeneratedLibrary("jackson_core_test");
diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core.dart b/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core.dart deleted file mode 100644 index e0ed1ff..0000000 --- a/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core.dart +++ /dev/null
@@ -1,4176 +0,0 @@ -// Generated from jackson-core which is licensed under the Apache License 2.0. -// The following copyright from the original authors applies. -// See https://github.com/FasterXML/jackson-core/blob/2.14/LICENSE -// -// Copyright (c) 2007 - The Jackson Project Authors -// Licensed under the Apache License, Version 2.0 (the "License") -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Autogenerated by jnigen. DO NOT EDIT! - -// ignore_for_file: camel_case_types -// ignore_for_file: non_constant_identifier_names -// ignore_for_file: constant_identifier_names -// ignore_for_file: annotate_overrides -// ignore_for_file: no_leading_underscores_for_local_identifiers -// ignore_for_file: unused_element - -import "dart:ffi" as ffi; -import "package:jni/internal_helpers_for_jnigen.dart"; -import "package:jni/jni.dart" as jni; - -import "../../../_init.dart" show jniLookup; - -/// from: com.fasterxml.jackson.core.JsonFactory -/// -/// The main factory class of Jackson package, used to configure and -/// construct reader (aka parser, JsonParser) -/// and writer (aka generator, JsonGenerator) -/// instances. -/// -/// Factory instances are thread-safe and reusable after configuration -/// (if any). Typically applications and services use only a single -/// globally shared factory instance, unless they need differently -/// configured factories. Factory reuse is important if efficiency matters; -/// most recycling of expensive construct is done on per-factory basis. -/// -/// Creation of a factory instance is a light-weight operation, -/// and since there is no need for pluggable alternative implementations -/// (as there is no "standard" JSON processor API to implement), -/// the default constructor is used for constructing factory -/// instances. -///@author Tatu Saloranta -class JsonFactory extends jni.JniObject { - JsonFactory.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); - - /// from: private static final long serialVersionUID - static const serialVersionUID = 2; - - /// from: static public final java.lang.String FORMAT_NAME_JSON - /// - /// Name used to identify JSON format - /// (and returned by \#getFormatName() - static const FORMAT_NAME_JSON = "JSON"; - - static final _get_DEFAULT_FACTORY_FEATURE_FLAGS = - jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "get_JsonFactory__DEFAULT_FACTORY_FEATURE_FLAGS") - .asFunction<jni.JniResult Function()>(); - - /// from: static protected final int DEFAULT_FACTORY_FEATURE_FLAGS - /// - /// Bitfield (set of flags) of all factory features that are enabled by default. - static int get DEFAULT_FACTORY_FEATURE_FLAGS => - _get_DEFAULT_FACTORY_FEATURE_FLAGS().integer; - - static final _get_DEFAULT_PARSER_FEATURE_FLAGS = - jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "get_JsonFactory__DEFAULT_PARSER_FEATURE_FLAGS") - .asFunction<jni.JniResult Function()>(); - - /// from: static protected final int DEFAULT_PARSER_FEATURE_FLAGS - /// - /// Bitfield (set of flags) of all parser features that are enabled - /// by default. - static int get DEFAULT_PARSER_FEATURE_FLAGS => - _get_DEFAULT_PARSER_FEATURE_FLAGS().integer; - - static final _get_DEFAULT_GENERATOR_FEATURE_FLAGS = - jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "get_JsonFactory__DEFAULT_GENERATOR_FEATURE_FLAGS") - .asFunction<jni.JniResult Function()>(); - - /// from: static protected final int DEFAULT_GENERATOR_FEATURE_FLAGS - /// - /// Bitfield (set of flags) of all generator features that are enabled - /// by default. - static int get DEFAULT_GENERATOR_FEATURE_FLAGS => - _get_DEFAULT_GENERATOR_FEATURE_FLAGS().integer; - - static final _get_DEFAULT_ROOT_VALUE_SEPARATOR = - jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "get_JsonFactory__DEFAULT_ROOT_VALUE_SEPARATOR") - .asFunction<jni.JniResult Function()>(); - - /// from: static public final com.fasterxml.jackson.core.SerializableString DEFAULT_ROOT_VALUE_SEPARATOR - /// The returned object must be deleted after use, by calling the `delete` method. - static jni.JniObject get DEFAULT_ROOT_VALUE_SEPARATOR => - jni.JniObject.fromRef(_get_DEFAULT_ROOT_VALUE_SEPARATOR().object); - - static final _ctor = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "JsonFactory__ctor") - .asFunction<jni.JniResult Function()>(); - - /// from: public void <init>() - /// - /// Default constructor used to create factory instances. - /// Creation of a factory instance is a light-weight operation, - /// but it is still a good idea to reuse limited number of - /// factory instances (and quite often just a single instance): - /// factories are used as context for storing some reused - /// processing objects (such as symbol tables parsers use) - /// and this reuse only works within context of a single - /// factory instance. - JsonFactory() : super.fromRef(_ctor().object); - - static final _ctor1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory__ctor1") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public void <init>(com.fasterxml.jackson.core.ObjectCodec oc) - JsonFactory.ctor1(jni.JniObject oc) - : super.fromRef(_ctor1(oc.reference).object); - - static final _ctor2 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__ctor2") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: protected void <init>(com.fasterxml.jackson.core.JsonFactory src, com.fasterxml.jackson.core.ObjectCodec codec) - /// - /// Constructor used when copy()ing a factory instance. - ///@param src Original factory to copy settings from - ///@param codec Databinding-level codec to use, if any - ///@since 2.2.1 - JsonFactory.ctor2(JsonFactory src, jni.JniObject codec) - : super.fromRef(_ctor2(src.reference, codec.reference).object); - - static final _ctor3 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory__ctor3") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public void <init>(com.fasterxml.jackson.core.JsonFactoryBuilder b) - /// - /// Constructor used by JsonFactoryBuilder for instantiation. - ///@param b Builder that contains settings to use - ///@since 2.10 - JsonFactory.ctor3(jni.JniObject b) - : super.fromRef(_ctor3(b.reference).object); - - static final _ctor4 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Uint8)>>("JsonFactory__ctor4") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); - - /// from: protected void <init>(com.fasterxml.jackson.core.TSFBuilder<?,?> b, boolean bogus) - /// - /// Constructor for subtypes; needed to work around the fact that before 3.0, - /// this factory has cumbersome dual role as generic type as well as actual - /// implementation for json. - ///@param b Builder that contains settings to use - ///@param bogus Argument only needed to separate constructor signature; ignored - JsonFactory.ctor4(jni.JniObject b, bool bogus) - : super.fromRef(_ctor4(b.reference, bogus ? 1 : 0).object); - - static final _rebuild = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory__rebuild") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.TSFBuilder<?,?> rebuild() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that allows construction of differently configured factory, starting - /// with settings of this factory. - ///@return Builder instance to use - ///@since 2.10 - jni.JniObject rebuild() => jni.JniObject.fromRef(_rebuild(reference).object); - - static final _builder = - jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "JsonFactory__builder") - .asFunction<jni.JniResult Function()>(); - - /// from: static public com.fasterxml.jackson.core.TSFBuilder<?,?> builder() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Main factory method to use for constructing JsonFactory instances with - /// different configuration: creates and returns a builder for collecting configuration - /// settings; instance created by calling {@code build()} after all configuration - /// set. - /// - /// NOTE: signature unfortunately does not expose true implementation type; this - /// will be fixed in 3.0. - ///@return Builder instance to use - static jni.JniObject builder() => jni.JniObject.fromRef(_builder().object); - - static final _copy = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory__copy") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonFactory copy() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing a new JsonFactory that has - /// the same settings as this instance, but is otherwise - /// independent (i.e. nothing is actually shared, symbol tables - /// are separate). - /// Note that ObjectCodec reference is not copied but is - /// set to null; caller typically needs to set it after calling - /// this method. Reason for this is that the codec is used for - /// callbacks, and assumption is that there is strict 1-to-1 - /// mapping between codec, factory. Caller has to, then, explicitly - /// set codec after making the copy. - ///@return Copy of this factory instance - ///@since 2.1 - JsonFactory copy() => JsonFactory.fromRef(_copy(reference).object); - - static final _readResolve = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory__readResolve") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: protected java.lang.Object readResolve() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that we need to override to actually make restoration go - /// through constructors etc: needed to allow JDK serializability of - /// factory instances. - /// - /// Note: must be overridden by sub-classes as well. - ///@return Newly constructed instance - jni.JniObject readResolve() => - jni.JniObject.fromRef(_readResolve(reference).object); - - static final _requiresPropertyOrdering = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( - "JsonFactory__requiresPropertyOrdering") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean requiresPropertyOrdering() - /// - /// Introspection method that higher-level functionality may call - /// to see whether underlying data format requires a stable ordering - /// of object properties or not. - /// This is usually used for determining - /// whether to force a stable ordering (like alphabetic ordering by name) - /// if no ordering if explicitly specified. - /// - /// Default implementation returns <code>false</code> as JSON does NOT - /// require stable ordering. Formats that require ordering include positional - /// textual formats like <code>CSV</code>, and schema-based binary formats - /// like <code>Avro</code>. - ///@return Whether format supported by this factory - /// requires Object properties to be ordered. - ///@since 2.3 - bool requiresPropertyOrdering() => - _requiresPropertyOrdering(reference).boolean; - - static final _canHandleBinaryNatively = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( - "JsonFactory__canHandleBinaryNatively") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean canHandleBinaryNatively() - /// - /// Introspection method that higher-level functionality may call - /// to see whether underlying data format can read and write binary - /// data natively; that is, embeded it as-is without using encodings - /// such as Base64. - /// - /// Default implementation returns <code>false</code> as JSON does not - /// support native access: all binary content must use Base64 encoding. - /// Most binary formats (like Smile and Avro) support native binary content. - ///@return Whether format supported by this factory - /// supports native binary content - ///@since 2.3 - bool canHandleBinaryNatively() => _canHandleBinaryNatively(reference).boolean; - - static final _canUseCharArrays = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory__canUseCharArrays") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean canUseCharArrays() - /// - /// Introspection method that can be used by base factory to check - /// whether access using <code>char[]</code> is something that actual - /// parser implementations can take advantage of, over having to - /// use java.io.Reader. Sub-types are expected to override - /// definition; default implementation (suitable for JSON) alleges - /// that optimization are possible; and thereby is likely to try - /// to access java.lang.String content by first copying it into - /// recyclable intermediate buffer. - ///@return Whether access to decoded textual content can be efficiently - /// accessed using parser method {@code getTextCharacters()}. - ///@since 2.4 - bool canUseCharArrays() => _canUseCharArrays(reference).boolean; - - static final _canParseAsync = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory__canParseAsync") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean canParseAsync() - /// - /// Introspection method that can be used to check whether this - /// factory can create non-blocking parsers: parsers that do not - /// use blocking I/O abstractions but instead use a - /// com.fasterxml.jackson.core.async.NonBlockingInputFeeder. - ///@return Whether this factory supports non-blocking ("async") parsing or - /// not (and consequently whether {@code createNonBlockingXxx()} method(s) work) - ///@since 2.9 - bool canParseAsync() => _canParseAsync(reference).boolean; - - static final _getFormatReadFeatureType = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( - "JsonFactory__getFormatReadFeatureType") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.Class<? extends com.fasterxml.jackson.core.FormatFeature> getFormatReadFeatureType() - /// The returned object must be deleted after use, by calling the `delete` method. - jni.JniObject getFormatReadFeatureType() => - jni.JniObject.fromRef(_getFormatReadFeatureType(reference).object); - - static final _getFormatWriteFeatureType = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( - "JsonFactory__getFormatWriteFeatureType") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.Class<? extends com.fasterxml.jackson.core.FormatFeature> getFormatWriteFeatureType() - /// The returned object must be deleted after use, by calling the `delete` method. - jni.JniObject getFormatWriteFeatureType() => - jni.JniObject.fromRef(_getFormatWriteFeatureType(reference).object); - - static final _canUseSchema = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__canUseSchema") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean canUseSchema(com.fasterxml.jackson.core.FormatSchema schema) - /// - /// Method that can be used to quickly check whether given schema - /// is something that parsers and/or generators constructed by this - /// factory could use. Note that this means possible use, at the level - /// of data format (i.e. schema is for same data format as parsers and - /// generators this factory constructs); individual schema instances - /// may have further usage restrictions. - ///@param schema Schema instance to check - ///@return Whether parsers and generators constructed by this factory - /// can use specified format schema instance - bool canUseSchema(jni.JniObject schema) => - _canUseSchema(reference, schema.reference).boolean; - - static final _getFormatName = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory__getFormatName") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.String getFormatName() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that returns short textual id identifying format - /// this factory supports. - /// - /// Note: sub-classes should override this method; default - /// implementation will return null for all sub-classes - ///@return Name of the format handled by parsers, generators this factory creates - jni.JniString getFormatName() => - jni.JniString.fromRef(_getFormatName(reference).object); - - static final _hasFormat = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__hasFormat") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.format.MatchStrength hasFormat(com.fasterxml.jackson.core.format.InputAccessor acc) - /// The returned object must be deleted after use, by calling the `delete` method. - jni.JniObject hasFormat(jni.JniObject acc) => - jni.JniObject.fromRef(_hasFormat(reference, acc.reference).object); - - static final _requiresCustomCodec = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory__requiresCustomCodec") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean requiresCustomCodec() - /// - /// Method that can be called to determine if a custom - /// ObjectCodec is needed for binding data parsed - /// using JsonParser constructed by this factory - /// (which typically also implies the same for serialization - /// with JsonGenerator). - ///@return True if custom codec is needed with parsers and - /// generators created by this factory; false if a general - /// ObjectCodec is enough - ///@since 2.1 - bool requiresCustomCodec() => _requiresCustomCodec(reference).boolean; - - static final _hasJSONFormat = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__hasJSONFormat") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: protected com.fasterxml.jackson.core.format.MatchStrength hasJSONFormat(com.fasterxml.jackson.core.format.InputAccessor acc) - /// The returned object must be deleted after use, by calling the `delete` method. - jni.JniObject hasJSONFormat(jni.JniObject acc) => - jni.JniObject.fromRef(_hasJSONFormat(reference, acc.reference).object); - - static final _version = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory__version") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.Version version() - /// The returned object must be deleted after use, by calling the `delete` method. - jni.JniObject version() => jni.JniObject.fromRef(_version(reference).object); - - static final _configure = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>, ffi.Uint8)>>("JsonFactory__configure") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int)>(); - - /// from: public final com.fasterxml.jackson.core.JsonFactory configure(com.fasterxml.jackson.core.JsonFactory.Feature f, boolean state) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for enabling or disabling specified parser feature - /// (check JsonParser.Feature for list of features) - ///@param f Feature to enable/disable - ///@param state Whether to enable or disable the feature - ///@return This factory instance (to allow call chaining) - ///@deprecated since 2.10 use JsonFactoryBuilder\#configure(JsonFactory.Feature, boolean) instead - JsonFactory configure(JsonFactory_Feature f, bool state) => - JsonFactory.fromRef( - _configure(reference, f.reference, state ? 1 : 0).object); - - static final _enable = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__enable") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonFactory enable(com.fasterxml.jackson.core.JsonFactory.Feature f) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for enabling specified parser feature - /// (check JsonFactory.Feature for list of features) - ///@param f Feature to enable - ///@return This factory instance (to allow call chaining) - ///@deprecated since 2.10 use JsonFactoryBuilder\#configure(JsonFactory.Feature, boolean) instead - JsonFactory enable(JsonFactory_Feature f) => - JsonFactory.fromRef(_enable(reference, f.reference).object); - - static final _disable = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__disable") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonFactory disable(com.fasterxml.jackson.core.JsonFactory.Feature f) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for disabling specified parser features - /// (check JsonFactory.Feature for list of features) - ///@param f Feature to disable - ///@return This factory instance (to allow call chaining) - ///@deprecated since 2.10 use JsonFactoryBuilder\#configure(JsonFactory.Feature, boolean) instead - JsonFactory disable(JsonFactory_Feature f) => - JsonFactory.fromRef(_disable(reference, f.reference).object); - - static final _isEnabled = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__isEnabled") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public final boolean isEnabled(com.fasterxml.jackson.core.JsonFactory.Feature f) - /// - /// Checked whether specified parser feature is enabled. - ///@param f Feature to check - ///@return True if the specified feature is enabled - bool isEnabled(JsonFactory_Feature f) => - _isEnabled(reference, f.reference).boolean; - - static final _getParserFeatures = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory__getParserFeatures") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public final int getParserFeatures() - int getParserFeatures() => _getParserFeatures(reference).integer; - - static final _getGeneratorFeatures = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory__getGeneratorFeatures") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public final int getGeneratorFeatures() - int getGeneratorFeatures() => _getGeneratorFeatures(reference).integer; - - static final _getFormatParserFeatures = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( - "JsonFactory__getFormatParserFeatures") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public int getFormatParserFeatures() - int getFormatParserFeatures() => _getFormatParserFeatures(reference).integer; - - static final _getFormatGeneratorFeatures = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( - "JsonFactory__getFormatGeneratorFeatures") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public int getFormatGeneratorFeatures() - int getFormatGeneratorFeatures() => - _getFormatGeneratorFeatures(reference).integer; - - static final _configure1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>, ffi.Uint8)>>("JsonFactory__configure1") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int)>(); - - /// from: public final com.fasterxml.jackson.core.JsonFactory configure(com.fasterxml.jackson.core.JsonParser.Feature f, boolean state) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for enabling or disabling specified parser feature - /// (check JsonParser.Feature for list of features) - ///@param f Feature to enable/disable - ///@param state Whether to enable or disable the feature - ///@return This factory instance (to allow call chaining) - JsonFactory configure1(JsonParser_Feature f, bool state) => - JsonFactory.fromRef( - _configure1(reference, f.reference, state ? 1 : 0).object); - - static final _enable1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__enable1") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonFactory enable(com.fasterxml.jackson.core.JsonParser.Feature f) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for enabling specified parser feature - /// (check JsonParser.Feature for list of features) - ///@param f Feature to enable - ///@return This factory instance (to allow call chaining) - JsonFactory enable1(JsonParser_Feature f) => - JsonFactory.fromRef(_enable1(reference, f.reference).object); - - static final _disable1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__disable1") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonFactory disable(com.fasterxml.jackson.core.JsonParser.Feature f) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for disabling specified parser features - /// (check JsonParser.Feature for list of features) - ///@param f Feature to disable - ///@return This factory instance (to allow call chaining) - JsonFactory disable1(JsonParser_Feature f) => - JsonFactory.fromRef(_disable1(reference, f.reference).object); - - static final _isEnabled1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__isEnabled1") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public final boolean isEnabled(com.fasterxml.jackson.core.JsonParser.Feature f) - /// - /// Method for checking if the specified parser feature is enabled. - ///@param f Feature to check - ///@return True if specified feature is enabled - bool isEnabled1(JsonParser_Feature f) => - _isEnabled1(reference, f.reference).boolean; - - static final _isEnabled2 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__isEnabled2") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public final boolean isEnabled(com.fasterxml.jackson.core.StreamReadFeature f) - /// - /// Method for checking if the specified stream read feature is enabled. - ///@param f Feature to check - ///@return True if specified feature is enabled - ///@since 2.10 - bool isEnabled2(jni.JniObject f) => - _isEnabled2(reference, f.reference).boolean; - - static final _getInputDecorator = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory__getInputDecorator") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.io.InputDecorator getInputDecorator() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for getting currently configured input decorator (if any; - /// there is no default decorator). - ///@return InputDecorator configured, if any - jni.JniObject getInputDecorator() => - jni.JniObject.fromRef(_getInputDecorator(reference).object); - - static final _setInputDecorator = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__setInputDecorator") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonFactory setInputDecorator(com.fasterxml.jackson.core.io.InputDecorator d) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for overriding currently configured input decorator - ///@param d Decorator to configure for this factory, if any ({@code null} if none) - ///@return This factory instance (to allow call chaining) - ///@deprecated Since 2.10 use JsonFactoryBuilder\#inputDecorator(InputDecorator) instead - JsonFactory setInputDecorator(jni.JniObject d) => - JsonFactory.fromRef(_setInputDecorator(reference, d.reference).object); - - static final _configure2 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>, ffi.Uint8)>>("JsonFactory__configure2") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int)>(); - - /// from: public final com.fasterxml.jackson.core.JsonFactory configure(com.fasterxml.jackson.core.JsonGenerator.Feature f, boolean state) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for enabling or disabling specified generator feature - /// (check JsonGenerator.Feature for list of features) - ///@param f Feature to enable/disable - ///@param state Whether to enable or disable the feature - ///@return This factory instance (to allow call chaining) - JsonFactory configure2(jni.JniObject f, bool state) => JsonFactory.fromRef( - _configure2(reference, f.reference, state ? 1 : 0).object); - - static final _enable2 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__enable2") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonFactory enable(com.fasterxml.jackson.core.JsonGenerator.Feature f) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for enabling specified generator features - /// (check JsonGenerator.Feature for list of features) - ///@param f Feature to enable - ///@return This factory instance (to allow call chaining) - JsonFactory enable2(jni.JniObject f) => - JsonFactory.fromRef(_enable2(reference, f.reference).object); - - static final _disable2 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__disable2") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonFactory disable(com.fasterxml.jackson.core.JsonGenerator.Feature f) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for disabling specified generator feature - /// (check JsonGenerator.Feature for list of features) - ///@param f Feature to disable - ///@return This factory instance (to allow call chaining) - JsonFactory disable2(jni.JniObject f) => - JsonFactory.fromRef(_disable2(reference, f.reference).object); - - static final _isEnabled3 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__isEnabled3") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public final boolean isEnabled(com.fasterxml.jackson.core.JsonGenerator.Feature f) - /// - /// Check whether specified generator feature is enabled. - ///@param f Feature to check - ///@return Whether specified feature is enabled - bool isEnabled3(jni.JniObject f) => - _isEnabled3(reference, f.reference).boolean; - - static final _isEnabled4 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__isEnabled4") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public final boolean isEnabled(com.fasterxml.jackson.core.StreamWriteFeature f) - /// - /// Check whether specified stream write feature is enabled. - ///@param f Feature to check - ///@return Whether specified feature is enabled - ///@since 2.10 - bool isEnabled4(jni.JniObject f) => - _isEnabled4(reference, f.reference).boolean; - - static final _getCharacterEscapes = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory__getCharacterEscapes") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.io.CharacterEscapes getCharacterEscapes() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for accessing custom escapes factory uses for JsonGenerators - /// it creates. - ///@return Configured {@code CharacterEscapes}, if any; {@code null} if none - jni.JniObject getCharacterEscapes() => - jni.JniObject.fromRef(_getCharacterEscapes(reference).object); - - static final _setCharacterEscapes = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__setCharacterEscapes") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonFactory setCharacterEscapes(com.fasterxml.jackson.core.io.CharacterEscapes esc) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for defining custom escapes factory uses for JsonGenerators - /// it creates. - ///@param esc CharaterEscapes to set (or {@code null} for "none") - ///@return This factory instance (to allow call chaining) - JsonFactory setCharacterEscapes(jni.JniObject esc) => JsonFactory.fromRef( - _setCharacterEscapes(reference, esc.reference).object); - - static final _getOutputDecorator = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory__getOutputDecorator") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.io.OutputDecorator getOutputDecorator() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for getting currently configured output decorator (if any; - /// there is no default decorator). - ///@return OutputDecorator configured for generators factory creates, if any; - /// {@code null} if none. - jni.JniObject getOutputDecorator() => - jni.JniObject.fromRef(_getOutputDecorator(reference).object); - - static final _setOutputDecorator = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__setOutputDecorator") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonFactory setOutputDecorator(com.fasterxml.jackson.core.io.OutputDecorator d) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for overriding currently configured output decorator - ///@return This factory instance (to allow call chaining) - ///@param d Output decorator to use, if any - ///@deprecated Since 2.10 use JsonFactoryBuilder\#outputDecorator(OutputDecorator) instead - JsonFactory setOutputDecorator(jni.JniObject d) => - JsonFactory.fromRef(_setOutputDecorator(reference, d.reference).object); - - static final _setRootValueSeparator = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__setRootValueSeparator") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonFactory setRootValueSeparator(java.lang.String sep) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that allows overriding String used for separating root-level - /// JSON values (default is single space character) - ///@param sep Separator to use, if any; null means that no separator is - /// automatically added - ///@return This factory instance (to allow call chaining) - JsonFactory setRootValueSeparator(jni.JniString sep) => JsonFactory.fromRef( - _setRootValueSeparator(reference, sep.reference).object); - - static final _getRootValueSeparator = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory__getRootValueSeparator") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.String getRootValueSeparator() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// @return Root value separator configured, if any - jni.JniString getRootValueSeparator() => - jni.JniString.fromRef(_getRootValueSeparator(reference).object); - - static final _setCodec = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__setCodec") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonFactory setCodec(com.fasterxml.jackson.core.ObjectCodec oc) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for associating a ObjectCodec (typically - /// a <code>com.fasterxml.jackson.databind.ObjectMapper</code>) - /// with this factory (and more importantly, parsers and generators - /// it constructs). This is needed to use data-binding methods - /// of JsonParser and JsonGenerator instances. - ///@param oc Codec to use - ///@return This factory instance (to allow call chaining) - JsonFactory setCodec(jni.JniObject oc) => - JsonFactory.fromRef(_setCodec(reference, oc.reference).object); - - static final _getCodec = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory__getCodec") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.ObjectCodec getCodec() - /// The returned object must be deleted after use, by calling the `delete` method. - jni.JniObject getCodec() => - jni.JniObject.fromRef(_getCodec(reference).object); - - static final _createParser = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.io.File f) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing JSON parser instance to parse - /// contents of specified file. - /// - /// - /// Encoding is auto-detected from contents according to JSON - /// specification recommended mechanism. Json specification - /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, - /// so auto-detection implemented only for this charsets. - /// For other charsets use \#createParser(java.io.Reader). - /// - /// - /// Underlying input stream (needed for reading contents) - /// will be __owned__ (and managed, i.e. closed as need be) by - /// the parser, since caller has no access to it. - ///@param f File that contains JSON content to parse - ///@since 2.1 - JsonParser createParser(jni.JniObject f) => - JsonParser.fromRef(_createParser(reference, f.reference).object); - - static final _createParser1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser1") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.net.URL url) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing JSON parser instance to parse - /// contents of resource reference by given URL. - /// - /// Encoding is auto-detected from contents according to JSON - /// specification recommended mechanism. Json specification - /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, - /// so auto-detection implemented only for this charsets. - /// For other charsets use \#createParser(java.io.Reader). - /// - /// Underlying input stream (needed for reading contents) - /// will be __owned__ (and managed, i.e. closed as need be) by - /// the parser, since caller has no access to it. - ///@param url URL pointing to resource that contains JSON content to parse - ///@since 2.1 - JsonParser createParser1(jni.JniObject url) => - JsonParser.fromRef(_createParser1(reference, url.reference).object); - - static final _createParser2 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser2") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.io.InputStream in) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing JSON parser instance to parse - /// the contents accessed via specified input stream. - /// - /// The input stream will __not be owned__ by - /// the parser, it will still be managed (i.e. closed if - /// end-of-stream is reacher, or parser close method called) - /// if (and only if) com.fasterxml.jackson.core.StreamReadFeature\#AUTO_CLOSE_SOURCE - /// is enabled. - /// - /// - /// Note: no encoding argument is taken since it can always be - /// auto-detected as suggested by JSON RFC. Json specification - /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, - /// so auto-detection implemented only for this charsets. - /// For other charsets use \#createParser(java.io.Reader). - ///@param in InputStream to use for reading JSON content to parse - ///@since 2.1 - JsonParser createParser2(jni.JniObject in0) => - JsonParser.fromRef(_createParser2(reference, in0.reference).object); - - static final _createParser3 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser3") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.io.Reader r) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing parser for parsing - /// the contents accessed via specified Reader. - /// - /// The read stream will __not be owned__ by - /// the parser, it will still be managed (i.e. closed if - /// end-of-stream is reacher, or parser close method called) - /// if (and only if) com.fasterxml.jackson.core.StreamReadFeature\#AUTO_CLOSE_SOURCE - /// is enabled. - ///@param r Reader to use for reading JSON content to parse - ///@since 2.1 - JsonParser createParser3(jni.JniObject r) => - JsonParser.fromRef(_createParser3(reference, r.reference).object); - - static final _createParser4 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser4") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createParser(byte[] data) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing parser for parsing - /// the contents of given byte array. - ///@since 2.1 - JsonParser createParser4(jni.JniObject data) => - JsonParser.fromRef(_createParser4(reference, data.reference).object); - - static final _createParser5 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>, - ffi.Int32, - ffi.Int32)>>("JsonFactory__createParser5") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int, int)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createParser(byte[] data, int offset, int len) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing parser for parsing - /// the contents of given byte array. - ///@param data Buffer that contains data to parse - ///@param offset Offset of the first data byte within buffer - ///@param len Length of contents to parse within buffer - ///@since 2.1 - JsonParser createParser5(jni.JniObject data, int offset, int len) => - JsonParser.fromRef( - _createParser5(reference, data.reference, offset, len).object); - - static final _createParser6 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser6") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.lang.String content) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing parser for parsing - /// contents of given String. - ///@since 2.1 - JsonParser createParser6(jni.JniString content) => - JsonParser.fromRef(_createParser6(reference, content.reference).object); - - static final _createParser7 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser7") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createParser(char[] content) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing parser for parsing - /// contents of given char array. - ///@since 2.4 - JsonParser createParser7(jni.JniObject content) => - JsonParser.fromRef(_createParser7(reference, content.reference).object); - - static final _createParser8 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>, - ffi.Int32, - ffi.Int32)>>("JsonFactory__createParser8") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int, int)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createParser(char[] content, int offset, int len) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing parser for parsing contents of given char array. - ///@since 2.4 - JsonParser createParser8(jni.JniObject content, int offset, int len) => - JsonParser.fromRef( - _createParser8(reference, content.reference, offset, len).object); - - static final _createParser9 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser9") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.io.DataInput in) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Optional method for constructing parser for reading contents from specified DataInput - /// instance. - /// - /// If this factory does not support DataInput as source, - /// will throw UnsupportedOperationException - ///@since 2.8 - JsonParser createParser9(jni.JniObject in0) => - JsonParser.fromRef(_createParser9(reference, in0.reference).object); - - static final _createNonBlockingByteArrayParser = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( - "JsonFactory__createNonBlockingByteArrayParser") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createNonBlockingByteArrayParser() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Optional method for constructing parser for non-blocking parsing - /// via com.fasterxml.jackson.core.async.ByteArrayFeeder - /// interface (accessed using JsonParser\#getNonBlockingInputFeeder() - /// from constructed instance). - /// - /// If this factory does not support non-blocking parsing (either at all, - /// or from byte array), - /// will throw UnsupportedOperationException. - /// - /// Note that JSON-backed factory only supports parsing of UTF-8 encoded JSON content - /// (and US-ASCII since it is proper subset); other encodings are not supported - /// at this point. - ///@since 2.9 - JsonParser createNonBlockingByteArrayParser() => - JsonParser.fromRef(_createNonBlockingByteArrayParser(reference).object); - - static final _createGenerator = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator") - .asFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing JSON generator for writing JSON content - /// using specified output stream. - /// Encoding to use must be specified, and needs to be one of available - /// types (as per JSON specification). - /// - /// Underlying stream __is NOT owned__ by the generator constructed, - /// so that generator will NOT close the output stream when - /// JsonGenerator\#close is called (unless auto-closing - /// feature, - /// com.fasterxml.jackson.core.JsonGenerator.Feature\#AUTO_CLOSE_TARGET - /// is enabled). - /// Using application needs to close it explicitly if this is the case. - /// - /// Note: there are formats that use fixed encoding (like most binary data formats) - /// and that ignore passed in encoding. - ///@param out OutputStream to use for writing JSON content - ///@param enc Character encoding to use - ///@since 2.1 - jni.JniObject createGenerator(jni.JniObject out, jni.JniObject enc) => - jni.JniObject.fromRef( - _createGenerator(reference, out.reference, enc.reference).object); - - static final _createGenerator1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator1") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.OutputStream out) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Convenience method for constructing generator that uses default - /// encoding of the format (UTF-8 for JSON and most other data formats). - /// - /// Note: there are formats that use fixed encoding (like most binary data formats). - ///@since 2.1 - jni.JniObject createGenerator1(jni.JniObject out) => - jni.JniObject.fromRef(_createGenerator1(reference, out.reference).object); - - static final _createGenerator2 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator2") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.Writer w) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing JSON generator for writing JSON content - /// using specified Writer. - /// - /// Underlying stream __is NOT owned__ by the generator constructed, - /// so that generator will NOT close the Reader when - /// JsonGenerator\#close is called (unless auto-closing - /// feature, - /// com.fasterxml.jackson.core.JsonGenerator.Feature\#AUTO_CLOSE_TARGET is enabled). - /// Using application needs to close it explicitly. - ///@since 2.1 - ///@param w Writer to use for writing JSON content - jni.JniObject createGenerator2(jni.JniObject w) => - jni.JniObject.fromRef(_createGenerator2(reference, w.reference).object); - - static final _createGenerator3 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator3") - .asFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.File f, com.fasterxml.jackson.core.JsonEncoding enc) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing JSON generator for writing JSON content - /// to specified file, overwriting contents it might have (or creating - /// it if such file does not yet exist). - /// Encoding to use must be specified, and needs to be one of available - /// types (as per JSON specification). - /// - /// Underlying stream __is owned__ by the generator constructed, - /// i.e. generator will handle closing of file when - /// JsonGenerator\#close is called. - ///@param f File to write contents to - ///@param enc Character encoding to use - ///@since 2.1 - jni.JniObject createGenerator3(jni.JniObject f, jni.JniObject enc) => - jni.JniObject.fromRef( - _createGenerator3(reference, f.reference, enc.reference).object); - - static final _createGenerator4 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator4") - .asFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.DataOutput out, com.fasterxml.jackson.core.JsonEncoding enc) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing generator for writing content using specified - /// DataOutput instance. - ///@since 2.8 - jni.JniObject createGenerator4(jni.JniObject out, jni.JniObject enc) => - jni.JniObject.fromRef( - _createGenerator4(reference, out.reference, enc.reference).object); - - static final _createGenerator5 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator5") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.DataOutput out) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Convenience method for constructing generator that uses default - /// encoding of the format (UTF-8 for JSON and most other data formats). - /// - /// Note: there are formats that use fixed encoding (like most binary data formats). - ///@since 2.8 - jni.JniObject createGenerator5(jni.JniObject out) => - jni.JniObject.fromRef(_createGenerator5(reference, out.reference).object); - - static final _createJsonParser = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(java.io.File f) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing JSON parser instance to parse - /// contents of specified file. - /// - /// Encoding is auto-detected from contents according to JSON - /// specification recommended mechanism. Json specification - /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, - /// so auto-detection implemented only for this charsets. - /// For other charsets use \#createParser(java.io.Reader). - /// - /// - /// Underlying input stream (needed for reading contents) - /// will be __owned__ (and managed, i.e. closed as need be) by - /// the parser, since caller has no access to it. - ///@param f File that contains JSON content to parse - ///@return Parser constructed - ///@throws IOException if parser initialization fails due to I/O (read) problem - ///@throws JsonParseException if parser initialization fails due to content decoding problem - ///@deprecated Since 2.2, use \#createParser(File) instead. - JsonParser createJsonParser(jni.JniObject f) => - JsonParser.fromRef(_createJsonParser(reference, f.reference).object); - - static final _createJsonParser1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser1") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(java.net.URL url) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing JSON parser instance to parse - /// contents of resource reference by given URL. - /// - /// Encoding is auto-detected from contents according to JSON - /// specification recommended mechanism. Json specification - /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, - /// so auto-detection implemented only for this charsets. - /// For other charsets use \#createParser(java.io.Reader). - /// - /// Underlying input stream (needed for reading contents) - /// will be __owned__ (and managed, i.e. closed as need be) by - /// the parser, since caller has no access to it. - ///@param url URL pointing to resource that contains JSON content to parse - ///@return Parser constructed - ///@throws IOException if parser initialization fails due to I/O (read) problem - ///@throws JsonParseException if parser initialization fails due to content decoding problem - ///@deprecated Since 2.2, use \#createParser(URL) instead. - JsonParser createJsonParser1(jni.JniObject url) => - JsonParser.fromRef(_createJsonParser1(reference, url.reference).object); - - static final _createJsonParser2 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser2") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(java.io.InputStream in) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing JSON parser instance to parse - /// the contents accessed via specified input stream. - /// - /// The input stream will __not be owned__ by - /// the parser, it will still be managed (i.e. closed if - /// end-of-stream is reacher, or parser close method called) - /// if (and only if) com.fasterxml.jackson.core.JsonParser.Feature\#AUTO_CLOSE_SOURCE - /// is enabled. - /// - /// - /// Note: no encoding argument is taken since it can always be - /// auto-detected as suggested by JSON RFC. Json specification - /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, - /// so auto-detection implemented only for this charsets. - /// For other charsets use \#createParser(java.io.Reader). - ///@param in InputStream to use for reading JSON content to parse - ///@return Parser constructed - ///@throws IOException if parser initialization fails due to I/O (read) problem - ///@throws JsonParseException if parser initialization fails due to content decoding problem - ///@deprecated Since 2.2, use \#createParser(InputStream) instead. - JsonParser createJsonParser2(jni.JniObject in0) => - JsonParser.fromRef(_createJsonParser2(reference, in0.reference).object); - - static final _createJsonParser3 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser3") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(java.io.Reader r) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing parser for parsing - /// the contents accessed via specified Reader. - /// - /// The read stream will __not be owned__ by - /// the parser, it will still be managed (i.e. closed if - /// end-of-stream is reacher, or parser close method called) - /// if (and only if) com.fasterxml.jackson.core.JsonParser.Feature\#AUTO_CLOSE_SOURCE - /// is enabled. - ///@param r Reader to use for reading JSON content to parse - ///@return Parser constructed - ///@throws IOException if parser initialization fails due to I/O (read) problem - ///@throws JsonParseException if parser initialization fails due to content decoding problem - ///@deprecated Since 2.2, use \#createParser(Reader) instead. - JsonParser createJsonParser3(jni.JniObject r) => - JsonParser.fromRef(_createJsonParser3(reference, r.reference).object); - - static final _createJsonParser4 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser4") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(byte[] data) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing parser for parsing the contents of given byte array. - ///@param data Input content to parse - ///@return Parser constructed - ///@throws IOException if parser initialization fails due to I/O (read) problem - ///@throws JsonParseException if parser initialization fails due to content decoding problem - ///@deprecated Since 2.2, use \#createParser(byte[]) instead. - JsonParser createJsonParser4(jni.JniObject data) => - JsonParser.fromRef(_createJsonParser4(reference, data.reference).object); - - static final _createJsonParser5 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>, - ffi.Int32, - ffi.Int32)>>("JsonFactory__createJsonParser5") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int, int)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(byte[] data, int offset, int len) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing parser for parsing - /// the contents of given byte array. - ///@param data Buffer that contains data to parse - ///@param offset Offset of the first data byte within buffer - ///@param len Length of contents to parse within buffer - ///@return Parser constructed - ///@throws IOException if parser initialization fails due to I/O (read) problem - ///@throws JsonParseException if parser initialization fails due to content decoding problem - ///@deprecated Since 2.2, use \#createParser(byte[],int,int) instead. - JsonParser createJsonParser5(jni.JniObject data, int offset, int len) => - JsonParser.fromRef( - _createJsonParser5(reference, data.reference, offset, len).object); - - static final _createJsonParser6 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser6") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(java.lang.String content) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing parser for parsing - /// contents of given String. - ///@param content Input content to parse - ///@return Parser constructed - ///@throws IOException if parser initialization fails due to I/O (read) problem - ///@throws JsonParseException if parser initialization fails due to content decoding problem - ///@deprecated Since 2.2, use \#createParser(String) instead. - JsonParser createJsonParser6(jni.JniString content) => JsonParser.fromRef( - _createJsonParser6(reference, content.reference).object); - - static final _createJsonGenerator = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonGenerator") - .asFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonGenerator createJsonGenerator(java.io.OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing JSON generator for writing JSON content - /// using specified output stream. - /// Encoding to use must be specified, and needs to be one of available - /// types (as per JSON specification). - /// - /// Underlying stream __is NOT owned__ by the generator constructed, - /// so that generator will NOT close the output stream when - /// JsonGenerator\#close is called (unless auto-closing - /// feature, - /// com.fasterxml.jackson.core.JsonGenerator.Feature\#AUTO_CLOSE_TARGET - /// is enabled). - /// Using application needs to close it explicitly if this is the case. - /// - /// Note: there are formats that use fixed encoding (like most binary data formats) - /// and that ignore passed in encoding. - ///@param out OutputStream to use for writing JSON content - ///@param enc Character encoding to use - ///@return Generator constructed - ///@throws IOException if parser initialization fails due to I/O (write) problem - ///@deprecated Since 2.2, use \#createGenerator(OutputStream, JsonEncoding) instead. - jni.JniObject createJsonGenerator(jni.JniObject out, jni.JniObject enc) => - jni.JniObject.fromRef( - _createJsonGenerator(reference, out.reference, enc.reference).object); - - static final _createJsonGenerator1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonGenerator1") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonGenerator createJsonGenerator(java.io.Writer out) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for constructing JSON generator for writing JSON content - /// using specified Writer. - /// - /// Underlying stream __is NOT owned__ by the generator constructed, - /// so that generator will NOT close the Reader when - /// JsonGenerator\#close is called (unless auto-closing - /// feature, - /// com.fasterxml.jackson.core.JsonGenerator.Feature\#AUTO_CLOSE_TARGET is enabled). - /// Using application needs to close it explicitly. - ///@param out Writer to use for writing JSON content - ///@return Generator constructed - ///@throws IOException if parser initialization fails due to I/O (write) problem - ///@deprecated Since 2.2, use \#createGenerator(Writer) instead. - jni.JniObject createJsonGenerator1(jni.JniObject out) => - jni.JniObject.fromRef( - _createJsonGenerator1(reference, out.reference).object); - - static final _createJsonGenerator2 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonGenerator2") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonGenerator createJsonGenerator(java.io.OutputStream out) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Convenience method for constructing generator that uses default - /// encoding of the format (UTF-8 for JSON and most other data formats). - /// - /// Note: there are formats that use fixed encoding (like most binary data formats). - ///@param out OutputStream to use for writing JSON content - ///@return Generator constructed - ///@throws IOException if parser initialization fails due to I/O (write) problem - ///@deprecated Since 2.2, use \#createGenerator(OutputStream) instead. - jni.JniObject createJsonGenerator2(jni.JniObject out) => - jni.JniObject.fromRef( - _createJsonGenerator2(reference, out.reference).object); -} - -/// from: com.fasterxml.jackson.core.JsonFactory$Feature -/// -/// Enumeration that defines all on/off features that can only be -/// changed for JsonFactory. -class JsonFactory_Feature extends jni.JniObject { - JsonFactory_Feature.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); - - static final _values = - jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "JsonFactory_Feature__values") - .asFunction<jni.JniResult Function()>(); - - /// from: static public com.fasterxml.jackson.core.JsonFactory.Feature[] values() - /// The returned object must be deleted after use, by calling the `delete` method. - static jni.JniObject values() => jni.JniObject.fromRef(_values().object); - - static final _valueOf = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory_Feature__valueOf") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: static public com.fasterxml.jackson.core.JsonFactory.Feature valueOf(java.lang.String name) - /// The returned object must be deleted after use, by calling the `delete` method. - static JsonFactory_Feature valueOf(jni.JniString name) => - JsonFactory_Feature.fromRef(_valueOf(name.reference).object); - - static final _collectDefaults = - jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "JsonFactory_Feature__collectDefaults") - .asFunction<jni.JniResult Function()>(); - - /// from: static public int collectDefaults() - /// - /// Method that calculates bit set (flags) of all features that - /// are enabled by default. - ///@return Bit field of features enabled by default - static int collectDefaults() => _collectDefaults().integer; - - static final _ctor = - jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Uint8)>>( - "JsonFactory_Feature__ctor") - .asFunction<jni.JniResult Function(int)>(); - - /// from: private void <init>(boolean defaultState) - JsonFactory_Feature(bool defaultState) - : super.fromRef(_ctor(defaultState ? 1 : 0).object); - - static final _enabledByDefault = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( - "JsonFactory_Feature__enabledByDefault") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean enabledByDefault() - bool enabledByDefault() => _enabledByDefault(reference).boolean; - - static final _enabledIn = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Int32)>>("JsonFactory_Feature__enabledIn") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); - - /// from: public boolean enabledIn(int flags) - bool enabledIn(int flags) => _enabledIn(reference, flags).boolean; - - static final _getMask = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonFactory_Feature__getMask") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public int getMask() - int getMask() => _getMask(reference).integer; -} - -/// from: com.fasterxml.jackson.core.JsonParser -/// -/// Base class that defines public API for reading JSON content. -/// Instances are created using factory methods of -/// a JsonFactory instance. -///@author Tatu Saloranta -class JsonParser extends jni.JniObject { - JsonParser.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); - - /// from: private static final int MIN_BYTE_I - static const MIN_BYTE_I = -128; - - /// from: private static final int MAX_BYTE_I - static const MAX_BYTE_I = 255; - - /// from: private static final int MIN_SHORT_I - static const MIN_SHORT_I = -32768; - - /// from: private static final int MAX_SHORT_I - static const MAX_SHORT_I = 32767; - - static final _get_DEFAULT_READ_CAPABILITIES = - jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "get_JsonParser__DEFAULT_READ_CAPABILITIES") - .asFunction<jni.JniResult Function()>(); - - /// from: static protected final com.fasterxml.jackson.core.util.JacksonFeatureSet<com.fasterxml.jackson.core.StreamReadCapability> DEFAULT_READ_CAPABILITIES - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Default set of StreamReadCapabilityies that may be used as - /// basis for format-specific readers (or as bogus instance if non-null - /// set needs to be passed). - ///@since 2.12 - static jni.JniObject get DEFAULT_READ_CAPABILITIES => - jni.JniObject.fromRef(_get_DEFAULT_READ_CAPABILITIES().object); - - static final _ctor = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "JsonParser__ctor") - .asFunction<jni.JniResult Function()>(); - - /// from: protected void <init>() - JsonParser() : super.fromRef(_ctor().object); - - static final _ctor1 = - jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Int32)>>( - "JsonParser__ctor1") - .asFunction<jni.JniResult Function(int)>(); - - /// from: protected void <init>(int features) - JsonParser.ctor1(int features) : super.fromRef(_ctor1(features).object); - - static final _getCodec = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getCodec") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract com.fasterxml.jackson.core.ObjectCodec getCodec() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Accessor for ObjectCodec associated with this - /// parser, if any. Codec is used by \#readValueAs(Class) - /// method (and its variants). - ///@return Codec assigned to this parser, if any; {@code null} if none - jni.JniObject getCodec() => - jni.JniObject.fromRef(_getCodec(reference).object); - - static final _setCodec = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__setCodec") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract void setCodec(com.fasterxml.jackson.core.ObjectCodec oc) - /// - /// Setter that allows defining ObjectCodec associated with this - /// parser, if any. Codec is used by \#readValueAs(Class) - /// method (and its variants). - ///@param oc Codec to assign, if any; {@code null} if none - void setCodec(jni.JniObject oc) => _setCodec(reference, oc.reference).check(); - - static final _getInputSource = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getInputSource") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.Object getInputSource() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that can be used to get access to object that is used - /// to access input being parsed; this is usually either - /// InputStream or Reader, depending on what - /// parser was constructed with. - /// Note that returned value may be null in some cases; including - /// case where parser implementation does not want to exposed raw - /// source to caller. - /// In cases where input has been decorated, object returned here - /// is the decorated version; this allows some level of interaction - /// between users of parser and decorator object. - /// - /// In general use of this accessor should be considered as - /// "last effort", i.e. only used if no other mechanism is applicable. - ///@return Input source this parser was configured with - jni.JniObject getInputSource() => - jni.JniObject.fromRef(_getInputSource(reference).object); - - static final _setRequestPayloadOnError = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( - "JsonParser__setRequestPayloadOnError") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public void setRequestPayloadOnError(com.fasterxml.jackson.core.util.RequestPayload payload) - /// - /// Sets the payload to be passed if JsonParseException is thrown. - ///@param payload Payload to pass - ///@since 2.8 - void setRequestPayloadOnError(jni.JniObject payload) => - _setRequestPayloadOnError(reference, payload.reference).check(); - - static final _setRequestPayloadOnError1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( - "JsonParser__setRequestPayloadOnError1") - .asFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>(); - - /// from: public void setRequestPayloadOnError(byte[] payload, java.lang.String charset) - /// - /// Sets the byte[] request payload and the charset - ///@param payload Payload to pass - ///@param charset Character encoding for (lazily) decoding payload - ///@since 2.8 - void setRequestPayloadOnError1( - jni.JniObject payload, jni.JniString charset) => - _setRequestPayloadOnError1( - reference, payload.reference, charset.reference) - .check(); - - static final _setRequestPayloadOnError2 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( - "JsonParser__setRequestPayloadOnError2") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public void setRequestPayloadOnError(java.lang.String payload) - /// - /// Sets the String request payload - ///@param payload Payload to pass - ///@since 2.8 - void setRequestPayloadOnError2(jni.JniString payload) => - _setRequestPayloadOnError2(reference, payload.reference).check(); - - static final _setSchema = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__setSchema") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public void setSchema(com.fasterxml.jackson.core.FormatSchema schema) - /// - /// Method to call to make this parser use specified schema. Method must - /// be called before trying to parse any content, right after parser instance - /// has been created. - /// Note that not all parsers support schemas; and those that do usually only - /// accept specific types of schemas: ones defined for data format parser can read. - /// - /// If parser does not support specified schema, UnsupportedOperationException - /// is thrown. - ///@param schema Schema to use - ///@throws UnsupportedOperationException if parser does not support schema - void setSchema(jni.JniObject schema) => - _setSchema(reference, schema.reference).check(); - - static final _getSchema = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getSchema") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.FormatSchema getSchema() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for accessing Schema that this parser uses, if any. - /// Default implementation returns null. - ///@return Schema in use by this parser, if any; {@code null} if none - ///@since 2.1 - jni.JniObject getSchema() => - jni.JniObject.fromRef(_getSchema(reference).object); - - static final _canUseSchema = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__canUseSchema") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean canUseSchema(com.fasterxml.jackson.core.FormatSchema schema) - /// - /// Method that can be used to verify that given schema can be used with - /// this parser (using \#setSchema). - ///@param schema Schema to check - ///@return True if this parser can use given schema; false if not - bool canUseSchema(jni.JniObject schema) => - _canUseSchema(reference, schema.reference).boolean; - - static final _requiresCustomCodec = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__requiresCustomCodec") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean requiresCustomCodec() - /// - /// Method that can be called to determine if a custom - /// ObjectCodec is needed for binding data parsed - /// using JsonParser constructed by this factory - /// (which typically also implies the same for serialization - /// with JsonGenerator). - ///@return True if format-specific codec is needed with this parser; false if a general - /// ObjectCodec is enough - ///@since 2.1 - bool requiresCustomCodec() => _requiresCustomCodec(reference).boolean; - - static final _canParseAsync = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__canParseAsync") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean canParseAsync() - /// - /// Method that can be called to determine if this parser instance - /// uses non-blocking ("asynchronous") input access for decoding or not. - /// Access mode is determined by earlier calls via JsonFactory; - /// it may not be changed after construction. - /// - /// If non-blocking decoding is (@code true}, it is possible to call - /// \#getNonBlockingInputFeeder() to obtain object to use - /// for feeding input; otherwise (<code>false</code> returned) - /// input is read by blocking - ///@return True if this is a non-blocking ("asynchronous") parser - ///@since 2.9 - bool canParseAsync() => _canParseAsync(reference).boolean; - - static final _getNonBlockingInputFeeder = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( - "JsonParser__getNonBlockingInputFeeder") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.async.NonBlockingInputFeeder getNonBlockingInputFeeder() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that will either return a feeder instance (if parser uses - /// non-blocking, aka asynchronous access); or <code>null</code> for - /// parsers that use blocking I/O. - ///@return Input feeder to use with non-blocking (async) parsing - ///@since 2.9 - jni.JniObject getNonBlockingInputFeeder() => - jni.JniObject.fromRef(_getNonBlockingInputFeeder(reference).object); - - static final _getReadCapabilities = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getReadCapabilities") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.util.JacksonFeatureSet<com.fasterxml.jackson.core.StreamReadCapability> getReadCapabilities() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Accessor for getting metadata on capabilities of this parser, based on - /// underlying data format being read (directly or indirectly). - ///@return Set of read capabilities for content to read via this parser - ///@since 2.12 - jni.JniObject getReadCapabilities() => - jni.JniObject.fromRef(_getReadCapabilities(reference).object); - - static final _version = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__version") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract com.fasterxml.jackson.core.Version version() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Accessor for getting version of the core package, given a parser instance. - /// Left for sub-classes to implement. - ///@return Version of this generator (derived from version declared for - /// {@code jackson-core} jar that contains the class - jni.JniObject version() => jni.JniObject.fromRef(_version(reference).object); - - static final _close = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__close") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract void close() - /// - /// Closes the parser so that no further iteration or data access - /// can be made; will also close the underlying input source - /// if parser either __owns__ the input source, or feature - /// Feature\#AUTO_CLOSE_SOURCE is enabled. - /// Whether parser owns the input source depends on factory - /// method that was used to construct instance (so check - /// com.fasterxml.jackson.core.JsonFactory for details, - /// but the general - /// idea is that if caller passes in closable resource (such - /// as InputStream or Reader) parser does NOT - /// own the source; but if it passes a reference (such as - /// java.io.File or java.net.URL and creates - /// stream or reader it does own them. - ///@throws IOException if there is either an underlying I/O problem - void close() => _close(reference).check(); - - static final _isClosed = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__isClosed") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract boolean isClosed() - /// - /// Method that can be called to determine whether this parser - /// is closed or not. If it is closed, no new tokens can be - /// retrieved by calling \#nextToken (and the underlying - /// stream may be closed). Closing may be due to an explicit - /// call to \#close or because parser has encountered - /// end of input. - ///@return {@code True} if this parser instance has been closed - bool isClosed() => _isClosed(reference).boolean; - - static final _getParsingContext = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getParsingContext") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract com.fasterxml.jackson.core.JsonStreamContext getParsingContext() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that can be used to access current parsing context reader - /// is in. There are 3 different types: root, array and object contexts, - /// with slightly different available information. Contexts are - /// hierarchically nested, and can be used for example for figuring - /// out part of the input document that correspond to specific - /// array or object (for highlighting purposes, or error reporting). - /// Contexts can also be used for simple xpath-like matching of - /// input, if so desired. - ///@return Stream input context (JsonStreamContext) associated with this parser - jni.JniObject getParsingContext() => - jni.JniObject.fromRef(_getParsingContext(reference).object); - - static final _currentLocation = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__currentLocation") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonLocation currentLocation() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that returns location of the last processed input unit (character - /// or byte) from the input; - /// usually for error reporting purposes. - /// - /// Note that the location is not guaranteed to be accurate (although most - /// implementation will try their best): some implementations may only - /// report specific boundary locations (start or end locations of tokens) - /// and others only return JsonLocation\#NA due to not having access - /// to input location information (when delegating actual decoding work - /// to other library) - ///@return Location of the last processed input unit (byte or character) - ///@since 2.13 - jni.JniObject currentLocation() => - jni.JniObject.fromRef(_currentLocation(reference).object); - - static final _currentTokenLocation = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__currentTokenLocation") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonLocation currentTokenLocation() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that return the __starting__ location of the current - /// (most recently returned) - /// token; that is, the position of the first input unit (character or byte) from input - /// that starts the current token. - /// - /// Note that the location is not guaranteed to be accurate (although most - /// implementation will try their best): some implementations may only - /// return JsonLocation\#NA due to not having access - /// to input location information (when delegating actual decoding work - /// to other library) - ///@return Starting location of the token parser currently points to - ///@since 2.13 (will eventually replace \#getTokenLocation) - jni.JniObject currentTokenLocation() => - jni.JniObject.fromRef(_currentTokenLocation(reference).object); - - static final _getCurrentLocation = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getCurrentLocation") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract com.fasterxml.jackson.core.JsonLocation getCurrentLocation() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Alias for \#currentLocation(), to be deprecated in later - /// Jackson 2.x versions (and removed from Jackson 3.0). - ///@return Location of the last processed input unit (byte or character) - jni.JniObject getCurrentLocation() => - jni.JniObject.fromRef(_getCurrentLocation(reference).object); - - static final _getTokenLocation = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getTokenLocation") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract com.fasterxml.jackson.core.JsonLocation getTokenLocation() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Alias for \#currentTokenLocation(), to be deprecated in later - /// Jackson 2.x versions (and removed from Jackson 3.0). - ///@return Starting location of the token parser currently points to - jni.JniObject getTokenLocation() => - jni.JniObject.fromRef(_getTokenLocation(reference).object); - - static final _currentValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__currentValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.Object currentValue() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Helper method, usually equivalent to: - ///<code> - /// getParsingContext().getCurrentValue(); - ///</code> - /// - /// Note that "current value" is NOT populated (or used) by Streaming parser; - /// it is only used by higher-level data-binding functionality. - /// The reason it is included here is that it can be stored and accessed hierarchically, - /// and gets passed through data-binding. - ///@return "Current value" associated with the current input context (state) of this parser - ///@since 2.13 (added as replacement for older \#getCurrentValue() - jni.JniObject currentValue() => - jni.JniObject.fromRef(_currentValue(reference).object); - - static final _assignCurrentValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__assignCurrentValue") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public void assignCurrentValue(java.lang.Object v) - /// - /// Helper method, usually equivalent to: - ///<code> - /// getParsingContext().setCurrentValue(v); - ///</code> - ///@param v Current value to assign for the current input context of this parser - ///@since 2.13 (added as replacement for older \#setCurrentValue - void assignCurrentValue(jni.JniObject v) => - _assignCurrentValue(reference, v.reference).check(); - - static final _getCurrentValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getCurrentValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.Object getCurrentValue() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Alias for \#currentValue(), to be deprecated in later - /// Jackson 2.x versions (and removed from Jackson 3.0). - ///@return Location of the last processed input unit (byte or character) - jni.JniObject getCurrentValue() => - jni.JniObject.fromRef(_getCurrentValue(reference).object); - - static final _setCurrentValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__setCurrentValue") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public void setCurrentValue(java.lang.Object v) - /// - /// Alias for \#assignCurrentValue, to be deprecated in later - /// Jackson 2.x versions (and removed from Jackson 3.0). - ///@param v Current value to assign for the current input context of this parser - void setCurrentValue(jni.JniObject v) => - _setCurrentValue(reference, v.reference).check(); - - static final _releaseBuffered = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__releaseBuffered") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public int releaseBuffered(java.io.OutputStream out) - /// - /// Method that can be called to push back any content that - /// has been read but not consumed by the parser. This is usually - /// done after reading all content of interest using parser. - /// Content is released by writing it to given stream if possible; - /// if underlying input is byte-based it can released, if not (char-based) - /// it can not. - ///@param out OutputStream to which buffered, undecoded content is written to - ///@return -1 if the underlying content source is not byte based - /// (that is, input can not be sent to OutputStream; - /// otherwise number of bytes released (0 if there was nothing to release) - ///@throws IOException if write to stream threw exception - int releaseBuffered(jni.JniObject out) => - _releaseBuffered(reference, out.reference).integer; - - static final _releaseBuffered1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__releaseBuffered1") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public int releaseBuffered(java.io.Writer w) - /// - /// Method that can be called to push back any content that - /// has been read but not consumed by the parser. - /// This is usually - /// done after reading all content of interest using parser. - /// Content is released by writing it to given writer if possible; - /// if underlying input is char-based it can released, if not (byte-based) - /// it can not. - ///@param w Writer to which buffered but unprocessed content is written to - ///@return -1 if the underlying content source is not char-based - /// (that is, input can not be sent to Writer; - /// otherwise number of chars released (0 if there was nothing to release) - ///@throws IOException if write using Writer threw exception - int releaseBuffered1(jni.JniObject w) => - _releaseBuffered1(reference, w.reference).integer; - - static final _enable = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__enable") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser enable(com.fasterxml.jackson.core.JsonParser.Feature f) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for enabling specified parser feature - /// (check Feature for list of features) - ///@param f Feature to enable - ///@return This parser, to allow call chaining - JsonParser enable(JsonParser_Feature f) => - JsonParser.fromRef(_enable(reference, f.reference).object); - - static final _disable = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__disable") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser disable(com.fasterxml.jackson.core.JsonParser.Feature f) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for disabling specified feature - /// (check Feature for list of features) - ///@param f Feature to disable - ///@return This parser, to allow call chaining - JsonParser disable(JsonParser_Feature f) => - JsonParser.fromRef(_disable(reference, f.reference).object); - - static final _configure = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>, ffi.Uint8)>>("JsonParser__configure") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser configure(com.fasterxml.jackson.core.JsonParser.Feature f, boolean state) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for enabling or disabling specified feature - /// (check Feature for list of features) - ///@param f Feature to enable or disable - ///@param state Whether to enable feature ({@code true}) or disable ({@code false}) - ///@return This parser, to allow call chaining - JsonParser configure(JsonParser_Feature f, bool state) => JsonParser.fromRef( - _configure(reference, f.reference, state ? 1 : 0).object); - - static final _isEnabled = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__isEnabled") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean isEnabled(com.fasterxml.jackson.core.JsonParser.Feature f) - /// - /// Method for checking whether specified Feature is enabled. - ///@param f Feature to check - ///@return {@code True} if feature is enabled; {@code false} otherwise - bool isEnabled(JsonParser_Feature f) => - _isEnabled(reference, f.reference).boolean; - - static final _isEnabled1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__isEnabled1") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean isEnabled(com.fasterxml.jackson.core.StreamReadFeature f) - /// - /// Method for checking whether specified Feature is enabled. - ///@param f Feature to check - ///@return {@code True} if feature is enabled; {@code false} otherwise - ///@since 2.10 - bool isEnabled1(jni.JniObject f) => - _isEnabled1(reference, f.reference).boolean; - - static final _getFeatureMask = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getFeatureMask") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public int getFeatureMask() - /// - /// Bulk access method for getting state of all standard Features. - ///@return Bit mask that defines current states of all standard Features. - ///@since 2.3 - int getFeatureMask() => _getFeatureMask(reference).integer; - - static final _setFeatureMask = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Int32)>>("JsonParser__setFeatureMask") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser setFeatureMask(int mask) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Bulk set method for (re)setting states of all standard Features - ///@param mask Bit mask that defines set of features to enable - ///@return This parser, to allow call chaining - ///@since 2.3 - ///@deprecated Since 2.7, use \#overrideStdFeatures(int, int) instead - JsonParser setFeatureMask(int mask) => - JsonParser.fromRef(_setFeatureMask(reference, mask).object); - - static final _overrideStdFeatures = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Int32, - ffi.Int32)>>("JsonParser__overrideStdFeatures") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int, int)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser overrideStdFeatures(int values, int mask) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Bulk set method for (re)setting states of features specified by <code>mask</code>. - /// Functionally equivalent to - ///<code> - /// int oldState = getFeatureMask(); - /// int newState = (oldState & ~mask) | (values & mask); - /// setFeatureMask(newState); - ///</code> - /// but preferred as this lets caller more efficiently specify actual changes made. - ///@param values Bit mask of set/clear state for features to change - ///@param mask Bit mask of features to change - ///@return This parser, to allow call chaining - ///@since 2.6 - JsonParser overrideStdFeatures(int values, int mask) => - JsonParser.fromRef(_overrideStdFeatures(reference, values, mask).object); - - static final _getFormatFeatures = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getFormatFeatures") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public int getFormatFeatures() - /// - /// Bulk access method for getting state of all FormatFeatures, format-specific - /// on/off configuration settings. - ///@return Bit mask that defines current states of all standard FormatFeatures. - ///@since 2.6 - int getFormatFeatures() => _getFormatFeatures(reference).integer; - - static final _overrideFormatFeatures = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Int32, - ffi.Int32)>>("JsonParser__overrideFormatFeatures") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int, int)>(); - - /// from: public com.fasterxml.jackson.core.JsonParser overrideFormatFeatures(int values, int mask) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Bulk set method for (re)setting states of FormatFeatures, - /// by specifying values (set / clear) along with a mask, to determine - /// which features to change, if any. - /// - /// Default implementation will simply throw an exception to indicate that - /// the parser implementation does not support any FormatFeatures. - ///@param values Bit mask of set/clear state for features to change - ///@param mask Bit mask of features to change - ///@return This parser, to allow call chaining - ///@since 2.6 - JsonParser overrideFormatFeatures(int values, int mask) => JsonParser.fromRef( - _overrideFormatFeatures(reference, values, mask).object); - - static final _nextToken = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__nextToken") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract com.fasterxml.jackson.core.JsonToken nextToken() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Main iteration method, which will advance stream enough - /// to determine type of the next token, if any. If none - /// remaining (stream has no content other than possible - /// white space before ending), null will be returned. - ///@return Next token from the stream, if any found, or null - /// to indicate end-of-input - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - JsonToken nextToken() => JsonToken.fromRef(_nextToken(reference).object); - - static final _nextValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__nextValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract com.fasterxml.jackson.core.JsonToken nextValue() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Iteration method that will advance stream enough - /// to determine type of the next token that is a value type - /// (including JSON Array and Object start/end markers). - /// Or put another way, nextToken() will be called once, - /// and if JsonToken\#FIELD_NAME is returned, another - /// time to get the value for the field. - /// Method is most useful for iterating over value entries - /// of JSON objects; field name will still be available - /// by calling \#getCurrentName when parser points to - /// the value. - ///@return Next non-field-name token from the stream, if any found, - /// or null to indicate end-of-input (or, for non-blocking - /// parsers, JsonToken\#NOT_AVAILABLE if no tokens were - /// available yet) - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - JsonToken nextValue() => JsonToken.fromRef(_nextValue(reference).object); - - static final _nextFieldName = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__nextFieldName") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean nextFieldName(com.fasterxml.jackson.core.SerializableString str) - /// - /// Method that fetches next token (as if calling \#nextToken) and - /// verifies whether it is JsonToken\#FIELD_NAME with specified name - /// and returns result of that comparison. - /// It is functionally equivalent to: - ///<pre> - /// return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(getCurrentName()); - ///</pre> - /// but may be faster for parser to verify, and can therefore be used if caller - /// expects to get such a property name from input next. - ///@param str Property name to compare next token to (if next token is - /// <code>JsonToken.FIELD_NAME</code>) - ///@return {@code True} if parser advanced to {@code JsonToken.FIELD_NAME} with - /// specified name; {@code false} otherwise (different token or non-matching name) - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - bool nextFieldName(jni.JniObject str) => - _nextFieldName(reference, str.reference).boolean; - - static final _nextFieldName1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__nextFieldName1") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.String nextFieldName() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that fetches next token (as if calling \#nextToken) and - /// verifies whether it is JsonToken\#FIELD_NAME; if it is, - /// returns same as \#getCurrentName(), otherwise null. - ///@return Name of the the {@code JsonToken.FIELD_NAME} parser advanced to, if any; - /// {@code null} if next token is of some other type - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - ///@since 2.5 - jni.JniString nextFieldName1() => - jni.JniString.fromRef(_nextFieldName1(reference).object); - - static final _nextTextValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__nextTextValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.String nextTextValue() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that fetches next token (as if calling \#nextToken) and - /// if it is JsonToken\#VALUE_STRING returns contained String value; - /// otherwise returns null. - /// It is functionally equivalent to: - ///<pre> - /// return (nextToken() == JsonToken.VALUE_STRING) ? getText() : null; - ///</pre> - /// but may be faster for parser to process, and can therefore be used if caller - /// expects to get a String value next from input. - ///@return Text value of the {@code JsonToken.VALUE_STRING} token parser advanced - /// to; or {@code null} if next token is of some other type - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - jni.JniString nextTextValue() => - jni.JniString.fromRef(_nextTextValue(reference).object); - - static final _nextIntValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Int32)>>("JsonParser__nextIntValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); - - /// from: public int nextIntValue(int defaultValue) - /// - /// Method that fetches next token (as if calling \#nextToken) and - /// if it is JsonToken\#VALUE_NUMBER_INT returns 32-bit int value; - /// otherwise returns specified default value - /// It is functionally equivalent to: - ///<pre> - /// return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getIntValue() : defaultValue; - ///</pre> - /// but may be faster for parser to process, and can therefore be used if caller - /// expects to get an int value next from input. - /// - /// NOTE: value checks are performed similar to \#getIntValue() - ///@param defaultValue Value to return if next token is NOT of type {@code JsonToken.VALUE_NUMBER_INT} - ///@return Integer ({@code int}) value of the {@code JsonToken.VALUE_NUMBER_INT} token parser advanced - /// to; or {@code defaultValue} if next token is of some other type - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - ///@throws InputCoercionException if integer number does not fit in Java {@code int} - int nextIntValue(int defaultValue) => - _nextIntValue(reference, defaultValue).integer; - - static final _nextLongValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Int64)>>("JsonParser__nextLongValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); - - /// from: public long nextLongValue(long defaultValue) - /// - /// Method that fetches next token (as if calling \#nextToken) and - /// if it is JsonToken\#VALUE_NUMBER_INT returns 64-bit long value; - /// otherwise returns specified default value - /// It is functionally equivalent to: - ///<pre> - /// return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getLongValue() : defaultValue; - ///</pre> - /// but may be faster for parser to process, and can therefore be used if caller - /// expects to get a long value next from input. - /// - /// NOTE: value checks are performed similar to \#getLongValue() - ///@param defaultValue Value to return if next token is NOT of type {@code JsonToken.VALUE_NUMBER_INT} - ///@return {@code long} value of the {@code JsonToken.VALUE_NUMBER_INT} token parser advanced - /// to; or {@code defaultValue} if next token is of some other type - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - ///@throws InputCoercionException if integer number does not fit in Java {@code long} - int nextLongValue(int defaultValue) => - _nextLongValue(reference, defaultValue).long; - - static final _nextBooleanValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__nextBooleanValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.Boolean nextBooleanValue() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that fetches next token (as if calling \#nextToken) and - /// if it is JsonToken\#VALUE_TRUE or JsonToken\#VALUE_FALSE - /// returns matching Boolean value; otherwise return null. - /// It is functionally equivalent to: - ///<pre> - /// JsonToken t = nextToken(); - /// if (t == JsonToken.VALUE_TRUE) return Boolean.TRUE; - /// if (t == JsonToken.VALUE_FALSE) return Boolean.FALSE; - /// return null; - ///</pre> - /// but may be faster for parser to process, and can therefore be used if caller - /// expects to get a Boolean value next from input. - ///@return {@code Boolean} value of the {@code JsonToken.VALUE_TRUE} or {@code JsonToken.VALUE_FALSE} - /// token parser advanced to; or {@code null} if next token is of some other type - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - jni.JniObject nextBooleanValue() => - jni.JniObject.fromRef(_nextBooleanValue(reference).object); - - static final _skipChildren = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__skipChildren") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract com.fasterxml.jackson.core.JsonParser skipChildren() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that will skip all child tokens of an array or - /// object token that the parser currently points to, - /// iff stream points to - /// JsonToken\#START_OBJECT or JsonToken\#START_ARRAY. - /// If not, it will do nothing. - /// After skipping, stream will point to __matching__ - /// JsonToken\#END_OBJECT or JsonToken\#END_ARRAY - /// (possibly skipping nested pairs of START/END OBJECT/ARRAY tokens - /// as well as value tokens). - /// The idea is that after calling this method, application - /// will call \#nextToken to point to the next - /// available token, if any. - ///@return This parser, to allow call chaining - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - JsonParser skipChildren() => - JsonParser.fromRef(_skipChildren(reference).object); - - static final _finishToken = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__finishToken") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public void finishToken() - /// - /// Method that may be used to force full handling of the current token - /// so that even if lazy processing is enabled, the whole contents are - /// read for possible retrieval. This is usually used to ensure that - /// the token end location is available, as well as token contents - /// (similar to what calling, say \#getTextCharacters(), would - /// achieve). - /// - /// Note that for many dataformat implementations this method - /// will not do anything; this is the default implementation unless - /// overridden by sub-classes. - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - ///@since 2.8 - void finishToken() => _finishToken(reference).check(); - - static final _currentToken = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__currentToken") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public com.fasterxml.jackson.core.JsonToken currentToken() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Accessor to find which token parser currently points to, if any; - /// null will be returned if none. - /// If return value is non-null, data associated with the token - /// is available via other accessor methods. - ///@return Type of the token this parser currently points to, - /// if any: null before any tokens have been read, and - /// after end-of-input has been encountered, as well as - /// if the current token has been explicitly cleared. - ///@since 2.8 - JsonToken currentToken() => - JsonToken.fromRef(_currentToken(reference).object); - - static final _currentTokenId = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__currentTokenId") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public int currentTokenId() - /// - /// Method similar to \#getCurrentToken() but that returns an - /// <code>int</code> instead of JsonToken (enum value). - /// - /// Use of int directly is typically more efficient on switch statements, - /// so this method may be useful when building low-overhead codecs. - /// Note, however, that effect may not be big enough to matter: make sure - /// to profile performance before deciding to use this method. - ///@since 2.8 - ///@return {@code int} matching one of constants from JsonTokenId. - int currentTokenId() => _currentTokenId(reference).integer; - - static final _getCurrentToken = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getCurrentToken") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract com.fasterxml.jackson.core.JsonToken getCurrentToken() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Alias for \#currentToken(), may be deprecated sometime after - /// Jackson 2.13 (will be removed from 3.0). - ///@return Type of the token this parser currently points to, - /// if any: null before any tokens have been read, and - JsonToken getCurrentToken() => - JsonToken.fromRef(_getCurrentToken(reference).object); - - static final _getCurrentTokenId = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getCurrentTokenId") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract int getCurrentTokenId() - /// - /// Deprecated alias for \#currentTokenId(). - ///@return {@code int} matching one of constants from JsonTokenId. - ///@deprecated Since 2.12 use \#currentTokenId instead - int getCurrentTokenId() => _getCurrentTokenId(reference).integer; - - static final _hasCurrentToken = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__hasCurrentToken") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract boolean hasCurrentToken() - /// - /// Method for checking whether parser currently points to - /// a token (and data for that token is available). - /// Equivalent to check for <code>parser.getCurrentToken() != null</code>. - ///@return True if the parser just returned a valid - /// token via \#nextToken; false otherwise (parser - /// was just constructed, encountered end-of-input - /// and returned null from \#nextToken, or the token - /// has been consumed) - bool hasCurrentToken() => _hasCurrentToken(reference).boolean; - - static final _hasTokenId = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Int32)>>("JsonParser__hasTokenId") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); - - /// from: public abstract boolean hasTokenId(int id) - /// - /// Method that is functionally equivalent to: - ///<code> - /// return currentTokenId() == id - ///</code> - /// but may be more efficiently implemented. - /// - /// Note that no traversal or conversion is performed; so in some - /// cases calling method like \#isExpectedStartArrayToken() - /// is necessary instead. - ///@param id Token id to match (from (@link JsonTokenId}) - ///@return {@code True} if the parser current points to specified token - ///@since 2.5 - bool hasTokenId(int id) => _hasTokenId(reference, id).boolean; - - static final _hasToken = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__hasToken") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract boolean hasToken(com.fasterxml.jackson.core.JsonToken t) - /// - /// Method that is functionally equivalent to: - ///<code> - /// return currentToken() == t - ///</code> - /// but may be more efficiently implemented. - /// - /// Note that no traversal or conversion is performed; so in some - /// cases calling method like \#isExpectedStartArrayToken() - /// is necessary instead. - ///@param t Token to match - ///@return {@code True} if the parser current points to specified token - ///@since 2.6 - bool hasToken(JsonToken t) => _hasToken(reference, t.reference).boolean; - - static final _isExpectedStartArrayToken = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( - "JsonParser__isExpectedStartArrayToken") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean isExpectedStartArrayToken() - /// - /// Specialized accessor that can be used to verify that the current - /// token indicates start array (usually meaning that current token - /// is JsonToken\#START_ARRAY) when start array is expected. - /// For some specialized parsers this can return true for other cases - /// as well; this is usually done to emulate arrays in cases underlying - /// format is ambiguous (XML, for example, has no format-level difference - /// between Objects and Arrays; it just has elements). - /// - /// Default implementation is equivalent to: - ///<pre> - /// currentToken() == JsonToken.START_ARRAY - ///</pre> - /// but may be overridden by custom parser implementations. - ///@return True if the current token can be considered as a - /// start-array marker (such JsonToken\#START_ARRAY); - /// {@code false} if not - bool isExpectedStartArrayToken() => - _isExpectedStartArrayToken(reference).boolean; - - static final _isExpectedStartObjectToken = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( - "JsonParser__isExpectedStartObjectToken") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean isExpectedStartObjectToken() - /// - /// Similar to \#isExpectedStartArrayToken(), but checks whether stream - /// currently points to JsonToken\#START_OBJECT. - ///@return True if the current token can be considered as a - /// start-array marker (such JsonToken\#START_OBJECT); - /// {@code false} if not - ///@since 2.5 - bool isExpectedStartObjectToken() => - _isExpectedStartObjectToken(reference).boolean; - - static final _isExpectedNumberIntToken = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( - "JsonParser__isExpectedNumberIntToken") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean isExpectedNumberIntToken() - /// - /// Similar to \#isExpectedStartArrayToken(), but checks whether stream - /// currently points to JsonToken\#VALUE_NUMBER_INT. - /// - /// The initial use case is for XML backend to efficiently (attempt to) coerce - /// textual content into numbers. - ///@return True if the current token can be considered as a - /// start-array marker (such JsonToken\#VALUE_NUMBER_INT); - /// {@code false} if not - ///@since 2.12 - bool isExpectedNumberIntToken() => - _isExpectedNumberIntToken(reference).boolean; - - static final _isNaN = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__isNaN") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean isNaN() - /// - /// Access for checking whether current token is a numeric value token, but - /// one that is of "not-a-number" (NaN) variety (including both "NaN" AND - /// positive/negative infinity!): not supported by all formats, - /// but often supported for JsonToken\#VALUE_NUMBER_FLOAT. - /// NOTE: roughly equivalent to calling <code>!Double.isFinite()</code> - /// on value you would get from calling \#getDoubleValue(). - ///@return {@code True} if the current token is of type JsonToken\#VALUE_NUMBER_FLOAT - /// but represents a "Not a Number"; {@code false} for other tokens and regular - /// floating-point numbers - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - ///@since 2.9 - bool isNaN() => _isNaN(reference).boolean; - - static final _clearCurrentToken = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__clearCurrentToken") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract void clearCurrentToken() - /// - /// Method called to "consume" the current token by effectively - /// removing it so that \#hasCurrentToken returns false, and - /// \#getCurrentToken null). - /// Cleared token value can still be accessed by calling - /// \#getLastClearedToken (if absolutely needed), but - /// usually isn't. - /// - /// Method was added to be used by the optional data binder, since - /// it has to be able to consume last token used for binding (so that - /// it will not be used again). - void clearCurrentToken() => _clearCurrentToken(reference).check(); - - static final _getLastClearedToken = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getLastClearedToken") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract com.fasterxml.jackson.core.JsonToken getLastClearedToken() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that can be called to get the last token that was - /// cleared using \#clearCurrentToken. This is not necessarily - /// the latest token read. - /// Will return null if no tokens have been cleared, - /// or if parser has been closed. - ///@return Last cleared token, if any; {@code null} otherwise - JsonToken getLastClearedToken() => - JsonToken.fromRef(_getLastClearedToken(reference).object); - - static final _overrideCurrentName = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__overrideCurrentName") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract void overrideCurrentName(java.lang.String name) - /// - /// Method that can be used to change what is considered to be - /// the current (field) name. - /// May be needed to support non-JSON data formats or unusual binding - /// conventions; not needed for typical processing. - /// - /// Note that use of this method should only be done as sort of last - /// resort, as it is a work-around for regular operation. - ///@param name Name to use as the current name; may be null. - void overrideCurrentName(jni.JniString name) => - _overrideCurrentName(reference, name.reference).check(); - - static final _getCurrentName = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getCurrentName") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract java.lang.String getCurrentName() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Alias of \#currentName(). - ///@return Name of the current field in the parsing context - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - jni.JniString getCurrentName() => - jni.JniString.fromRef(_getCurrentName(reference).object); - - static final _currentName = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__currentName") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.String currentName() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that can be called to get the name associated with - /// the current token: for JsonToken\#FIELD_NAMEs it will - /// be the same as what \#getText returns; - /// for field values it will be preceding field name; - /// and for others (array values, root-level values) null. - ///@return Name of the current field in the parsing context - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - ///@since 2.10 - jni.JniString currentName() => - jni.JniString.fromRef(_currentName(reference).object); - - static final _getText = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getText") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract java.lang.String getText() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for accessing textual representation of the current token; - /// if no current token (before first call to \#nextToken, or - /// after encountering end-of-input), returns null. - /// Method can be called for any token type. - ///@return Textual value associated with the current token (one returned - /// by \#nextToken() or other iteration methods) - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - jni.JniString getText() => jni.JniString.fromRef(_getText(reference).object); - - static final _getText1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__getText1") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public int getText(java.io.Writer writer) - /// - /// Method to read the textual representation of the current token in chunks and - /// pass it to the given Writer. - /// Conceptually same as calling: - ///<pre> - /// writer.write(parser.getText()); - ///</pre> - /// but should typically be more efficient as longer content does need to - /// be combined into a single <code>String</code> to return, and write - /// can occur directly from intermediate buffers Jackson uses. - ///@param writer Writer to write textual content to - ///@return The number of characters written to the Writer - ///@throws IOException for low-level read issues or writes using passed - /// {@code writer}, or - /// JsonParseException for decoding problems - ///@since 2.8 - int getText1(jni.JniObject writer) => - _getText1(reference, writer.reference).integer; - - static final _getTextCharacters = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getTextCharacters") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract char[] getTextCharacters() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method similar to \#getText, but that will return - /// underlying (unmodifiable) character array that contains - /// textual value, instead of constructing a String object - /// to contain this information. - /// Note, however, that: - ///<ul> - /// <li>Textual contents are not guaranteed to start at - /// index 0 (rather, call \#getTextOffset) to - /// know the actual offset - /// </li> - /// <li>Length of textual contents may be less than the - /// length of returned buffer: call \#getTextLength - /// for actual length of returned content. - /// </li> - /// </ul> - /// - /// Note that caller __MUST NOT__ modify the returned - /// character array in any way -- doing so may corrupt - /// current parser state and render parser instance useless. - /// - /// The only reason to call this method (over \#getText) - /// is to avoid construction of a String object (which - /// will make a copy of contents). - ///@return Buffer that contains the current textual value (but not necessarily - /// at offset 0, and not necessarily until the end of buffer) - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - jni.JniObject getTextCharacters() => - jni.JniObject.fromRef(_getTextCharacters(reference).object); - - static final _getTextLength = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getTextLength") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract int getTextLength() - /// - /// Accessor used with \#getTextCharacters, to know length - /// of String stored in returned buffer. - ///@return Number of characters within buffer returned - /// by \#getTextCharacters that are part of - /// textual content of the current token. - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - int getTextLength() => _getTextLength(reference).integer; - - static final _getTextOffset = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getTextOffset") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract int getTextOffset() - /// - /// Accessor used with \#getTextCharacters, to know offset - /// of the first text content character within buffer. - ///@return Offset of the first character within buffer returned - /// by \#getTextCharacters that is part of - /// textual content of the current token. - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - int getTextOffset() => _getTextOffset(reference).integer; - - static final _hasTextCharacters = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__hasTextCharacters") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract boolean hasTextCharacters() - /// - /// Method that can be used to determine whether calling of - /// \#getTextCharacters would be the most efficient - /// way to access textual content for the event parser currently - /// points to. - /// - /// Default implementation simply returns false since only actual - /// implementation class has knowledge of its internal buffering - /// state. - /// Implementations are strongly encouraged to properly override - /// this method, to allow efficient copying of content by other - /// code. - ///@return True if parser currently has character array that can - /// be efficiently returned via \#getTextCharacters; false - /// means that it may or may not exist - bool hasTextCharacters() => _hasTextCharacters(reference).boolean; - - static final _getNumberValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getNumberValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract java.lang.Number getNumberValue() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Generic number value accessor method that will work for - /// all kinds of numeric values. It will return the optimal - /// (simplest/smallest possible) wrapper object that can - /// express the numeric value just parsed. - ///@return Numeric value of the current token in its most optimal - /// representation - ///@throws IOException Problem with access: JsonParseException if - /// the current token is not numeric, or if decoding of the value fails - /// (invalid format for numbers); plain IOException if underlying - /// content read fails (possible if values are extracted lazily) - jni.JniObject getNumberValue() => - jni.JniObject.fromRef(_getNumberValue(reference).object); - - static final _getNumberValueExact = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getNumberValueExact") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.Number getNumberValueExact() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method similar to \#getNumberValue with the difference that - /// for floating-point numbers value returned may be BigDecimal - /// if the underlying format does not store floating-point numbers using - /// native representation: for example, textual formats represent numbers - /// as Strings (which are 10-based), and conversion to java.lang.Double - /// is potentially lossy operation. - /// - /// Default implementation simply returns \#getNumberValue() - ///@return Numeric value of the current token using most accurate representation - ///@throws IOException Problem with access: JsonParseException if - /// the current token is not numeric, or if decoding of the value fails - /// (invalid format for numbers); plain IOException if underlying - /// content read fails (possible if values are extracted lazily) - ///@since 2.12 - jni.JniObject getNumberValueExact() => - jni.JniObject.fromRef(_getNumberValueExact(reference).object); - - static final _getNumberType = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getNumberType") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract com.fasterxml.jackson.core.JsonParser.NumberType getNumberType() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// If current token is of type - /// JsonToken\#VALUE_NUMBER_INT or - /// JsonToken\#VALUE_NUMBER_FLOAT, returns - /// one of NumberType constants; otherwise returns null. - ///@return Type of current number, if parser points to numeric token; {@code null} otherwise - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - JsonParser_NumberType getNumberType() => - JsonParser_NumberType.fromRef(_getNumberType(reference).object); - - static final _getByteValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getByteValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public byte getByteValue() - /// - /// Numeric accessor that can be called when the current - /// token is of type JsonToken\#VALUE_NUMBER_INT and - /// it can be expressed as a value of Java byte primitive type. - /// Note that in addition to "natural" input range of {@code [-128, 127]}, - /// this also allows "unsigned 8-bit byte" values {@code [128, 255]}: - /// but for this range value will be translated by truncation, leading - /// to sign change. - /// - /// It can also be called for JsonToken\#VALUE_NUMBER_FLOAT; - /// if so, it is equivalent to calling \#getDoubleValue - /// and then casting; except for possible overflow/underflow - /// exception. - /// - /// Note: if the resulting integer value falls outside range of - /// {@code [-128, 255]}, - /// a InputCoercionException - /// will be thrown to indicate numeric overflow/underflow. - ///@return Current number value as {@code byte} (if numeric token within - /// range of {@code [-128, 255]}); otherwise exception thrown - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - int getByteValue() => _getByteValue(reference).byte; - - static final _getShortValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getShortValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public short getShortValue() - /// - /// Numeric accessor that can be called when the current - /// token is of type JsonToken\#VALUE_NUMBER_INT and - /// it can be expressed as a value of Java short primitive type. - /// It can also be called for JsonToken\#VALUE_NUMBER_FLOAT; - /// if so, it is equivalent to calling \#getDoubleValue - /// and then casting; except for possible overflow/underflow - /// exception. - /// - /// Note: if the resulting integer value falls outside range of - /// Java short, a InputCoercionException - /// will be thrown to indicate numeric overflow/underflow. - ///@return Current number value as {@code short} (if numeric token within - /// Java 16-bit signed {@code short} range); otherwise exception thrown - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - int getShortValue() => _getShortValue(reference).short; - - static final _getIntValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getIntValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract int getIntValue() - /// - /// Numeric accessor that can be called when the current - /// token is of type JsonToken\#VALUE_NUMBER_INT and - /// it can be expressed as a value of Java int primitive type. - /// It can also be called for JsonToken\#VALUE_NUMBER_FLOAT; - /// if so, it is equivalent to calling \#getDoubleValue - /// and then casting; except for possible overflow/underflow - /// exception. - /// - /// Note: if the resulting integer value falls outside range of - /// Java {@code int}, a InputCoercionException - /// may be thrown to indicate numeric overflow/underflow. - ///@return Current number value as {@code int} (if numeric token within - /// Java 32-bit signed {@code int} range); otherwise exception thrown - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - int getIntValue() => _getIntValue(reference).integer; - - static final _getLongValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getLongValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract long getLongValue() - /// - /// Numeric accessor that can be called when the current - /// token is of type JsonToken\#VALUE_NUMBER_INT and - /// it can be expressed as a Java long primitive type. - /// It can also be called for JsonToken\#VALUE_NUMBER_FLOAT; - /// if so, it is equivalent to calling \#getDoubleValue - /// and then casting to int; except for possible overflow/underflow - /// exception. - /// - /// Note: if the token is an integer, but its value falls - /// outside of range of Java long, a InputCoercionException - /// may be thrown to indicate numeric overflow/underflow. - ///@return Current number value as {@code long} (if numeric token within - /// Java 32-bit signed {@code long} range); otherwise exception thrown - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - int getLongValue() => _getLongValue(reference).long; - - static final _getBigIntegerValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getBigIntegerValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract java.math.BigInteger getBigIntegerValue() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Numeric accessor that can be called when the current - /// token is of type JsonToken\#VALUE_NUMBER_INT and - /// it can not be used as a Java long primitive type due to its - /// magnitude. - /// It can also be called for JsonToken\#VALUE_NUMBER_FLOAT; - /// if so, it is equivalent to calling \#getDecimalValue - /// and then constructing a BigInteger from that value. - ///@return Current number value as BigInteger (if numeric token); - /// otherwise exception thrown - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - jni.JniObject getBigIntegerValue() => - jni.JniObject.fromRef(_getBigIntegerValue(reference).object); - - static final _getFloatValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getFloatValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract float getFloatValue() - /// - /// Numeric accessor that can be called when the current - /// token is of type JsonToken\#VALUE_NUMBER_FLOAT and - /// it can be expressed as a Java float primitive type. - /// It can also be called for JsonToken\#VALUE_NUMBER_INT; - /// if so, it is equivalent to calling \#getLongValue - /// and then casting; except for possible overflow/underflow - /// exception. - /// - /// Note: if the value falls - /// outside of range of Java float, a InputCoercionException - /// will be thrown to indicate numeric overflow/underflow. - ///@return Current number value as {@code float} (if numeric token within - /// Java {@code float} range); otherwise exception thrown - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - double getFloatValue() => _getFloatValue(reference).float; - - static final _getDoubleValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getDoubleValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract double getDoubleValue() - /// - /// Numeric accessor that can be called when the current - /// token is of type JsonToken\#VALUE_NUMBER_FLOAT and - /// it can be expressed as a Java double primitive type. - /// It can also be called for JsonToken\#VALUE_NUMBER_INT; - /// if so, it is equivalent to calling \#getLongValue - /// and then casting; except for possible overflow/underflow - /// exception. - /// - /// Note: if the value falls - /// outside of range of Java double, a InputCoercionException - /// will be thrown to indicate numeric overflow/underflow. - ///@return Current number value as {@code double} (if numeric token within - /// Java {@code double} range); otherwise exception thrown - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - double getDoubleValue() => _getDoubleValue(reference).doubleFloat; - - static final _getDecimalValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getDecimalValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract java.math.BigDecimal getDecimalValue() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Numeric accessor that can be called when the current - /// token is of type JsonToken\#VALUE_NUMBER_FLOAT or - /// JsonToken\#VALUE_NUMBER_INT. No under/overflow exceptions - /// are ever thrown. - ///@return Current number value as BigDecimal (if numeric token); - /// otherwise exception thrown - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - jni.JniObject getDecimalValue() => - jni.JniObject.fromRef(_getDecimalValue(reference).object); - - static final _getBooleanValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getBooleanValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean getBooleanValue() - /// - /// Convenience accessor that can be called when the current - /// token is JsonToken\#VALUE_TRUE or - /// JsonToken\#VALUE_FALSE, to return matching {@code boolean} - /// value. - /// If the current token is of some other type, JsonParseException - /// will be thrown - ///@return {@code True} if current token is {@code JsonToken.VALUE_TRUE}, - /// {@code false} if current token is {@code JsonToken.VALUE_FALSE}; - /// otherwise throws JsonParseException - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - bool getBooleanValue() => _getBooleanValue(reference).boolean; - - static final _getEmbeddedObject = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getEmbeddedObject") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.Object getEmbeddedObject() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Accessor that can be called if (and only if) the current token - /// is JsonToken\#VALUE_EMBEDDED_OBJECT. For other token types, - /// null is returned. - /// - /// Note: only some specialized parser implementations support - /// embedding of objects (usually ones that are facades on top - /// of non-streaming sources, such as object trees). One exception - /// is access to binary content (whether via base64 encoding or not) - /// which typically is accessible using this method, as well as - /// \#getBinaryValue(). - ///@return Embedded value (usually of "native" type supported by format) - /// for the current token, if any; {@code null otherwise} - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - jni.JniObject getEmbeddedObject() => - jni.JniObject.fromRef(_getEmbeddedObject(reference).object); - - static final _getBinaryValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__getBinaryValue") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract byte[] getBinaryValue(com.fasterxml.jackson.core.Base64Variant bv) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that can be used to read (and consume -- results - /// may not be accessible using other methods after the call) - /// base64-encoded binary data - /// included in the current textual JSON value. - /// It works similar to getting String value via \#getText - /// and decoding result (except for decoding part), - /// but should be significantly more performant. - /// - /// Note that non-decoded textual contents of the current token - /// are not guaranteed to be accessible after this method - /// is called. Current implementation, for example, clears up - /// textual content during decoding. - /// Decoded binary content, however, will be retained until - /// parser is advanced to the next event. - ///@param bv Expected variant of base64 encoded - /// content (see Base64Variants for definitions - /// of "standard" variants). - ///@return Decoded binary data - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - jni.JniObject getBinaryValue(jni.JniObject bv) => - jni.JniObject.fromRef(_getBinaryValue(reference, bv.reference).object); - - static final _getBinaryValue1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getBinaryValue1") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public byte[] getBinaryValue() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Convenience alternative to \#getBinaryValue(Base64Variant) - /// that defaults to using - /// Base64Variants\#getDefaultVariant as the default encoding. - ///@return Decoded binary data - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - jni.JniObject getBinaryValue1() => - jni.JniObject.fromRef(_getBinaryValue1(reference).object); - - static final _readBinaryValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__readBinaryValue") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public int readBinaryValue(java.io.OutputStream out) - /// - /// Method that can be used as an alternative to \#getBigIntegerValue(), - /// especially when value can be large. The main difference (beyond method - /// of returning content using OutputStream instead of as byte array) - /// is that content will NOT remain accessible after method returns: any content - /// processed will be consumed and is not buffered in any way. If caller needs - /// buffering, it has to implement it. - ///@param out Output stream to use for passing decoded binary data - ///@return Number of bytes that were decoded and written via OutputStream - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - ///@since 2.1 - int readBinaryValue(jni.JniObject out) => - _readBinaryValue(reference, out.reference).integer; - - static final _readBinaryValue1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__readBinaryValue1") - .asFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>(); - - /// from: public int readBinaryValue(com.fasterxml.jackson.core.Base64Variant bv, java.io.OutputStream out) - /// - /// Similar to \#readBinaryValue(OutputStream) but allows explicitly - /// specifying base64 variant to use. - ///@param bv base64 variant to use - ///@param out Output stream to use for passing decoded binary data - ///@return Number of bytes that were decoded and written via OutputStream - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - ///@since 2.1 - int readBinaryValue1(jni.JniObject bv, jni.JniObject out) => - _readBinaryValue1(reference, bv.reference, out.reference).integer; - - static final _getValueAsInt = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsInt") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public int getValueAsInt() - /// - /// Method that will try to convert value of current token to a - /// Java {@code int} value. - /// Numbers are coerced using default Java rules; booleans convert to 0 (false) - /// and 1 (true), and Strings are parsed using default Java language integer - /// parsing rules. - /// - /// If representation can not be converted to an int (including structured type - /// markers like start/end Object/Array) - /// default value of __0__ will be returned; no exceptions are thrown. - ///@return {@code int} value current token is converted to, if possible; exception thrown - /// otherwise - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - int getValueAsInt() => _getValueAsInt(reference).integer; - - static final _getValueAsInt1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Int32)>>("JsonParser__getValueAsInt1") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); - - /// from: public int getValueAsInt(int def) - /// - /// Method that will try to convert value of current token to a - /// __int__. - /// Numbers are coerced using default Java rules; booleans convert to 0 (false) - /// and 1 (true), and Strings are parsed using default Java language integer - /// parsing rules. - /// - /// If representation can not be converted to an int (including structured type - /// markers like start/end Object/Array) - /// specified __def__ will be returned; no exceptions are thrown. - ///@param def Default value to return if conversion to {@code int} is not possible - ///@return {@code int} value current token is converted to, if possible; {@code def} otherwise - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - int getValueAsInt1(int def) => _getValueAsInt1(reference, def).integer; - - static final _getValueAsLong = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsLong") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public long getValueAsLong() - /// - /// Method that will try to convert value of current token to a - /// __long__. - /// Numbers are coerced using default Java rules; booleans convert to 0 (false) - /// and 1 (true), and Strings are parsed using default Java language integer - /// parsing rules. - /// - /// If representation can not be converted to a long (including structured type - /// markers like start/end Object/Array) - /// default value of __0L__ will be returned; no exceptions are thrown. - ///@return {@code long} value current token is converted to, if possible; exception thrown - /// otherwise - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - int getValueAsLong() => _getValueAsLong(reference).long; - - static final _getValueAsLong1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Int64)>>("JsonParser__getValueAsLong1") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); - - /// from: public long getValueAsLong(long def) - /// - /// Method that will try to convert value of current token to a - /// __long__. - /// Numbers are coerced using default Java rules; booleans convert to 0 (false) - /// and 1 (true), and Strings are parsed using default Java language integer - /// parsing rules. - /// - /// If representation can not be converted to a long (including structured type - /// markers like start/end Object/Array) - /// specified __def__ will be returned; no exceptions are thrown. - ///@param def Default value to return if conversion to {@code long} is not possible - ///@return {@code long} value current token is converted to, if possible; {@code def} otherwise - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - int getValueAsLong1(int def) => _getValueAsLong1(reference, def).long; - - static final _getValueAsDouble = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsDouble") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public double getValueAsDouble() - /// - /// Method that will try to convert value of current token to a Java - /// __double__. - /// Numbers are coerced using default Java rules; booleans convert to 0.0 (false) - /// and 1.0 (true), and Strings are parsed using default Java language floating - /// point parsing rules. - /// - /// If representation can not be converted to a double (including structured types - /// like Objects and Arrays), - /// default value of __0.0__ will be returned; no exceptions are thrown. - ///@return {@code double} value current token is converted to, if possible; exception thrown - /// otherwise - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - double getValueAsDouble() => _getValueAsDouble(reference).doubleFloat; - - static final _getValueAsDouble1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Double)>>("JsonParser__getValueAsDouble1") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, double)>(); - - /// from: public double getValueAsDouble(double def) - /// - /// Method that will try to convert value of current token to a - /// Java __double__. - /// Numbers are coerced using default Java rules; booleans convert to 0.0 (false) - /// and 1.0 (true), and Strings are parsed using default Java language floating - /// point parsing rules. - /// - /// If representation can not be converted to a double (including structured types - /// like Objects and Arrays), - /// specified __def__ will be returned; no exceptions are thrown. - ///@param def Default value to return if conversion to {@code double} is not possible - ///@return {@code double} value current token is converted to, if possible; {@code def} otherwise - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - double getValueAsDouble1(double def) => - _getValueAsDouble1(reference, def).doubleFloat; - - static final _getValueAsBoolean = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsBoolean") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean getValueAsBoolean() - /// - /// Method that will try to convert value of current token to a - /// __boolean__. - /// JSON booleans map naturally; integer numbers other than 0 map to true, and - /// 0 maps to false - /// and Strings 'true' and 'false' map to corresponding values. - /// - /// If representation can not be converted to a boolean value (including structured types - /// like Objects and Arrays), - /// default value of __false__ will be returned; no exceptions are thrown. - ///@return {@code boolean} value current token is converted to, if possible; exception thrown - /// otherwise - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - bool getValueAsBoolean() => _getValueAsBoolean(reference).boolean; - - static final _getValueAsBoolean1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Uint8)>>("JsonParser__getValueAsBoolean1") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); - - /// from: public boolean getValueAsBoolean(boolean def) - /// - /// Method that will try to convert value of current token to a - /// __boolean__. - /// JSON booleans map naturally; integer numbers other than 0 map to true, and - /// 0 maps to false - /// and Strings 'true' and 'false' map to corresponding values. - /// - /// If representation can not be converted to a boolean value (including structured types - /// like Objects and Arrays), - /// specified __def__ will be returned; no exceptions are thrown. - ///@param def Default value to return if conversion to {@code boolean} is not possible - ///@return {@code boolean} value current token is converted to, if possible; {@code def} otherwise - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - bool getValueAsBoolean1(bool def) => - _getValueAsBoolean1(reference, def ? 1 : 0).boolean; - - static final _getValueAsString = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsString") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.String getValueAsString() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that will try to convert value of current token to a - /// java.lang.String. - /// JSON Strings map naturally; scalar values get converted to - /// their textual representation. - /// If representation can not be converted to a String value (including structured types - /// like Objects and Arrays and {@code null} token), default value of - /// __null__ will be returned; no exceptions are thrown. - ///@return String value current token is converted to, if possible; {@code null} otherwise - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - ///@since 2.1 - jni.JniString getValueAsString() => - jni.JniString.fromRef(_getValueAsString(reference).object); - - static final _getValueAsString1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsString1") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public abstract java.lang.String getValueAsString(java.lang.String def) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that will try to convert value of current token to a - /// java.lang.String. - /// JSON Strings map naturally; scalar values get converted to - /// their textual representation. - /// If representation can not be converted to a String value (including structured types - /// like Objects and Arrays and {@code null} token), specified default value - /// will be returned; no exceptions are thrown. - ///@param def Default value to return if conversion to {@code String} is not possible - ///@return String value current token is converted to, if possible; {@code def} otherwise - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - ///@since 2.1 - jni.JniString getValueAsString1(jni.JniString def) => jni.JniString.fromRef( - _getValueAsString1(reference, def.reference).object); - - static final _canReadObjectId = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__canReadObjectId") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean canReadObjectId() - /// - /// Introspection method that may be called to see if the underlying - /// data format supports some kind of Object Ids natively (many do not; - /// for example, JSON doesn't). - /// - /// Default implementation returns true; overridden by data formats - /// that do support native Object Ids. Caller is expected to either - /// use a non-native notation (explicit property or such), or fail, - /// in case it can not use native object ids. - ///@return {@code True} if the format being read supports native Object Ids; - /// {@code false} if not - ///@since 2.3 - bool canReadObjectId() => _canReadObjectId(reference).boolean; - - static final _canReadTypeId = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__canReadTypeId") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean canReadTypeId() - /// - /// Introspection method that may be called to see if the underlying - /// data format supports some kind of Type Ids natively (many do not; - /// for example, JSON doesn't). - /// - /// Default implementation returns true; overridden by data formats - /// that do support native Type Ids. Caller is expected to either - /// use a non-native notation (explicit property or such), or fail, - /// in case it can not use native type ids. - ///@return {@code True} if the format being read supports native Type Ids; - /// {@code false} if not - ///@since 2.3 - bool canReadTypeId() => _canReadTypeId(reference).boolean; - - static final _getObjectId = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getObjectId") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.Object getObjectId() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that can be called to check whether current token - /// (one that was just read) has an associated Object id, and if - /// so, return it. - /// Note that while typically caller should check with \#canReadObjectId - /// first, it is not illegal to call this method even if that method returns - /// true; but if so, it will return null. This may be used to simplify calling - /// code. - /// - /// Default implementation will simply return null. - ///@return Native Object id associated with the current token, if any; {@code null} if none - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - ///@since 2.3 - jni.JniObject getObjectId() => - jni.JniObject.fromRef(_getObjectId(reference).object); - - static final _getTypeId = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser__getTypeId") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public java.lang.Object getTypeId() - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method that can be called to check whether current token - /// (one that was just read) has an associated type id, and if - /// so, return it. - /// Note that while typically caller should check with \#canReadTypeId - /// first, it is not illegal to call this method even if that method returns - /// true; but if so, it will return null. This may be used to simplify calling - /// code. - /// - /// Default implementation will simply return null. - ///@return Native Type Id associated with the current token, if any; {@code null} if none - ///@throws IOException for low-level read issues, or - /// JsonParseException for decoding problems - ///@since 2.3 - jni.JniObject getTypeId() => - jni.JniObject.fromRef(_getTypeId(reference).object); - - static final _readValuesAs = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__readValuesAs") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public java.util.Iterator<T> readValuesAs(java.lang.Class<T> valueType) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for reading sequence of Objects from parser stream, - /// all with same specified value type. - ///@param <T> Nominal type parameter for value type - ///@param valueType Java type to read content as (passed to ObjectCodec that - /// deserializes content) - ///@return Iterator for reading multiple Java values from content - ///@throws IOException if there is either an underlying I/O problem or decoding - /// issue at format layer - jni.JniObject readValuesAs(jni.JniObject valueType) => jni.JniObject.fromRef( - _readValuesAs(reference, valueType.reference).object); - - static final _readValuesAs1 = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Pointer<ffi.Void>)>>("JsonParser__readValuesAs1") - .asFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); - - /// from: public java.util.Iterator<T> readValuesAs(com.fasterxml.jackson.core.type.TypeReference<T> valueTypeRef) - /// The returned object must be deleted after use, by calling the `delete` method. - /// - /// Method for reading sequence of Objects from parser stream, - /// all with same specified value type. - ///@param <T> Nominal type parameter for value type - ///@param valueTypeRef Java type to read content as (passed to ObjectCodec that - /// deserializes content) - ///@return Iterator for reading multiple Java values from content - ///@throws IOException if there is either an underlying I/O problem or decoding - /// issue at format layer - jni.JniObject readValuesAs1(jni.JniObject valueTypeRef) => - jni.JniObject.fromRef( - _readValuesAs1(reference, valueTypeRef.reference).object); -} - -/// from: com.fasterxml.jackson.core.JsonParser$Feature -/// -/// Enumeration that defines all on/off features for parsers. -class JsonParser_Feature extends jni.JniObject { - JsonParser_Feature.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); - - static final _values = - jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "JsonParser_Feature__values") - .asFunction<jni.JniResult Function()>(); - - /// from: static public com.fasterxml.jackson.core.JsonParser.Feature[] values() - /// The returned object must be deleted after use, by calling the `delete` method. - static jni.JniObject values() => jni.JniObject.fromRef(_values().object); - - static final _valueOf = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser_Feature__valueOf") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: static public com.fasterxml.jackson.core.JsonParser.Feature valueOf(java.lang.String name) - /// The returned object must be deleted after use, by calling the `delete` method. - static JsonParser_Feature valueOf(jni.JniString name) => - JsonParser_Feature.fromRef(_valueOf(name.reference).object); - - static final _collectDefaults = - jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "JsonParser_Feature__collectDefaults") - .asFunction<jni.JniResult Function()>(); - - /// from: static public int collectDefaults() - /// - /// Method that calculates bit set (flags) of all features that - /// are enabled by default. - ///@return Bit mask of all features that are enabled by default - static int collectDefaults() => _collectDefaults().integer; - - static final _ctor = - jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Uint8)>>( - "JsonParser_Feature__ctor") - .asFunction<jni.JniResult Function(int)>(); - - /// from: private void <init>(boolean defaultState) - JsonParser_Feature(bool defaultState) - : super.fromRef(_ctor(defaultState ? 1 : 0).object); - - static final _enabledByDefault = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( - "JsonParser_Feature__enabledByDefault") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public boolean enabledByDefault() - bool enabledByDefault() => _enabledByDefault(reference).boolean; - - static final _enabledIn = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>, - ffi.Int32)>>("JsonParser_Feature__enabledIn") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); - - /// from: public boolean enabledIn(int flags) - bool enabledIn(int flags) => _enabledIn(reference, flags).boolean; - - static final _getMask = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser_Feature__getMask") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public int getMask() - int getMask() => _getMask(reference).integer; -} - -/// from: com.fasterxml.jackson.core.JsonParser$NumberType -/// -/// Enumeration of possible "native" (optimal) types that can be -/// used for numbers. -class JsonParser_NumberType extends jni.JniObject { - JsonParser_NumberType.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); - - static final _values = - jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "JsonParser_NumberType__values") - .asFunction<jni.JniResult Function()>(); - - /// from: static public com.fasterxml.jackson.core.JsonParser.NumberType[] values() - /// The returned object must be deleted after use, by calling the `delete` method. - static jni.JniObject values() => jni.JniObject.fromRef(_values().object); - - static final _valueOf = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonParser_NumberType__valueOf") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: static public com.fasterxml.jackson.core.JsonParser.NumberType valueOf(java.lang.String name) - /// The returned object must be deleted after use, by calling the `delete` method. - static JsonParser_NumberType valueOf(jni.JniString name) => - JsonParser_NumberType.fromRef(_valueOf(name.reference).object); - - static final _ctor = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "JsonParser_NumberType__ctor") - .asFunction<jni.JniResult Function()>(); - - /// from: private void <init>() - JsonParser_NumberType() : super.fromRef(_ctor().object); -} - -/// from: com.fasterxml.jackson.core.JsonToken -/// -/// Enumeration for basic token types used for returning results -/// of parsing JSON content. -class JsonToken extends jni.JniObject { - JsonToken.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); - - static final _values = - jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "JsonToken__values") - .asFunction<jni.JniResult Function()>(); - - /// from: static public com.fasterxml.jackson.core.JsonToken[] values() - /// The returned object must be deleted after use, by calling the `delete` method. - static jni.JniObject values() => jni.JniObject.fromRef(_values().object); - - static final _valueOf = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonToken__valueOf") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: static public com.fasterxml.jackson.core.JsonToken valueOf(java.lang.String name) - /// The returned object must be deleted after use, by calling the `delete` method. - static JsonToken valueOf(jni.JniString name) => - JsonToken.fromRef(_valueOf(name.reference).object); - - static final _ctor = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>, ffi.Int32)>>("JsonToken__ctor") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); - - /// from: private void <init>(java.lang.String token, int id) - /// - /// @param token representation for this token, if there is a - /// single static representation; null otherwise - ///@param id Numeric id from JsonTokenId - JsonToken(jni.JniString token, int id) - : super.fromRef(_ctor(token.reference, id).object); - - static final _id = jniLookup< - ffi.NativeFunction< - jni.JniResult Function(ffi.Pointer<ffi.Void>)>>("JsonToken__id") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public final int id() - int id() => _id(reference).integer; - - static final _asString = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonToken__asString") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public final java.lang.String asString() - /// The returned object must be deleted after use, by calling the `delete` method. - jni.JniString asString() => - jni.JniString.fromRef(_asString(reference).object); - - static final _asCharArray = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonToken__asCharArray") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public final char[] asCharArray() - /// The returned object must be deleted after use, by calling the `delete` method. - jni.JniObject asCharArray() => - jni.JniObject.fromRef(_asCharArray(reference).object); - - static final _asByteArray = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonToken__asByteArray") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public final byte[] asByteArray() - /// The returned object must be deleted after use, by calling the `delete` method. - jni.JniObject asByteArray() => - jni.JniObject.fromRef(_asByteArray(reference).object); - - static final _isNumeric = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonToken__isNumeric") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public final boolean isNumeric() - /// - /// @return {@code True} if this token is {@code VALUE_NUMBER_INT} or {@code VALUE_NUMBER_FLOAT}, - /// {@code false} otherwise - bool isNumeric() => _isNumeric(reference).boolean; - - static final _isStructStart = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonToken__isStructStart") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public final boolean isStructStart() - /// - /// Accessor that is functionally equivalent to: - /// <code> - /// this == JsonToken.START_OBJECT || this == JsonToken.START_ARRAY - /// </code> - ///@return {@code True} if this token is {@code START_OBJECT} or {@code START_ARRAY}, - /// {@code false} otherwise - ///@since 2.3 - bool isStructStart() => _isStructStart(reference).boolean; - - static final _isStructEnd = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonToken__isStructEnd") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public final boolean isStructEnd() - /// - /// Accessor that is functionally equivalent to: - /// <code> - /// this == JsonToken.END_OBJECT || this == JsonToken.END_ARRAY - /// </code> - ///@return {@code True} if this token is {@code END_OBJECT} or {@code END_ARRAY}, - /// {@code false} otherwise - ///@since 2.3 - bool isStructEnd() => _isStructEnd(reference).boolean; - - static final _isScalarValue = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonToken__isScalarValue") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public final boolean isScalarValue() - /// - /// Method that can be used to check whether this token represents - /// a valid non-structured value. This means all {@code VALUE_xxx} tokens; - /// excluding {@code START_xxx} and {@code END_xxx} tokens as well - /// {@code FIELD_NAME}. - ///@return {@code True} if this token is a scalar value token (one of - /// {@code VALUE_xxx} tokens), {@code false} otherwise - bool isScalarValue() => _isScalarValue(reference).boolean; - - static final _isBoolean = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("JsonToken__isBoolean") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public final boolean isBoolean() - /// - /// @return {@code True} if this token is {@code VALUE_TRUE} or {@code VALUE_FALSE}, - /// {@code false} otherwise - bool isBoolean() => _isBoolean(reference).boolean; -}
diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonFactory.dart b/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonFactory.dart new file mode 100644 index 0000000..0a5547e --- /dev/null +++ b/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonFactory.dart
@@ -0,0 +1,1686 @@ +// Generated from jackson-core which is licensed under the Apache License 2.0. +// The following copyright from the original authors applies. +// See https://github.com/FasterXML/jackson-core/blob/2.14/LICENSE +// +// Copyright (c) 2007 - The Jackson Project Authors +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: camel_case_types +// ignore_for_file: file_names +// ignore_for_file: unused_import +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: constant_identifier_names +// ignore_for_file: annotate_overrides +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: unused_element + +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; +import "package:jni/jni.dart" as jni; + +import "JsonParser.dart" as jsonparser_; +import "../../../../_init.dart" show jniLookup; + +/// from: com.fasterxml.jackson.core.JsonFactory +/// +/// The main factory class of Jackson package, used to configure and +/// construct reader (aka parser, JsonParser) +/// and writer (aka generator, JsonGenerator) +/// instances. +/// +/// Factory instances are thread-safe and reusable after configuration +/// (if any). Typically applications and services use only a single +/// globally shared factory instance, unless they need differently +/// configured factories. Factory reuse is important if efficiency matters; +/// most recycling of expensive construct is done on per-factory basis. +/// +/// Creation of a factory instance is a light-weight operation, +/// and since there is no need for pluggable alternative implementations +/// (as there is no "standard" JSON processor API to implement), +/// the default constructor is used for constructing factory +/// instances. +///@author Tatu Saloranta +class JsonFactory extends jni.JniObject { + JsonFactory.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); + + /// from: private static final long serialVersionUID + static const serialVersionUID = 2; + + /// from: static public final java.lang.String FORMAT_NAME_JSON + /// + /// Name used to identify JSON format + /// (and returned by \#getFormatName() + static const FORMAT_NAME_JSON = "JSON"; + + static final _get_DEFAULT_FACTORY_FEATURE_FLAGS = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "get_JsonFactory__DEFAULT_FACTORY_FEATURE_FLAGS") + .asFunction<jni.JniResult Function()>(); + + /// from: static protected final int DEFAULT_FACTORY_FEATURE_FLAGS + /// + /// Bitfield (set of flags) of all factory features that are enabled by default. + static int get DEFAULT_FACTORY_FEATURE_FLAGS => + _get_DEFAULT_FACTORY_FEATURE_FLAGS().integer; + + static final _get_DEFAULT_PARSER_FEATURE_FLAGS = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "get_JsonFactory__DEFAULT_PARSER_FEATURE_FLAGS") + .asFunction<jni.JniResult Function()>(); + + /// from: static protected final int DEFAULT_PARSER_FEATURE_FLAGS + /// + /// Bitfield (set of flags) of all parser features that are enabled + /// by default. + static int get DEFAULT_PARSER_FEATURE_FLAGS => + _get_DEFAULT_PARSER_FEATURE_FLAGS().integer; + + static final _get_DEFAULT_GENERATOR_FEATURE_FLAGS = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "get_JsonFactory__DEFAULT_GENERATOR_FEATURE_FLAGS") + .asFunction<jni.JniResult Function()>(); + + /// from: static protected final int DEFAULT_GENERATOR_FEATURE_FLAGS + /// + /// Bitfield (set of flags) of all generator features that are enabled + /// by default. + static int get DEFAULT_GENERATOR_FEATURE_FLAGS => + _get_DEFAULT_GENERATOR_FEATURE_FLAGS().integer; + + static final _get_DEFAULT_ROOT_VALUE_SEPARATOR = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "get_JsonFactory__DEFAULT_ROOT_VALUE_SEPARATOR") + .asFunction<jni.JniResult Function()>(); + + /// from: static public final com.fasterxml.jackson.core.SerializableString DEFAULT_ROOT_VALUE_SEPARATOR + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JniObject get DEFAULT_ROOT_VALUE_SEPARATOR => + jni.JniObject.fromRef(_get_DEFAULT_ROOT_VALUE_SEPARATOR().object); + + static final _ctor = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonFactory__ctor") + .asFunction<jni.JniResult Function()>(); + + /// from: public void <init>() + /// + /// Default constructor used to create factory instances. + /// Creation of a factory instance is a light-weight operation, + /// but it is still a good idea to reuse limited number of + /// factory instances (and quite often just a single instance): + /// factories are used as context for storing some reused + /// processing objects (such as symbol tables parsers use) + /// and this reuse only works within context of a single + /// factory instance. + JsonFactory() : super.fromRef(_ctor().object); + + static final _ctor1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__ctor1") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public void <init>(com.fasterxml.jackson.core.ObjectCodec oc) + JsonFactory.ctor1(jni.JniObject oc) + : super.fromRef(_ctor1(oc.reference).object); + + static final _ctor2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__ctor2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: protected void <init>(com.fasterxml.jackson.core.JsonFactory src, com.fasterxml.jackson.core.ObjectCodec codec) + /// + /// Constructor used when copy()ing a factory instance. + ///@param src Original factory to copy settings from + ///@param codec Databinding-level codec to use, if any + ///@since 2.2.1 + JsonFactory.ctor2(JsonFactory src, jni.JniObject codec) + : super.fromRef(_ctor2(src.reference, codec.reference).object); + + static final _ctor3 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__ctor3") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public void <init>(com.fasterxml.jackson.core.JsonFactoryBuilder b) + /// + /// Constructor used by JsonFactoryBuilder for instantiation. + ///@param b Builder that contains settings to use + ///@since 2.10 + JsonFactory.ctor3(jni.JniObject b) + : super.fromRef(_ctor3(b.reference).object); + + static final _ctor4 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Uint8)>>("JsonFactory__ctor4") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: protected void <init>(com.fasterxml.jackson.core.TSFBuilder<?,?> b, boolean bogus) + /// + /// Constructor for subtypes; needed to work around the fact that before 3.0, + /// this factory has cumbersome dual role as generic type as well as actual + /// implementation for json. + ///@param b Builder that contains settings to use + ///@param bogus Argument only needed to separate constructor signature; ignored + JsonFactory.ctor4(jni.JniObject b, bool bogus) + : super.fromRef(_ctor4(b.reference, bogus ? 1 : 0).object); + + static final _rebuild = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__rebuild") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.TSFBuilder<?,?> rebuild() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that allows construction of differently configured factory, starting + /// with settings of this factory. + ///@return Builder instance to use + ///@since 2.10 + jni.JniObject rebuild() => jni.JniObject.fromRef(_rebuild(reference).object); + + static final _builder = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonFactory__builder") + .asFunction<jni.JniResult Function()>(); + + /// from: static public com.fasterxml.jackson.core.TSFBuilder<?,?> builder() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Main factory method to use for constructing JsonFactory instances with + /// different configuration: creates and returns a builder for collecting configuration + /// settings; instance created by calling {@code build()} after all configuration + /// set. + /// + /// NOTE: signature unfortunately does not expose true implementation type; this + /// will be fixed in 3.0. + ///@return Builder instance to use + static jni.JniObject builder() => jni.JniObject.fromRef(_builder().object); + + static final _copy = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__copy") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory copy() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing a new JsonFactory that has + /// the same settings as this instance, but is otherwise + /// independent (i.e. nothing is actually shared, symbol tables + /// are separate). + /// Note that ObjectCodec reference is not copied but is + /// set to null; caller typically needs to set it after calling + /// this method. Reason for this is that the codec is used for + /// callbacks, and assumption is that there is strict 1-to-1 + /// mapping between codec, factory. Caller has to, then, explicitly + /// set codec after making the copy. + ///@return Copy of this factory instance + ///@since 2.1 + JsonFactory copy() => JsonFactory.fromRef(_copy(reference).object); + + static final _readResolve = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__readResolve") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: protected java.lang.Object readResolve() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that we need to override to actually make restoration go + /// through constructors etc: needed to allow JDK serializability of + /// factory instances. + /// + /// Note: must be overridden by sub-classes as well. + ///@return Newly constructed instance + jni.JniObject readResolve() => + jni.JniObject.fromRef(_readResolve(reference).object); + + static final _requiresPropertyOrdering = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonFactory__requiresPropertyOrdering") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean requiresPropertyOrdering() + /// + /// Introspection method that higher-level functionality may call + /// to see whether underlying data format requires a stable ordering + /// of object properties or not. + /// This is usually used for determining + /// whether to force a stable ordering (like alphabetic ordering by name) + /// if no ordering if explicitly specified. + /// + /// Default implementation returns <code>false</code> as JSON does NOT + /// require stable ordering. Formats that require ordering include positional + /// textual formats like <code>CSV</code>, and schema-based binary formats + /// like <code>Avro</code>. + ///@return Whether format supported by this factory + /// requires Object properties to be ordered. + ///@since 2.3 + bool requiresPropertyOrdering() => + _requiresPropertyOrdering(reference).boolean; + + static final _canHandleBinaryNatively = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonFactory__canHandleBinaryNatively") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean canHandleBinaryNatively() + /// + /// Introspection method that higher-level functionality may call + /// to see whether underlying data format can read and write binary + /// data natively; that is, embeded it as-is without using encodings + /// such as Base64. + /// + /// Default implementation returns <code>false</code> as JSON does not + /// support native access: all binary content must use Base64 encoding. + /// Most binary formats (like Smile and Avro) support native binary content. + ///@return Whether format supported by this factory + /// supports native binary content + ///@since 2.3 + bool canHandleBinaryNatively() => _canHandleBinaryNatively(reference).boolean; + + static final _canUseCharArrays = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__canUseCharArrays") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean canUseCharArrays() + /// + /// Introspection method that can be used by base factory to check + /// whether access using <code>char[]</code> is something that actual + /// parser implementations can take advantage of, over having to + /// use java.io.Reader. Sub-types are expected to override + /// definition; default implementation (suitable for JSON) alleges + /// that optimization are possible; and thereby is likely to try + /// to access java.lang.String content by first copying it into + /// recyclable intermediate buffer. + ///@return Whether access to decoded textual content can be efficiently + /// accessed using parser method {@code getTextCharacters()}. + ///@since 2.4 + bool canUseCharArrays() => _canUseCharArrays(reference).boolean; + + static final _canParseAsync = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__canParseAsync") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean canParseAsync() + /// + /// Introspection method that can be used to check whether this + /// factory can create non-blocking parsers: parsers that do not + /// use blocking I/O abstractions but instead use a + /// com.fasterxml.jackson.core.async.NonBlockingInputFeeder. + ///@return Whether this factory supports non-blocking ("async") parsing or + /// not (and consequently whether {@code createNonBlockingXxx()} method(s) work) + ///@since 2.9 + bool canParseAsync() => _canParseAsync(reference).boolean; + + static final _getFormatReadFeatureType = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonFactory__getFormatReadFeatureType") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Class<? extends com.fasterxml.jackson.core.FormatFeature> getFormatReadFeatureType() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JniObject getFormatReadFeatureType() => + jni.JniObject.fromRef(_getFormatReadFeatureType(reference).object); + + static final _getFormatWriteFeatureType = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonFactory__getFormatWriteFeatureType") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Class<? extends com.fasterxml.jackson.core.FormatFeature> getFormatWriteFeatureType() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JniObject getFormatWriteFeatureType() => + jni.JniObject.fromRef(_getFormatWriteFeatureType(reference).object); + + static final _canUseSchema = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__canUseSchema") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean canUseSchema(com.fasterxml.jackson.core.FormatSchema schema) + /// + /// Method that can be used to quickly check whether given schema + /// is something that parsers and/or generators constructed by this + /// factory could use. Note that this means possible use, at the level + /// of data format (i.e. schema is for same data format as parsers and + /// generators this factory constructs); individual schema instances + /// may have further usage restrictions. + ///@param schema Schema instance to check + ///@return Whether parsers and generators constructed by this factory + /// can use specified format schema instance + bool canUseSchema(jni.JniObject schema) => + _canUseSchema(reference, schema.reference).boolean; + + static final _getFormatName = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__getFormatName") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String getFormatName() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that returns short textual id identifying format + /// this factory supports. + /// + /// Note: sub-classes should override this method; default + /// implementation will return null for all sub-classes + ///@return Name of the format handled by parsers, generators this factory creates + jni.JniString getFormatName() => + jni.JniString.fromRef(_getFormatName(reference).object); + + static final _hasFormat = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__hasFormat") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.format.MatchStrength hasFormat(com.fasterxml.jackson.core.format.InputAccessor acc) + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JniObject hasFormat(jni.JniObject acc) => + jni.JniObject.fromRef(_hasFormat(reference, acc.reference).object); + + static final _requiresCustomCodec = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__requiresCustomCodec") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean requiresCustomCodec() + /// + /// Method that can be called to determine if a custom + /// ObjectCodec is needed for binding data parsed + /// using JsonParser constructed by this factory + /// (which typically also implies the same for serialization + /// with JsonGenerator). + ///@return True if custom codec is needed with parsers and + /// generators created by this factory; false if a general + /// ObjectCodec is enough + ///@since 2.1 + bool requiresCustomCodec() => _requiresCustomCodec(reference).boolean; + + static final _hasJSONFormat = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__hasJSONFormat") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: protected com.fasterxml.jackson.core.format.MatchStrength hasJSONFormat(com.fasterxml.jackson.core.format.InputAccessor acc) + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JniObject hasJSONFormat(jni.JniObject acc) => + jni.JniObject.fromRef(_hasJSONFormat(reference, acc.reference).object); + + static final _version = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__version") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.Version version() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JniObject version() => jni.JniObject.fromRef(_version(reference).object); + + static final _configure = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, ffi.Uint8)>>("JsonFactory__configure") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int)>(); + + /// from: public final com.fasterxml.jackson.core.JsonFactory configure(com.fasterxml.jackson.core.JsonFactory.Feature f, boolean state) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for enabling or disabling specified parser feature + /// (check JsonParser.Feature for list of features) + ///@param f Feature to enable/disable + ///@param state Whether to enable or disable the feature + ///@return This factory instance (to allow call chaining) + ///@deprecated since 2.10 use JsonFactoryBuilder\#configure(JsonFactory.Feature, boolean) instead + JsonFactory configure(JsonFactory_Feature f, bool state) => + JsonFactory.fromRef( + _configure(reference, f.reference, state ? 1 : 0).object); + + static final _enable = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__enable") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory enable(com.fasterxml.jackson.core.JsonFactory.Feature f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for enabling specified parser feature + /// (check JsonFactory.Feature for list of features) + ///@param f Feature to enable + ///@return This factory instance (to allow call chaining) + ///@deprecated since 2.10 use JsonFactoryBuilder\#configure(JsonFactory.Feature, boolean) instead + JsonFactory enable(JsonFactory_Feature f) => + JsonFactory.fromRef(_enable(reference, f.reference).object); + + static final _disable = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__disable") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory disable(com.fasterxml.jackson.core.JsonFactory.Feature f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for disabling specified parser features + /// (check JsonFactory.Feature for list of features) + ///@param f Feature to disable + ///@return This factory instance (to allow call chaining) + ///@deprecated since 2.10 use JsonFactoryBuilder\#configure(JsonFactory.Feature, boolean) instead + JsonFactory disable(JsonFactory_Feature f) => + JsonFactory.fromRef(_disable(reference, f.reference).object); + + static final _isEnabled = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__isEnabled") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isEnabled(com.fasterxml.jackson.core.JsonFactory.Feature f) + /// + /// Checked whether specified parser feature is enabled. + ///@param f Feature to check + ///@return True if the specified feature is enabled + bool isEnabled(JsonFactory_Feature f) => + _isEnabled(reference, f.reference).boolean; + + static final _getParserFeatures = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__getParserFeatures") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final int getParserFeatures() + int getParserFeatures() => _getParserFeatures(reference).integer; + + static final _getGeneratorFeatures = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__getGeneratorFeatures") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final int getGeneratorFeatures() + int getGeneratorFeatures() => _getGeneratorFeatures(reference).integer; + + static final _getFormatParserFeatures = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonFactory__getFormatParserFeatures") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int getFormatParserFeatures() + int getFormatParserFeatures() => _getFormatParserFeatures(reference).integer; + + static final _getFormatGeneratorFeatures = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonFactory__getFormatGeneratorFeatures") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int getFormatGeneratorFeatures() + int getFormatGeneratorFeatures() => + _getFormatGeneratorFeatures(reference).integer; + + static final _configure1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, ffi.Uint8)>>("JsonFactory__configure1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int)>(); + + /// from: public final com.fasterxml.jackson.core.JsonFactory configure(com.fasterxml.jackson.core.JsonParser.Feature f, boolean state) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for enabling or disabling specified parser feature + /// (check JsonParser.Feature for list of features) + ///@param f Feature to enable/disable + ///@param state Whether to enable or disable the feature + ///@return This factory instance (to allow call chaining) + JsonFactory configure1(jsonparser_.JsonParser_Feature f, bool state) => + JsonFactory.fromRef( + _configure1(reference, f.reference, state ? 1 : 0).object); + + static final _enable1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__enable1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory enable(com.fasterxml.jackson.core.JsonParser.Feature f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for enabling specified parser feature + /// (check JsonParser.Feature for list of features) + ///@param f Feature to enable + ///@return This factory instance (to allow call chaining) + JsonFactory enable1(jsonparser_.JsonParser_Feature f) => + JsonFactory.fromRef(_enable1(reference, f.reference).object); + + static final _disable1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__disable1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory disable(com.fasterxml.jackson.core.JsonParser.Feature f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for disabling specified parser features + /// (check JsonParser.Feature for list of features) + ///@param f Feature to disable + ///@return This factory instance (to allow call chaining) + JsonFactory disable1(jsonparser_.JsonParser_Feature f) => + JsonFactory.fromRef(_disable1(reference, f.reference).object); + + static final _isEnabled1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__isEnabled1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isEnabled(com.fasterxml.jackson.core.JsonParser.Feature f) + /// + /// Method for checking if the specified parser feature is enabled. + ///@param f Feature to check + ///@return True if specified feature is enabled + bool isEnabled1(jsonparser_.JsonParser_Feature f) => + _isEnabled1(reference, f.reference).boolean; + + static final _isEnabled2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__isEnabled2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isEnabled(com.fasterxml.jackson.core.StreamReadFeature f) + /// + /// Method for checking if the specified stream read feature is enabled. + ///@param f Feature to check + ///@return True if specified feature is enabled + ///@since 2.10 + bool isEnabled2(jni.JniObject f) => + _isEnabled2(reference, f.reference).boolean; + + static final _getInputDecorator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__getInputDecorator") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.io.InputDecorator getInputDecorator() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for getting currently configured input decorator (if any; + /// there is no default decorator). + ///@return InputDecorator configured, if any + jni.JniObject getInputDecorator() => + jni.JniObject.fromRef(_getInputDecorator(reference).object); + + static final _setInputDecorator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__setInputDecorator") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory setInputDecorator(com.fasterxml.jackson.core.io.InputDecorator d) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for overriding currently configured input decorator + ///@param d Decorator to configure for this factory, if any ({@code null} if none) + ///@return This factory instance (to allow call chaining) + ///@deprecated Since 2.10 use JsonFactoryBuilder\#inputDecorator(InputDecorator) instead + JsonFactory setInputDecorator(jni.JniObject d) => + JsonFactory.fromRef(_setInputDecorator(reference, d.reference).object); + + static final _configure2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, ffi.Uint8)>>("JsonFactory__configure2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int)>(); + + /// from: public final com.fasterxml.jackson.core.JsonFactory configure(com.fasterxml.jackson.core.JsonGenerator.Feature f, boolean state) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for enabling or disabling specified generator feature + /// (check JsonGenerator.Feature for list of features) + ///@param f Feature to enable/disable + ///@param state Whether to enable or disable the feature + ///@return This factory instance (to allow call chaining) + JsonFactory configure2(jni.JniObject f, bool state) => JsonFactory.fromRef( + _configure2(reference, f.reference, state ? 1 : 0).object); + + static final _enable2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__enable2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory enable(com.fasterxml.jackson.core.JsonGenerator.Feature f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for enabling specified generator features + /// (check JsonGenerator.Feature for list of features) + ///@param f Feature to enable + ///@return This factory instance (to allow call chaining) + JsonFactory enable2(jni.JniObject f) => + JsonFactory.fromRef(_enable2(reference, f.reference).object); + + static final _disable2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__disable2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory disable(com.fasterxml.jackson.core.JsonGenerator.Feature f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for disabling specified generator feature + /// (check JsonGenerator.Feature for list of features) + ///@param f Feature to disable + ///@return This factory instance (to allow call chaining) + JsonFactory disable2(jni.JniObject f) => + JsonFactory.fromRef(_disable2(reference, f.reference).object); + + static final _isEnabled3 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__isEnabled3") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isEnabled(com.fasterxml.jackson.core.JsonGenerator.Feature f) + /// + /// Check whether specified generator feature is enabled. + ///@param f Feature to check + ///@return Whether specified feature is enabled + bool isEnabled3(jni.JniObject f) => + _isEnabled3(reference, f.reference).boolean; + + static final _isEnabled4 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__isEnabled4") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isEnabled(com.fasterxml.jackson.core.StreamWriteFeature f) + /// + /// Check whether specified stream write feature is enabled. + ///@param f Feature to check + ///@return Whether specified feature is enabled + ///@since 2.10 + bool isEnabled4(jni.JniObject f) => + _isEnabled4(reference, f.reference).boolean; + + static final _getCharacterEscapes = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__getCharacterEscapes") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.io.CharacterEscapes getCharacterEscapes() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for accessing custom escapes factory uses for JsonGenerators + /// it creates. + ///@return Configured {@code CharacterEscapes}, if any; {@code null} if none + jni.JniObject getCharacterEscapes() => + jni.JniObject.fromRef(_getCharacterEscapes(reference).object); + + static final _setCharacterEscapes = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__setCharacterEscapes") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory setCharacterEscapes(com.fasterxml.jackson.core.io.CharacterEscapes esc) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for defining custom escapes factory uses for JsonGenerators + /// it creates. + ///@param esc CharaterEscapes to set (or {@code null} for "none") + ///@return This factory instance (to allow call chaining) + JsonFactory setCharacterEscapes(jni.JniObject esc) => JsonFactory.fromRef( + _setCharacterEscapes(reference, esc.reference).object); + + static final _getOutputDecorator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__getOutputDecorator") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.io.OutputDecorator getOutputDecorator() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for getting currently configured output decorator (if any; + /// there is no default decorator). + ///@return OutputDecorator configured for generators factory creates, if any; + /// {@code null} if none. + jni.JniObject getOutputDecorator() => + jni.JniObject.fromRef(_getOutputDecorator(reference).object); + + static final _setOutputDecorator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__setOutputDecorator") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory setOutputDecorator(com.fasterxml.jackson.core.io.OutputDecorator d) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for overriding currently configured output decorator + ///@return This factory instance (to allow call chaining) + ///@param d Output decorator to use, if any + ///@deprecated Since 2.10 use JsonFactoryBuilder\#outputDecorator(OutputDecorator) instead + JsonFactory setOutputDecorator(jni.JniObject d) => + JsonFactory.fromRef(_setOutputDecorator(reference, d.reference).object); + + static final _setRootValueSeparator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__setRootValueSeparator") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory setRootValueSeparator(java.lang.String sep) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that allows overriding String used for separating root-level + /// JSON values (default is single space character) + ///@param sep Separator to use, if any; null means that no separator is + /// automatically added + ///@return This factory instance (to allow call chaining) + JsonFactory setRootValueSeparator(jni.JniString sep) => JsonFactory.fromRef( + _setRootValueSeparator(reference, sep.reference).object); + + static final _getRootValueSeparator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__getRootValueSeparator") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String getRootValueSeparator() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// @return Root value separator configured, if any + jni.JniString getRootValueSeparator() => + jni.JniString.fromRef(_getRootValueSeparator(reference).object); + + static final _setCodec = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__setCodec") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonFactory setCodec(com.fasterxml.jackson.core.ObjectCodec oc) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for associating a ObjectCodec (typically + /// a <code>com.fasterxml.jackson.databind.ObjectMapper</code>) + /// with this factory (and more importantly, parsers and generators + /// it constructs). This is needed to use data-binding methods + /// of JsonParser and JsonGenerator instances. + ///@param oc Codec to use + ///@return This factory instance (to allow call chaining) + JsonFactory setCodec(jni.JniObject oc) => + JsonFactory.fromRef(_setCodec(reference, oc.reference).object); + + static final _getCodec = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory__getCodec") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.ObjectCodec getCodec() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JniObject getCodec() => + jni.JniObject.fromRef(_getCodec(reference).object); + + static final _createParser = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.io.File f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON parser instance to parse + /// contents of specified file. + /// + /// + /// Encoding is auto-detected from contents according to JSON + /// specification recommended mechanism. Json specification + /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + /// so auto-detection implemented only for this charsets. + /// For other charsets use \#createParser(java.io.Reader). + /// + /// + /// Underlying input stream (needed for reading contents) + /// will be __owned__ (and managed, i.e. closed as need be) by + /// the parser, since caller has no access to it. + ///@param f File that contains JSON content to parse + ///@since 2.1 + jsonparser_.JsonParser createParser(jni.JniObject f) => + jsonparser_.JsonParser.fromRef( + _createParser(reference, f.reference).object); + + static final _createParser1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.net.URL url) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON parser instance to parse + /// contents of resource reference by given URL. + /// + /// Encoding is auto-detected from contents according to JSON + /// specification recommended mechanism. Json specification + /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + /// so auto-detection implemented only for this charsets. + /// For other charsets use \#createParser(java.io.Reader). + /// + /// Underlying input stream (needed for reading contents) + /// will be __owned__ (and managed, i.e. closed as need be) by + /// the parser, since caller has no access to it. + ///@param url URL pointing to resource that contains JSON content to parse + ///@since 2.1 + jsonparser_.JsonParser createParser1(jni.JniObject url) => + jsonparser_.JsonParser.fromRef( + _createParser1(reference, url.reference).object); + + static final _createParser2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.io.InputStream in) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON parser instance to parse + /// the contents accessed via specified input stream. + /// + /// The input stream will __not be owned__ by + /// the parser, it will still be managed (i.e. closed if + /// end-of-stream is reacher, or parser close method called) + /// if (and only if) com.fasterxml.jackson.core.StreamReadFeature\#AUTO_CLOSE_SOURCE + /// is enabled. + /// + /// + /// Note: no encoding argument is taken since it can always be + /// auto-detected as suggested by JSON RFC. Json specification + /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + /// so auto-detection implemented only for this charsets. + /// For other charsets use \#createParser(java.io.Reader). + ///@param in InputStream to use for reading JSON content to parse + ///@since 2.1 + jsonparser_.JsonParser createParser2(jni.JniObject in0) => + jsonparser_.JsonParser.fromRef( + _createParser2(reference, in0.reference).object); + + static final _createParser3 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser3") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.io.Reader r) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing + /// the contents accessed via specified Reader. + /// + /// The read stream will __not be owned__ by + /// the parser, it will still be managed (i.e. closed if + /// end-of-stream is reacher, or parser close method called) + /// if (and only if) com.fasterxml.jackson.core.StreamReadFeature\#AUTO_CLOSE_SOURCE + /// is enabled. + ///@param r Reader to use for reading JSON content to parse + ///@since 2.1 + jsonparser_.JsonParser createParser3(jni.JniObject r) => + jsonparser_.JsonParser.fromRef( + _createParser3(reference, r.reference).object); + + static final _createParser4 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser4") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(byte[] data) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing + /// the contents of given byte array. + ///@since 2.1 + jsonparser_.JsonParser createParser4(jni.JniObject data) => + jsonparser_.JsonParser.fromRef( + _createParser4(reference, data.reference).object); + + static final _createParser5 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, + ffi.Int32, + ffi.Int32)>>("JsonFactory__createParser5") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int, int)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(byte[] data, int offset, int len) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing + /// the contents of given byte array. + ///@param data Buffer that contains data to parse + ///@param offset Offset of the first data byte within buffer + ///@param len Length of contents to parse within buffer + ///@since 2.1 + jsonparser_.JsonParser createParser5( + jni.JniObject data, int offset, int len) => + jsonparser_.JsonParser.fromRef( + _createParser5(reference, data.reference, offset, len).object); + + static final _createParser6 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser6") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.lang.String content) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing + /// contents of given String. + ///@since 2.1 + jsonparser_.JsonParser createParser6(jni.JniString content) => + jsonparser_.JsonParser.fromRef( + _createParser6(reference, content.reference).object); + + static final _createParser7 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser7") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(char[] content) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing + /// contents of given char array. + ///@since 2.4 + jsonparser_.JsonParser createParser7(jni.JniObject content) => + jsonparser_.JsonParser.fromRef( + _createParser7(reference, content.reference).object); + + static final _createParser8 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, + ffi.Int32, + ffi.Int32)>>("JsonFactory__createParser8") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int, int)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(char[] content, int offset, int len) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing contents of given char array. + ///@since 2.4 + jsonparser_.JsonParser createParser8( + jni.JniObject content, int offset, int len) => + jsonparser_.JsonParser.fromRef( + _createParser8(reference, content.reference, offset, len).object); + + static final _createParser9 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createParser9") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createParser(java.io.DataInput in) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Optional method for constructing parser for reading contents from specified DataInput + /// instance. + /// + /// If this factory does not support DataInput as source, + /// will throw UnsupportedOperationException + ///@since 2.8 + jsonparser_.JsonParser createParser9(jni.JniObject in0) => + jsonparser_.JsonParser.fromRef( + _createParser9(reference, in0.reference).object); + + static final _createNonBlockingByteArrayParser = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonFactory__createNonBlockingByteArrayParser") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createNonBlockingByteArrayParser() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Optional method for constructing parser for non-blocking parsing + /// via com.fasterxml.jackson.core.async.ByteArrayFeeder + /// interface (accessed using JsonParser\#getNonBlockingInputFeeder() + /// from constructed instance). + /// + /// If this factory does not support non-blocking parsing (either at all, + /// or from byte array), + /// will throw UnsupportedOperationException. + /// + /// Note that JSON-backed factory only supports parsing of UTF-8 encoded JSON content + /// (and US-ASCII since it is proper subset); other encodings are not supported + /// at this point. + ///@since 2.9 + jsonparser_.JsonParser createNonBlockingByteArrayParser() => + jsonparser_.JsonParser.fromRef( + _createNonBlockingByteArrayParser(reference).object); + + static final _createGenerator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator") + .asFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON generator for writing JSON content + /// using specified output stream. + /// Encoding to use must be specified, and needs to be one of available + /// types (as per JSON specification). + /// + /// Underlying stream __is NOT owned__ by the generator constructed, + /// so that generator will NOT close the output stream when + /// JsonGenerator\#close is called (unless auto-closing + /// feature, + /// com.fasterxml.jackson.core.JsonGenerator.Feature\#AUTO_CLOSE_TARGET + /// is enabled). + /// Using application needs to close it explicitly if this is the case. + /// + /// Note: there are formats that use fixed encoding (like most binary data formats) + /// and that ignore passed in encoding. + ///@param out OutputStream to use for writing JSON content + ///@param enc Character encoding to use + ///@since 2.1 + jni.JniObject createGenerator(jni.JniObject out, jni.JniObject enc) => + jni.JniObject.fromRef( + _createGenerator(reference, out.reference, enc.reference).object); + + static final _createGenerator1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.OutputStream out) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Convenience method for constructing generator that uses default + /// encoding of the format (UTF-8 for JSON and most other data formats). + /// + /// Note: there are formats that use fixed encoding (like most binary data formats). + ///@since 2.1 + jni.JniObject createGenerator1(jni.JniObject out) => + jni.JniObject.fromRef(_createGenerator1(reference, out.reference).object); + + static final _createGenerator2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.Writer w) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON generator for writing JSON content + /// using specified Writer. + /// + /// Underlying stream __is NOT owned__ by the generator constructed, + /// so that generator will NOT close the Reader when + /// JsonGenerator\#close is called (unless auto-closing + /// feature, + /// com.fasterxml.jackson.core.JsonGenerator.Feature\#AUTO_CLOSE_TARGET is enabled). + /// Using application needs to close it explicitly. + ///@since 2.1 + ///@param w Writer to use for writing JSON content + jni.JniObject createGenerator2(jni.JniObject w) => + jni.JniObject.fromRef(_createGenerator2(reference, w.reference).object); + + static final _createGenerator3 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator3") + .asFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.File f, com.fasterxml.jackson.core.JsonEncoding enc) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON generator for writing JSON content + /// to specified file, overwriting contents it might have (or creating + /// it if such file does not yet exist). + /// Encoding to use must be specified, and needs to be one of available + /// types (as per JSON specification). + /// + /// Underlying stream __is owned__ by the generator constructed, + /// i.e. generator will handle closing of file when + /// JsonGenerator\#close is called. + ///@param f File to write contents to + ///@param enc Character encoding to use + ///@since 2.1 + jni.JniObject createGenerator3(jni.JniObject f, jni.JniObject enc) => + jni.JniObject.fromRef( + _createGenerator3(reference, f.reference, enc.reference).object); + + static final _createGenerator4 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator4") + .asFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.DataOutput out, com.fasterxml.jackson.core.JsonEncoding enc) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing generator for writing content using specified + /// DataOutput instance. + ///@since 2.8 + jni.JniObject createGenerator4(jni.JniObject out, jni.JniObject enc) => + jni.JniObject.fromRef( + _createGenerator4(reference, out.reference, enc.reference).object); + + static final _createGenerator5 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createGenerator5") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createGenerator(java.io.DataOutput out) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Convenience method for constructing generator that uses default + /// encoding of the format (UTF-8 for JSON and most other data formats). + /// + /// Note: there are formats that use fixed encoding (like most binary data formats). + ///@since 2.8 + jni.JniObject createGenerator5(jni.JniObject out) => + jni.JniObject.fromRef(_createGenerator5(reference, out.reference).object); + + static final _createJsonParser = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(java.io.File f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON parser instance to parse + /// contents of specified file. + /// + /// Encoding is auto-detected from contents according to JSON + /// specification recommended mechanism. Json specification + /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + /// so auto-detection implemented only for this charsets. + /// For other charsets use \#createParser(java.io.Reader). + /// + /// + /// Underlying input stream (needed for reading contents) + /// will be __owned__ (and managed, i.e. closed as need be) by + /// the parser, since caller has no access to it. + ///@param f File that contains JSON content to parse + ///@return Parser constructed + ///@throws IOException if parser initialization fails due to I/O (read) problem + ///@throws JsonParseException if parser initialization fails due to content decoding problem + ///@deprecated Since 2.2, use \#createParser(File) instead. + jsonparser_.JsonParser createJsonParser(jni.JniObject f) => + jsonparser_.JsonParser.fromRef( + _createJsonParser(reference, f.reference).object); + + static final _createJsonParser1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(java.net.URL url) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON parser instance to parse + /// contents of resource reference by given URL. + /// + /// Encoding is auto-detected from contents according to JSON + /// specification recommended mechanism. Json specification + /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + /// so auto-detection implemented only for this charsets. + /// For other charsets use \#createParser(java.io.Reader). + /// + /// Underlying input stream (needed for reading contents) + /// will be __owned__ (and managed, i.e. closed as need be) by + /// the parser, since caller has no access to it. + ///@param url URL pointing to resource that contains JSON content to parse + ///@return Parser constructed + ///@throws IOException if parser initialization fails due to I/O (read) problem + ///@throws JsonParseException if parser initialization fails due to content decoding problem + ///@deprecated Since 2.2, use \#createParser(URL) instead. + jsonparser_.JsonParser createJsonParser1(jni.JniObject url) => + jsonparser_.JsonParser.fromRef( + _createJsonParser1(reference, url.reference).object); + + static final _createJsonParser2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(java.io.InputStream in) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON parser instance to parse + /// the contents accessed via specified input stream. + /// + /// The input stream will __not be owned__ by + /// the parser, it will still be managed (i.e. closed if + /// end-of-stream is reacher, or parser close method called) + /// if (and only if) com.fasterxml.jackson.core.JsonParser.Feature\#AUTO_CLOSE_SOURCE + /// is enabled. + /// + /// + /// Note: no encoding argument is taken since it can always be + /// auto-detected as suggested by JSON RFC. Json specification + /// supports only UTF-8, UTF-16 and UTF-32 as valid encodings, + /// so auto-detection implemented only for this charsets. + /// For other charsets use \#createParser(java.io.Reader). + ///@param in InputStream to use for reading JSON content to parse + ///@return Parser constructed + ///@throws IOException if parser initialization fails due to I/O (read) problem + ///@throws JsonParseException if parser initialization fails due to content decoding problem + ///@deprecated Since 2.2, use \#createParser(InputStream) instead. + jsonparser_.JsonParser createJsonParser2(jni.JniObject in0) => + jsonparser_.JsonParser.fromRef( + _createJsonParser2(reference, in0.reference).object); + + static final _createJsonParser3 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser3") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(java.io.Reader r) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing + /// the contents accessed via specified Reader. + /// + /// The read stream will __not be owned__ by + /// the parser, it will still be managed (i.e. closed if + /// end-of-stream is reacher, or parser close method called) + /// if (and only if) com.fasterxml.jackson.core.JsonParser.Feature\#AUTO_CLOSE_SOURCE + /// is enabled. + ///@param r Reader to use for reading JSON content to parse + ///@return Parser constructed + ///@throws IOException if parser initialization fails due to I/O (read) problem + ///@throws JsonParseException if parser initialization fails due to content decoding problem + ///@deprecated Since 2.2, use \#createParser(Reader) instead. + jsonparser_.JsonParser createJsonParser3(jni.JniObject r) => + jsonparser_.JsonParser.fromRef( + _createJsonParser3(reference, r.reference).object); + + static final _createJsonParser4 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser4") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(byte[] data) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing the contents of given byte array. + ///@param data Input content to parse + ///@return Parser constructed + ///@throws IOException if parser initialization fails due to I/O (read) problem + ///@throws JsonParseException if parser initialization fails due to content decoding problem + ///@deprecated Since 2.2, use \#createParser(byte[]) instead. + jsonparser_.JsonParser createJsonParser4(jni.JniObject data) => + jsonparser_.JsonParser.fromRef( + _createJsonParser4(reference, data.reference).object); + + static final _createJsonParser5 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, + ffi.Int32, + ffi.Int32)>>("JsonFactory__createJsonParser5") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int, int)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(byte[] data, int offset, int len) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing + /// the contents of given byte array. + ///@param data Buffer that contains data to parse + ///@param offset Offset of the first data byte within buffer + ///@param len Length of contents to parse within buffer + ///@return Parser constructed + ///@throws IOException if parser initialization fails due to I/O (read) problem + ///@throws JsonParseException if parser initialization fails due to content decoding problem + ///@deprecated Since 2.2, use \#createParser(byte[],int,int) instead. + jsonparser_.JsonParser createJsonParser5( + jni.JniObject data, int offset, int len) => + jsonparser_.JsonParser.fromRef( + _createJsonParser5(reference, data.reference, offset, len).object); + + static final _createJsonParser6 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonParser6") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser createJsonParser(java.lang.String content) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing parser for parsing + /// contents of given String. + ///@param content Input content to parse + ///@return Parser constructed + ///@throws IOException if parser initialization fails due to I/O (read) problem + ///@throws JsonParseException if parser initialization fails due to content decoding problem + ///@deprecated Since 2.2, use \#createParser(String) instead. + jsonparser_.JsonParser createJsonParser6(jni.JniString content) => + jsonparser_.JsonParser.fromRef( + _createJsonParser6(reference, content.reference).object); + + static final _createJsonGenerator = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonGenerator") + .asFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createJsonGenerator(java.io.OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON generator for writing JSON content + /// using specified output stream. + /// Encoding to use must be specified, and needs to be one of available + /// types (as per JSON specification). + /// + /// Underlying stream __is NOT owned__ by the generator constructed, + /// so that generator will NOT close the output stream when + /// JsonGenerator\#close is called (unless auto-closing + /// feature, + /// com.fasterxml.jackson.core.JsonGenerator.Feature\#AUTO_CLOSE_TARGET + /// is enabled). + /// Using application needs to close it explicitly if this is the case. + /// + /// Note: there are formats that use fixed encoding (like most binary data formats) + /// and that ignore passed in encoding. + ///@param out OutputStream to use for writing JSON content + ///@param enc Character encoding to use + ///@return Generator constructed + ///@throws IOException if parser initialization fails due to I/O (write) problem + ///@deprecated Since 2.2, use \#createGenerator(OutputStream, JsonEncoding) instead. + jni.JniObject createJsonGenerator(jni.JniObject out, jni.JniObject enc) => + jni.JniObject.fromRef( + _createJsonGenerator(reference, out.reference, enc.reference).object); + + static final _createJsonGenerator1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonGenerator1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createJsonGenerator(java.io.Writer out) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for constructing JSON generator for writing JSON content + /// using specified Writer. + /// + /// Underlying stream __is NOT owned__ by the generator constructed, + /// so that generator will NOT close the Reader when + /// JsonGenerator\#close is called (unless auto-closing + /// feature, + /// com.fasterxml.jackson.core.JsonGenerator.Feature\#AUTO_CLOSE_TARGET is enabled). + /// Using application needs to close it explicitly. + ///@param out Writer to use for writing JSON content + ///@return Generator constructed + ///@throws IOException if parser initialization fails due to I/O (write) problem + ///@deprecated Since 2.2, use \#createGenerator(Writer) instead. + jni.JniObject createJsonGenerator1(jni.JniObject out) => + jni.JniObject.fromRef( + _createJsonGenerator1(reference, out.reference).object); + + static final _createJsonGenerator2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonFactory__createJsonGenerator2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonGenerator createJsonGenerator(java.io.OutputStream out) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Convenience method for constructing generator that uses default + /// encoding of the format (UTF-8 for JSON and most other data formats). + /// + /// Note: there are formats that use fixed encoding (like most binary data formats). + ///@param out OutputStream to use for writing JSON content + ///@return Generator constructed + ///@throws IOException if parser initialization fails due to I/O (write) problem + ///@deprecated Since 2.2, use \#createGenerator(OutputStream) instead. + jni.JniObject createJsonGenerator2(jni.JniObject out) => + jni.JniObject.fromRef( + _createJsonGenerator2(reference, out.reference).object); +} + +/// from: com.fasterxml.jackson.core.JsonFactory$Feature +/// +/// Enumeration that defines all on/off features that can only be +/// changed for JsonFactory. +class JsonFactory_Feature extends jni.JniObject { + JsonFactory_Feature.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); + + static final _values = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonFactory_Feature__values") + .asFunction<jni.JniResult Function()>(); + + /// from: static public com.fasterxml.jackson.core.JsonFactory.Feature[] values() + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JniObject values() => jni.JniObject.fromRef(_values().object); + + static final _valueOf = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory_Feature__valueOf") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: static public com.fasterxml.jackson.core.JsonFactory.Feature valueOf(java.lang.String name) + /// The returned object must be deleted after use, by calling the `delete` method. + static JsonFactory_Feature valueOf(jni.JniString name) => + JsonFactory_Feature.fromRef(_valueOf(name.reference).object); + + static final _collectDefaults = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonFactory_Feature__collectDefaults") + .asFunction<jni.JniResult Function()>(); + + /// from: static public int collectDefaults() + /// + /// Method that calculates bit set (flags) of all features that + /// are enabled by default. + ///@return Bit field of features enabled by default + static int collectDefaults() => _collectDefaults().integer; + + static final _ctor = + jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Uint8)>>( + "JsonFactory_Feature__ctor") + .asFunction<jni.JniResult Function(int)>(); + + /// from: private void <init>(boolean defaultState) + JsonFactory_Feature(bool defaultState) + : super.fromRef(_ctor(defaultState ? 1 : 0).object); + + static final _enabledByDefault = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonFactory_Feature__enabledByDefault") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean enabledByDefault() + bool enabledByDefault() => _enabledByDefault(reference).boolean; + + static final _enabledIn = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Int32)>>("JsonFactory_Feature__enabledIn") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public boolean enabledIn(int flags) + bool enabledIn(int flags) => _enabledIn(reference, flags).boolean; + + static final _getMask = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonFactory_Feature__getMask") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int getMask() + int getMask() => _getMask(reference).integer; +}
diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonParser.dart b/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonParser.dart new file mode 100644 index 0000000..6f695fd --- /dev/null +++ b/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonParser.dart
@@ -0,0 +1,2391 @@ +// Generated from jackson-core which is licensed under the Apache License 2.0. +// The following copyright from the original authors applies. +// See https://github.com/FasterXML/jackson-core/blob/2.14/LICENSE +// +// Copyright (c) 2007 - The Jackson Project Authors +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: camel_case_types +// ignore_for_file: file_names +// ignore_for_file: unused_import +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: constant_identifier_names +// ignore_for_file: annotate_overrides +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: unused_element + +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; +import "package:jni/jni.dart" as jni; + +import "JsonToken.dart" as jsontoken_; +import "../../../../_init.dart" show jniLookup; + +/// from: com.fasterxml.jackson.core.JsonParser +/// +/// Base class that defines public API for reading JSON content. +/// Instances are created using factory methods of +/// a JsonFactory instance. +///@author Tatu Saloranta +class JsonParser extends jni.JniObject { + JsonParser.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); + + /// from: private static final int MIN_BYTE_I + static const MIN_BYTE_I = -128; + + /// from: private static final int MAX_BYTE_I + static const MAX_BYTE_I = 255; + + /// from: private static final int MIN_SHORT_I + static const MIN_SHORT_I = -32768; + + /// from: private static final int MAX_SHORT_I + static const MAX_SHORT_I = 32767; + + static final _get_DEFAULT_READ_CAPABILITIES = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "get_JsonParser__DEFAULT_READ_CAPABILITIES") + .asFunction<jni.JniResult Function()>(); + + /// from: static protected final com.fasterxml.jackson.core.util.JacksonFeatureSet<com.fasterxml.jackson.core.StreamReadCapability> DEFAULT_READ_CAPABILITIES + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Default set of StreamReadCapabilityies that may be used as + /// basis for format-specific readers (or as bogus instance if non-null + /// set needs to be passed). + ///@since 2.12 + static jni.JniObject get DEFAULT_READ_CAPABILITIES => + jni.JniObject.fromRef(_get_DEFAULT_READ_CAPABILITIES().object); + + static final _ctor = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonParser__ctor") + .asFunction<jni.JniResult Function()>(); + + /// from: protected void <init>() + JsonParser() : super.fromRef(_ctor().object); + + static final _ctor1 = + jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Int32)>>( + "JsonParser__ctor1") + .asFunction<jni.JniResult Function(int)>(); + + /// from: protected void <init>(int features) + JsonParser.ctor1(int features) : super.fromRef(_ctor1(features).object); + + static final _getCodec = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getCodec") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.ObjectCodec getCodec() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Accessor for ObjectCodec associated with this + /// parser, if any. Codec is used by \#readValueAs(Class) + /// method (and its variants). + ///@return Codec assigned to this parser, if any; {@code null} if none + jni.JniObject getCodec() => + jni.JniObject.fromRef(_getCodec(reference).object); + + static final _setCodec = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__setCodec") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract void setCodec(com.fasterxml.jackson.core.ObjectCodec oc) + /// + /// Setter that allows defining ObjectCodec associated with this + /// parser, if any. Codec is used by \#readValueAs(Class) + /// method (and its variants). + ///@param oc Codec to assign, if any; {@code null} if none + void setCodec(jni.JniObject oc) => _setCodec(reference, oc.reference).check(); + + static final _getInputSource = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getInputSource") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Object getInputSource() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that can be used to get access to object that is used + /// to access input being parsed; this is usually either + /// InputStream or Reader, depending on what + /// parser was constructed with. + /// Note that returned value may be null in some cases; including + /// case where parser implementation does not want to exposed raw + /// source to caller. + /// In cases where input has been decorated, object returned here + /// is the decorated version; this allows some level of interaction + /// between users of parser and decorator object. + /// + /// In general use of this accessor should be considered as + /// "last effort", i.e. only used if no other mechanism is applicable. + ///@return Input source this parser was configured with + jni.JniObject getInputSource() => + jni.JniObject.fromRef(_getInputSource(reference).object); + + static final _setRequestPayloadOnError = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( + "JsonParser__setRequestPayloadOnError") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setRequestPayloadOnError(com.fasterxml.jackson.core.util.RequestPayload payload) + /// + /// Sets the payload to be passed if JsonParseException is thrown. + ///@param payload Payload to pass + ///@since 2.8 + void setRequestPayloadOnError(jni.JniObject payload) => + _setRequestPayloadOnError(reference, payload.reference).check(); + + static final _setRequestPayloadOnError1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( + "JsonParser__setRequestPayloadOnError1") + .asFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>(); + + /// from: public void setRequestPayloadOnError(byte[] payload, java.lang.String charset) + /// + /// Sets the byte[] request payload and the charset + ///@param payload Payload to pass + ///@param charset Character encoding for (lazily) decoding payload + ///@since 2.8 + void setRequestPayloadOnError1( + jni.JniObject payload, jni.JniString charset) => + _setRequestPayloadOnError1( + reference, payload.reference, charset.reference) + .check(); + + static final _setRequestPayloadOnError2 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>( + "JsonParser__setRequestPayloadOnError2") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setRequestPayloadOnError(java.lang.String payload) + /// + /// Sets the String request payload + ///@param payload Payload to pass + ///@since 2.8 + void setRequestPayloadOnError2(jni.JniString payload) => + _setRequestPayloadOnError2(reference, payload.reference).check(); + + static final _setSchema = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__setSchema") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setSchema(com.fasterxml.jackson.core.FormatSchema schema) + /// + /// Method to call to make this parser use specified schema. Method must + /// be called before trying to parse any content, right after parser instance + /// has been created. + /// Note that not all parsers support schemas; and those that do usually only + /// accept specific types of schemas: ones defined for data format parser can read. + /// + /// If parser does not support specified schema, UnsupportedOperationException + /// is thrown. + ///@param schema Schema to use + ///@throws UnsupportedOperationException if parser does not support schema + void setSchema(jni.JniObject schema) => + _setSchema(reference, schema.reference).check(); + + static final _getSchema = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getSchema") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.FormatSchema getSchema() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for accessing Schema that this parser uses, if any. + /// Default implementation returns null. + ///@return Schema in use by this parser, if any; {@code null} if none + ///@since 2.1 + jni.JniObject getSchema() => + jni.JniObject.fromRef(_getSchema(reference).object); + + static final _canUseSchema = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__canUseSchema") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean canUseSchema(com.fasterxml.jackson.core.FormatSchema schema) + /// + /// Method that can be used to verify that given schema can be used with + /// this parser (using \#setSchema). + ///@param schema Schema to check + ///@return True if this parser can use given schema; false if not + bool canUseSchema(jni.JniObject schema) => + _canUseSchema(reference, schema.reference).boolean; + + static final _requiresCustomCodec = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__requiresCustomCodec") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean requiresCustomCodec() + /// + /// Method that can be called to determine if a custom + /// ObjectCodec is needed for binding data parsed + /// using JsonParser constructed by this factory + /// (which typically also implies the same for serialization + /// with JsonGenerator). + ///@return True if format-specific codec is needed with this parser; false if a general + /// ObjectCodec is enough + ///@since 2.1 + bool requiresCustomCodec() => _requiresCustomCodec(reference).boolean; + + static final _canParseAsync = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__canParseAsync") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean canParseAsync() + /// + /// Method that can be called to determine if this parser instance + /// uses non-blocking ("asynchronous") input access for decoding or not. + /// Access mode is determined by earlier calls via JsonFactory; + /// it may not be changed after construction. + /// + /// If non-blocking decoding is (@code true}, it is possible to call + /// \#getNonBlockingInputFeeder() to obtain object to use + /// for feeding input; otherwise (<code>false</code> returned) + /// input is read by blocking + ///@return True if this is a non-blocking ("asynchronous") parser + ///@since 2.9 + bool canParseAsync() => _canParseAsync(reference).boolean; + + static final _getNonBlockingInputFeeder = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonParser__getNonBlockingInputFeeder") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.async.NonBlockingInputFeeder getNonBlockingInputFeeder() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that will either return a feeder instance (if parser uses + /// non-blocking, aka asynchronous access); or <code>null</code> for + /// parsers that use blocking I/O. + ///@return Input feeder to use with non-blocking (async) parsing + ///@since 2.9 + jni.JniObject getNonBlockingInputFeeder() => + jni.JniObject.fromRef(_getNonBlockingInputFeeder(reference).object); + + static final _getReadCapabilities = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getReadCapabilities") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.util.JacksonFeatureSet<com.fasterxml.jackson.core.StreamReadCapability> getReadCapabilities() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Accessor for getting metadata on capabilities of this parser, based on + /// underlying data format being read (directly or indirectly). + ///@return Set of read capabilities for content to read via this parser + ///@since 2.12 + jni.JniObject getReadCapabilities() => + jni.JniObject.fromRef(_getReadCapabilities(reference).object); + + static final _version = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__version") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.Version version() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Accessor for getting version of the core package, given a parser instance. + /// Left for sub-classes to implement. + ///@return Version of this generator (derived from version declared for + /// {@code jackson-core} jar that contains the class + jni.JniObject version() => jni.JniObject.fromRef(_version(reference).object); + + static final _close = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__close") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract void close() + /// + /// Closes the parser so that no further iteration or data access + /// can be made; will also close the underlying input source + /// if parser either __owns__ the input source, or feature + /// Feature\#AUTO_CLOSE_SOURCE is enabled. + /// Whether parser owns the input source depends on factory + /// method that was used to construct instance (so check + /// com.fasterxml.jackson.core.JsonFactory for details, + /// but the general + /// idea is that if caller passes in closable resource (such + /// as InputStream or Reader) parser does NOT + /// own the source; but if it passes a reference (such as + /// java.io.File or java.net.URL and creates + /// stream or reader it does own them. + ///@throws IOException if there is either an underlying I/O problem + void close() => _close(reference).check(); + + static final _isClosed = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__isClosed") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract boolean isClosed() + /// + /// Method that can be called to determine whether this parser + /// is closed or not. If it is closed, no new tokens can be + /// retrieved by calling \#nextToken (and the underlying + /// stream may be closed). Closing may be due to an explicit + /// call to \#close or because parser has encountered + /// end of input. + ///@return {@code True} if this parser instance has been closed + bool isClosed() => _isClosed(reference).boolean; + + static final _getParsingContext = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getParsingContext") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonStreamContext getParsingContext() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that can be used to access current parsing context reader + /// is in. There are 3 different types: root, array and object contexts, + /// with slightly different available information. Contexts are + /// hierarchically nested, and can be used for example for figuring + /// out part of the input document that correspond to specific + /// array or object (for highlighting purposes, or error reporting). + /// Contexts can also be used for simple xpath-like matching of + /// input, if so desired. + ///@return Stream input context (JsonStreamContext) associated with this parser + jni.JniObject getParsingContext() => + jni.JniObject.fromRef(_getParsingContext(reference).object); + + static final _currentLocation = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__currentLocation") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonLocation currentLocation() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that returns location of the last processed input unit (character + /// or byte) from the input; + /// usually for error reporting purposes. + /// + /// Note that the location is not guaranteed to be accurate (although most + /// implementation will try their best): some implementations may only + /// report specific boundary locations (start or end locations of tokens) + /// and others only return JsonLocation\#NA due to not having access + /// to input location information (when delegating actual decoding work + /// to other library) + ///@return Location of the last processed input unit (byte or character) + ///@since 2.13 + jni.JniObject currentLocation() => + jni.JniObject.fromRef(_currentLocation(reference).object); + + static final _currentTokenLocation = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__currentTokenLocation") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonLocation currentTokenLocation() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that return the __starting__ location of the current + /// (most recently returned) + /// token; that is, the position of the first input unit (character or byte) from input + /// that starts the current token. + /// + /// Note that the location is not guaranteed to be accurate (although most + /// implementation will try their best): some implementations may only + /// return JsonLocation\#NA due to not having access + /// to input location information (when delegating actual decoding work + /// to other library) + ///@return Starting location of the token parser currently points to + ///@since 2.13 (will eventually replace \#getTokenLocation) + jni.JniObject currentTokenLocation() => + jni.JniObject.fromRef(_currentTokenLocation(reference).object); + + static final _getCurrentLocation = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getCurrentLocation") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonLocation getCurrentLocation() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Alias for \#currentLocation(), to be deprecated in later + /// Jackson 2.x versions (and removed from Jackson 3.0). + ///@return Location of the last processed input unit (byte or character) + jni.JniObject getCurrentLocation() => + jni.JniObject.fromRef(_getCurrentLocation(reference).object); + + static final _getTokenLocation = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getTokenLocation") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonLocation getTokenLocation() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Alias for \#currentTokenLocation(), to be deprecated in later + /// Jackson 2.x versions (and removed from Jackson 3.0). + ///@return Starting location of the token parser currently points to + jni.JniObject getTokenLocation() => + jni.JniObject.fromRef(_getTokenLocation(reference).object); + + static final _currentValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__currentValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Object currentValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Helper method, usually equivalent to: + ///<code> + /// getParsingContext().getCurrentValue(); + ///</code> + /// + /// Note that "current value" is NOT populated (or used) by Streaming parser; + /// it is only used by higher-level data-binding functionality. + /// The reason it is included here is that it can be stored and accessed hierarchically, + /// and gets passed through data-binding. + ///@return "Current value" associated with the current input context (state) of this parser + ///@since 2.13 (added as replacement for older \#getCurrentValue() + jni.JniObject currentValue() => + jni.JniObject.fromRef(_currentValue(reference).object); + + static final _assignCurrentValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__assignCurrentValue") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void assignCurrentValue(java.lang.Object v) + /// + /// Helper method, usually equivalent to: + ///<code> + /// getParsingContext().setCurrentValue(v); + ///</code> + ///@param v Current value to assign for the current input context of this parser + ///@since 2.13 (added as replacement for older \#setCurrentValue + void assignCurrentValue(jni.JniObject v) => + _assignCurrentValue(reference, v.reference).check(); + + static final _getCurrentValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getCurrentValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Object getCurrentValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Alias for \#currentValue(), to be deprecated in later + /// Jackson 2.x versions (and removed from Jackson 3.0). + ///@return Location of the last processed input unit (byte or character) + jni.JniObject getCurrentValue() => + jni.JniObject.fromRef(_getCurrentValue(reference).object); + + static final _setCurrentValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__setCurrentValue") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public void setCurrentValue(java.lang.Object v) + /// + /// Alias for \#assignCurrentValue, to be deprecated in later + /// Jackson 2.x versions (and removed from Jackson 3.0). + ///@param v Current value to assign for the current input context of this parser + void setCurrentValue(jni.JniObject v) => + _setCurrentValue(reference, v.reference).check(); + + static final _releaseBuffered = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__releaseBuffered") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public int releaseBuffered(java.io.OutputStream out) + /// + /// Method that can be called to push back any content that + /// has been read but not consumed by the parser. This is usually + /// done after reading all content of interest using parser. + /// Content is released by writing it to given stream if possible; + /// if underlying input is byte-based it can released, if not (char-based) + /// it can not. + ///@param out OutputStream to which buffered, undecoded content is written to + ///@return -1 if the underlying content source is not byte based + /// (that is, input can not be sent to OutputStream; + /// otherwise number of bytes released (0 if there was nothing to release) + ///@throws IOException if write to stream threw exception + int releaseBuffered(jni.JniObject out) => + _releaseBuffered(reference, out.reference).integer; + + static final _releaseBuffered1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__releaseBuffered1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public int releaseBuffered(java.io.Writer w) + /// + /// Method that can be called to push back any content that + /// has been read but not consumed by the parser. + /// This is usually + /// done after reading all content of interest using parser. + /// Content is released by writing it to given writer if possible; + /// if underlying input is char-based it can released, if not (byte-based) + /// it can not. + ///@param w Writer to which buffered but unprocessed content is written to + ///@return -1 if the underlying content source is not char-based + /// (that is, input can not be sent to Writer; + /// otherwise number of chars released (0 if there was nothing to release) + ///@throws IOException if write using Writer threw exception + int releaseBuffered1(jni.JniObject w) => + _releaseBuffered1(reference, w.reference).integer; + + static final _enable = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__enable") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser enable(com.fasterxml.jackson.core.JsonParser.Feature f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for enabling specified parser feature + /// (check Feature for list of features) + ///@param f Feature to enable + ///@return This parser, to allow call chaining + JsonParser enable(JsonParser_Feature f) => + JsonParser.fromRef(_enable(reference, f.reference).object); + + static final _disable = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__disable") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser disable(com.fasterxml.jackson.core.JsonParser.Feature f) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for disabling specified feature + /// (check Feature for list of features) + ///@param f Feature to disable + ///@return This parser, to allow call chaining + JsonParser disable(JsonParser_Feature f) => + JsonParser.fromRef(_disable(reference, f.reference).object); + + static final _configure = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, ffi.Uint8)>>("JsonParser__configure") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser configure(com.fasterxml.jackson.core.JsonParser.Feature f, boolean state) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for enabling or disabling specified feature + /// (check Feature for list of features) + ///@param f Feature to enable or disable + ///@param state Whether to enable feature ({@code true}) or disable ({@code false}) + ///@return This parser, to allow call chaining + JsonParser configure(JsonParser_Feature f, bool state) => JsonParser.fromRef( + _configure(reference, f.reference, state ? 1 : 0).object); + + static final _isEnabled = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__isEnabled") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean isEnabled(com.fasterxml.jackson.core.JsonParser.Feature f) + /// + /// Method for checking whether specified Feature is enabled. + ///@param f Feature to check + ///@return {@code True} if feature is enabled; {@code false} otherwise + bool isEnabled(JsonParser_Feature f) => + _isEnabled(reference, f.reference).boolean; + + static final _isEnabled1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__isEnabled1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean isEnabled(com.fasterxml.jackson.core.StreamReadFeature f) + /// + /// Method for checking whether specified Feature is enabled. + ///@param f Feature to check + ///@return {@code True} if feature is enabled; {@code false} otherwise + ///@since 2.10 + bool isEnabled1(jni.JniObject f) => + _isEnabled1(reference, f.reference).boolean; + + static final _getFeatureMask = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getFeatureMask") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int getFeatureMask() + /// + /// Bulk access method for getting state of all standard Features. + ///@return Bit mask that defines current states of all standard Features. + ///@since 2.3 + int getFeatureMask() => _getFeatureMask(reference).integer; + + static final _setFeatureMask = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Int32)>>("JsonParser__setFeatureMask") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser setFeatureMask(int mask) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Bulk set method for (re)setting states of all standard Features + ///@param mask Bit mask that defines set of features to enable + ///@return This parser, to allow call chaining + ///@since 2.3 + ///@deprecated Since 2.7, use \#overrideStdFeatures(int, int) instead + JsonParser setFeatureMask(int mask) => + JsonParser.fromRef(_setFeatureMask(reference, mask).object); + + static final _overrideStdFeatures = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Int32, + ffi.Int32)>>("JsonParser__overrideStdFeatures") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int, int)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser overrideStdFeatures(int values, int mask) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Bulk set method for (re)setting states of features specified by <code>mask</code>. + /// Functionally equivalent to + ///<code> + /// int oldState = getFeatureMask(); + /// int newState = (oldState & ~mask) | (values & mask); + /// setFeatureMask(newState); + ///</code> + /// but preferred as this lets caller more efficiently specify actual changes made. + ///@param values Bit mask of set/clear state for features to change + ///@param mask Bit mask of features to change + ///@return This parser, to allow call chaining + ///@since 2.6 + JsonParser overrideStdFeatures(int values, int mask) => + JsonParser.fromRef(_overrideStdFeatures(reference, values, mask).object); + + static final _getFormatFeatures = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getFormatFeatures") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int getFormatFeatures() + /// + /// Bulk access method for getting state of all FormatFeatures, format-specific + /// on/off configuration settings. + ///@return Bit mask that defines current states of all standard FormatFeatures. + ///@since 2.6 + int getFormatFeatures() => _getFormatFeatures(reference).integer; + + static final _overrideFormatFeatures = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Int32, + ffi.Int32)>>("JsonParser__overrideFormatFeatures") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int, int)>(); + + /// from: public com.fasterxml.jackson.core.JsonParser overrideFormatFeatures(int values, int mask) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Bulk set method for (re)setting states of FormatFeatures, + /// by specifying values (set / clear) along with a mask, to determine + /// which features to change, if any. + /// + /// Default implementation will simply throw an exception to indicate that + /// the parser implementation does not support any FormatFeatures. + ///@param values Bit mask of set/clear state for features to change + ///@param mask Bit mask of features to change + ///@return This parser, to allow call chaining + ///@since 2.6 + JsonParser overrideFormatFeatures(int values, int mask) => JsonParser.fromRef( + _overrideFormatFeatures(reference, values, mask).object); + + static final _nextToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__nextToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonToken nextToken() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Main iteration method, which will advance stream enough + /// to determine type of the next token, if any. If none + /// remaining (stream has no content other than possible + /// white space before ending), null will be returned. + ///@return Next token from the stream, if any found, or null + /// to indicate end-of-input + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jsontoken_.JsonToken nextToken() => + jsontoken_.JsonToken.fromRef(_nextToken(reference).object); + + static final _nextValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__nextValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonToken nextValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Iteration method that will advance stream enough + /// to determine type of the next token that is a value type + /// (including JSON Array and Object start/end markers). + /// Or put another way, nextToken() will be called once, + /// and if JsonToken\#FIELD_NAME is returned, another + /// time to get the value for the field. + /// Method is most useful for iterating over value entries + /// of JSON objects; field name will still be available + /// by calling \#getCurrentName when parser points to + /// the value. + ///@return Next non-field-name token from the stream, if any found, + /// or null to indicate end-of-input (or, for non-blocking + /// parsers, JsonToken\#NOT_AVAILABLE if no tokens were + /// available yet) + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jsontoken_.JsonToken nextValue() => + jsontoken_.JsonToken.fromRef(_nextValue(reference).object); + + static final _nextFieldName = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__nextFieldName") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean nextFieldName(com.fasterxml.jackson.core.SerializableString str) + /// + /// Method that fetches next token (as if calling \#nextToken) and + /// verifies whether it is JsonToken\#FIELD_NAME with specified name + /// and returns result of that comparison. + /// It is functionally equivalent to: + ///<pre> + /// return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(getCurrentName()); + ///</pre> + /// but may be faster for parser to verify, and can therefore be used if caller + /// expects to get such a property name from input next. + ///@param str Property name to compare next token to (if next token is + /// <code>JsonToken.FIELD_NAME</code>) + ///@return {@code True} if parser advanced to {@code JsonToken.FIELD_NAME} with + /// specified name; {@code false} otherwise (different token or non-matching name) + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + bool nextFieldName(jni.JniObject str) => + _nextFieldName(reference, str.reference).boolean; + + static final _nextFieldName1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__nextFieldName1") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String nextFieldName() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that fetches next token (as if calling \#nextToken) and + /// verifies whether it is JsonToken\#FIELD_NAME; if it is, + /// returns same as \#getCurrentName(), otherwise null. + ///@return Name of the the {@code JsonToken.FIELD_NAME} parser advanced to, if any; + /// {@code null} if next token is of some other type + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.5 + jni.JniString nextFieldName1() => + jni.JniString.fromRef(_nextFieldName1(reference).object); + + static final _nextTextValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__nextTextValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String nextTextValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that fetches next token (as if calling \#nextToken) and + /// if it is JsonToken\#VALUE_STRING returns contained String value; + /// otherwise returns null. + /// It is functionally equivalent to: + ///<pre> + /// return (nextToken() == JsonToken.VALUE_STRING) ? getText() : null; + ///</pre> + /// but may be faster for parser to process, and can therefore be used if caller + /// expects to get a String value next from input. + ///@return Text value of the {@code JsonToken.VALUE_STRING} token parser advanced + /// to; or {@code null} if next token is of some other type + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jni.JniString nextTextValue() => + jni.JniString.fromRef(_nextTextValue(reference).object); + + static final _nextIntValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Int32)>>("JsonParser__nextIntValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public int nextIntValue(int defaultValue) + /// + /// Method that fetches next token (as if calling \#nextToken) and + /// if it is JsonToken\#VALUE_NUMBER_INT returns 32-bit int value; + /// otherwise returns specified default value + /// It is functionally equivalent to: + ///<pre> + /// return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getIntValue() : defaultValue; + ///</pre> + /// but may be faster for parser to process, and can therefore be used if caller + /// expects to get an int value next from input. + /// + /// NOTE: value checks are performed similar to \#getIntValue() + ///@param defaultValue Value to return if next token is NOT of type {@code JsonToken.VALUE_NUMBER_INT} + ///@return Integer ({@code int}) value of the {@code JsonToken.VALUE_NUMBER_INT} token parser advanced + /// to; or {@code defaultValue} if next token is of some other type + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@throws InputCoercionException if integer number does not fit in Java {@code int} + int nextIntValue(int defaultValue) => + _nextIntValue(reference, defaultValue).integer; + + static final _nextLongValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Int64)>>("JsonParser__nextLongValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public long nextLongValue(long defaultValue) + /// + /// Method that fetches next token (as if calling \#nextToken) and + /// if it is JsonToken\#VALUE_NUMBER_INT returns 64-bit long value; + /// otherwise returns specified default value + /// It is functionally equivalent to: + ///<pre> + /// return (nextToken() == JsonToken.VALUE_NUMBER_INT) ? getLongValue() : defaultValue; + ///</pre> + /// but may be faster for parser to process, and can therefore be used if caller + /// expects to get a long value next from input. + /// + /// NOTE: value checks are performed similar to \#getLongValue() + ///@param defaultValue Value to return if next token is NOT of type {@code JsonToken.VALUE_NUMBER_INT} + ///@return {@code long} value of the {@code JsonToken.VALUE_NUMBER_INT} token parser advanced + /// to; or {@code defaultValue} if next token is of some other type + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@throws InputCoercionException if integer number does not fit in Java {@code long} + int nextLongValue(int defaultValue) => + _nextLongValue(reference, defaultValue).long; + + static final _nextBooleanValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__nextBooleanValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Boolean nextBooleanValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that fetches next token (as if calling \#nextToken) and + /// if it is JsonToken\#VALUE_TRUE or JsonToken\#VALUE_FALSE + /// returns matching Boolean value; otherwise return null. + /// It is functionally equivalent to: + ///<pre> + /// JsonToken t = nextToken(); + /// if (t == JsonToken.VALUE_TRUE) return Boolean.TRUE; + /// if (t == JsonToken.VALUE_FALSE) return Boolean.FALSE; + /// return null; + ///</pre> + /// but may be faster for parser to process, and can therefore be used if caller + /// expects to get a Boolean value next from input. + ///@return {@code Boolean} value of the {@code JsonToken.VALUE_TRUE} or {@code JsonToken.VALUE_FALSE} + /// token parser advanced to; or {@code null} if next token is of some other type + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jni.JniObject nextBooleanValue() => + jni.JniObject.fromRef(_nextBooleanValue(reference).object); + + static final _skipChildren = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__skipChildren") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonParser skipChildren() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that will skip all child tokens of an array or + /// object token that the parser currently points to, + /// iff stream points to + /// JsonToken\#START_OBJECT or JsonToken\#START_ARRAY. + /// If not, it will do nothing. + /// After skipping, stream will point to __matching__ + /// JsonToken\#END_OBJECT or JsonToken\#END_ARRAY + /// (possibly skipping nested pairs of START/END OBJECT/ARRAY tokens + /// as well as value tokens). + /// The idea is that after calling this method, application + /// will call \#nextToken to point to the next + /// available token, if any. + ///@return This parser, to allow call chaining + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + JsonParser skipChildren() => + JsonParser.fromRef(_skipChildren(reference).object); + + static final _finishToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__finishToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public void finishToken() + /// + /// Method that may be used to force full handling of the current token + /// so that even if lazy processing is enabled, the whole contents are + /// read for possible retrieval. This is usually used to ensure that + /// the token end location is available, as well as token contents + /// (similar to what calling, say \#getTextCharacters(), would + /// achieve). + /// + /// Note that for many dataformat implementations this method + /// will not do anything; this is the default implementation unless + /// overridden by sub-classes. + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.8 + void finishToken() => _finishToken(reference).check(); + + static final _currentToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__currentToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public com.fasterxml.jackson.core.JsonToken currentToken() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Accessor to find which token parser currently points to, if any; + /// null will be returned if none. + /// If return value is non-null, data associated with the token + /// is available via other accessor methods. + ///@return Type of the token this parser currently points to, + /// if any: null before any tokens have been read, and + /// after end-of-input has been encountered, as well as + /// if the current token has been explicitly cleared. + ///@since 2.8 + jsontoken_.JsonToken currentToken() => + jsontoken_.JsonToken.fromRef(_currentToken(reference).object); + + static final _currentTokenId = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__currentTokenId") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int currentTokenId() + /// + /// Method similar to \#getCurrentToken() but that returns an + /// <code>int</code> instead of JsonToken (enum value). + /// + /// Use of int directly is typically more efficient on switch statements, + /// so this method may be useful when building low-overhead codecs. + /// Note, however, that effect may not be big enough to matter: make sure + /// to profile performance before deciding to use this method. + ///@since 2.8 + ///@return {@code int} matching one of constants from JsonTokenId. + int currentTokenId() => _currentTokenId(reference).integer; + + static final _getCurrentToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getCurrentToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonToken getCurrentToken() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Alias for \#currentToken(), may be deprecated sometime after + /// Jackson 2.13 (will be removed from 3.0). + ///@return Type of the token this parser currently points to, + /// if any: null before any tokens have been read, and + jsontoken_.JsonToken getCurrentToken() => + jsontoken_.JsonToken.fromRef(_getCurrentToken(reference).object); + + static final _getCurrentTokenId = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getCurrentTokenId") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract int getCurrentTokenId() + /// + /// Deprecated alias for \#currentTokenId(). + ///@return {@code int} matching one of constants from JsonTokenId. + ///@deprecated Since 2.12 use \#currentTokenId instead + int getCurrentTokenId() => _getCurrentTokenId(reference).integer; + + static final _hasCurrentToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__hasCurrentToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract boolean hasCurrentToken() + /// + /// Method for checking whether parser currently points to + /// a token (and data for that token is available). + /// Equivalent to check for <code>parser.getCurrentToken() != null</code>. + ///@return True if the parser just returned a valid + /// token via \#nextToken; false otherwise (parser + /// was just constructed, encountered end-of-input + /// and returned null from \#nextToken, or the token + /// has been consumed) + bool hasCurrentToken() => _hasCurrentToken(reference).boolean; + + static final _hasTokenId = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Int32)>>("JsonParser__hasTokenId") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public abstract boolean hasTokenId(int id) + /// + /// Method that is functionally equivalent to: + ///<code> + /// return currentTokenId() == id + ///</code> + /// but may be more efficiently implemented. + /// + /// Note that no traversal or conversion is performed; so in some + /// cases calling method like \#isExpectedStartArrayToken() + /// is necessary instead. + ///@param id Token id to match (from (@link JsonTokenId}) + ///@return {@code True} if the parser current points to specified token + ///@since 2.5 + bool hasTokenId(int id) => _hasTokenId(reference, id).boolean; + + static final _hasToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__hasToken") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract boolean hasToken(com.fasterxml.jackson.core.JsonToken t) + /// + /// Method that is functionally equivalent to: + ///<code> + /// return currentToken() == t + ///</code> + /// but may be more efficiently implemented. + /// + /// Note that no traversal or conversion is performed; so in some + /// cases calling method like \#isExpectedStartArrayToken() + /// is necessary instead. + ///@param t Token to match + ///@return {@code True} if the parser current points to specified token + ///@since 2.6 + bool hasToken(jsontoken_.JsonToken t) => + _hasToken(reference, t.reference).boolean; + + static final _isExpectedStartArrayToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonParser__isExpectedStartArrayToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean isExpectedStartArrayToken() + /// + /// Specialized accessor that can be used to verify that the current + /// token indicates start array (usually meaning that current token + /// is JsonToken\#START_ARRAY) when start array is expected. + /// For some specialized parsers this can return true for other cases + /// as well; this is usually done to emulate arrays in cases underlying + /// format is ambiguous (XML, for example, has no format-level difference + /// between Objects and Arrays; it just has elements). + /// + /// Default implementation is equivalent to: + ///<pre> + /// currentToken() == JsonToken.START_ARRAY + ///</pre> + /// but may be overridden by custom parser implementations. + ///@return True if the current token can be considered as a + /// start-array marker (such JsonToken\#START_ARRAY); + /// {@code false} if not + bool isExpectedStartArrayToken() => + _isExpectedStartArrayToken(reference).boolean; + + static final _isExpectedStartObjectToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonParser__isExpectedStartObjectToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean isExpectedStartObjectToken() + /// + /// Similar to \#isExpectedStartArrayToken(), but checks whether stream + /// currently points to JsonToken\#START_OBJECT. + ///@return True if the current token can be considered as a + /// start-array marker (such JsonToken\#START_OBJECT); + /// {@code false} if not + ///@since 2.5 + bool isExpectedStartObjectToken() => + _isExpectedStartObjectToken(reference).boolean; + + static final _isExpectedNumberIntToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonParser__isExpectedNumberIntToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean isExpectedNumberIntToken() + /// + /// Similar to \#isExpectedStartArrayToken(), but checks whether stream + /// currently points to JsonToken\#VALUE_NUMBER_INT. + /// + /// The initial use case is for XML backend to efficiently (attempt to) coerce + /// textual content into numbers. + ///@return True if the current token can be considered as a + /// start-array marker (such JsonToken\#VALUE_NUMBER_INT); + /// {@code false} if not + ///@since 2.12 + bool isExpectedNumberIntToken() => + _isExpectedNumberIntToken(reference).boolean; + + static final _isNaN = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__isNaN") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean isNaN() + /// + /// Access for checking whether current token is a numeric value token, but + /// one that is of "not-a-number" (NaN) variety (including both "NaN" AND + /// positive/negative infinity!): not supported by all formats, + /// but often supported for JsonToken\#VALUE_NUMBER_FLOAT. + /// NOTE: roughly equivalent to calling <code>!Double.isFinite()</code> + /// on value you would get from calling \#getDoubleValue(). + ///@return {@code True} if the current token is of type JsonToken\#VALUE_NUMBER_FLOAT + /// but represents a "Not a Number"; {@code false} for other tokens and regular + /// floating-point numbers + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.9 + bool isNaN() => _isNaN(reference).boolean; + + static final _clearCurrentToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__clearCurrentToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract void clearCurrentToken() + /// + /// Method called to "consume" the current token by effectively + /// removing it so that \#hasCurrentToken returns false, and + /// \#getCurrentToken null). + /// Cleared token value can still be accessed by calling + /// \#getLastClearedToken (if absolutely needed), but + /// usually isn't. + /// + /// Method was added to be used by the optional data binder, since + /// it has to be able to consume last token used for binding (so that + /// it will not be used again). + void clearCurrentToken() => _clearCurrentToken(reference).check(); + + static final _getLastClearedToken = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getLastClearedToken") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonToken getLastClearedToken() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that can be called to get the last token that was + /// cleared using \#clearCurrentToken. This is not necessarily + /// the latest token read. + /// Will return null if no tokens have been cleared, + /// or if parser has been closed. + ///@return Last cleared token, if any; {@code null} otherwise + jsontoken_.JsonToken getLastClearedToken() => + jsontoken_.JsonToken.fromRef(_getLastClearedToken(reference).object); + + static final _overrideCurrentName = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__overrideCurrentName") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract void overrideCurrentName(java.lang.String name) + /// + /// Method that can be used to change what is considered to be + /// the current (field) name. + /// May be needed to support non-JSON data formats or unusual binding + /// conventions; not needed for typical processing. + /// + /// Note that use of this method should only be done as sort of last + /// resort, as it is a work-around for regular operation. + ///@param name Name to use as the current name; may be null. + void overrideCurrentName(jni.JniString name) => + _overrideCurrentName(reference, name.reference).check(); + + static final _getCurrentName = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getCurrentName") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract java.lang.String getCurrentName() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Alias of \#currentName(). + ///@return Name of the current field in the parsing context + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jni.JniString getCurrentName() => + jni.JniString.fromRef(_getCurrentName(reference).object); + + static final _currentName = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__currentName") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String currentName() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that can be called to get the name associated with + /// the current token: for JsonToken\#FIELD_NAMEs it will + /// be the same as what \#getText returns; + /// for field values it will be preceding field name; + /// and for others (array values, root-level values) null. + ///@return Name of the current field in the parsing context + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.10 + jni.JniString currentName() => + jni.JniString.fromRef(_currentName(reference).object); + + static final _getText = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getText") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract java.lang.String getText() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for accessing textual representation of the current token; + /// if no current token (before first call to \#nextToken, or + /// after encountering end-of-input), returns null. + /// Method can be called for any token type. + ///@return Textual value associated with the current token (one returned + /// by \#nextToken() or other iteration methods) + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jni.JniString getText() => jni.JniString.fromRef(_getText(reference).object); + + static final _getText1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__getText1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public int getText(java.io.Writer writer) + /// + /// Method to read the textual representation of the current token in chunks and + /// pass it to the given Writer. + /// Conceptually same as calling: + ///<pre> + /// writer.write(parser.getText()); + ///</pre> + /// but should typically be more efficient as longer content does need to + /// be combined into a single <code>String</code> to return, and write + /// can occur directly from intermediate buffers Jackson uses. + ///@param writer Writer to write textual content to + ///@return The number of characters written to the Writer + ///@throws IOException for low-level read issues or writes using passed + /// {@code writer}, or + /// JsonParseException for decoding problems + ///@since 2.8 + int getText1(jni.JniObject writer) => + _getText1(reference, writer.reference).integer; + + static final _getTextCharacters = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getTextCharacters") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract char[] getTextCharacters() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method similar to \#getText, but that will return + /// underlying (unmodifiable) character array that contains + /// textual value, instead of constructing a String object + /// to contain this information. + /// Note, however, that: + ///<ul> + /// <li>Textual contents are not guaranteed to start at + /// index 0 (rather, call \#getTextOffset) to + /// know the actual offset + /// </li> + /// <li>Length of textual contents may be less than the + /// length of returned buffer: call \#getTextLength + /// for actual length of returned content. + /// </li> + /// </ul> + /// + /// Note that caller __MUST NOT__ modify the returned + /// character array in any way -- doing so may corrupt + /// current parser state and render parser instance useless. + /// + /// The only reason to call this method (over \#getText) + /// is to avoid construction of a String object (which + /// will make a copy of contents). + ///@return Buffer that contains the current textual value (but not necessarily + /// at offset 0, and not necessarily until the end of buffer) + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jni.JniObject getTextCharacters() => + jni.JniObject.fromRef(_getTextCharacters(reference).object); + + static final _getTextLength = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getTextLength") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract int getTextLength() + /// + /// Accessor used with \#getTextCharacters, to know length + /// of String stored in returned buffer. + ///@return Number of characters within buffer returned + /// by \#getTextCharacters that are part of + /// textual content of the current token. + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getTextLength() => _getTextLength(reference).integer; + + static final _getTextOffset = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getTextOffset") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract int getTextOffset() + /// + /// Accessor used with \#getTextCharacters, to know offset + /// of the first text content character within buffer. + ///@return Offset of the first character within buffer returned + /// by \#getTextCharacters that is part of + /// textual content of the current token. + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getTextOffset() => _getTextOffset(reference).integer; + + static final _hasTextCharacters = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__hasTextCharacters") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract boolean hasTextCharacters() + /// + /// Method that can be used to determine whether calling of + /// \#getTextCharacters would be the most efficient + /// way to access textual content for the event parser currently + /// points to. + /// + /// Default implementation simply returns false since only actual + /// implementation class has knowledge of its internal buffering + /// state. + /// Implementations are strongly encouraged to properly override + /// this method, to allow efficient copying of content by other + /// code. + ///@return True if parser currently has character array that can + /// be efficiently returned via \#getTextCharacters; false + /// means that it may or may not exist + bool hasTextCharacters() => _hasTextCharacters(reference).boolean; + + static final _getNumberValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getNumberValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract java.lang.Number getNumberValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Generic number value accessor method that will work for + /// all kinds of numeric values. It will return the optimal + /// (simplest/smallest possible) wrapper object that can + /// express the numeric value just parsed. + ///@return Numeric value of the current token in its most optimal + /// representation + ///@throws IOException Problem with access: JsonParseException if + /// the current token is not numeric, or if decoding of the value fails + /// (invalid format for numbers); plain IOException if underlying + /// content read fails (possible if values are extracted lazily) + jni.JniObject getNumberValue() => + jni.JniObject.fromRef(_getNumberValue(reference).object); + + static final _getNumberValueExact = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getNumberValueExact") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Number getNumberValueExact() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method similar to \#getNumberValue with the difference that + /// for floating-point numbers value returned may be BigDecimal + /// if the underlying format does not store floating-point numbers using + /// native representation: for example, textual formats represent numbers + /// as Strings (which are 10-based), and conversion to java.lang.Double + /// is potentially lossy operation. + /// + /// Default implementation simply returns \#getNumberValue() + ///@return Numeric value of the current token using most accurate representation + ///@throws IOException Problem with access: JsonParseException if + /// the current token is not numeric, or if decoding of the value fails + /// (invalid format for numbers); plain IOException if underlying + /// content read fails (possible if values are extracted lazily) + ///@since 2.12 + jni.JniObject getNumberValueExact() => + jni.JniObject.fromRef(_getNumberValueExact(reference).object); + + static final _getNumberType = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getNumberType") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract com.fasterxml.jackson.core.JsonParser.NumberType getNumberType() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// If current token is of type + /// JsonToken\#VALUE_NUMBER_INT or + /// JsonToken\#VALUE_NUMBER_FLOAT, returns + /// one of NumberType constants; otherwise returns null. + ///@return Type of current number, if parser points to numeric token; {@code null} otherwise + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + JsonParser_NumberType getNumberType() => + JsonParser_NumberType.fromRef(_getNumberType(reference).object); + + static final _getByteValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getByteValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public byte getByteValue() + /// + /// Numeric accessor that can be called when the current + /// token is of type JsonToken\#VALUE_NUMBER_INT and + /// it can be expressed as a value of Java byte primitive type. + /// Note that in addition to "natural" input range of {@code [-128, 127]}, + /// this also allows "unsigned 8-bit byte" values {@code [128, 255]}: + /// but for this range value will be translated by truncation, leading + /// to sign change. + /// + /// It can also be called for JsonToken\#VALUE_NUMBER_FLOAT; + /// if so, it is equivalent to calling \#getDoubleValue + /// and then casting; except for possible overflow/underflow + /// exception. + /// + /// Note: if the resulting integer value falls outside range of + /// {@code [-128, 255]}, + /// a InputCoercionException + /// will be thrown to indicate numeric overflow/underflow. + ///@return Current number value as {@code byte} (if numeric token within + /// range of {@code [-128, 255]}); otherwise exception thrown + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getByteValue() => _getByteValue(reference).byte; + + static final _getShortValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getShortValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public short getShortValue() + /// + /// Numeric accessor that can be called when the current + /// token is of type JsonToken\#VALUE_NUMBER_INT and + /// it can be expressed as a value of Java short primitive type. + /// It can also be called for JsonToken\#VALUE_NUMBER_FLOAT; + /// if so, it is equivalent to calling \#getDoubleValue + /// and then casting; except for possible overflow/underflow + /// exception. + /// + /// Note: if the resulting integer value falls outside range of + /// Java short, a InputCoercionException + /// will be thrown to indicate numeric overflow/underflow. + ///@return Current number value as {@code short} (if numeric token within + /// Java 16-bit signed {@code short} range); otherwise exception thrown + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getShortValue() => _getShortValue(reference).short; + + static final _getIntValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getIntValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract int getIntValue() + /// + /// Numeric accessor that can be called when the current + /// token is of type JsonToken\#VALUE_NUMBER_INT and + /// it can be expressed as a value of Java int primitive type. + /// It can also be called for JsonToken\#VALUE_NUMBER_FLOAT; + /// if so, it is equivalent to calling \#getDoubleValue + /// and then casting; except for possible overflow/underflow + /// exception. + /// + /// Note: if the resulting integer value falls outside range of + /// Java {@code int}, a InputCoercionException + /// may be thrown to indicate numeric overflow/underflow. + ///@return Current number value as {@code int} (if numeric token within + /// Java 32-bit signed {@code int} range); otherwise exception thrown + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getIntValue() => _getIntValue(reference).integer; + + static final _getLongValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getLongValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract long getLongValue() + /// + /// Numeric accessor that can be called when the current + /// token is of type JsonToken\#VALUE_NUMBER_INT and + /// it can be expressed as a Java long primitive type. + /// It can also be called for JsonToken\#VALUE_NUMBER_FLOAT; + /// if so, it is equivalent to calling \#getDoubleValue + /// and then casting to int; except for possible overflow/underflow + /// exception. + /// + /// Note: if the token is an integer, but its value falls + /// outside of range of Java long, a InputCoercionException + /// may be thrown to indicate numeric overflow/underflow. + ///@return Current number value as {@code long} (if numeric token within + /// Java 32-bit signed {@code long} range); otherwise exception thrown + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getLongValue() => _getLongValue(reference).long; + + static final _getBigIntegerValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getBigIntegerValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract java.math.BigInteger getBigIntegerValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Numeric accessor that can be called when the current + /// token is of type JsonToken\#VALUE_NUMBER_INT and + /// it can not be used as a Java long primitive type due to its + /// magnitude. + /// It can also be called for JsonToken\#VALUE_NUMBER_FLOAT; + /// if so, it is equivalent to calling \#getDecimalValue + /// and then constructing a BigInteger from that value. + ///@return Current number value as BigInteger (if numeric token); + /// otherwise exception thrown + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jni.JniObject getBigIntegerValue() => + jni.JniObject.fromRef(_getBigIntegerValue(reference).object); + + static final _getFloatValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getFloatValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract float getFloatValue() + /// + /// Numeric accessor that can be called when the current + /// token is of type JsonToken\#VALUE_NUMBER_FLOAT and + /// it can be expressed as a Java float primitive type. + /// It can also be called for JsonToken\#VALUE_NUMBER_INT; + /// if so, it is equivalent to calling \#getLongValue + /// and then casting; except for possible overflow/underflow + /// exception. + /// + /// Note: if the value falls + /// outside of range of Java float, a InputCoercionException + /// will be thrown to indicate numeric overflow/underflow. + ///@return Current number value as {@code float} (if numeric token within + /// Java {@code float} range); otherwise exception thrown + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + double getFloatValue() => _getFloatValue(reference).float; + + static final _getDoubleValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getDoubleValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract double getDoubleValue() + /// + /// Numeric accessor that can be called when the current + /// token is of type JsonToken\#VALUE_NUMBER_FLOAT and + /// it can be expressed as a Java double primitive type. + /// It can also be called for JsonToken\#VALUE_NUMBER_INT; + /// if so, it is equivalent to calling \#getLongValue + /// and then casting; except for possible overflow/underflow + /// exception. + /// + /// Note: if the value falls + /// outside of range of Java double, a InputCoercionException + /// will be thrown to indicate numeric overflow/underflow. + ///@return Current number value as {@code double} (if numeric token within + /// Java {@code double} range); otherwise exception thrown + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + double getDoubleValue() => _getDoubleValue(reference).doubleFloat; + + static final _getDecimalValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getDecimalValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract java.math.BigDecimal getDecimalValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Numeric accessor that can be called when the current + /// token is of type JsonToken\#VALUE_NUMBER_FLOAT or + /// JsonToken\#VALUE_NUMBER_INT. No under/overflow exceptions + /// are ever thrown. + ///@return Current number value as BigDecimal (if numeric token); + /// otherwise exception thrown + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jni.JniObject getDecimalValue() => + jni.JniObject.fromRef(_getDecimalValue(reference).object); + + static final _getBooleanValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getBooleanValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean getBooleanValue() + /// + /// Convenience accessor that can be called when the current + /// token is JsonToken\#VALUE_TRUE or + /// JsonToken\#VALUE_FALSE, to return matching {@code boolean} + /// value. + /// If the current token is of some other type, JsonParseException + /// will be thrown + ///@return {@code True} if current token is {@code JsonToken.VALUE_TRUE}, + /// {@code false} if current token is {@code JsonToken.VALUE_FALSE}; + /// otherwise throws JsonParseException + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + bool getBooleanValue() => _getBooleanValue(reference).boolean; + + static final _getEmbeddedObject = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getEmbeddedObject") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Object getEmbeddedObject() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Accessor that can be called if (and only if) the current token + /// is JsonToken\#VALUE_EMBEDDED_OBJECT. For other token types, + /// null is returned. + /// + /// Note: only some specialized parser implementations support + /// embedding of objects (usually ones that are facades on top + /// of non-streaming sources, such as object trees). One exception + /// is access to binary content (whether via base64 encoding or not) + /// which typically is accessible using this method, as well as + /// \#getBinaryValue(). + ///@return Embedded value (usually of "native" type supported by format) + /// for the current token, if any; {@code null otherwise} + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jni.JniObject getEmbeddedObject() => + jni.JniObject.fromRef(_getEmbeddedObject(reference).object); + + static final _getBinaryValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__getBinaryValue") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract byte[] getBinaryValue(com.fasterxml.jackson.core.Base64Variant bv) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that can be used to read (and consume -- results + /// may not be accessible using other methods after the call) + /// base64-encoded binary data + /// included in the current textual JSON value. + /// It works similar to getting String value via \#getText + /// and decoding result (except for decoding part), + /// but should be significantly more performant. + /// + /// Note that non-decoded textual contents of the current token + /// are not guaranteed to be accessible after this method + /// is called. Current implementation, for example, clears up + /// textual content during decoding. + /// Decoded binary content, however, will be retained until + /// parser is advanced to the next event. + ///@param bv Expected variant of base64 encoded + /// content (see Base64Variants for definitions + /// of "standard" variants). + ///@return Decoded binary data + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jni.JniObject getBinaryValue(jni.JniObject bv) => + jni.JniObject.fromRef(_getBinaryValue(reference, bv.reference).object); + + static final _getBinaryValue1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getBinaryValue1") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public byte[] getBinaryValue() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Convenience alternative to \#getBinaryValue(Base64Variant) + /// that defaults to using + /// Base64Variants\#getDefaultVariant as the default encoding. + ///@return Decoded binary data + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + jni.JniObject getBinaryValue1() => + jni.JniObject.fromRef(_getBinaryValue1(reference).object); + + static final _readBinaryValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__readBinaryValue") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public int readBinaryValue(java.io.OutputStream out) + /// + /// Method that can be used as an alternative to \#getBigIntegerValue(), + /// especially when value can be large. The main difference (beyond method + /// of returning content using OutputStream instead of as byte array) + /// is that content will NOT remain accessible after method returns: any content + /// processed will be consumed and is not buffered in any way. If caller needs + /// buffering, it has to implement it. + ///@param out Output stream to use for passing decoded binary data + ///@return Number of bytes that were decoded and written via OutputStream + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.1 + int readBinaryValue(jni.JniObject out) => + _readBinaryValue(reference, out.reference).integer; + + static final _readBinaryValue1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__readBinaryValue1") + .asFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>(); + + /// from: public int readBinaryValue(com.fasterxml.jackson.core.Base64Variant bv, java.io.OutputStream out) + /// + /// Similar to \#readBinaryValue(OutputStream) but allows explicitly + /// specifying base64 variant to use. + ///@param bv base64 variant to use + ///@param out Output stream to use for passing decoded binary data + ///@return Number of bytes that were decoded and written via OutputStream + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.1 + int readBinaryValue1(jni.JniObject bv, jni.JniObject out) => + _readBinaryValue1(reference, bv.reference, out.reference).integer; + + static final _getValueAsInt = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsInt") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int getValueAsInt() + /// + /// Method that will try to convert value of current token to a + /// Java {@code int} value. + /// Numbers are coerced using default Java rules; booleans convert to 0 (false) + /// and 1 (true), and Strings are parsed using default Java language integer + /// parsing rules. + /// + /// If representation can not be converted to an int (including structured type + /// markers like start/end Object/Array) + /// default value of __0__ will be returned; no exceptions are thrown. + ///@return {@code int} value current token is converted to, if possible; exception thrown + /// otherwise + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getValueAsInt() => _getValueAsInt(reference).integer; + + static final _getValueAsInt1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Int32)>>("JsonParser__getValueAsInt1") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public int getValueAsInt(int def) + /// + /// Method that will try to convert value of current token to a + /// __int__. + /// Numbers are coerced using default Java rules; booleans convert to 0 (false) + /// and 1 (true), and Strings are parsed using default Java language integer + /// parsing rules. + /// + /// If representation can not be converted to an int (including structured type + /// markers like start/end Object/Array) + /// specified __def__ will be returned; no exceptions are thrown. + ///@param def Default value to return if conversion to {@code int} is not possible + ///@return {@code int} value current token is converted to, if possible; {@code def} otherwise + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getValueAsInt1(int def) => _getValueAsInt1(reference, def).integer; + + static final _getValueAsLong = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsLong") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public long getValueAsLong() + /// + /// Method that will try to convert value of current token to a + /// __long__. + /// Numbers are coerced using default Java rules; booleans convert to 0 (false) + /// and 1 (true), and Strings are parsed using default Java language integer + /// parsing rules. + /// + /// If representation can not be converted to a long (including structured type + /// markers like start/end Object/Array) + /// default value of __0L__ will be returned; no exceptions are thrown. + ///@return {@code long} value current token is converted to, if possible; exception thrown + /// otherwise + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getValueAsLong() => _getValueAsLong(reference).long; + + static final _getValueAsLong1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Int64)>>("JsonParser__getValueAsLong1") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public long getValueAsLong(long def) + /// + /// Method that will try to convert value of current token to a + /// __long__. + /// Numbers are coerced using default Java rules; booleans convert to 0 (false) + /// and 1 (true), and Strings are parsed using default Java language integer + /// parsing rules. + /// + /// If representation can not be converted to a long (including structured type + /// markers like start/end Object/Array) + /// specified __def__ will be returned; no exceptions are thrown. + ///@param def Default value to return if conversion to {@code long} is not possible + ///@return {@code long} value current token is converted to, if possible; {@code def} otherwise + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + int getValueAsLong1(int def) => _getValueAsLong1(reference, def).long; + + static final _getValueAsDouble = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsDouble") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public double getValueAsDouble() + /// + /// Method that will try to convert value of current token to a Java + /// __double__. + /// Numbers are coerced using default Java rules; booleans convert to 0.0 (false) + /// and 1.0 (true), and Strings are parsed using default Java language floating + /// point parsing rules. + /// + /// If representation can not be converted to a double (including structured types + /// like Objects and Arrays), + /// default value of __0.0__ will be returned; no exceptions are thrown. + ///@return {@code double} value current token is converted to, if possible; exception thrown + /// otherwise + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + double getValueAsDouble() => _getValueAsDouble(reference).doubleFloat; + + static final _getValueAsDouble1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Double)>>("JsonParser__getValueAsDouble1") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, double)>(); + + /// from: public double getValueAsDouble(double def) + /// + /// Method that will try to convert value of current token to a + /// Java __double__. + /// Numbers are coerced using default Java rules; booleans convert to 0.0 (false) + /// and 1.0 (true), and Strings are parsed using default Java language floating + /// point parsing rules. + /// + /// If representation can not be converted to a double (including structured types + /// like Objects and Arrays), + /// specified __def__ will be returned; no exceptions are thrown. + ///@param def Default value to return if conversion to {@code double} is not possible + ///@return {@code double} value current token is converted to, if possible; {@code def} otherwise + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + double getValueAsDouble1(double def) => + _getValueAsDouble1(reference, def).doubleFloat; + + static final _getValueAsBoolean = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsBoolean") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean getValueAsBoolean() + /// + /// Method that will try to convert value of current token to a + /// __boolean__. + /// JSON booleans map naturally; integer numbers other than 0 map to true, and + /// 0 maps to false + /// and Strings 'true' and 'false' map to corresponding values. + /// + /// If representation can not be converted to a boolean value (including structured types + /// like Objects and Arrays), + /// default value of __false__ will be returned; no exceptions are thrown. + ///@return {@code boolean} value current token is converted to, if possible; exception thrown + /// otherwise + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + bool getValueAsBoolean() => _getValueAsBoolean(reference).boolean; + + static final _getValueAsBoolean1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Uint8)>>("JsonParser__getValueAsBoolean1") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public boolean getValueAsBoolean(boolean def) + /// + /// Method that will try to convert value of current token to a + /// __boolean__. + /// JSON booleans map naturally; integer numbers other than 0 map to true, and + /// 0 maps to false + /// and Strings 'true' and 'false' map to corresponding values. + /// + /// If representation can not be converted to a boolean value (including structured types + /// like Objects and Arrays), + /// specified __def__ will be returned; no exceptions are thrown. + ///@param def Default value to return if conversion to {@code boolean} is not possible + ///@return {@code boolean} value current token is converted to, if possible; {@code def} otherwise + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + bool getValueAsBoolean1(bool def) => + _getValueAsBoolean1(reference, def ? 1 : 0).boolean; + + static final _getValueAsString = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsString") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.String getValueAsString() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that will try to convert value of current token to a + /// java.lang.String. + /// JSON Strings map naturally; scalar values get converted to + /// their textual representation. + /// If representation can not be converted to a String value (including structured types + /// like Objects and Arrays and {@code null} token), default value of + /// __null__ will be returned; no exceptions are thrown. + ///@return String value current token is converted to, if possible; {@code null} otherwise + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.1 + jni.JniString getValueAsString() => + jni.JniString.fromRef(_getValueAsString(reference).object); + + static final _getValueAsString1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__getValueAsString1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public abstract java.lang.String getValueAsString(java.lang.String def) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that will try to convert value of current token to a + /// java.lang.String. + /// JSON Strings map naturally; scalar values get converted to + /// their textual representation. + /// If representation can not be converted to a String value (including structured types + /// like Objects and Arrays and {@code null} token), specified default value + /// will be returned; no exceptions are thrown. + ///@param def Default value to return if conversion to {@code String} is not possible + ///@return String value current token is converted to, if possible; {@code def} otherwise + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.1 + jni.JniString getValueAsString1(jni.JniString def) => jni.JniString.fromRef( + _getValueAsString1(reference, def.reference).object); + + static final _canReadObjectId = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__canReadObjectId") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean canReadObjectId() + /// + /// Introspection method that may be called to see if the underlying + /// data format supports some kind of Object Ids natively (many do not; + /// for example, JSON doesn't). + /// + /// Default implementation returns true; overridden by data formats + /// that do support native Object Ids. Caller is expected to either + /// use a non-native notation (explicit property or such), or fail, + /// in case it can not use native object ids. + ///@return {@code True} if the format being read supports native Object Ids; + /// {@code false} if not + ///@since 2.3 + bool canReadObjectId() => _canReadObjectId(reference).boolean; + + static final _canReadTypeId = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__canReadTypeId") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean canReadTypeId() + /// + /// Introspection method that may be called to see if the underlying + /// data format supports some kind of Type Ids natively (many do not; + /// for example, JSON doesn't). + /// + /// Default implementation returns true; overridden by data formats + /// that do support native Type Ids. Caller is expected to either + /// use a non-native notation (explicit property or such), or fail, + /// in case it can not use native type ids. + ///@return {@code True} if the format being read supports native Type Ids; + /// {@code false} if not + ///@since 2.3 + bool canReadTypeId() => _canReadTypeId(reference).boolean; + + static final _getObjectId = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getObjectId") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Object getObjectId() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that can be called to check whether current token + /// (one that was just read) has an associated Object id, and if + /// so, return it. + /// Note that while typically caller should check with \#canReadObjectId + /// first, it is not illegal to call this method even if that method returns + /// true; but if so, it will return null. This may be used to simplify calling + /// code. + /// + /// Default implementation will simply return null. + ///@return Native Object id associated with the current token, if any; {@code null} if none + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.3 + jni.JniObject getObjectId() => + jni.JniObject.fromRef(_getObjectId(reference).object); + + static final _getTypeId = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser__getTypeId") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public java.lang.Object getTypeId() + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method that can be called to check whether current token + /// (one that was just read) has an associated type id, and if + /// so, return it. + /// Note that while typically caller should check with \#canReadTypeId + /// first, it is not illegal to call this method even if that method returns + /// true; but if so, it will return null. This may be used to simplify calling + /// code. + /// + /// Default implementation will simply return null. + ///@return Native Type Id associated with the current token, if any; {@code null} if none + ///@throws IOException for low-level read issues, or + /// JsonParseException for decoding problems + ///@since 2.3 + jni.JniObject getTypeId() => + jni.JniObject.fromRef(_getTypeId(reference).object); + + static final _readValuesAs = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__readValuesAs") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public java.util.Iterator<T> readValuesAs(java.lang.Class<T> valueType) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for reading sequence of Objects from parser stream, + /// all with same specified value type. + ///@param <T> Nominal type parameter for value type + ///@param valueType Java type to read content as (passed to ObjectCodec that + /// deserializes content) + ///@return Iterator for reading multiple Java values from content + ///@throws IOException if there is either an underlying I/O problem or decoding + /// issue at format layer + jni.JniObject readValuesAs(jni.JniObject valueType) => jni.JniObject.fromRef( + _readValuesAs(reference, valueType.reference).object); + + static final _readValuesAs1 = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Pointer<ffi.Void>)>>("JsonParser__readValuesAs1") + .asFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>(); + + /// from: public java.util.Iterator<T> readValuesAs(com.fasterxml.jackson.core.type.TypeReference<T> valueTypeRef) + /// The returned object must be deleted after use, by calling the `delete` method. + /// + /// Method for reading sequence of Objects from parser stream, + /// all with same specified value type. + ///@param <T> Nominal type parameter for value type + ///@param valueTypeRef Java type to read content as (passed to ObjectCodec that + /// deserializes content) + ///@return Iterator for reading multiple Java values from content + ///@throws IOException if there is either an underlying I/O problem or decoding + /// issue at format layer + jni.JniObject readValuesAs1(jni.JniObject valueTypeRef) => + jni.JniObject.fromRef( + _readValuesAs1(reference, valueTypeRef.reference).object); +} + +/// from: com.fasterxml.jackson.core.JsonParser$Feature +/// +/// Enumeration that defines all on/off features for parsers. +class JsonParser_Feature extends jni.JniObject { + JsonParser_Feature.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); + + static final _values = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonParser_Feature__values") + .asFunction<jni.JniResult Function()>(); + + /// from: static public com.fasterxml.jackson.core.JsonParser.Feature[] values() + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JniObject values() => jni.JniObject.fromRef(_values().object); + + static final _valueOf = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser_Feature__valueOf") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: static public com.fasterxml.jackson.core.JsonParser.Feature valueOf(java.lang.String name) + /// The returned object must be deleted after use, by calling the `delete` method. + static JsonParser_Feature valueOf(jni.JniString name) => + JsonParser_Feature.fromRef(_valueOf(name.reference).object); + + static final _collectDefaults = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonParser_Feature__collectDefaults") + .asFunction<jni.JniResult Function()>(); + + /// from: static public int collectDefaults() + /// + /// Method that calculates bit set (flags) of all features that + /// are enabled by default. + ///@return Bit mask of all features that are enabled by default + static int collectDefaults() => _collectDefaults().integer; + + static final _ctor = + jniLookup<ffi.NativeFunction<jni.JniResult Function(ffi.Uint8)>>( + "JsonParser_Feature__ctor") + .asFunction<jni.JniResult Function(int)>(); + + /// from: private void <init>(boolean defaultState) + JsonParser_Feature(bool defaultState) + : super.fromRef(_ctor(defaultState ? 1 : 0).object); + + static final _enabledByDefault = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>( + "JsonParser_Feature__enabledByDefault") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public boolean enabledByDefault() + bool enabledByDefault() => _enabledByDefault(reference).boolean; + + static final _enabledIn = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>, + ffi.Int32)>>("JsonParser_Feature__enabledIn") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: public boolean enabledIn(int flags) + bool enabledIn(int flags) => _enabledIn(reference, flags).boolean; + + static final _getMask = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser_Feature__getMask") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int getMask() + int getMask() => _getMask(reference).integer; +} + +/// from: com.fasterxml.jackson.core.JsonParser$NumberType +/// +/// Enumeration of possible "native" (optimal) types that can be +/// used for numbers. +class JsonParser_NumberType extends jni.JniObject { + JsonParser_NumberType.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); + + static final _values = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonParser_NumberType__values") + .asFunction<jni.JniResult Function()>(); + + /// from: static public com.fasterxml.jackson.core.JsonParser.NumberType[] values() + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JniObject values() => jni.JniObject.fromRef(_values().object); + + static final _valueOf = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonParser_NumberType__valueOf") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: static public com.fasterxml.jackson.core.JsonParser.NumberType valueOf(java.lang.String name) + /// The returned object must be deleted after use, by calling the `delete` method. + static JsonParser_NumberType valueOf(jni.JniString name) => + JsonParser_NumberType.fromRef(_valueOf(name.reference).object); + + static final _ctor = jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonParser_NumberType__ctor") + .asFunction<jni.JniResult Function()>(); + + /// from: private void <init>() + JsonParser_NumberType() : super.fromRef(_ctor().object); +}
diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonToken.dart b/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonToken.dart new file mode 100644 index 0000000..01cfc9a --- /dev/null +++ b/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/JsonToken.dart
@@ -0,0 +1,190 @@ +// Generated from jackson-core which is licensed under the Apache License 2.0. +// The following copyright from the original authors applies. +// See https://github.com/FasterXML/jackson-core/blob/2.14/LICENSE +// +// Copyright (c) 2007 - The Jackson Project Authors +// Licensed under the Apache License, Version 2.0 (the "License") +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Autogenerated by jnigen. DO NOT EDIT! + +// ignore_for_file: camel_case_types +// ignore_for_file: file_names +// ignore_for_file: unused_import +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: constant_identifier_names +// ignore_for_file: annotate_overrides +// ignore_for_file: no_leading_underscores_for_local_identifiers +// ignore_for_file: unused_element + +import "dart:ffi" as ffi; +import "package:jni/internal_helpers_for_jnigen.dart"; +import "package:jni/jni.dart" as jni; + +import "../../../../_init.dart" show jniLookup; + +/// from: com.fasterxml.jackson.core.JsonToken +/// +/// Enumeration for basic token types used for returning results +/// of parsing JSON content. +class JsonToken extends jni.JniObject { + JsonToken.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); + + static final _values = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "JsonToken__values") + .asFunction<jni.JniResult Function()>(); + + /// from: static public com.fasterxml.jackson.core.JsonToken[] values() + /// The returned object must be deleted after use, by calling the `delete` method. + static jni.JniObject values() => jni.JniObject.fromRef(_values().object); + + static final _valueOf = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__valueOf") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: static public com.fasterxml.jackson.core.JsonToken valueOf(java.lang.String name) + /// The returned object must be deleted after use, by calling the `delete` method. + static JsonToken valueOf(jni.JniString name) => + JsonToken.fromRef(_valueOf(name.reference).object); + + static final _ctor = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>, ffi.Int32)>>("JsonToken__ctor") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>, int)>(); + + /// from: private void <init>(java.lang.String token, int id) + /// + /// @param token representation for this token, if there is a + /// single static representation; null otherwise + ///@param id Numeric id from JsonTokenId + JsonToken(jni.JniString token, int id) + : super.fromRef(_ctor(token.reference, id).object); + + static final _id = jniLookup< + ffi.NativeFunction< + jni.JniResult Function(ffi.Pointer<ffi.Void>)>>("JsonToken__id") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final int id() + int id() => _id(reference).integer; + + static final _asString = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__asString") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final java.lang.String asString() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JniString asString() => + jni.JniString.fromRef(_asString(reference).object); + + static final _asCharArray = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__asCharArray") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final char[] asCharArray() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JniObject asCharArray() => + jni.JniObject.fromRef(_asCharArray(reference).object); + + static final _asByteArray = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__asByteArray") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final byte[] asByteArray() + /// The returned object must be deleted after use, by calling the `delete` method. + jni.JniObject asByteArray() => + jni.JniObject.fromRef(_asByteArray(reference).object); + + static final _isNumeric = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__isNumeric") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isNumeric() + /// + /// @return {@code True} if this token is {@code VALUE_NUMBER_INT} or {@code VALUE_NUMBER_FLOAT}, + /// {@code false} otherwise + bool isNumeric() => _isNumeric(reference).boolean; + + static final _isStructStart = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__isStructStart") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isStructStart() + /// + /// Accessor that is functionally equivalent to: + /// <code> + /// this == JsonToken.START_OBJECT || this == JsonToken.START_ARRAY + /// </code> + ///@return {@code True} if this token is {@code START_OBJECT} or {@code START_ARRAY}, + /// {@code false} otherwise + ///@since 2.3 + bool isStructStart() => _isStructStart(reference).boolean; + + static final _isStructEnd = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__isStructEnd") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isStructEnd() + /// + /// Accessor that is functionally equivalent to: + /// <code> + /// this == JsonToken.END_OBJECT || this == JsonToken.END_ARRAY + /// </code> + ///@return {@code True} if this token is {@code END_OBJECT} or {@code END_ARRAY}, + /// {@code false} otherwise + ///@since 2.3 + bool isStructEnd() => _isStructEnd(reference).boolean; + + static final _isScalarValue = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__isScalarValue") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isScalarValue() + /// + /// Method that can be used to check whether this token represents + /// a valid non-structured value. This means all {@code VALUE_xxx} tokens; + /// excluding {@code START_xxx} and {@code END_xxx} tokens as well + /// {@code FIELD_NAME}. + ///@return {@code True} if this token is a scalar value token (one of + /// {@code VALUE_xxx} tokens), {@code false} otherwise + bool isScalarValue() => _isScalarValue(reference).boolean; + + static final _isBoolean = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("JsonToken__isBoolean") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public final boolean isBoolean() + /// + /// @return {@code True} if this token is {@code VALUE_TRUE} or {@code VALUE_FALSE}, + /// {@code false} otherwise + bool isBoolean() => _isBoolean(reference).boolean; +}
diff --git a/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/_package.dart b/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/_package.dart new file mode 100644 index 0000000..cae2a52 --- /dev/null +++ b/pkgs/jnigen/test/jackson_core_test/third_party/lib/com/fasterxml/jackson/core/_package.dart
@@ -0,0 +1,3 @@ +export "JsonFactory.dart"; +export "JsonParser.dart"; +export "JsonToken.dart";
diff --git a/pkgs/jnigen/test/package_resolver_test.dart b/pkgs/jnigen/test/package_resolver_test.dart index 14ed74e..cacb159 100644 --- a/pkgs/jnigen/test/package_resolver_test.dart +++ b/pkgs/jnigen/test/package_resolver_test.dart
@@ -3,7 +3,6 @@ // BSD-style license that can be found in the LICENSE file. import 'package:jnigen/src/writers/files_writer.dart'; -import 'package:jnigen/src/util/name_utils.dart'; import 'package:test/test.dart'; class ResolverTest { @@ -14,12 +13,12 @@ } void main() { - final resolver = PackagePathResolver( + final resolver = FilePathResolver( { 'org.apache.pdfbox': 'package:pdfbox/pdfbox.dart', 'android.os.Process': 'package:android/os.dart', }, - 'a.b', + 'a.b.N', { 'a.b.C', 'a.b.c.D', @@ -34,28 +33,28 @@ final tests = [ // Absolute imports resolved using import map ResolverTest( - 'android.os.Process', 'package:android/os.dart', 'os_.Process'), + 'android.os.Process', 'package:android/os.dart', 'process_.Process'), ResolverTest('org.apache.pdfbox.pdmodel.PDDocument', - 'package:pdfbox/pdfbox.dart', 'pdmodel_.PDDocument'), + 'package:pdfbox/pdfbox.dart', 'pddocument_.PDDocument'), // Relative imports // inner package - ResolverTest('a.b.c.D', 'b/c.dart', 'c_.D'), + ResolverTest('a.b.c.D', 'c/D.dart', 'd_.D'), // inner package, deeper - ResolverTest('a.b.c.d.E', 'b/c/d.dart', 'd_.E'), + ResolverTest('a.b.c.d.E', 'c/d/E.dart', 'e_.E'), // parent package - ResolverTest('a.X', '../a.dart', 'a_.X'), + ResolverTest('a.X', '../X.dart', 'x_.X'), // unrelated package in same translation unit - ResolverTest('e.f.G', '../e/f.dart', 'f_.G'), - ResolverTest('e.F', '../e.dart', 'e_.F'), + ResolverTest('e.f.G', '../../e/f/G.dart', 'g_.G'), + ResolverTest('e.F', '../../e/F.dart', 'f_.F'), // neighbour package - ResolverTest('a.g.Y', 'g.dart', 'g_.Y'), + ResolverTest('a.g.Y', '../g/Y.dart', 'y_.Y'), // inner package of a neighbour package - ResolverTest('a.m.n.P', 'm/n.dart', 'n_.P'), + ResolverTest('a.m.n.P', '../m/n/P.dart', 'p_.P'), ]; for (var testCase in tests) { final binaryName = testCase.binaryName; - final packageName = cutFromLast(binaryName, '.')[0]; + final packageName = getFileClassName(binaryName); test( 'getImport $binaryName', () => expect(resolver.getImport(packageName, binaryName), @@ -65,6 +64,4 @@ () => expect( resolver.resolve(binaryName), equals(testCase.expectedName))); } - test('resolve in same package', - () => expect(resolver.resolve('a.b.C'), equals('C'))); }
diff --git a/pkgs/jnigen/test/simple_package_test/generate.dart b/pkgs/jnigen/test/simple_package_test/generate.dart index e87d9f6..c433d43 100644 --- a/pkgs/jnigen/test/simple_package_test/generate.dart +++ b/pkgs/jnigen/test/simple_package_test/generate.dart
@@ -50,7 +50,10 @@ path: cWrapperDir, libraryName: 'simple_package', ), - dartConfig: DartCodeOutputConfig(path: dartWrappersRoot), + dartConfig: DartCodeOutputConfig( + path: dartWrappersRoot.resolve('simple_package.dart'), + structure: OutputStructure.singleFile, + ), ), preamble: preamble, );
diff --git a/pkgs/jnigen/test/simple_package_test/generated_files_test.dart b/pkgs/jnigen/test/simple_package_test/generated_files_test.dart index c37de4a..212e969 100644 --- a/pkgs/jnigen/test/simple_package_test/generated_files_test.dart +++ b/pkgs/jnigen/test/simple_package_test/generated_files_test.dart
@@ -12,7 +12,7 @@ test("Generate and compare bindings for simple_package", () async { await generateAndCompareBindings( getConfig(), - join(testRoot, "lib"), + join(testRoot, "lib", "simple_package.dart"), join(testRoot, "src"), ); }); // test if generated file == expected file
diff --git a/pkgs/jnigen/test/simple_package_test/lib/_init.dart b/pkgs/jnigen/test/simple_package_test/lib/_init.dart deleted file mode 100644 index f0e14e4..0000000 --- a/pkgs/jnigen/test/simple_package_test/lib/_init.dart +++ /dev/null
@@ -1,9 +0,0 @@ -// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import "dart:ffi"; -import "package:jni/internal_helpers_for_jnigen.dart"; - -final Pointer<T> Function<T extends NativeType>(String sym) jniLookup = - ProtectedJniExtensions.initGeneratedLibrary("simple_package");
diff --git a/pkgs/jnigen/test/simple_package_test/lib/com/github/dart_lang/jnigen/pkg2.dart b/pkgs/jnigen/test/simple_package_test/lib/com/github/dart_lang/jnigen/pkg2.dart deleted file mode 100644 index e72bdb9..0000000 --- a/pkgs/jnigen/test/simple_package_test/lib/com/github/dart_lang/jnigen/pkg2.dart +++ /dev/null
@@ -1,66 +0,0 @@ -// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// Autogenerated by jnigen. DO NOT EDIT! - -// ignore_for_file: camel_case_types -// ignore_for_file: non_constant_identifier_names -// ignore_for_file: constant_identifier_names -// ignore_for_file: annotate_overrides -// ignore_for_file: no_leading_underscores_for_local_identifiers -// ignore_for_file: unused_element - -import "dart:ffi" as ffi; -import "package:jni/internal_helpers_for_jnigen.dart"; -import "package:jni/jni.dart" as jni; - -import "../../../../_init.dart" show jniLookup; - -/// from: com.github.dart_lang.jnigen.pkg2.C2 -class C2 extends jni.JniObject { - C2.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); - - static final _get_CONSTANT = - jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( - "get_C2__CONSTANT") - .asFunction<jni.JniResult Function()>(); - - /// from: static public int CONSTANT - static int get CONSTANT => _get_CONSTANT().integer; - static final _set_CONSTANT = - jniLookup<ffi.NativeFunction<jni.JThrowable Function(ffi.Int32)>>( - "set_C2__CONSTANT") - .asFunction<jni.JThrowable Function(int)>(); - - /// from: static public int CONSTANT - static set CONSTANT(int value) => _set_CONSTANT(value); - - static final _ctor = - jniLookup<ffi.NativeFunction<jni.JniResult Function()>>("C2__ctor") - .asFunction<jni.JniResult Function()>(); - - /// from: public void <init>() - C2() : super.fromRef(_ctor().object); -} - -/// from: com.github.dart_lang.jnigen.pkg2.Example -class Example extends jni.JniObject { - Example.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); - - static final _ctor = - jniLookup<ffi.NativeFunction<jni.JniResult Function()>>("Example1__ctor") - .asFunction<jni.JniResult Function()>(); - - /// from: public void <init>() - Example() : super.fromRef(_ctor().object); - - static final _whichExample = jniLookup< - ffi.NativeFunction< - jni.JniResult Function( - ffi.Pointer<ffi.Void>)>>("Example1__whichExample") - .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); - - /// from: public int whichExample() - int whichExample() => _whichExample(reference).integer; -}
diff --git a/pkgs/jnigen/test/simple_package_test/lib/com/github/dart_lang/jnigen/simple_package.dart b/pkgs/jnigen/test/simple_package_test/lib/simple_package.dart similarity index 78% rename from pkgs/jnigen/test/simple_package_test/lib/com/github/dart_lang/jnigen/simple_package.dart rename to pkgs/jnigen/test/simple_package_test/lib/simple_package.dart index b2002d2..d9f7a42 100644 --- a/pkgs/jnigen/test/simple_package_test/lib/com/github/dart_lang/jnigen/simple_package.dart +++ b/pkgs/jnigen/test/simple_package_test/lib/simple_package.dart
@@ -5,6 +5,8 @@ // Autogenerated by jnigen. DO NOT EDIT! // ignore_for_file: camel_case_types +// ignore_for_file: file_names +// ignore_for_file: unused_import // ignore_for_file: non_constant_identifier_names // ignore_for_file: constant_identifier_names // ignore_for_file: annotate_overrides @@ -15,7 +17,10 @@ import "package:jni/internal_helpers_for_jnigen.dart"; import "package:jni/jni.dart" as jni; -import "../../../../_init.dart" show jniLookup; +// Auto-generated initialization code. + +final ffi.Pointer<T> Function<T extends ffi.NativeType>(String sym) jniLookup = + ProtectedJniExtensions.initGeneratedLibrary("simple_package"); /// from: com.github.dart_lang.jnigen.simple_package.Example class Example extends jni.JniObject { @@ -179,3 +184,51 @@ /// from: public void setValue(boolean value) void setValue(bool value) => _setValue(reference, value ? 1 : 0).check(); } + +/// from: com.github.dart_lang.jnigen.pkg2.C2 +class C2 extends jni.JniObject { + C2.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); + + static final _get_CONSTANT = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>( + "get_C2__CONSTANT") + .asFunction<jni.JniResult Function()>(); + + /// from: static public int CONSTANT + static int get CONSTANT => _get_CONSTANT().integer; + static final _set_CONSTANT = + jniLookup<ffi.NativeFunction<jni.JThrowable Function(ffi.Int32)>>( + "set_C2__CONSTANT") + .asFunction<jni.JThrowable Function(int)>(); + + /// from: static public int CONSTANT + static set CONSTANT(int value) => _set_CONSTANT(value); + + static final _ctor = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>("C2__ctor") + .asFunction<jni.JniResult Function()>(); + + /// from: public void <init>() + C2() : super.fromRef(_ctor().object); +} + +/// from: com.github.dart_lang.jnigen.pkg2.Example +class Example1 extends jni.JniObject { + Example1.fromRef(ffi.Pointer<ffi.Void> ref) : super.fromRef(ref); + + static final _ctor = + jniLookup<ffi.NativeFunction<jni.JniResult Function()>>("Example1__ctor") + .asFunction<jni.JniResult Function()>(); + + /// from: public void <init>() + Example1() : super.fromRef(_ctor().object); + + static final _whichExample = jniLookup< + ffi.NativeFunction< + jni.JniResult Function( + ffi.Pointer<ffi.Void>)>>("Example1__whichExample") + .asFunction<jni.JniResult Function(ffi.Pointer<ffi.Void>)>(); + + /// from: public int whichExample() + int whichExample() => _whichExample(reference).integer; +}
diff --git a/pkgs/jnigen/test/test_util/test_util.dart b/pkgs/jnigen/test/test_util/test_util.dart index c35f7a9..1a14265 100644 --- a/pkgs/jnigen/test/test_util/test_util.dart +++ b/pkgs/jnigen/test/test_util/test_util.dart
@@ -36,8 +36,18 @@ .toList(); } +/// Read file normalizing CRLF to LF. +String readFile(File file) => file.readAsStringSync().replaceAll('\r\n', '\n'); + /// compares 2 hierarchies, with and without prefix 'test_' -void compareDirs(String path1, String path2) { +void comparePaths(String path1, String path2) { + if (File(path1).existsSync()) { + expect( + readFile(File(path1)), + readFile(File(path2)), + ); + return; + } final list1 = Directory(path1).listSync(recursive: true); final list2 = Directory(path2).listSync(recursive: true); expect(list1.length, equals(list2.length)); @@ -50,31 +60,36 @@ } final a = File(list1[i].path); final b = File(list2[i].path); - // Some windows problems: Depending on your working tree and git config - // one file may have CRLFs and other may have LFs. - expect(a.readAsStringSync().replaceAll("\r\n", "\n"), - equals(b.readAsStringSync().replaceAll("\r\n", "\n"))); + expect(readFile(a), readFile(b)); } } Future<void> _generateTempBindings(Config config, Directory tempDir) async { final tempSrc = tempDir.uri.resolve("src/"); - final tempLib = tempDir.uri.resolve("lib/"); + final singleFile = + config.outputConfig.dartConfig.structure == OutputStructure.singleFile; + final tempLib = singleFile + ? tempDir.uri.resolve("generated.dart") + : tempDir.uri.resolve("lib/"); config.outputConfig.cConfig.path = tempSrc; config.outputConfig.dartConfig.path = tempLib; await generateJniBindings(config); } Future<void> generateAndCompareBindings( - Config config, String lib, String src) async { + Config config, String dartPath, String cPath) async { final currentDir = Directory.current; final tempDir = currentDir.createTempSync("jnigen_test_temp"); final tempSrc = tempDir.uri.resolve("src/"); - final tempLib = tempDir.uri.resolve("lib/"); + final singleFile = + config.outputConfig.dartConfig.structure == OutputStructure.singleFile; + final tempLib = singleFile + ? tempDir.uri.resolve("generated.dart") + : tempDir.uri.resolve("lib/"); try { await _generateTempBindings(config, tempDir); - compareDirs(lib, tempLib.toFilePath()); - compareDirs(src, tempSrc.toFilePath()); + comparePaths(dartPath, tempLib.toFilePath()); + comparePaths(cPath, tempSrc.toFilePath()); } finally { tempDir.deleteSync(recursive: true); }
diff --git a/pkgs/jnigen/test/yaml_config_test.dart b/pkgs/jnigen/test/yaml_config_test.dart index 7557e2f..198457d 100644 --- a/pkgs/jnigen/test/yaml_config_test.dart +++ b/pkgs/jnigen/test/yaml_config_test.dart
@@ -21,8 +21,8 @@ final args = [ '--config', configFile, - '-Doutput.c.path=$testSrc', - '-Doutput.dart.path=$testLib', + '-Doutput.c.path=$testSrc/', + '-Doutput.dart.path=$testLib/', ]; final config = Config.parseArgs(args); await generateAndCompareBindings(config, lib, src);
diff --git a/pkgs/jnigen/tool/pre_commit_checks.dart b/pkgs/jnigen/tool/pre_commit_checks.dart index e269fc5..6575e8a 100644 --- a/pkgs/jnigen/tool/pre_commit_checks.dart +++ b/pkgs/jnigen/tool/pre_commit_checks.dart
@@ -173,12 +173,12 @@ "jnigen", "--config", "jnigen.yaml", - "-Doutput.c.path=src_temp", - "-Doutput.dart.path=lib_temp", + "-Doutput.c.path=src_temp/", + "-Doutput.dart.path=_temp.dart", ]) - ..chainCommand("diff", ["-qr", "lib/android_utils/", "lib_temp/"]) + ..chainCommand("diff", ["lib/android_utils.dart", "_temp.dart"]) ..chainCommand("diff", ["-qr", "src/android_utils/", "src_temp/"]) - ..chainCleanupCommand("rm", ["-r", "lib_temp", "src_temp"]); + ..chainCleanupCommand("rm", ["-r", "_temp.dart", "src_temp"]); final comparePdfboxBindings = Runner( "Generate & compare PdfBox Bindings", "jnigen/example/pdfbox_plugin") ..chainCommand("dart", [ @@ -186,8 +186,8 @@ "jnigen", "--config", "jnigen.yaml", - "-Doutput.c.path=src_temp", - "-Doutput.dart.path=lib_temp", + "-Doutput.c.path=src_temp/", + "-Doutput.dart.path=lib_temp/", ]) ..chainCommand("diff", ["-qr", "lib/src/third_party/", "lib_temp/"]) ..chainCommand("diff", ["-qr", "src/", "src_temp/"]) @@ -200,12 +200,12 @@ "jnigen", "--config", "jnigen.yaml", - "-Doutput.c.path=src_temp", - "-Doutput.dart.path=lib_temp", + "-Doutput.c.path=src_temp/", + "-Doutput.dart.path=_temp.dart", ]) - ..chainCommand("diff", ["-qr", "lib/", "lib_temp/"]) + ..chainCommand("diff", ["lib/notifications.dart", "_temp.dart"]) ..chainCommand("diff", ["-qr", "src/", "src_temp/"]) - ..chainCleanupCommand("rm", ["-r", "lib_temp", "src_temp"]); + ..chainCleanupCommand("rm", ["-r", "_temp.dart", "src_temp"]); unawaited(jnigenAnalyze.run().then((_) { jnigenTest.run(); compareInAppJavaBindings.run();