|
| 1 | +/* |
| 2 | + * Copyright 2024 ObjectBox Ltd. All rights reserved. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +// automatically generated by the FlatBuffers compiler, do not modify |
| 18 | + |
| 19 | +package io.objectbox.sync; |
| 20 | + |
| 21 | +import io.objectbox.flatbuffers.BaseVector; |
| 22 | +import io.objectbox.flatbuffers.BooleanVector; |
| 23 | +import io.objectbox.flatbuffers.ByteVector; |
| 24 | +import io.objectbox.flatbuffers.Constants; |
| 25 | +import io.objectbox.flatbuffers.DoubleVector; |
| 26 | +import io.objectbox.flatbuffers.FlatBufferBuilder; |
| 27 | +import io.objectbox.flatbuffers.FloatVector; |
| 28 | +import io.objectbox.flatbuffers.IntVector; |
| 29 | +import io.objectbox.flatbuffers.LongVector; |
| 30 | +import io.objectbox.flatbuffers.ShortVector; |
| 31 | +import io.objectbox.flatbuffers.StringVector; |
| 32 | +import io.objectbox.flatbuffers.Struct; |
| 33 | +import io.objectbox.flatbuffers.Table; |
| 34 | +import io.objectbox.flatbuffers.UnionVector; |
| 35 | +import java.nio.ByteBuffer; |
| 36 | +import java.nio.ByteOrder; |
| 37 | + |
| 38 | +/** |
| 39 | + * Credentials consist of a type and the credentials data to perform authentication checks. |
| 40 | + * The data is either provided as plain-bytes, or as a list of strings. |
| 41 | + * Credentials can be used from the client and server side. |
| 42 | + * This depends on the type however: |
| 43 | + * for example, shared secrets are configured at both sides, but username/password is only provided at the client. |
| 44 | + */ |
| 45 | +@SuppressWarnings("unused") |
| 46 | +public final class Credentials extends Table { |
| 47 | + public static void ValidateVersion() { Constants.FLATBUFFERS_23_5_26(); } |
| 48 | + public static Credentials getRootAsCredentials(ByteBuffer _bb) { return getRootAsCredentials(_bb, new Credentials()); } |
| 49 | + public static Credentials getRootAsCredentials(ByteBuffer _bb, Credentials obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); } |
| 50 | + public void __init(int _i, ByteBuffer _bb) { __reset(_i, _bb); } |
| 51 | + public Credentials __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; } |
| 52 | + |
| 53 | + public long type() { int o = __offset(4); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; } |
| 54 | + /** |
| 55 | + * Credentials provided by plain bytes. |
| 56 | + * This is used for shared secrets (client & server). |
| 57 | + */ |
| 58 | + public int bytes(int j) { int o = __offset(6); return o != 0 ? bb.get(__vector(o) + j * 1) & 0xFF : 0; } |
| 59 | + public int bytesLength() { int o = __offset(6); return o != 0 ? __vector_len(o) : 0; } |
| 60 | + public ByteVector bytesVector() { return bytesVector(new ByteVector()); } |
| 61 | + public ByteVector bytesVector(ByteVector obj) { int o = __offset(6); return o != 0 ? obj.__assign(__vector(o), bb) : null; } |
| 62 | + public ByteBuffer bytesAsByteBuffer() { return __vector_as_bytebuffer(6, 1); } |
| 63 | + public ByteBuffer bytesInByteBuffer(ByteBuffer _bb) { return __vector_in_bytebuffer(_bb, 6, 1); } |
| 64 | + /** |
| 65 | + * Credentials provided by a string array. |
| 66 | + * For username/password (client-only), provide the username in strings[0] and the password in strings[1]. |
| 67 | + * For GoogleAuth, you can provide a list of accepted IDs (server-only). |
| 68 | + */ |
| 69 | + public String strings(int j) { int o = __offset(8); return o != 0 ? __string(__vector(o) + j * 4) : null; } |
| 70 | + public int stringsLength() { int o = __offset(8); return o != 0 ? __vector_len(o) : 0; } |
| 71 | + public StringVector stringsVector() { return stringsVector(new StringVector()); } |
| 72 | + public StringVector stringsVector(StringVector obj) { int o = __offset(8); return o != 0 ? obj.__assign(__vector(o), 4, bb) : null; } |
| 73 | + |
| 74 | + public static int createCredentials(FlatBufferBuilder builder, |
| 75 | + long type, |
| 76 | + int bytesOffset, |
| 77 | + int stringsOffset) { |
| 78 | + builder.startTable(3); |
| 79 | + Credentials.addStrings(builder, stringsOffset); |
| 80 | + Credentials.addBytes(builder, bytesOffset); |
| 81 | + Credentials.addType(builder, type); |
| 82 | + return Credentials.endCredentials(builder); |
| 83 | + } |
| 84 | + |
| 85 | + public static void startCredentials(FlatBufferBuilder builder) { builder.startTable(3); } |
| 86 | + public static void addType(FlatBufferBuilder builder, long type) { builder.addInt(0, (int) type, (int) 0L); } |
| 87 | + public static void addBytes(FlatBufferBuilder builder, int bytesOffset) { builder.addOffset(1, bytesOffset, 0); } |
| 88 | + public static int createBytesVector(FlatBufferBuilder builder, byte[] data) { return builder.createByteVector(data); } |
| 89 | + public static int createBytesVector(FlatBufferBuilder builder, ByteBuffer data) { return builder.createByteVector(data); } |
| 90 | + public static void startBytesVector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); } |
| 91 | + public static void addStrings(FlatBufferBuilder builder, int stringsOffset) { builder.addOffset(2, stringsOffset, 0); } |
| 92 | + public static int createStringsVector(FlatBufferBuilder builder, int[] data) { builder.startVector(4, data.length, 4); for (int i = data.length - 1; i >= 0; i--) builder.addOffset(data[i]); return builder.endVector(); } |
| 93 | + public static void startStringsVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } |
| 94 | + public static int endCredentials(FlatBufferBuilder builder) { |
| 95 | + int o = builder.endTable(); |
| 96 | + return o; |
| 97 | + } |
| 98 | + |
| 99 | + public static final class Vector extends BaseVector { |
| 100 | + public Vector __assign(int _vector, int _element_size, ByteBuffer _bb) { __reset(_vector, _element_size, _bb); return this; } |
| 101 | + |
| 102 | + public Credentials get(int j) { return get(new Credentials(), j); } |
| 103 | + public Credentials get(Credentials obj, int j) { return obj.__assign(__indirect(__element(j), bb), bb); } |
| 104 | + } |
| 105 | +} |
| 106 | + |
0 commit comments