id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
48,400
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java
SecureDfuImpl.setObjectSize
private void setObjectSize(@NonNull final byte[] data, final int value) { data[2] = (byte) (value & 0xFF); data[3] = (byte) ((value >> 8) & 0xFF); data[4] = (byte) ((value >> 16) & 0xFF); data[5] = (byte) ((value >> 24) & 0xFF); }
java
private void setObjectSize(@NonNull final byte[] data, final int value) { data[2] = (byte) (value & 0xFF); data[3] = (byte) ((value >> 8) & 0xFF); data[4] = (byte) ((value >> 16) & 0xFF); data[5] = (byte) ((value >> 24) & 0xFF); }
[ "private", "void", "setObjectSize", "(", "@", "NonNull", "final", "byte", "[", "]", "data", ",", "final", "int", "value", ")", "{", "data", "[", "2", "]", "=", "(", "byte", ")", "(", "value", "&", "0xFF", ")", ";", "data", "[", "3", "]", "=", "...
Sets the object size in correct position of the data array. @param data control point data packet @param value Object size in bytes.
[ "Sets", "the", "object", "size", "in", "correct", "position", "of", "the", "data", "array", "." ]
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java#L737-L742
48,401
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java
SecureDfuImpl.writeCreateRequest
private void writeCreateRequest(final int type, final int size) throws DeviceDisconnectedException, DfuException, UploadAbortedException, RemoteDfuException, UnknownResponseException { if (!mConnected) throw new DeviceDisconnectedException("Unable to create object: device disconnected"); final byte[] data...
java
private void writeCreateRequest(final int type, final int size) throws DeviceDisconnectedException, DfuException, UploadAbortedException, RemoteDfuException, UnknownResponseException { if (!mConnected) throw new DeviceDisconnectedException("Unable to create object: device disconnected"); final byte[] data...
[ "private", "void", "writeCreateRequest", "(", "final", "int", "type", ",", "final", "int", "size", ")", "throws", "DeviceDisconnectedException", ",", "DfuException", ",", "UploadAbortedException", ",", "RemoteDfuException", ",", "UnknownResponseException", "{", "if", ...
Writes Create Object request providing the type and size of the object. @param type {@link #OBJECT_COMMAND} or {@link #OBJECT_DATA}. @param size size of the object or current part of the object. @throws DeviceDisconnectedException @throws DfuException @throws UploadAbortedException @throws RemoteDfuException thrown wh...
[ "Writes", "Create", "Object", "request", "providing", "the", "type", "and", "size", "of", "the", "object", "." ]
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java#L807-L823
48,402
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java
SecureDfuImpl.selectObject
private ObjectInfo selectObject(final int type) throws DeviceDisconnectedException, DfuException, UploadAbortedException, RemoteDfuException, UnknownResponseException { if (!mConnected) throw new DeviceDisconnectedException("Unable to read object info: device disconnected"); OP_CODE_SELECT_OBJECT[1] = (by...
java
private ObjectInfo selectObject(final int type) throws DeviceDisconnectedException, DfuException, UploadAbortedException, RemoteDfuException, UnknownResponseException { if (!mConnected) throw new DeviceDisconnectedException("Unable to read object info: device disconnected"); OP_CODE_SELECT_OBJECT[1] = (by...
[ "private", "ObjectInfo", "selectObject", "(", "final", "int", "type", ")", "throws", "DeviceDisconnectedException", ",", "DfuException", ",", "UploadAbortedException", ",", "RemoteDfuException", ",", "UnknownResponseException", "{", "if", "(", "!", "mConnected", ")", ...
Selects the current object and reads its metadata. The object info contains the max object size, and the offset and CRC32 of the whole object until now. @return object info. @throws DeviceDisconnectedException @throws DfuException @throws UploadAbortedException @throws RemoteDfuException thrown when the returned statu...
[ "Selects", "the", "current", "object", "and", "reads", "its", "metadata", ".", "The", "object", "info", "contains", "the", "max", "object", "size", "and", "the", "offset", "and", "CRC32", "of", "the", "whole", "object", "until", "now", "." ]
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java#L836-L857
48,403
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java
SecureDfuImpl.readChecksum
private ObjectChecksum readChecksum() throws DeviceDisconnectedException, DfuException, UploadAbortedException, RemoteDfuException, UnknownResponseException { if (!mConnected) throw new DeviceDisconnectedException("Unable to read Checksum: device disconnected"); writeOpCode(mControlPointCharacterist...
java
private ObjectChecksum readChecksum() throws DeviceDisconnectedException, DfuException, UploadAbortedException, RemoteDfuException, UnknownResponseException { if (!mConnected) throw new DeviceDisconnectedException("Unable to read Checksum: device disconnected"); writeOpCode(mControlPointCharacterist...
[ "private", "ObjectChecksum", "readChecksum", "(", ")", "throws", "DeviceDisconnectedException", ",", "DfuException", ",", "UploadAbortedException", ",", "RemoteDfuException", ",", "UnknownResponseException", "{", "if", "(", "!", "mConnected", ")", "throw", "new", "Devic...
Sends the Calculate Checksum request. As a response a notification will be sent with current offset and CRC32 of the current object. @return requested object info. @throws DeviceDisconnectedException @throws DfuException @throws UploadAbortedException @throws RemoteDfuException thrown when the returned status code is ...
[ "Sends", "the", "Calculate", "Checksum", "request", ".", "As", "a", "response", "a", "notification", "will", "be", "sent", "with", "current", "offset", "and", "CRC32", "of", "the", "current", "object", "." ]
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java#L870-L888
48,404
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java
SecureDfuImpl.writeExecute
private void writeExecute() throws DfuException, DeviceDisconnectedException, UploadAbortedException, UnknownResponseException, RemoteDfuException { if (!mConnected) throw new DeviceDisconnectedException("Unable to read Checksum: device disconnected"); writeOpCode(mControlPointCharacteristic, OP_COD...
java
private void writeExecute() throws DfuException, DeviceDisconnectedException, UploadAbortedException, UnknownResponseException, RemoteDfuException { if (!mConnected) throw new DeviceDisconnectedException("Unable to read Checksum: device disconnected"); writeOpCode(mControlPointCharacteristic, OP_COD...
[ "private", "void", "writeExecute", "(", ")", "throws", "DfuException", ",", "DeviceDisconnectedException", ",", "UploadAbortedException", ",", "UnknownResponseException", ",", "RemoteDfuException", "{", "if", "(", "!", "mConnected", ")", "throw", "new", "DeviceDisconnec...
Sends the Execute operation code and awaits for a return notification containing status code. The Execute command will confirm the last chunk of data or the last command that was sent. Creating the same object again, instead of executing it allows to retransmitting it in case of a CRC error. @throws DfuException @thro...
[ "Sends", "the", "Execute", "operation", "code", "and", "awaits", "for", "a", "return", "notification", "containing", "status", "code", ".", "The", "Execute", "command", "will", "confirm", "the", "last", "chunk", "of", "data", "or", "the", "last", "command", ...
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java#L903-L916
48,405
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/internal/scanner/BootloaderScannerFactory.java
BootloaderScannerFactory.getScanner
public static BootloaderScanner getScanner() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) return new BootloaderScannerLollipop(); return new BootloaderScannerJB(); }
java
public static BootloaderScanner getScanner() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) return new BootloaderScannerLollipop(); return new BootloaderScannerJB(); }
[ "public", "static", "BootloaderScanner", "getScanner", "(", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "LOLLIPOP", ")", "return", "new", "BootloaderScannerLollipop", "(", ")", ";", "return", "new", ...
Returns the scanner implementation. @return the bootloader scanner
[ "Returns", "the", "scanner", "implementation", "." ]
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/internal/scanner/BootloaderScannerFactory.java#L38-L42
48,406
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java
DfuBaseService.openInputStream
private InputStream openInputStream(@NonNull final String filePath, final String mimeType, final int mbrSize, final int types) throws IOException { final InputStream is = new FileInputStream(filePath); if (MIME_TYPE_ZIP.equals(mimeType)) return new ArchiveInputStream(is, mbrSize, types); if (filePath.toLowe...
java
private InputStream openInputStream(@NonNull final String filePath, final String mimeType, final int mbrSize, final int types) throws IOException { final InputStream is = new FileInputStream(filePath); if (MIME_TYPE_ZIP.equals(mimeType)) return new ArchiveInputStream(is, mbrSize, types); if (filePath.toLowe...
[ "private", "InputStream", "openInputStream", "(", "@", "NonNull", "final", "String", "filePath", ",", "final", "String", "mimeType", ",", "final", "int", "mbrSize", ",", "final", "int", "types", ")", "throws", "IOException", "{", "final", "InputStream", "is", ...
Opens the binary input stream that returns the firmware image content. A Path to the file is given. @param filePath the path to the HEX, BIN or ZIP file. @param mimeType the file type. @param mbrSize the size of MBR, by default 0x1000. @param types the content files types in ZIP. @return The input stream with bina...
[ "Opens", "the", "binary", "input", "stream", "that", "returns", "the", "firmware", "image", "content", ".", "A", "Path", "to", "the", "file", "is", "given", "." ]
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java#L1416-L1424
48,407
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java
DfuBaseService.openInputStream
private InputStream openInputStream(@NonNull final Uri stream, final String mimeType, final int mbrSize, final int types) throws IOException { final InputStream is = getContentResolver().openInputStream(stream); if (MIME_TYPE_ZIP.equals(mimeType)) return new ArchiveInputStream(is, mbrSize, types); final St...
java
private InputStream openInputStream(@NonNull final Uri stream, final String mimeType, final int mbrSize, final int types) throws IOException { final InputStream is = getContentResolver().openInputStream(stream); if (MIME_TYPE_ZIP.equals(mimeType)) return new ArchiveInputStream(is, mbrSize, types); final St...
[ "private", "InputStream", "openInputStream", "(", "@", "NonNull", "final", "Uri", "stream", ",", "final", "String", "mimeType", ",", "final", "int", "mbrSize", ",", "final", "int", "types", ")", "throws", "IOException", "{", "final", "InputStream", "is", "=", ...
Opens the binary input stream. A Uri to the stream is given. @param stream the Uri to the stream. @param mimeType the file type. @param mbrSize the size of MBR, by default 0x1000. @param types the content files types in ZIP. @return The input stream with binary image content.
[ "Opens", "the", "binary", "input", "stream", ".", "A", "Uri", "to", "the", "stream", "is", "given", "." ]
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java#L1435-L1454
48,408
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java
DfuBaseService.terminateConnection
protected void terminateConnection(@NonNull final BluetoothGatt gatt, final int error) { if (mConnectionState != STATE_DISCONNECTED) { // Disconnect from the device disconnect(gatt); } // Close the device refreshDeviceCache(gatt, false); // This should be set to true when DFU Version is 0.5 or lower cl...
java
protected void terminateConnection(@NonNull final BluetoothGatt gatt, final int error) { if (mConnectionState != STATE_DISCONNECTED) { // Disconnect from the device disconnect(gatt); } // Close the device refreshDeviceCache(gatt, false); // This should be set to true when DFU Version is 0.5 or lower cl...
[ "protected", "void", "terminateConnection", "(", "@", "NonNull", "final", "BluetoothGatt", "gatt", ",", "final", "int", "error", ")", "{", "if", "(", "mConnectionState", "!=", "STATE_DISCONNECTED", ")", "{", "// Disconnect from the device", "disconnect", "(", "gatt"...
Disconnects from the device and cleans local variables in case of error. This method is SYNCHRONOUS and wait until the disconnecting process will be completed. @param gatt the GATT device to be disconnected. @param error error number.
[ "Disconnects", "from", "the", "device", "and", "cleans", "local", "variables", "in", "case", "of", "error", ".", "This", "method", "is", "SYNCHRONOUS", "and", "wait", "until", "the", "disconnecting", "process", "will", "be", "completed", "." ]
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java#L1519-L1531
48,409
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java
DfuBaseService.waitFor
protected void waitFor(final int millis) { synchronized (mLock) { try { sendLogBroadcast(DfuBaseService.LOG_LEVEL_DEBUG, "wait(" + millis + ")"); mLock.wait(millis); } catch (final InterruptedException e) { loge("Sleeping interrupted", e); } } }
java
protected void waitFor(final int millis) { synchronized (mLock) { try { sendLogBroadcast(DfuBaseService.LOG_LEVEL_DEBUG, "wait(" + millis + ")"); mLock.wait(millis); } catch (final InterruptedException e) { loge("Sleeping interrupted", e); } } }
[ "protected", "void", "waitFor", "(", "final", "int", "millis", ")", "{", "synchronized", "(", "mLock", ")", "{", "try", "{", "sendLogBroadcast", "(", "DfuBaseService", ".", "LOG_LEVEL_DEBUG", ",", "\"wait(\"", "+", "millis", "+", "\")\"", ")", ";", "mLock", ...
Wait for given number of milliseconds. @param millis waiting period.
[ "Wait", "for", "given", "number", "of", "milliseconds", "." ]
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java#L1577-L1586
48,410
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java
DfuBaseService.close
protected void close(final BluetoothGatt gatt) { logi("Cleaning up..."); sendLogBroadcast(LOG_LEVEL_DEBUG, "gatt.close()"); gatt.close(); mConnectionState = STATE_CLOSED; }
java
protected void close(final BluetoothGatt gatt) { logi("Cleaning up..."); sendLogBroadcast(LOG_LEVEL_DEBUG, "gatt.close()"); gatt.close(); mConnectionState = STATE_CLOSED; }
[ "protected", "void", "close", "(", "final", "BluetoothGatt", "gatt", ")", "{", "logi", "(", "\"Cleaning up...\"", ")", ";", "sendLogBroadcast", "(", "LOG_LEVEL_DEBUG", ",", "\"gatt.close()\"", ")", ";", "gatt", ".", "close", "(", ")", ";", "mConnectionState", ...
Closes the GATT device and cleans up. @param gatt the GATT device to be closed.
[ "Closes", "the", "GATT", "device", "and", "cleans", "up", "." ]
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java#L1593-L1598
48,411
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java
DfuBaseService.refreshDeviceCache
protected void refreshDeviceCache(final BluetoothGatt gatt, final boolean force) { /* * If the device is bonded this is up to the Service Changed characteristic to notify Android that the services has changed. * There is no need for this trick in that case. * If not bonded, the Android should not keep the se...
java
protected void refreshDeviceCache(final BluetoothGatt gatt, final boolean force) { /* * If the device is bonded this is up to the Service Changed characteristic to notify Android that the services has changed. * There is no need for this trick in that case. * If not bonded, the Android should not keep the se...
[ "protected", "void", "refreshDeviceCache", "(", "final", "BluetoothGatt", "gatt", ",", "final", "boolean", "force", ")", "{", "/*\n\t\t * If the device is bonded this is up to the Service Changed characteristic to notify Android that the services has changed.\n\t\t * There is no need for t...
Clears the device cache. After uploading new firmware the DFU target will have other services than before. @param gatt the GATT device to be refreshed. @param force <code>true</code> to force the refresh.
[ "Clears", "the", "device", "cache", ".", "After", "uploading", "new", "firmware", "the", "DFU", "target", "will", "have", "other", "services", "than", "before", "." ]
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java#L1607-L1629
48,412
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java
DfuBaseService.updateProgressNotification
protected void updateProgressNotification(@NonNull final NotificationCompat.Builder builder, final int progress) { // Add Abort action to the notification if (progress != PROGRESS_ABORTED && progress != PROGRESS_COMPLETED) { final Intent abortIntent = new Intent(BROADCAST_ACTION); abortIntent.putExtra(EXTRA_A...
java
protected void updateProgressNotification(@NonNull final NotificationCompat.Builder builder, final int progress) { // Add Abort action to the notification if (progress != PROGRESS_ABORTED && progress != PROGRESS_COMPLETED) { final Intent abortIntent = new Intent(BROADCAST_ACTION); abortIntent.putExtra(EXTRA_A...
[ "protected", "void", "updateProgressNotification", "(", "@", "NonNull", "final", "NotificationCompat", ".", "Builder", "builder", ",", "final", "int", "progress", ")", "{", "// Add Abort action to the notification", "if", "(", "progress", "!=", "PROGRESS_ABORTED", "&&",...
This method allows you to update the notification showing the upload progress. @param builder notification builder.
[ "This", "method", "allows", "you", "to", "update", "the", "notification", "showing", "the", "upload", "progress", "." ]
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java#L1725-L1733
48,413
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java
DfuBaseService.report
private void report(final int error) { sendErrorBroadcast(error); if (mDisableNotification) return; // create or update notification: final String deviceAddress = mDeviceAddress; final String deviceName = mDeviceName != null ? mDeviceName : getString(R.string.dfu_unknown_name); final NotificationCompa...
java
private void report(final int error) { sendErrorBroadcast(error); if (mDisableNotification) return; // create or update notification: final String deviceAddress = mDeviceAddress; final String deviceName = mDeviceName != null ? mDeviceName : getString(R.string.dfu_unknown_name); final NotificationCompa...
[ "private", "void", "report", "(", "final", "int", "error", ")", "{", "sendErrorBroadcast", "(", "error", ")", ";", "if", "(", "mDisableNotification", ")", "return", ";", "// create or update notification:", "final", "String", "deviceAddress", "=", "mDeviceAddress", ...
Creates or updates the notification in the Notification Manager. Sends broadcast with given error number to the activity. @param error the error number.
[ "Creates", "or", "updates", "the", "notification", "in", "the", "Notification", "Manager", ".", "Sends", "broadcast", "with", "given", "error", "number", "to", "the", "activity", "." ]
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java#L1741-L1775
48,414
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java
DfuBaseService.initialize
@SuppressWarnings("UnusedReturnValue") private boolean initialize() { // For API level 18 and above, get a reference to BluetoothAdapter through // BluetoothManager. final BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE); if (bluetoothManager == null) { loge...
java
@SuppressWarnings("UnusedReturnValue") private boolean initialize() { // For API level 18 and above, get a reference to BluetoothAdapter through // BluetoothManager. final BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE); if (bluetoothManager == null) { loge...
[ "@", "SuppressWarnings", "(", "\"UnusedReturnValue\"", ")", "private", "boolean", "initialize", "(", ")", "{", "// For API level 18 and above, get a reference to BluetoothAdapter through", "// BluetoothManager.", "final", "BluetoothManager", "bluetoothManager", "=", "(", "Bluetoo...
Initializes bluetooth adapter. @return <code>True</code> if initialization was successful.
[ "Initializes", "bluetooth", "adapter", "." ]
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java#L1923-L1940
48,415
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/internal/HexInputStream.java
HexInputStream.readLine
private int readLine() throws IOException { // end of file reached if (pos == -1) return 0; final InputStream in = this.in; // temporary value int b; int lineSize, type, offset; do { // skip end of line do { b = in.read(); pos++; } while (b == '\n' || b == '\r'); /* * Each li...
java
private int readLine() throws IOException { // end of file reached if (pos == -1) return 0; final InputStream in = this.in; // temporary value int b; int lineSize, type, offset; do { // skip end of line do { b = in.read(); pos++; } while (b == '\n' || b == '\r'); /* * Each li...
[ "private", "int", "readLine", "(", ")", "throws", "IOException", "{", "// end of file reached", "if", "(", "pos", "==", "-", "1", ")", "return", "0", ";", "final", "InputStream", "in", "=", "this", ".", "in", ";", "// temporary value", "int", "b", ";", "...
Reads new line from the input stream. Input stream must be a HEX file. The first line is always skipped. @return the number of data bytes in the new line. 0 if end of file. @throws java.io.IOException if this stream is closed or another IOException occurs.
[ "Reads", "new", "line", "from", "the", "input", "stream", ".", "Input", "stream", "must", "be", "a", "HEX", "file", ".", "The", "first", "line", "is", "always", "skipped", "." ]
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/internal/HexInputStream.java#L242-L328
48,416
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/LegacyDfuImpl.java
LegacyDfuImpl.readVersion
private int readVersion(@Nullable final BluetoothGattCharacteristic characteristic) { // The value of this characteristic has been read before by LegacyButtonlessDfuImpl return characteristic != null ? characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT16, 0) : 0; }
java
private int readVersion(@Nullable final BluetoothGattCharacteristic characteristic) { // The value of this characteristic has been read before by LegacyButtonlessDfuImpl return characteristic != null ? characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT16, 0) : 0; }
[ "private", "int", "readVersion", "(", "@", "Nullable", "final", "BluetoothGattCharacteristic", "characteristic", ")", "{", "// The value of this characteristic has been read before by LegacyButtonlessDfuImpl", "return", "characteristic", "!=", "null", "?", "characteristic", ".", ...
Returns the DFU Version characteristic if such exists. Otherwise it returns 0. @param characteristic the characteristic to read. @return a version number or 0 if not present on the bootloader.
[ "Returns", "the", "DFU", "Version", "characteristic", "if", "such", "exists", ".", "Otherwise", "it", "returns", "0", "." ]
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/LegacyDfuImpl.java#L588-L591
48,417
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/LegacyDfuImpl.java
LegacyDfuImpl.resetAndRestart
private void resetAndRestart(@NonNull final BluetoothGatt gatt, @NonNull final Intent intent) throws DfuException, DeviceDisconnectedException, UploadAbortedException { mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_WARNING, "Last upload interrupted. Restarting device..."); // Send 'jump to bootloader comman...
java
private void resetAndRestart(@NonNull final BluetoothGatt gatt, @NonNull final Intent intent) throws DfuException, DeviceDisconnectedException, UploadAbortedException { mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_WARNING, "Last upload interrupted. Restarting device..."); // Send 'jump to bootloader comman...
[ "private", "void", "resetAndRestart", "(", "@", "NonNull", "final", "BluetoothGatt", "gatt", ",", "@", "NonNull", "final", "Intent", "intent", ")", "throws", "DfuException", ",", "DeviceDisconnectedException", ",", "UploadAbortedException", "{", "mService", ".", "se...
Sends Reset command to the target device to reset its state and restarts the DFU Service that will start again. @param gatt the GATT device. @param intent intent used to start the service. @throws DeviceDisconnectedException Thrown when the device will disconnect in the middle of the transmission. @throws DfuException...
[ "Sends", "Reset", "command", "to", "the", "target", "device", "to", "reset", "its", "state", "and", "restarts", "the", "DFU", "Service", "that", "will", "start", "again", "." ]
ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/LegacyDfuImpl.java#L720-L744
48,418
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObjectRef.java
JsiiObjectRef.parse
public static JsiiObjectRef parse(final JsonNode objRef) { if (!objRef.has(TOKEN_REF)) { throw new JsiiException("Malformed object reference. Expecting " + TOKEN_REF); } return new JsiiObjectRef(objRef.get(TOKEN_REF).textValue(), objRef); }
java
public static JsiiObjectRef parse(final JsonNode objRef) { if (!objRef.has(TOKEN_REF)) { throw new JsiiException("Malformed object reference. Expecting " + TOKEN_REF); } return new JsiiObjectRef(objRef.get(TOKEN_REF).textValue(), objRef); }
[ "public", "static", "JsiiObjectRef", "parse", "(", "final", "JsonNode", "objRef", ")", "{", "if", "(", "!", "objRef", ".", "has", "(", "TOKEN_REF", ")", ")", "{", "throw", "new", "JsiiException", "(", "\"Malformed object reference. Expecting \"", "+", "TOKEN_REF...
Creates an object reference. @param objRef The object reference. @return A {@link JsiiObjectRef} object.
[ "Creates", "an", "object", "reference", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObjectRef.java#L50-L56
48,419
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObjectRef.java
JsiiObjectRef.fromObjId
public static JsiiObjectRef fromObjId(final String objId) { ObjectNode node = JsonNodeFactory.instance.objectNode(); node.put(TOKEN_REF, objId); return new JsiiObjectRef(objId, node); }
java
public static JsiiObjectRef fromObjId(final String objId) { ObjectNode node = JsonNodeFactory.instance.objectNode(); node.put(TOKEN_REF, objId); return new JsiiObjectRef(objId, node); }
[ "public", "static", "JsiiObjectRef", "fromObjId", "(", "final", "String", "objId", ")", "{", "ObjectNode", "node", "=", "JsonNodeFactory", ".", "instance", ".", "objectNode", "(", ")", ";", "node", ".", "put", "(", "TOKEN_REF", ",", "objId", ")", ";", "ret...
Creates an object ref from an object ID. @param objId Object ID. @return The new object ref.
[ "Creates", "an", "object", "ref", "from", "an", "object", "ID", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObjectRef.java#L63-L67
48,420
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java
JsiiClient.loadModule
public void loadModule(final JsiiModule module) { try { String tarball = extractResource(module.getModuleClass(), module.getBundleResourceName(), null); ObjectNode req = makeRequest("load"); req.put("tarball", tarball); req.put("name", module.getModuleName()); ...
java
public void loadModule(final JsiiModule module) { try { String tarball = extractResource(module.getModuleClass(), module.getBundleResourceName(), null); ObjectNode req = makeRequest("load"); req.put("tarball", tarball); req.put("name", module.getModuleName()); ...
[ "public", "void", "loadModule", "(", "final", "JsiiModule", "module", ")", "{", "try", "{", "String", "tarball", "=", "extractResource", "(", "module", ".", "getModuleClass", "(", ")", ",", "module", ".", "getBundleResourceName", "(", ")", ",", "null", ")", ...
Loads a JavaScript module into the remote sandbox. @param module The module to load
[ "Loads", "a", "JavaScript", "module", "into", "the", "remote", "sandbox", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L46-L57
48,421
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java
JsiiClient.deleteObject
public void deleteObject(final JsiiObjectRef objRef) { ObjectNode req = makeRequest("del", objRef); this.runtime.requestResponse(req); }
java
public void deleteObject(final JsiiObjectRef objRef) { ObjectNode req = makeRequest("del", objRef); this.runtime.requestResponse(req); }
[ "public", "void", "deleteObject", "(", "final", "JsiiObjectRef", "objRef", ")", "{", "ObjectNode", "req", "=", "makeRequest", "(", "\"del\"", ",", "objRef", ")", ";", "this", ".", "runtime", ".", "requestResponse", "(", "req", ")", ";", "}" ]
Deletes a remote object. @param objRef The object reference.
[ "Deletes", "a", "remote", "object", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L98-L101
48,422
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java
JsiiClient.getPropertyValue
public JsonNode getPropertyValue(final JsiiObjectRef objRef, final String property) { ObjectNode req = makeRequest("get", objRef); req.put("property", property); return this.runtime.requestResponse(req).get("value"); }
java
public JsonNode getPropertyValue(final JsiiObjectRef objRef, final String property) { ObjectNode req = makeRequest("get", objRef); req.put("property", property); return this.runtime.requestResponse(req).get("value"); }
[ "public", "JsonNode", "getPropertyValue", "(", "final", "JsiiObjectRef", "objRef", ",", "final", "String", "property", ")", "{", "ObjectNode", "req", "=", "makeRequest", "(", "\"get\"", ",", "objRef", ")", ";", "req", ".", "put", "(", "\"property\"", ",", "p...
Gets a value for a property from a remote object. @param objRef The remote object reference. @param property The property name. @return The value of the property.
[ "Gets", "a", "value", "for", "a", "property", "from", "a", "remote", "object", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L109-L114
48,423
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java
JsiiClient.setPropertyValue
public void setPropertyValue(final JsiiObjectRef objRef, final String property, final JsonNode value) { ObjectNode req = makeRequest("set", objRef); req.put("property", property); req.set("value", value); this.runtime.requestResponse(req); }
java
public void setPropertyValue(final JsiiObjectRef objRef, final String property, final JsonNode value) { ObjectNode req = makeRequest("set", objRef); req.put("property", property); req.set("value", value); this.runtime.requestResponse(req); }
[ "public", "void", "setPropertyValue", "(", "final", "JsiiObjectRef", "objRef", ",", "final", "String", "property", ",", "final", "JsonNode", "value", ")", "{", "ObjectNode", "req", "=", "makeRequest", "(", "\"set\"", ",", "objRef", ")", ";", "req", ".", "put...
Sets a value for a property in a remote object. @param objRef The remote object reference. @param property The name of the property. @param value The new property value.
[ "Sets", "a", "value", "for", "a", "property", "in", "a", "remote", "object", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L122-L128
48,424
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java
JsiiClient.getStaticPropertyValue
public JsonNode getStaticPropertyValue(final String fqn, final String property) { ObjectNode req = makeRequest("sget"); req.put("fqn", fqn); req.put("property", property); return this.runtime.requestResponse(req).get("value"); }
java
public JsonNode getStaticPropertyValue(final String fqn, final String property) { ObjectNode req = makeRequest("sget"); req.put("fqn", fqn); req.put("property", property); return this.runtime.requestResponse(req).get("value"); }
[ "public", "JsonNode", "getStaticPropertyValue", "(", "final", "String", "fqn", ",", "final", "String", "property", ")", "{", "ObjectNode", "req", "=", "makeRequest", "(", "\"sget\"", ")", ";", "req", ".", "put", "(", "\"fqn\"", ",", "fqn", ")", ";", "req",...
Gets a value of a static property. @param fqn The FQN of the class @param property The name of the static property @return The value of the static property
[ "Gets", "a", "value", "of", "a", "static", "property", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L136-L141
48,425
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java
JsiiClient.setStaticPropertyValue
public void setStaticPropertyValue(final String fqn, final String property, final JsonNode value) { ObjectNode req = makeRequest("sset"); req.put("fqn", fqn); req.put("property", property); req.set("value", value); this.runtime.requestResponse(req); }
java
public void setStaticPropertyValue(final String fqn, final String property, final JsonNode value) { ObjectNode req = makeRequest("sset"); req.put("fqn", fqn); req.put("property", property); req.set("value", value); this.runtime.requestResponse(req); }
[ "public", "void", "setStaticPropertyValue", "(", "final", "String", "fqn", ",", "final", "String", "property", ",", "final", "JsonNode", "value", ")", "{", "ObjectNode", "req", "=", "makeRequest", "(", "\"sset\"", ")", ";", "req", ".", "put", "(", "\"fqn\"",...
Sets the value of a mutable static property. @param fqn The FQN of the class @param property The property name @param value The new value
[ "Sets", "the", "value", "of", "a", "mutable", "static", "property", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L149-L155
48,426
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java
JsiiClient.callStaticMethod
public JsonNode callStaticMethod(final String fqn, final String method, final ArrayNode args) { ObjectNode req = makeRequest("sinvoke"); req.put("fqn", fqn); req.put("method", method); req.set("args", args); JsonNode resp = this.runtime.requestResponse(req); return resp.g...
java
public JsonNode callStaticMethod(final String fqn, final String method, final ArrayNode args) { ObjectNode req = makeRequest("sinvoke"); req.put("fqn", fqn); req.put("method", method); req.set("args", args); JsonNode resp = this.runtime.requestResponse(req); return resp.g...
[ "public", "JsonNode", "callStaticMethod", "(", "final", "String", "fqn", ",", "final", "String", "method", ",", "final", "ArrayNode", "args", ")", "{", "ObjectNode", "req", "=", "makeRequest", "(", "\"sinvoke\"", ")", ";", "req", ".", "put", "(", "\"fqn\"", ...
Invokes a static method. @param fqn The FQN of the class. @param method The method name. @param args The method arguments. @return The return value.
[ "Invokes", "a", "static", "method", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L164-L171
48,427
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java
JsiiClient.callMethod
public JsonNode callMethod(final JsiiObjectRef objRef, final String method, final ArrayNode args) { ObjectNode req = makeRequest("invoke", objRef); req.put("method", method); req.set("args", args); JsonNode resp = this.runtime.requestResponse(req); return resp.get("result"); ...
java
public JsonNode callMethod(final JsiiObjectRef objRef, final String method, final ArrayNode args) { ObjectNode req = makeRequest("invoke", objRef); req.put("method", method); req.set("args", args); JsonNode resp = this.runtime.requestResponse(req); return resp.get("result"); ...
[ "public", "JsonNode", "callMethod", "(", "final", "JsiiObjectRef", "objRef", ",", "final", "String", "method", ",", "final", "ArrayNode", "args", ")", "{", "ObjectNode", "req", "=", "makeRequest", "(", "\"invoke\"", ",", "objRef", ")", ";", "req", ".", "put"...
Calls a method on a remote object. @param objRef The remote object reference. @param method The name of the method. @param args Method arguments. @return The return value of the method.
[ "Calls", "a", "method", "on", "a", "remote", "object", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L180-L187
48,428
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java
JsiiClient.endAsyncMethod
public JsonNode endAsyncMethod(final JsiiPromise promise) { ObjectNode req = makeRequest("end"); req.put("promiseid", promise.getPromiseId()); JsonNode resp = this.runtime.requestResponse(req); if (resp == null) { return null; // result is null } return resp.g...
java
public JsonNode endAsyncMethod(final JsiiPromise promise) { ObjectNode req = makeRequest("end"); req.put("promiseid", promise.getPromiseId()); JsonNode resp = this.runtime.requestResponse(req); if (resp == null) { return null; // result is null } return resp.g...
[ "public", "JsonNode", "endAsyncMethod", "(", "final", "JsiiPromise", "promise", ")", "{", "ObjectNode", "req", "=", "makeRequest", "(", "\"end\"", ")", ";", "req", ".", "put", "(", "\"promiseid\"", ",", "promise", ".", "getPromiseId", "(", ")", ")", ";", "...
Ends the execution of an async method. @param promise The promise returned by beginAsyncMethod. @return The method return value.
[ "Ends", "the", "execution", "of", "an", "async", "method", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L210-L218
48,429
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java
JsiiClient.pendingCallbacks
public List<Callback> pendingCallbacks() { ObjectNode req = makeRequest("callbacks"); JsonNode resp = this.runtime.requestResponse(req); JsonNode callbacksResp = resp.get("callbacks"); if (callbacksResp == null || !callbacksResp.isArray()) { throw new JsiiException("Expectin...
java
public List<Callback> pendingCallbacks() { ObjectNode req = makeRequest("callbacks"); JsonNode resp = this.runtime.requestResponse(req); JsonNode callbacksResp = resp.get("callbacks"); if (callbacksResp == null || !callbacksResp.isArray()) { throw new JsiiException("Expectin...
[ "public", "List", "<", "Callback", ">", "pendingCallbacks", "(", ")", "{", "ObjectNode", "req", "=", "makeRequest", "(", "\"callbacks\"", ")", ";", "JsonNode", "resp", "=", "this", ".", "runtime", ".", "requestResponse", "(", "req", ")", ";", "JsonNode", "...
Dequques all the currently pending callbacks. @return A list of all pending callbacks.
[ "Dequques", "all", "the", "currently", "pending", "callbacks", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L224-L241
48,430
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java
JsiiClient.completeCallback
public void completeCallback(final Callback callback, final String error, final JsonNode result) { ObjectNode req = makeRequest("complete"); req.put("cbid", callback.getCbid()); req.put("err", error); req.set("result", result); this.runtime.requestResponse(req); }
java
public void completeCallback(final Callback callback, final String error, final JsonNode result) { ObjectNode req = makeRequest("complete"); req.put("cbid", callback.getCbid()); req.put("err", error); req.set("result", result); this.runtime.requestResponse(req); }
[ "public", "void", "completeCallback", "(", "final", "Callback", "callback", ",", "final", "String", "error", ",", "final", "JsonNode", "result", ")", "{", "ObjectNode", "req", "=", "makeRequest", "(", "\"complete\"", ")", ";", "req", ".", "put", "(", "\"cbid...
Completes a callback. @param callback The callback to complete. @param error Error information (or null). @param result Result (or null).
[ "Completes", "a", "callback", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L249-L256
48,431
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java
JsiiClient.getModuleNames
public JsonNode getModuleNames(final String moduleName) { ObjectNode req = makeRequest("naming"); req.put("assembly", moduleName); JsonNode resp = this.runtime.requestResponse(req); return resp.get("naming"); }
java
public JsonNode getModuleNames(final String moduleName) { ObjectNode req = makeRequest("naming"); req.put("assembly", moduleName); JsonNode resp = this.runtime.requestResponse(req); return resp.get("naming"); }
[ "public", "JsonNode", "getModuleNames", "(", "final", "String", "moduleName", ")", "{", "ObjectNode", "req", "=", "makeRequest", "(", "\"naming\"", ")", ";", "req", ".", "put", "(", "\"assembly\"", ",", "moduleName", ")", ";", "JsonNode", "resp", "=", "this"...
Returns all names for a jsii module. @param moduleName The name of the module. @return The result (map from "lang" to language configuration).
[ "Returns", "all", "names", "for", "a", "jsii", "module", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L263-L269
48,432
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java
JsiiClient.makeRequest
private ObjectNode makeRequest(final String api) { ObjectNode req = JSON.objectNode(); req.put("api", api); return req; }
java
private ObjectNode makeRequest(final String api) { ObjectNode req = JSON.objectNode(); req.put("api", api); return req; }
[ "private", "ObjectNode", "makeRequest", "(", "final", "String", "api", ")", "{", "ObjectNode", "req", "=", "JSON", ".", "objectNode", "(", ")", ";", "req", ".", "put", "(", "\"api\"", ",", "api", ")", ";", "return", "req", ";", "}" ]
Returns a request object for a specific API call. @param api The api call (i.e "create", "del", "load", ....) @return A JSON object
[ "Returns", "a", "request", "object", "for", "a", "specific", "API", "call", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L276-L280
48,433
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java
JsiiClient.makeRequest
private ObjectNode makeRequest(final String api, final JsiiObjectRef objRef) { ObjectNode req = makeRequest(api); req.set("objref", objRef.toJson()); return req; }
java
private ObjectNode makeRequest(final String api, final JsiiObjectRef objRef) { ObjectNode req = makeRequest(api); req.set("objref", objRef.toJson()); return req; }
[ "private", "ObjectNode", "makeRequest", "(", "final", "String", "api", ",", "final", "JsiiObjectRef", "objRef", ")", "{", "ObjectNode", "req", "=", "makeRequest", "(", "api", ")", ";", "req", ".", "set", "(", "\"objref\"", ",", "objRef", ".", "toJson", "("...
Returns a new request object for a specific API and a specific object. @param api The API call @param objRef The object reference @return A JSON object
[ "Returns", "a", "new", "request", "object", "for", "a", "specific", "API", "and", "a", "specific", "object", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L288-L292
48,434
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java
JsiiRuntime.requestResponse
JsonNode requestResponse(final JsonNode request) { try { // write request String str = request.toString(); this.stdin.write(str + "\n"); this.stdin.flush(); // read response JsonNode resp = readNextResponse(); // throw if thi...
java
JsonNode requestResponse(final JsonNode request) { try { // write request String str = request.toString(); this.stdin.write(str + "\n"); this.stdin.flush(); // read response JsonNode resp = readNextResponse(); // throw if thi...
[ "JsonNode", "requestResponse", "(", "final", "JsonNode", "request", ")", "{", "try", "{", "// write request", "String", "str", "=", "request", ".", "toString", "(", ")", ";", "this", ".", "stdin", ".", "write", "(", "str", "+", "\"\\n\"", ")", ";", "this...
The main API of this class. Sends a JSON request to jsii-runtime and returns the JSON response. @param request The JSON request @return The JSON response @throws JsiiException If the runtime returns an error response.
[ "The", "main", "API", "of", "this", "class", ".", "Sends", "a", "JSON", "request", "to", "jsii", "-", "runtime", "and", "returns", "the", "JSON", "response", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java#L71-L98
48,435
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java
JsiiRuntime.processErrorResponse
private JsonNode processErrorResponse(final JsonNode resp) { String errorMessage = resp.get("error").asText(); if (resp.has("stack")) { errorMessage += "\n" + resp.get("stack").asText(); } throw new JsiiException(errorMessage); }
java
private JsonNode processErrorResponse(final JsonNode resp) { String errorMessage = resp.get("error").asText(); if (resp.has("stack")) { errorMessage += "\n" + resp.get("stack").asText(); } throw new JsiiException(errorMessage); }
[ "private", "JsonNode", "processErrorResponse", "(", "final", "JsonNode", "resp", ")", "{", "String", "errorMessage", "=", "resp", ".", "get", "(", "\"error\"", ")", ".", "asText", "(", ")", ";", "if", "(", "resp", ".", "has", "(", "\"stack\"", ")", ")", ...
Handles an "error" response by extracting the message and stack trace and throwing a JsiiException. @param resp The response @return Never
[ "Handles", "an", "error", "response", "by", "extracting", "the", "message", "and", "stack", "trace", "and", "throwing", "a", "JsiiException", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java#L106-L113
48,436
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java
JsiiRuntime.processCallbackResponse
private JsonNode processCallbackResponse(final JsonNode resp) { if (this.callbackHandler == null) { throw new JsiiException("Cannot process callback since callbackHandler was not set"); } Callback callback = JsiiObjectMapper.treeToValue(resp.get("callback"), Callback.class); ...
java
private JsonNode processCallbackResponse(final JsonNode resp) { if (this.callbackHandler == null) { throw new JsiiException("Cannot process callback since callbackHandler was not set"); } Callback callback = JsiiObjectMapper.treeToValue(resp.get("callback"), Callback.class); ...
[ "private", "JsonNode", "processCallbackResponse", "(", "final", "JsonNode", "resp", ")", "{", "if", "(", "this", ".", "callbackHandler", "==", "null", ")", "{", "throw", "new", "JsiiException", "(", "\"Cannot process callback since callbackHandler was not set\"", ")", ...
Processes a "callback" response, which is a request to invoke a synchronous callback and send back the result. @param resp The response. @return The next response in the req/res chain.
[ "Processes", "a", "callback", "response", "which", "is", "a", "request", "to", "invoke", "a", "synchronous", "callback", "and", "send", "back", "the", "result", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java#L121-L153
48,437
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java
JsiiRuntime.startRuntimeIfNeeded
private void startRuntimeIfNeeded() { if (childProcess != null) { return; } // If JSII_DEBUG is set, enable traces. String jsiiDebug = System.getenv("JSII_DEBUG"); if (jsiiDebug != null && !jsiiDebug.isEmpty() && !jsiiDebug.equalsIgnor...
java
private void startRuntimeIfNeeded() { if (childProcess != null) { return; } // If JSII_DEBUG is set, enable traces. String jsiiDebug = System.getenv("JSII_DEBUG"); if (jsiiDebug != null && !jsiiDebug.isEmpty() && !jsiiDebug.equalsIgnor...
[ "private", "void", "startRuntimeIfNeeded", "(", ")", "{", "if", "(", "childProcess", "!=", "null", ")", "{", "return", ";", "}", "// If JSII_DEBUG is set, enable traces.", "String", "jsiiDebug", "=", "System", ".", "getenv", "(", "\"JSII_DEBUG\"", ")", ";", "if"...
Starts jsii-server as a child process if it is not already started.
[ "Starts", "jsii", "-", "server", "as", "a", "child", "process", "if", "it", "is", "not", "already", "started", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java#L184-L245
48,438
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java
JsiiRuntime.handshake
private void handshake() { JsonNode helloResponse = this.readNextResponse(); if (!helloResponse.has("hello")) { throw new JsiiException("Expecting 'hello' message from jsii-runtime"); } String runtimeVersion = helloResponse.get("hello").asText(); assertVersionCompat...
java
private void handshake() { JsonNode helloResponse = this.readNextResponse(); if (!helloResponse.has("hello")) { throw new JsiiException("Expecting 'hello' message from jsii-runtime"); } String runtimeVersion = helloResponse.get("hello").asText(); assertVersionCompat...
[ "private", "void", "handshake", "(", ")", "{", "JsonNode", "helloResponse", "=", "this", ".", "readNextResponse", "(", ")", ";", "if", "(", "!", "helloResponse", ".", "has", "(", "\"hello\"", ")", ")", "{", "throw", "new", "JsiiException", "(", "\"Expectin...
Verifies the "hello" message and runtime version compatibility. In the meantime, we require full version compatibility, but we should use semver eventually.
[ "Verifies", "the", "hello", "message", "and", "runtime", "version", "compatibility", ".", "In", "the", "meantime", "we", "require", "full", "version", "compatibility", "but", "we", "should", "use", "semver", "eventually", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java#L251-L260
48,439
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java
JsiiRuntime.readNextResponse
JsonNode readNextResponse() { try { String responseLine = this.stdout.readLine(); if (responseLine == null) { String error = this.stderr.lines().collect(Collectors.joining("\n\t")); throw new JsiiException("Child process exited unexpectedly: " + error); ...
java
JsonNode readNextResponse() { try { String responseLine = this.stdout.readLine(); if (responseLine == null) { String error = this.stderr.lines().collect(Collectors.joining("\n\t")); throw new JsiiException("Child process exited unexpectedly: " + error); ...
[ "JsonNode", "readNextResponse", "(", ")", "{", "try", "{", "String", "responseLine", "=", "this", ".", "stdout", ".", "readLine", "(", ")", ";", "if", "(", "responseLine", "==", "null", ")", "{", "String", "error", "=", "this", ".", "stderr", ".", "lin...
Reads the next response from STDOUT of the child process. @return The parsed JSON response. @throws JsiiException if we couldn't parse the response.
[ "Reads", "the", "next", "response", "from", "STDOUT", "of", "the", "child", "process", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java#L267-L278
48,440
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java
JsiiRuntime.startPipeErrorStreamThread
private void startPipeErrorStreamThread() { Thread daemon = new Thread(() -> { while (true) { try { String line = stderr.readLine(); System.err.println(line); if (line == null) { break; ...
java
private void startPipeErrorStreamThread() { Thread daemon = new Thread(() -> { while (true) { try { String line = stderr.readLine(); System.err.println(line); if (line == null) { break; ...
[ "private", "void", "startPipeErrorStreamThread", "(", ")", "{", "Thread", "daemon", "=", "new", "Thread", "(", "(", ")", "->", "{", "while", "(", "true", ")", "{", "try", "{", "String", "line", "=", "stderr", ".", "readLine", "(", ")", ";", "System", ...
Starts a thread that pipes STDERR from the child process to our STDERR.
[ "Starts", "a", "thread", "that", "pipes", "STDERR", "from", "the", "child", "process", "to", "our", "STDERR", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java#L283-L300
48,441
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java
JsiiRuntime.assertVersionCompatible
static void assertVersionCompatible(final String expectedVersion, final String actualVersion) { final String shortActualVersion = actualVersion.replaceAll(VERSION_BUILD_PART_REGEX, ""); final String shortExpectedVersion = expectedVersion.replaceAll(VERSION_BUILD_PART_REGEX, ""); if (shortExpecte...
java
static void assertVersionCompatible(final String expectedVersion, final String actualVersion) { final String shortActualVersion = actualVersion.replaceAll(VERSION_BUILD_PART_REGEX, ""); final String shortExpectedVersion = expectedVersion.replaceAll(VERSION_BUILD_PART_REGEX, ""); if (shortExpecte...
[ "static", "void", "assertVersionCompatible", "(", "final", "String", "expectedVersion", ",", "final", "String", "actualVersion", ")", "{", "final", "String", "shortActualVersion", "=", "actualVersion", ".", "replaceAll", "(", "VERSION_BUILD_PART_REGEX", ",", "\"\"", "...
Asserts that a peer runtimeVersion is compatible with this Java runtime version, which means they share the same version components, with the possible exception of the build number. @param expectedVersion The version this client expects from the runtime @param actualVersion The actual version the runtime reports @t...
[ "Asserts", "that", "a", "peer", "runtimeVersion", "is", "compatible", "with", "this", "Java", "runtime", "version", "which", "means", "they", "share", "the", "same", "version", "components", "with", "the", "possible", "exception", "of", "the", "build", "number",...
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java#L330-L338
48,442
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java
JsiiRuntime.prepareBundledRuntime
private String prepareBundledRuntime() { try { String directory = Files.createTempDirectory("jsii-java-runtime").toString(); String entrypoint = extractResource(getClass(), "jsii-runtime.js", directory); extractResource(getClass(), "jsii-runtime.js.map", directory); ...
java
private String prepareBundledRuntime() { try { String directory = Files.createTempDirectory("jsii-java-runtime").toString(); String entrypoint = extractResource(getClass(), "jsii-runtime.js", directory); extractResource(getClass(), "jsii-runtime.js.map", directory); ...
[ "private", "String", "prepareBundledRuntime", "(", ")", "{", "try", "{", "String", "directory", "=", "Files", ".", "createTempDirectory", "(", "\"jsii-java-runtime\"", ")", ".", "toString", "(", ")", ";", "String", "entrypoint", "=", "extractResource", "(", "get...
Extracts all files needed for jsii-runtime.js from JAR into a temp directory. @return The full path for jsii-runtime.js
[ "Extracts", "all", "files", "needed", "for", "jsii", "-", "runtime", ".", "js", "from", "JAR", "into", "a", "temp", "directory", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiRuntime.java#L344-L355
48,443
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.loadModule
public void loadModule(final Class<? extends JsiiModule> moduleClass) { if (!JsiiModule.class.isAssignableFrom(moduleClass)) { throw new JsiiException("Invalid module class " + moduleClass.getName() + ". It must be derived from JsiiModule"); } ...
java
public void loadModule(final Class<? extends JsiiModule> moduleClass) { if (!JsiiModule.class.isAssignableFrom(moduleClass)) { throw new JsiiException("Invalid module class " + moduleClass.getName() + ". It must be derived from JsiiModule"); } ...
[ "public", "void", "loadModule", "(", "final", "Class", "<", "?", "extends", "JsiiModule", ">", "moduleClass", ")", "{", "if", "(", "!", "JsiiModule", ".", "class", ".", "isAssignableFrom", "(", "moduleClass", ")", ")", "{", "throw", "new", "JsiiException", ...
Loads a JavaScript module into the remote jsii-server. No-op if the module is already loaded. @param moduleClass The jsii module class.
[ "Loads", "a", "JavaScript", "module", "into", "the", "remote", "jsii", "-", "server", ".", "No", "-", "op", "if", "the", "module", "is", "already", "loaded", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L82-L109
48,444
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.registerObject
public void registerObject(final JsiiObjectRef objRef, final Object obj) { if (obj instanceof JsiiObject) { ((JsiiObject) obj).setObjRef(objRef); } this.objects.put(objRef.getObjId(), obj); }
java
public void registerObject(final JsiiObjectRef objRef, final Object obj) { if (obj instanceof JsiiObject) { ((JsiiObject) obj).setObjRef(objRef); } this.objects.put(objRef.getObjId(), obj); }
[ "public", "void", "registerObject", "(", "final", "JsiiObjectRef", "objRef", ",", "final", "Object", "obj", ")", "{", "if", "(", "obj", "instanceof", "JsiiObject", ")", "{", "(", "(", "JsiiObject", ")", "obj", ")", ".", "setObjRef", "(", "objRef", ")", "...
Registers an object into the object cache. @param objRef The object reference. @param obj The object to register.
[ "Registers", "an", "object", "into", "the", "object", "cache", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L116-L121
48,445
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.nativeFromObjRef
public Object nativeFromObjRef(final JsiiObjectRef objRef) { Object obj = this.objects.get(objRef.getObjId()); if (obj == null) { obj = createNative(objRef.getFqn()); this.registerObject(objRef, obj); } return obj; }
java
public Object nativeFromObjRef(final JsiiObjectRef objRef) { Object obj = this.objects.get(objRef.getObjId()); if (obj == null) { obj = createNative(objRef.getFqn()); this.registerObject(objRef, obj); } return obj; }
[ "public", "Object", "nativeFromObjRef", "(", "final", "JsiiObjectRef", "objRef", ")", "{", "Object", "obj", "=", "this", ".", "objects", ".", "get", "(", "objRef", ".", "getObjId", "(", ")", ")", ";", "if", "(", "obj", "==", "null", ")", "{", "obj", ...
Returns the native java object for a given jsii object reference. If it already exists in our native objects cache, we return it. If we can't find the object in the cache, it means it was created in javascript-land, so we need to create a native wrapper with the correct type and add it to cache. @param objRef The obj...
[ "Returns", "the", "native", "java", "object", "for", "a", "given", "jsii", "object", "reference", ".", "If", "it", "already", "exists", "in", "our", "native", "objects", "cache", "we", "return", "it", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L133-L140
48,446
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.nativeToObjRef
public JsiiObjectRef nativeToObjRef(final Object nativeObject) { if (nativeObject instanceof JsiiObject) { return ((JsiiObject) nativeObject).getObjRef(); } for (String objid : this.objects.keySet()) { Object obj = this.objects.get(objid); if (obj == nativeOb...
java
public JsiiObjectRef nativeToObjRef(final Object nativeObject) { if (nativeObject instanceof JsiiObject) { return ((JsiiObject) nativeObject).getObjRef(); } for (String objid : this.objects.keySet()) { Object obj = this.objects.get(objid); if (obj == nativeOb...
[ "public", "JsiiObjectRef", "nativeToObjRef", "(", "final", "Object", "nativeObject", ")", "{", "if", "(", "nativeObject", "instanceof", "JsiiObject", ")", "{", "return", "(", "(", "JsiiObject", ")", "nativeObject", ")", ".", "getObjRef", "(", ")", ";", "}", ...
Returns the jsii object reference given a native object. If the native object extends JsiiObject (directly or indirectly), we can grab the objref from within the JsiiObject. Otherwise, we have a "pure" native object on our hands, so we will first perform a reverse lookup in the objects cache to see if it was already ...
[ "Returns", "the", "jsii", "object", "reference", "given", "a", "native", "object", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L155-L169
48,447
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.getObject
public Object getObject(final JsiiObjectRef objRef) { Object obj = this.objects.get(objRef.getObjId()); if (obj == null) { throw new JsiiException("Cannot find jsii object: " + objRef.getObjId()); } return obj; }
java
public Object getObject(final JsiiObjectRef objRef) { Object obj = this.objects.get(objRef.getObjId()); if (obj == null) { throw new JsiiException("Cannot find jsii object: " + objRef.getObjId()); } return obj; }
[ "public", "Object", "getObject", "(", "final", "JsiiObjectRef", "objRef", ")", "{", "Object", "obj", "=", "this", ".", "objects", ".", "get", "(", "objRef", ".", "getObjId", "(", ")", ")", ";", "if", "(", "obj", "==", "null", ")", "{", "throw", "new"...
Gets an object by reference. Throws if the object cannot be found. @param objRef The object reference @return a JsiiObject @throws JsiiException If the object is not found.
[ "Gets", "an", "object", "by", "reference", ".", "Throws", "if", "the", "object", "cannot", "be", "found", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L178-L184
48,448
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.resolveJavaClass
private Class<?> resolveJavaClass(final String fqn) throws ClassNotFoundException { String[] parts = fqn.split("\\."); if (parts.length < 2) { throw new JsiiException("Malformed FQN: " + fqn); } String moduleName = parts[0]; JsonNode names = this.getClient().getModu...
java
private Class<?> resolveJavaClass(final String fqn) throws ClassNotFoundException { String[] parts = fqn.split("\\."); if (parts.length < 2) { throw new JsiiException("Malformed FQN: " + fqn); } String moduleName = parts[0]; JsonNode names = this.getClient().getModu...
[ "private", "Class", "<", "?", ">", "resolveJavaClass", "(", "final", "String", "fqn", ")", "throws", "ClassNotFoundException", "{", "String", "[", "]", "parts", "=", "fqn", ".", "split", "(", "\"\\\\.\"", ")", ";", "if", "(", "parts", ".", "length", "<",...
Given a jsii FQN, returns the Java class for it. @param fqn The FQN. @return The Java class name.
[ "Given", "a", "jsii", "FQN", "returns", "the", "Java", "class", "for", "it", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L203-L221
48,449
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.createNative
private JsiiObject createNative(final String fqn) { try { Class<?> klass = resolveJavaClass(fqn); if (klass.isInterface() || Modifier.isAbstract(klass.getModifiers())) { // "$" is used to represent inner classes in Java klass = Class.forName(klass.getCanon...
java
private JsiiObject createNative(final String fqn) { try { Class<?> klass = resolveJavaClass(fqn); if (klass.isInterface() || Modifier.isAbstract(klass.getModifiers())) { // "$" is used to represent inner classes in Java klass = Class.forName(klass.getCanon...
[ "private", "JsiiObject", "createNative", "(", "final", "String", "fqn", ")", "{", "try", "{", "Class", "<", "?", ">", "klass", "=", "resolveJavaClass", "(", "fqn", ")", ";", "if", "(", "klass", ".", "isInterface", "(", ")", "||", "Modifier", ".", "isAb...
Given a jsii FQN, instantiates a Java JsiiObject. NOTE: if a the Java class cannot be found, we will simply return a {@link JsiiObject}. @param fqn The jsii FQN of the type @return An object derived from JsiiObject.
[ "Given", "a", "jsii", "FQN", "instantiates", "a", "Java", "JsiiObject", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L231-L257
48,450
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.processAllPendingCallbacks
public void processAllPendingCallbacks() { while (true) { List<Callback> callbacks = this.getClient().pendingCallbacks(); if (callbacks.size() == 0) { break; } callbacks.forEach(this::processCallback); } }
java
public void processAllPendingCallbacks() { while (true) { List<Callback> callbacks = this.getClient().pendingCallbacks(); if (callbacks.size() == 0) { break; } callbacks.forEach(this::processCallback); } }
[ "public", "void", "processAllPendingCallbacks", "(", ")", "{", "while", "(", "true", ")", "{", "List", "<", "Callback", ">", "callbacks", "=", "this", ".", "getClient", "(", ")", ".", "pendingCallbacks", "(", ")", ";", "if", "(", "callbacks", ".", "size"...
Dequeues and processes pending jsii callbacks until there are no more callbacks to process.
[ "Dequeues", "and", "processes", "pending", "jsii", "callbacks", "until", "there", "are", "no", "more", "callbacks", "to", "process", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L284-L293
48,451
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.invokeCallbackGet
private JsonNode invokeCallbackGet(final GetRequest req) { Object obj = this.getObject(req.getObjref()); String methodName = javaScriptPropertyToJavaPropertyName("get", req.getProperty()); try { Method getter = obj.getClass().getMethod(methodName); return JsiiObjectMapper...
java
private JsonNode invokeCallbackGet(final GetRequest req) { Object obj = this.getObject(req.getObjref()); String methodName = javaScriptPropertyToJavaPropertyName("get", req.getProperty()); try { Method getter = obj.getClass().getMethod(methodName); return JsiiObjectMapper...
[ "private", "JsonNode", "invokeCallbackGet", "(", "final", "GetRequest", "req", ")", "{", "Object", "obj", "=", "this", ".", "getObject", "(", "req", ".", "getObjref", "(", ")", ")", ";", "String", "methodName", "=", "javaScriptPropertyToJavaPropertyName", "(", ...
Invokes an override for a property getter. @param req The get request @return The override's return value.
[ "Invokes", "an", "override", "for", "a", "property", "getter", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L319-L328
48,452
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.invokeCallbackSet
private JsonNode invokeCallbackSet(final SetRequest req) { final Object obj = this.getObject(req.getObjref()); String setterMethodName = javaScriptPropertyToJavaPropertyName("set", req.getProperty()); Method setter = null; for (Method method: obj.getClass().getMethods()) { i...
java
private JsonNode invokeCallbackSet(final SetRequest req) { final Object obj = this.getObject(req.getObjref()); String setterMethodName = javaScriptPropertyToJavaPropertyName("set", req.getProperty()); Method setter = null; for (Method method: obj.getClass().getMethods()) { i...
[ "private", "JsonNode", "invokeCallbackSet", "(", "final", "SetRequest", "req", ")", "{", "final", "Object", "obj", "=", "this", ".", "getObject", "(", "req", ".", "getObjref", "(", ")", ")", ";", "String", "setterMethodName", "=", "javaScriptPropertyToJavaProper...
Invokes an override for a property setter. @param req The set request @return The setter return value (an empty object)
[ "Invokes", "an", "override", "for", "a", "property", "setter", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L335-L353
48,453
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.invokeCallbackMethod
private JsonNode invokeCallbackMethod(final InvokeRequest req, final String cookie) { Object obj = this.getObject(req.getObjref()); Method method = this.findCallbackMethod(obj.getClass(), cookie); final Class<?>[] argTypes = method.getParameterTypes(); final Object[] args = new Object[a...
java
private JsonNode invokeCallbackMethod(final InvokeRequest req, final String cookie) { Object obj = this.getObject(req.getObjref()); Method method = this.findCallbackMethod(obj.getClass(), cookie); final Class<?>[] argTypes = method.getParameterTypes(); final Object[] args = new Object[a...
[ "private", "JsonNode", "invokeCallbackMethod", "(", "final", "InvokeRequest", "req", ",", "final", "String", "cookie", ")", "{", "Object", "obj", "=", "this", ".", "getObject", "(", "req", ".", "getObjref", "(", ")", ")", ";", "Method", "method", "=", "thi...
Invokes an override for a method. @param req The request @param cookie The cookie @return The method's return value
[ "Invokes", "an", "override", "for", "a", "method", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L361-L372
48,454
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.invokeMethod
private Object invokeMethod(final Object obj, final Method method, final Object... args) { // turn method to accessible. otherwise, we won't be able to callback to methods // on non-public classes. boolean accessibility = method.isAccessible(); method.setAccessible(true); try { ...
java
private Object invokeMethod(final Object obj, final Method method, final Object... args) { // turn method to accessible. otherwise, we won't be able to callback to methods // on non-public classes. boolean accessibility = method.isAccessible(); method.setAccessible(true); try { ...
[ "private", "Object", "invokeMethod", "(", "final", "Object", "obj", ",", "final", "Method", "method", ",", "final", "Object", "...", "args", ")", "{", "// turn method to accessible. otherwise, we won't be able to callback to methods", "// on non-public classes.", "boolean", ...
Invokes a Java method, even if the method is protected. @param obj The object @param method The method @param args Method arguments @return The return value
[ "Invokes", "a", "Java", "method", "even", "if", "the", "method", "is", "protected", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L381-L402
48,455
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.processCallback
private void processCallback(final Callback callback) { try { JsonNode result = handleCallback(callback); this.getClient().completeCallback(callback, null, result); } catch (JsiiException e) { this.getClient().completeCallback(callback, e.getMessage(), null); ...
java
private void processCallback(final Callback callback) { try { JsonNode result = handleCallback(callback); this.getClient().completeCallback(callback, null, result); } catch (JsiiException e) { this.getClient().completeCallback(callback, e.getMessage(), null); ...
[ "private", "void", "processCallback", "(", "final", "Callback", "callback", ")", "{", "try", "{", "JsonNode", "result", "=", "handleCallback", "(", "callback", ")", ";", "this", ".", "getClient", "(", ")", ".", "completeCallback", "(", "callback", ",", "null...
Process a single callback by invoking the native method it refers to. @param callback The callback to process.
[ "Process", "a", "single", "callback", "by", "invoking", "the", "native", "method", "it", "refers", "to", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L408-L415
48,456
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.findCallbackMethod
private Method findCallbackMethod(final Class<?> klass, final String signature) { for (Method method : klass.getMethods()) { if (method.toString().equals(signature)) { // found! return method; } } throw new JsiiException("Unable to find c...
java
private Method findCallbackMethod(final Class<?> klass, final String signature) { for (Method method : klass.getMethods()) { if (method.toString().equals(signature)) { // found! return method; } } throw new JsiiException("Unable to find c...
[ "private", "Method", "findCallbackMethod", "(", "final", "Class", "<", "?", ">", "klass", ",", "final", "String", "signature", ")", "{", "for", "(", "Method", "method", ":", "klass", ".", "getMethods", "(", ")", ")", "{", "if", "(", "method", ".", "toS...
Finds the Java method that implements a callback. @param klass The java class. @param signature Method signature @return a {@link Method}.
[ "Finds", "the", "Java", "method", "that", "implements", "a", "callback", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L423-L433
48,457
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.discoverOverrides
private static Collection<JsiiOverride> discoverOverrides(final Class<?> classToInspect) { Map<String, JsiiOverride> overrides = new HashMap<>(); Class<?> klass = classToInspect; // if we reached a generated jsii class or Object, we should stop collecting those overrides since // all t...
java
private static Collection<JsiiOverride> discoverOverrides(final Class<?> classToInspect) { Map<String, JsiiOverride> overrides = new HashMap<>(); Class<?> klass = classToInspect; // if we reached a generated jsii class or Object, we should stop collecting those overrides since // all t...
[ "private", "static", "Collection", "<", "JsiiOverride", ">", "discoverOverrides", "(", "final", "Class", "<", "?", ">", "classToInspect", ")", "{", "Map", "<", "String", ",", "JsiiOverride", ">", "overrides", "=", "new", "HashMap", "<>", "(", ")", ";", "Cl...
Prepare a list of methods which are overridden by Java classes. @param classToInspect The java class to inspect for @return A list of method names that should be overridden.
[ "Prepare", "a", "list", "of", "methods", "which", "are", "overridden", "by", "Java", "classes", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L469-L520
48,458
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.tryGetJsiiAnnotation
static Jsii tryGetJsiiAnnotation(final Class<?> type, final boolean inherited) { Jsii[] ann; if (inherited) { ann = (Jsii[]) type.getAnnotationsByType(Jsii.class); } else { ann = (Jsii[]) type.getDeclaredAnnotationsByType(Jsii.class); } if (ann.length ==...
java
static Jsii tryGetJsiiAnnotation(final Class<?> type, final boolean inherited) { Jsii[] ann; if (inherited) { ann = (Jsii[]) type.getAnnotationsByType(Jsii.class); } else { ann = (Jsii[]) type.getDeclaredAnnotationsByType(Jsii.class); } if (ann.length ==...
[ "static", "Jsii", "tryGetJsiiAnnotation", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "boolean", "inherited", ")", "{", "Jsii", "[", "]", "ann", ";", "if", "(", "inherited", ")", "{", "ann", "=", "(", "Jsii", "[", "]", ")", "type", ...
Attempts to find the @Jsii annotation from a type. @param type The type. @param inherited If 'true' will look for the annotation up the class hierarchy. @return The annotation or null.
[ "Attempts", "to", "find", "the" ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L532-L546
48,459
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.loadModuleForClass
String loadModuleForClass(Class<?> nativeClass) { final Jsii jsii = tryGetJsiiAnnotation(nativeClass, true); if (jsii == null) { throw new JsiiException("Unable to find @Jsii annotation for class"); } this.loadModule(jsii.module()); return jsii.fqn(); }
java
String loadModuleForClass(Class<?> nativeClass) { final Jsii jsii = tryGetJsiiAnnotation(nativeClass, true); if (jsii == null) { throw new JsiiException("Unable to find @Jsii annotation for class"); } this.loadModule(jsii.module()); return jsii.fqn(); }
[ "String", "loadModuleForClass", "(", "Class", "<", "?", ">", "nativeClass", ")", "{", "final", "Jsii", "jsii", "=", "tryGetJsiiAnnotation", "(", "nativeClass", ",", "true", ")", ";", "if", "(", "jsii", "==", "null", ")", "{", "throw", "new", "JsiiException...
Given a java class that extends a Jsii proxy, loads the corresponding jsii module and returns the FQN of the jsii type. @param nativeClass The java class. @return The FQN.
[ "Given", "a", "java", "class", "that", "extends", "a", "Jsii", "proxy", "loads", "the", "corresponding", "jsii", "module", "and", "returns", "the", "FQN", "of", "the", "jsii", "type", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L554-L562
48,460
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/Util.java
Util.readString
static String readString(final InputStream is) { try (final Scanner s = new Scanner(is, "UTF-8")) { s.useDelimiter("\\A"); if (s.hasNext()) { return s.next(); } else { return ""; } } }
java
static String readString(final InputStream is) { try (final Scanner s = new Scanner(is, "UTF-8")) { s.useDelimiter("\\A"); if (s.hasNext()) { return s.next(); } else { return ""; } } }
[ "static", "String", "readString", "(", "final", "InputStream", "is", ")", "{", "try", "(", "final", "Scanner", "s", "=", "new", "Scanner", "(", "is", ",", "\"UTF-8\"", ")", ")", "{", "s", ".", "useDelimiter", "(", "\"\\\\A\"", ")", ";", "if", "(", "s...
Reads a string from an input stream. @param is The input stream., @return A string.
[ "Reads", "a", "string", "from", "an", "input", "stream", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/Util.java#L32-L41
48,461
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/Util.java
Util.extractResource
static String extractResource(final Class<?> klass, final String resourceName, final String outputDirectory) throws IOException { String directory = outputDirectory; if (directory == null) { directory = Files.createTempDirectory("jsii-java-runtime-resource").toString(); } Pa...
java
static String extractResource(final Class<?> klass, final String resourceName, final String outputDirectory) throws IOException { String directory = outputDirectory; if (directory == null) { directory = Files.createTempDirectory("jsii-java-runtime-resource").toString(); } Pa...
[ "static", "String", "extractResource", "(", "final", "Class", "<", "?", ">", "klass", ",", "final", "String", "resourceName", ",", "final", "String", "outputDirectory", ")", "throws", "IOException", "{", "String", "directory", "=", "outputDirectory", ";", "if", ...
Extracts a resource file from the .jar and saves it into an output directory. @param url The URL of the resource @param outputDirectory The output directory (optional) @return The full path of the saved resource @throws IOException If there was an I/O error
[ "Extracts", "a", "resource", "file", "from", "the", ".", "jar", "and", "saves", "it", "into", "an", "output", "directory", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/Util.java#L102-L118
48,462
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java
JsiiObject.jsiiCall
@Nullable protected final <T> T jsiiCall(final String method, final Class<T> returnType, @Nullable final Object... args) { return JsiiObjectMapper.treeToValue(JsiiObject.engine.getClient() .callMethod(this.objRef, ...
java
@Nullable protected final <T> T jsiiCall(final String method, final Class<T> returnType, @Nullable final Object... args) { return JsiiObjectMapper.treeToValue(JsiiObject.engine.getClient() .callMethod(this.objRef, ...
[ "@", "Nullable", "protected", "final", "<", "T", ">", "T", "jsiiCall", "(", "final", "String", "method", ",", "final", "Class", "<", "T", ">", "returnType", ",", "@", "Nullable", "final", "Object", "...", "args", ")", "{", "return", "JsiiObjectMapper", "...
Calls a JavaScript method on the object. @param method The name of the method. @param returnType The return type. @param args Method arguments. @param <T> Java type for the return value. @return A return value.
[ "Calls", "a", "JavaScript", "method", "on", "the", "object", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L54-L61
48,463
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java
JsiiObject.jsiiStaticCall
@Nullable protected static <T> T jsiiStaticCall(final Class<?> nativeClass, final String method, final Class<T> returnType, @Nullable final Object... args) { String fqn = engine.loadModuleForClass(nativeClass); return JsiiObjectMapper.treeToValue(engine.getClient() ...
java
@Nullable protected static <T> T jsiiStaticCall(final Class<?> nativeClass, final String method, final Class<T> returnType, @Nullable final Object... args) { String fqn = engine.loadModuleForClass(nativeClass); return JsiiObjectMapper.treeToValue(engine.getClient() ...
[ "@", "Nullable", "protected", "static", "<", "T", ">", "T", "jsiiStaticCall", "(", "final", "Class", "<", "?", ">", "nativeClass", ",", "final", "String", "method", ",", "final", "Class", "<", "T", ">", "returnType", ",", "@", "Nullable", "final", "Objec...
Calls a static method. @param nativeClass The java class. @param method The method to call. @param returnType The return type. @param args The method arguments. @param <T> Return type. @return Return value.
[ "Calls", "a", "static", "method", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L72-L78
48,464
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java
JsiiObject.jsiiAsyncCall
@Nullable protected final <T> T jsiiAsyncCall(final String method, final Class<T> returnType, @Nullable final Object... args) { JsiiClient client = engine.getClient(); JsiiPromise promise = client.beginAsyncMethod(this.objRef, method, JsiiObjectMapper.valueToTree(args)); engine.processAllPe...
java
@Nullable protected final <T> T jsiiAsyncCall(final String method, final Class<T> returnType, @Nullable final Object... args) { JsiiClient client = engine.getClient(); JsiiPromise promise = client.beginAsyncMethod(this.objRef, method, JsiiObjectMapper.valueToTree(args)); engine.processAllPe...
[ "@", "Nullable", "protected", "final", "<", "T", ">", "T", "jsiiAsyncCall", "(", "final", "String", "method", ",", "final", "Class", "<", "T", ">", "returnType", ",", "@", "Nullable", "final", "Object", "...", "args", ")", "{", "JsiiClient", "client", "=...
Calls an async method on the object. @param method The name of the method. @param returnType The return type. @param args Method arguments. @param <T> Java type for the return value. @return A ereturn value.
[ "Calls", "an", "async", "method", "on", "the", "object", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L88-L96
48,465
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java
JsiiObject.jsiiGet
@Nullable protected final <T> T jsiiGet(final String property, final Class<T> type) { return JsiiObjectMapper.treeToValue(engine.getClient().getPropertyValue(this.objRef, property), type); }
java
@Nullable protected final <T> T jsiiGet(final String property, final Class<T> type) { return JsiiObjectMapper.treeToValue(engine.getClient().getPropertyValue(this.objRef, property), type); }
[ "@", "Nullable", "protected", "final", "<", "T", ">", "T", "jsiiGet", "(", "final", "String", "property", ",", "final", "Class", "<", "T", ">", "type", ")", "{", "return", "JsiiObjectMapper", ".", "treeToValue", "(", "engine", ".", "getClient", "(", ")",...
Gets a property value from the object. @param property The property name. @param type The Java type of the property. @param <T> The Java type of the property. @return The property value.
[ "Gets", "a", "property", "value", "from", "the", "object", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L105-L108
48,466
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java
JsiiObject.jsiiStaticGet
@Nullable protected static <T> T jsiiStaticGet(final Class<?> nativeClass, final String property, final Class<T> type) { String fqn = engine.loadModuleForClass(nativeClass); return JsiiObjectMapper.treeToValue(engine.getClient().getStaticPropertyValue(fqn, property), type); }
java
@Nullable protected static <T> T jsiiStaticGet(final Class<?> nativeClass, final String property, final Class<T> type) { String fqn = engine.loadModuleForClass(nativeClass); return JsiiObjectMapper.treeToValue(engine.getClient().getStaticPropertyValue(fqn, property), type); }
[ "@", "Nullable", "protected", "static", "<", "T", ">", "T", "jsiiStaticGet", "(", "final", "Class", "<", "?", ">", "nativeClass", ",", "final", "String", "property", ",", "final", "Class", "<", "T", ">", "type", ")", "{", "String", "fqn", "=", "engine"...
Returns the value of a static property. @param nativeClass The java class. @param property The name of the property. @param type The expected java return type. @param <T> Return type @return Return value
[ "Returns", "the", "value", "of", "a", "static", "property", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L118-L122
48,467
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java
JsiiObject.jsiiSet
protected final void jsiiSet(final String property, @Nullable final Object value) { engine.getClient().setPropertyValue(this.objRef, property, JsiiObjectMapper.valueToTree(value)); }
java
protected final void jsiiSet(final String property, @Nullable final Object value) { engine.getClient().setPropertyValue(this.objRef, property, JsiiObjectMapper.valueToTree(value)); }
[ "protected", "final", "void", "jsiiSet", "(", "final", "String", "property", ",", "@", "Nullable", "final", "Object", "value", ")", "{", "engine", ".", "getClient", "(", ")", ".", "setPropertyValue", "(", "this", ".", "objRef", ",", "property", ",", "JsiiO...
Sets a property value of an object. @param property The name of the property. @param value The property value.
[ "Sets", "a", "property", "value", "of", "an", "object", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L129-L131
48,468
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java
JsiiObject.jsiiStaticSet
protected static void jsiiStaticSet(final Class<?> nativeClass, final String property, @Nullable final Object value) { String fqn = engine.loadModuleForClass(nativeClass); engine.getClient().setStaticPropertyValue(fqn, property, JsiiObjectMapper.valueToTree(value)); }
java
protected static void jsiiStaticSet(final Class<?> nativeClass, final String property, @Nullable final Object value) { String fqn = engine.loadModuleForClass(nativeClass); engine.getClient().setStaticPropertyValue(fqn, property, JsiiObjectMapper.valueToTree(value)); }
[ "protected", "static", "void", "jsiiStaticSet", "(", "final", "Class", "<", "?", ">", "nativeClass", ",", "final", "String", "property", ",", "@", "Nullable", "final", "Object", "value", ")", "{", "String", "fqn", "=", "engine", ".", "loadModuleForClass", "(...
Sets a value for a static property. @param nativeClass The java class. @param property The name of the property @param value The value
[ "Sets", "a", "value", "for", "a", "static", "property", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L139-L142
48,469
NordicSemiconductor/Android-Scanner-Compat-Library
scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/BluetoothLeUtils.java
BluetoothLeUtils.checkAdapterStateOn
@RequiresPermission(Manifest.permission.BLUETOOTH) static void checkAdapterStateOn(@Nullable final BluetoothAdapter adapter) { if (adapter == null || adapter.getState() != BluetoothAdapter.STATE_ON) { throw new IllegalStateException("BT Adapter is not turned ON"); } }
java
@RequiresPermission(Manifest.permission.BLUETOOTH) static void checkAdapterStateOn(@Nullable final BluetoothAdapter adapter) { if (adapter == null || adapter.getState() != BluetoothAdapter.STATE_ON) { throw new IllegalStateException("BT Adapter is not turned ON"); } }
[ "@", "RequiresPermission", "(", "Manifest", ".", "permission", ".", "BLUETOOTH", ")", "static", "void", "checkAdapterStateOn", "(", "@", "Nullable", "final", "BluetoothAdapter", "adapter", ")", "{", "if", "(", "adapter", "==", "null", "||", "adapter", ".", "ge...
Ensure Bluetooth is turned on. @throws IllegalStateException If {@code adapter} is null or Bluetooth state is not {@link BluetoothAdapter#STATE_ON}.
[ "Ensure", "Bluetooth", "is", "turned", "on", "." ]
569982877c77c005649f728809d3199faf2080af
https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library/blob/569982877c77c005649f728809d3199faf2080af/scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/BluetoothLeUtils.java#L137-L142
48,470
NordicSemiconductor/Android-Scanner-Compat-Library
scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/ScanFilter.java
ScanFilter.matchesServiceUuid
private static boolean matchesServiceUuid(@NonNull final UUID uuid, @Nullable final UUID mask, @NonNull final UUID data) { if (mask == null) { return uuid.equals(data); } if ((uuid.getLeastSignificantBits() & mask.getLeastSignificantBits()) != (data.getLeastSignificantBits() & m...
java
private static boolean matchesServiceUuid(@NonNull final UUID uuid, @Nullable final UUID mask, @NonNull final UUID data) { if (mask == null) { return uuid.equals(data); } if ((uuid.getLeastSignificantBits() & mask.getLeastSignificantBits()) != (data.getLeastSignificantBits() & m...
[ "private", "static", "boolean", "matchesServiceUuid", "(", "@", "NonNull", "final", "UUID", "uuid", ",", "@", "Nullable", "final", "UUID", "mask", ",", "@", "NonNull", "final", "UUID", "data", ")", "{", "if", "(", "mask", "==", "null", ")", "{", "return"...
Check if the uuid pattern matches the particular service uuid.
[ "Check", "if", "the", "uuid", "pattern", "matches", "the", "particular", "service", "uuid", "." ]
569982877c77c005649f728809d3199faf2080af
https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library/blob/569982877c77c005649f728809d3199faf2080af/scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/ScanFilter.java#L350-L362
48,471
NordicSemiconductor/Android-Scanner-Compat-Library
scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/ScanFilter.java
ScanFilter.matchesPartialData
@SuppressWarnings("BooleanMethodIsAlwaysInverted") private boolean matchesPartialData(@Nullable final byte[] data, @Nullable final byte[] dataMask, @Nullable final byte[] parsedData) { if (data == null) { // If filter data is null it means it doesn't matter. // We return true if any dat...
java
@SuppressWarnings("BooleanMethodIsAlwaysInverted") private boolean matchesPartialData(@Nullable final byte[] data, @Nullable final byte[] dataMask, @Nullable final byte[] parsedData) { if (data == null) { // If filter data is null it means it doesn't matter. // We return true if any dat...
[ "@", "SuppressWarnings", "(", "\"BooleanMethodIsAlwaysInverted\"", ")", "private", "boolean", "matchesPartialData", "(", "@", "Nullable", "final", "byte", "[", "]", "data", ",", "@", "Nullable", "final", "byte", "[", "]", "dataMask", ",", "@", "Nullable", "final...
Check whether the data pattern matches the parsed data.
[ "Check", "whether", "the", "data", "pattern", "matches", "the", "parsed", "data", "." ]
569982877c77c005649f728809d3199faf2080af
https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library/blob/569982877c77c005649f728809d3199faf2080af/scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/ScanFilter.java#L365-L391
48,472
NordicSemiconductor/Android-Scanner-Compat-Library
scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/BluetoothLeScannerCompat.java
BluetoothLeScannerCompat.getScanner
@NonNull public synchronized static BluetoothLeScannerCompat getScanner() { if (instance != null) return instance; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) return instance = new BluetoothLeScannerImplOreo(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) return instance = new BluetoothLe...
java
@NonNull public synchronized static BluetoothLeScannerCompat getScanner() { if (instance != null) return instance; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) return instance = new BluetoothLeScannerImplOreo(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) return instance = new BluetoothLe...
[ "@", "NonNull", "public", "synchronized", "static", "BluetoothLeScannerCompat", "getScanner", "(", ")", "{", "if", "(", "instance", "!=", "null", ")", "return", "instance", ";", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION...
Returns the scanner compat object @return scanner implementation
[ "Returns", "the", "scanner", "compat", "object" ]
569982877c77c005649f728809d3199faf2080af
https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library/blob/569982877c77c005649f728809d3199faf2080af/scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/BluetoothLeScannerCompat.java#L96-L107
48,473
NordicSemiconductor/Android-Scanner-Compat-Library
scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/BluetoothLeScannerImplJB.java
BluetoothLeScannerImplJB.setPowerSaveSettings
private void setPowerSaveSettings() { long minRest = Long.MAX_VALUE, minScan = Long.MAX_VALUE; synchronized (wrappers) { for (final ScanCallbackWrapper wrapper : wrappers.values()) { final ScanSettings settings = wrapper.scanSettings; if (settings.hasPowerSaveMode()) { if (minRest > settings.getPowe...
java
private void setPowerSaveSettings() { long minRest = Long.MAX_VALUE, minScan = Long.MAX_VALUE; synchronized (wrappers) { for (final ScanCallbackWrapper wrapper : wrappers.values()) { final ScanSettings settings = wrapper.scanSettings; if (settings.hasPowerSaveMode()) { if (minRest > settings.getPowe...
[ "private", "void", "setPowerSaveSettings", "(", ")", "{", "long", "minRest", "=", "Long", ".", "MAX_VALUE", ",", "minScan", "=", "Long", ".", "MAX_VALUE", ";", "synchronized", "(", "wrappers", ")", "{", "for", "(", "final", "ScanCallbackWrapper", "wrapper", ...
This method goes through registered callbacks and sets the power rest and scan intervals to next lowest value.
[ "This", "method", "goes", "through", "registered", "callbacks", "and", "sets", "the", "power", "rest", "and", "scan", "intervals", "to", "next", "lowest", "value", "." ]
569982877c77c005649f728809d3199faf2080af
https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library/blob/569982877c77c005649f728809d3199faf2080af/scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/BluetoothLeScannerImplJB.java#L213-L243
48,474
alibaba/Virtualview-Android
virtualview/src/main/java/com/tmall/wireless/vaf/expr/engine/CodeReader.java
CodeReader.setCode
public void setCode(ExprCode code) { mCode = code; mStartPos = mCode.mStartPos; mCurIndex = mStartPos; }
java
public void setCode(ExprCode code) { mCode = code; mStartPos = mCode.mStartPos; mCurIndex = mStartPos; }
[ "public", "void", "setCode", "(", "ExprCode", "code", ")", "{", "mCode", "=", "code", ";", "mStartPos", "=", "mCode", ".", "mStartPos", ";", "mCurIndex", "=", "mStartPos", ";", "}" ]
private int mCount;
[ "private", "int", "mCount", ";" ]
30c65791f34458ec840e00d2b84ab2912ea102f0
https://github.com/alibaba/Virtualview-Android/blob/30c65791f34458ec840e00d2b84ab2912ea102f0/virtualview/src/main/java/com/tmall/wireless/vaf/expr/engine/CodeReader.java#L39-L44
48,475
alibaba/Virtualview-Android
virtualview/src/main/java/com/tmall/wireless/vaf/virtualview/Helper/RtlHelper.java
RtlHelper.isRtl
public static boolean isRtl() { if (sEnable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return View.LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()); } return false; }
java
public static boolean isRtl() { if (sEnable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return View.LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()); } return false; }
[ "public", "static", "boolean", "isRtl", "(", ")", "{", "if", "(", "sEnable", "&&", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN_MR1", ")", "{", "return", "View", ".", "LAYOUT_DIRECTION_RTL", "==", "TextUtils"...
In Rtl env or not. @return true if in Rtl env.
[ "In", "Rtl", "env", "or", "not", "." ]
30c65791f34458ec840e00d2b84ab2912ea102f0
https://github.com/alibaba/Virtualview-Android/blob/30c65791f34458ec840e00d2b84ab2912ea102f0/virtualview/src/main/java/com/tmall/wireless/vaf/virtualview/Helper/RtlHelper.java#L33-L39
48,476
alibaba/Virtualview-Android
virtualview/src/main/java/com/tmall/wireless/vaf/virtualview/Helper/RtlHelper.java
RtlHelper.getRealLeft
public static int getRealLeft(boolean isRtl, int parentLeft, int parentWidth, int left, int width) { if (isRtl) { // 1, trim the parent's left. left -= parentLeft; // 2, calculate the RTL left. left = parentWidth - width - left; // 3, add the parent's ...
java
public static int getRealLeft(boolean isRtl, int parentLeft, int parentWidth, int left, int width) { if (isRtl) { // 1, trim the parent's left. left -= parentLeft; // 2, calculate the RTL left. left = parentWidth - width - left; // 3, add the parent's ...
[ "public", "static", "int", "getRealLeft", "(", "boolean", "isRtl", ",", "int", "parentLeft", ",", "int", "parentWidth", ",", "int", "left", ",", "int", "width", ")", "{", "if", "(", "isRtl", ")", "{", "// 1, trim the parent's left.", "left", "-=", "parentLef...
Convert left to RTL left if need. @param parentLeft parent's left @param parentWidth parent's width @param left self's left @param width self's width @return
[ "Convert", "left", "to", "RTL", "left", "if", "need", "." ]
30c65791f34458ec840e00d2b84ab2912ea102f0
https://github.com/alibaba/Virtualview-Android/blob/30c65791f34458ec840e00d2b84ab2912ea102f0/virtualview/src/main/java/com/tmall/wireless/vaf/virtualview/Helper/RtlHelper.java#L49-L59
48,477
alibaba/Virtualview-Android
app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java
ViewServer.get
public static ViewServer get(Context context) { ApplicationInfo info = context.getApplicationInfo(); if (BUILD_TYPE_USER.equals(Build.TYPE) && (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { if (sServer == null) { sServer = new ViewServer(ViewServer.VIE...
java
public static ViewServer get(Context context) { ApplicationInfo info = context.getApplicationInfo(); if (BUILD_TYPE_USER.equals(Build.TYPE) && (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { if (sServer == null) { sServer = new ViewServer(ViewServer.VIE...
[ "public", "static", "ViewServer", "get", "(", "Context", "context", ")", "{", "ApplicationInfo", "info", "=", "context", ".", "getApplicationInfo", "(", ")", ";", "if", "(", "BUILD_TYPE_USER", ".", "equals", "(", "Build", ".", "TYPE", ")", "&&", "(", "info...
Returns a unique instance of the ViewServer. This method should only be called from the main thread of your application. The server will have the same lifetime as your process. If your application does not have the <code>android:debuggable</code> flag set in its manifest, the server returned by this method will be a d...
[ "Returns", "a", "unique", "instance", "of", "the", "ViewServer", ".", "This", "method", "should", "only", "be", "called", "from", "the", "main", "thread", "of", "your", "application", ".", "The", "server", "will", "have", "the", "same", "lifetime", "as", "...
30c65791f34458ec840e00d2b84ab2912ea102f0
https://github.com/alibaba/Virtualview-Android/blob/30c65791f34458ec840e00d2b84ab2912ea102f0/app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java#L173-L193
48,478
alibaba/Virtualview-Android
app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java
ViewServer.removeWindow
public void removeWindow(View view) { mWindowsLock.writeLock().lock(); try { mWindows.remove(view.getRootView()); } finally { mWindowsLock.writeLock().unlock(); } fireWindowsChangedEvent(); }
java
public void removeWindow(View view) { mWindowsLock.writeLock().lock(); try { mWindows.remove(view.getRootView()); } finally { mWindowsLock.writeLock().unlock(); } fireWindowsChangedEvent(); }
[ "public", "void", "removeWindow", "(", "View", "view", ")", "{", "mWindowsLock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "mWindows", ".", "remove", "(", "view", ".", "getRootView", "(", ")", ")", ";", "}", "finally", "{", ...
Invoke this method to unregister a view hierarchy. @param view A view that belongs to the view hierarchy/window to unregister @see #addWindow(View, String)
[ "Invoke", "this", "method", "to", "unregister", "a", "view", "hierarchy", "." ]
30c65791f34458ec840e00d2b84ab2912ea102f0
https://github.com/alibaba/Virtualview-Android/blob/30c65791f34458ec840e00d2b84ab2912ea102f0/app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java#L353-L361
48,479
alibaba/Virtualview-Android
app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java
ViewServer.setFocusedWindow
public void setFocusedWindow(View view) { mFocusLock.writeLock().lock(); try { mFocusedWindow = view == null ? null : view.getRootView(); } finally { mFocusLock.writeLock().unlock(); } fireFocusChangedEvent(); }
java
public void setFocusedWindow(View view) { mFocusLock.writeLock().lock(); try { mFocusedWindow = view == null ? null : view.getRootView(); } finally { mFocusLock.writeLock().unlock(); } fireFocusChangedEvent(); }
[ "public", "void", "setFocusedWindow", "(", "View", "view", ")", "{", "mFocusLock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "mFocusedWindow", "=", "view", "==", "null", "?", "null", ":", "view", ".", "getRootView", "(", ")", ...
Invoke this method to change the currently focused window. @param view A view that belongs to the view hierarchy/window that has focus, or null to remove focus
[ "Invoke", "this", "method", "to", "change", "the", "currently", "focused", "window", "." ]
30c65791f34458ec840e00d2b84ab2912ea102f0
https://github.com/alibaba/Virtualview-Android/blob/30c65791f34458ec840e00d2b84ab2912ea102f0/app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java#L379-L387
48,480
alibaba/Virtualview-Android
app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java
ViewServer.run
public void run() { try { mServer = new ServerSocket(mPort, VIEW_SERVER_MAX_CONNECTIONS, InetAddress.getLocalHost()); } catch (Exception e) { Log.w(LOG_TAG, "Starting ServerSocket error: ", e); } while (mServer != null && Thread.currentThread() == mThread) { ...
java
public void run() { try { mServer = new ServerSocket(mPort, VIEW_SERVER_MAX_CONNECTIONS, InetAddress.getLocalHost()); } catch (Exception e) { Log.w(LOG_TAG, "Starting ServerSocket error: ", e); } while (mServer != null && Thread.currentThread() == mThread) { ...
[ "public", "void", "run", "(", ")", "{", "try", "{", "mServer", "=", "new", "ServerSocket", "(", "mPort", ",", "VIEW_SERVER_MAX_CONNECTIONS", ",", "InetAddress", ".", "getLocalHost", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "Log"...
Main server loop.
[ "Main", "server", "loop", "." ]
30c65791f34458ec840e00d2b84ab2912ea102f0
https://github.com/alibaba/Virtualview-Android/blob/30c65791f34458ec840e00d2b84ab2912ea102f0/app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java#L392-L416
48,481
restfb/restfb
src/main/java/com/restfb/util/UrlUtils.java
UrlUtils.removeQueryParameter
public static String removeQueryParameter(String url, String key) { String[] urlParts = url.split("\\?"); if (urlParts.length == 2) { Map<String, List<String>> paramMap = extractParametersFromQueryString(urlParts[1]); if (paramMap.containsKey(key)) { String queryValue = paramMap.get(key).ge...
java
public static String removeQueryParameter(String url, String key) { String[] urlParts = url.split("\\?"); if (urlParts.length == 2) { Map<String, List<String>> paramMap = extractParametersFromQueryString(urlParts[1]); if (paramMap.containsKey(key)) { String queryValue = paramMap.get(key).ge...
[ "public", "static", "String", "removeQueryParameter", "(", "String", "url", ",", "String", "key", ")", "{", "String", "[", "]", "urlParts", "=", "url", ".", "split", "(", "\"\\\\?\"", ")", ";", "if", "(", "urlParts", ".", "length", "==", "2", ")", "{",...
Remove the given key from the url query string and return the new URL as String. @param url The URL from which parameters are extracted. @param key the key, that should be removed @return the modified URL as String
[ "Remove", "the", "given", "key", "from", "the", "url", "query", "string", "and", "return", "the", "new", "URL", "as", "String", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/util/UrlUtils.java#L204-L223
48,482
restfb/restfb
src/main/java/com/restfb/BaseFacebookClient.java
BaseFacebookClient.verifyParameterLegality
protected void verifyParameterLegality(Parameter... parameters) { for (Parameter parameter : parameters) if (illegalParamNames.contains(parameter.name)) { throw new IllegalArgumentException( "Parameter '" + parameter.name + "' is reserved for RestFB use - you cannot specify it yourself...
java
protected void verifyParameterLegality(Parameter... parameters) { for (Parameter parameter : parameters) if (illegalParamNames.contains(parameter.name)) { throw new IllegalArgumentException( "Parameter '" + parameter.name + "' is reserved for RestFB use - you cannot specify it yourself...
[ "protected", "void", "verifyParameterLegality", "(", "Parameter", "...", "parameters", ")", "{", "for", "(", "Parameter", "parameter", ":", "parameters", ")", "if", "(", "illegalParamNames", ".", "contains", "(", "parameter", ".", "name", ")", ")", "{", "throw...
Verifies that the provided parameter names don't collide with the ones we internally pass along to Facebook. @param parameters The parameters to check. @throws IllegalArgumentException If there's a parameter name collision.
[ "Verifies", "that", "the", "provided", "parameter", "names", "don", "t", "collide", "with", "the", "ones", "we", "internally", "pass", "along", "to", "Facebook", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/BaseFacebookClient.java#L136-L142
48,483
restfb/restfb
src/main/lombok/com/restfb/types/webhook/messaging/NlpResult.java
NlpResult.getEntities
public <T extends BaseNlpEntity> List<T> getEntities(Class<T> clazz) { List<BaseNlpEntity> resultList = new ArrayList<>(); for (BaseNlpEntity item : getEntities()) { if (item.getClass().equals(clazz)) { resultList.add(item); } } return (List<T>) resultList; }
java
public <T extends BaseNlpEntity> List<T> getEntities(Class<T> clazz) { List<BaseNlpEntity> resultList = new ArrayList<>(); for (BaseNlpEntity item : getEntities()) { if (item.getClass().equals(clazz)) { resultList.add(item); } } return (List<T>) resultList; }
[ "public", "<", "T", "extends", "BaseNlpEntity", ">", "List", "<", "T", ">", "getEntities", "(", "Class", "<", "T", ">", "clazz", ")", "{", "List", "<", "BaseNlpEntity", ">", "resultList", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Bas...
returns a subset of the found entities. Only entities that are of type <code>T</code> are returned. T needs to extend the {@link BaseNlpEntity}. @param clazz the filter class @return List of entites, only the filtered elements are returned.
[ "returns", "a", "subset", "of", "the", "found", "entities", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/lombok/com/restfb/types/webhook/messaging/NlpResult.java#L138-L146
48,484
restfb/restfb
src/main/lombok/com/restfb/types/Comments.java
Comments.fillOrder
private void fillOrder(JsonObject summary) { if (summary != null) { order = summary.getString("order", order); } if (order == null && openGraphCommentOrder != null) { order = openGraphCommentOrder; } }
java
private void fillOrder(JsonObject summary) { if (summary != null) { order = summary.getString("order", order); } if (order == null && openGraphCommentOrder != null) { order = openGraphCommentOrder; } }
[ "private", "void", "fillOrder", "(", "JsonObject", "summary", ")", "{", "if", "(", "summary", "!=", "null", ")", "{", "order", "=", "summary", ".", "getString", "(", "\"order\"", ",", "order", ")", ";", "}", "if", "(", "order", "==", "null", "&&", "o...
set the order the comments are sorted
[ "set", "the", "order", "the", "comments", "are", "sorted" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/lombok/com/restfb/types/Comments.java#L157-L165
48,485
restfb/restfb
src/main/lombok/com/restfb/types/Comments.java
Comments.fillCanComment
private void fillCanComment(JsonObject summary) { if (summary != null && summary.get("can_comment") != null) { canComment = summary.get("can_comment").asBoolean(); } if (canComment == null && openGraphCanComment != null) { canComment = openGraphCanComment; } }
java
private void fillCanComment(JsonObject summary) { if (summary != null && summary.get("can_comment") != null) { canComment = summary.get("can_comment").asBoolean(); } if (canComment == null && openGraphCanComment != null) { canComment = openGraphCanComment; } }
[ "private", "void", "fillCanComment", "(", "JsonObject", "summary", ")", "{", "if", "(", "summary", "!=", "null", "&&", "summary", ".", "get", "(", "\"can_comment\"", ")", "!=", "null", ")", "{", "canComment", "=", "summary", ".", "get", "(", "\"can_comment...
set the can_comment
[ "set", "the", "can_comment" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/lombok/com/restfb/types/Comments.java#L170-L178
48,486
restfb/restfb
src/main/java/com/restfb/util/EncodingUtils.java
EncodingUtils.decodeBase64
public static byte[] decodeBase64(String base64) { if (base64 == null) throw new NullPointerException("Parameter 'base64' cannot be null."); String fixedBase64 = padBase64(base64); return Base64.getDecoder().decode(fixedBase64); }
java
public static byte[] decodeBase64(String base64) { if (base64 == null) throw new NullPointerException("Parameter 'base64' cannot be null."); String fixedBase64 = padBase64(base64); return Base64.getDecoder().decode(fixedBase64); }
[ "public", "static", "byte", "[", "]", "decodeBase64", "(", "String", "base64", ")", "{", "if", "(", "base64", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"Parameter 'base64' cannot be null.\"", ")", ";", "String", "fixedBase64", "=", "padBa...
Decodes a base64-encoded string, padding out if necessary. @param base64 The base64-encoded string to decode. @return A decoded version of {@code base64}. @throws NullPointerException If {@code base64} is {@code null}.
[ "Decodes", "a", "base64", "-", "encoded", "string", "padding", "out", "if", "necessary", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/util/EncodingUtils.java#L53-L59
48,487
restfb/restfb
src/main/java/com/restfb/util/EncodingUtils.java
EncodingUtils.encodeAppSecretProof
public static String encodeAppSecretProof(String appSecret, String accessToken) { try { byte[] key = appSecret.getBytes(StandardCharsets.UTF_8); SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA256"); Mac mac = Mac.getInstance("HmacSHA256"); mac.init(signingKey); byte[] raw = ...
java
public static String encodeAppSecretProof(String appSecret, String accessToken) { try { byte[] key = appSecret.getBytes(StandardCharsets.UTF_8); SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA256"); Mac mac = Mac.getInstance("HmacSHA256"); mac.init(signingKey); byte[] raw = ...
[ "public", "static", "String", "encodeAppSecretProof", "(", "String", "appSecret", ",", "String", "accessToken", ")", "{", "try", "{", "byte", "[", "]", "key", "=", "appSecret", ".", "getBytes", "(", "StandardCharsets", ".", "UTF_8", ")", ";", "SecretKeySpec", ...
Generates an appsecret_proof for facebook. See https://developers.facebook.com/docs/graph-api/securing-requests for more info @param appSecret The facebook application secret @param accessToken The facebook access token @return A Hex encoded SHA256 Hash as a String
[ "Generates", "an", "appsecret_proof", "for", "facebook", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/util/EncodingUtils.java#L112-L124
48,488
restfb/restfb
src/main/java/com/restfb/json/JsonObject.java
JsonObject.remove
public JsonObject remove(String name) { if (name == null) { throw new NullPointerException(NAME_IS_NULL); } int index = indexOf(name); if (index != -1) { table.remove(index); names.remove(index); values.remove(index); } return this; }
java
public JsonObject remove(String name) { if (name == null) { throw new NullPointerException(NAME_IS_NULL); } int index = indexOf(name); if (index != -1) { table.remove(index); names.remove(index); values.remove(index); } return this; }
[ "public", "JsonObject", "remove", "(", "String", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "NAME_IS_NULL", ")", ";", "}", "int", "index", "=", "indexOf", "(", "name", ")", ";", "if", "(", ...
Removes a member with the specified name from this object. If this object contains multiple members with the given name, only the last one is removed. If this object does not contain a member with the specified name, the object is not modified. @param name the name of the member to remove @return the object itself, to...
[ "Removes", "a", "member", "with", "the", "specified", "name", "from", "this", "object", ".", "If", "this", "object", "contains", "multiple", "members", "with", "the", "given", "name", "only", "the", "last", "one", "is", "removed", ".", "If", "this", "objec...
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/json/JsonObject.java#L501-L512
48,489
restfb/restfb
src/main/java/com/restfb/json/JsonObject.java
JsonObject.merge
public JsonObject merge(JsonObject object) { if (object == null) { throw new NullPointerException(OBJECT_IS_NULL); } for (Member member : object) { this.set(member.name, member.value); } return this; }
java
public JsonObject merge(JsonObject object) { if (object == null) { throw new NullPointerException(OBJECT_IS_NULL); } for (Member member : object) { this.set(member.name, member.value); } return this; }
[ "public", "JsonObject", "merge", "(", "JsonObject", "object", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "OBJECT_IS_NULL", ")", ";", "}", "for", "(", "Member", "member", ":", "object", ")", "{", "t...
Copies all members of the specified object into this object. When the specified object contains members with names that also exist in this object, the existing values in this object will be replaced by the corresponding values in the specified object. @param object the object to merge @return the object itself, to ena...
[ "Copies", "all", "members", "of", "the", "specified", "object", "into", "this", "object", ".", "When", "the", "specified", "object", "contains", "members", "with", "names", "that", "also", "exist", "in", "this", "object", "the", "existing", "values", "in", "...
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/json/JsonObject.java#L536-L544
48,490
restfb/restfb
src/main/java/com/restfb/DefaultFacebookClient.java
DefaultFacebookClient.urlDecodeSignedRequestToken
protected String urlDecodeSignedRequestToken(String signedRequestToken) { verifyParameterPresence("signedRequestToken", signedRequestToken); return signedRequestToken.replace("-", "+").replace("_", "/").trim(); }
java
protected String urlDecodeSignedRequestToken(String signedRequestToken) { verifyParameterPresence("signedRequestToken", signedRequestToken); return signedRequestToken.replace("-", "+").replace("_", "/").trim(); }
[ "protected", "String", "urlDecodeSignedRequestToken", "(", "String", "signedRequestToken", ")", "{", "verifyParameterPresence", "(", "\"signedRequestToken\"", ",", "signedRequestToken", ")", ";", "return", "signedRequestToken", ".", "replace", "(", "\"-\"", ",", "\"+\"", ...
Decodes a component of a signed request received from Facebook using FB's special URL-encoding strategy. @param signedRequestToken Token to decode. @return The decoded token.
[ "Decodes", "a", "component", "of", "a", "signed", "request", "received", "from", "Facebook", "using", "FB", "s", "special", "URL", "-", "encoding", "strategy", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/DefaultFacebookClient.java#L619-L622
48,491
restfb/restfb
src/main/java/com/restfb/DefaultFacebookClient.java
DefaultFacebookClient.verifySignedRequest
protected boolean verifySignedRequest(String appSecret, String algorithm, String encodedPayload, byte[] signature) { verifyParameterPresence("appSecret", appSecret); verifyParameterPresence("algorithm", algorithm); verifyParameterPresence("encodedPayload", encodedPayload); verifyParameterPresence("signa...
java
protected boolean verifySignedRequest(String appSecret, String algorithm, String encodedPayload, byte[] signature) { verifyParameterPresence("appSecret", appSecret); verifyParameterPresence("algorithm", algorithm); verifyParameterPresence("encodedPayload", encodedPayload); verifyParameterPresence("signa...
[ "protected", "boolean", "verifySignedRequest", "(", "String", "appSecret", ",", "String", "algorithm", ",", "String", "encodedPayload", ",", "byte", "[", "]", "signature", ")", "{", "verifyParameterPresence", "(", "\"appSecret\"", ",", "appSecret", ")", ";", "veri...
Verifies that the signed request is really from Facebook. @param appSecret The secret for the app that can verify this signed request. @param algorithm Signature algorithm specified by FB in the decoded payload. @param encodedPayload The encoded payload used to generate a signature for comparison against the provided ...
[ "Verifies", "that", "the", "signed", "request", "is", "really", "from", "Facebook", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/DefaultFacebookClient.java#L657-L676
48,492
restfb/restfb
src/main/java/com/restfb/DefaultFacebookClient.java
DefaultFacebookClient.toParameterString
protected String toParameterString(boolean withJsonParameter, Parameter... parameters) { if (!isBlank(accessToken)) { parameters = parametersWithAdditionalParameter(Parameter.with(ACCESS_TOKEN_PARAM_NAME, accessToken), parameters); } if (!isBlank(accessToken) && !isBlank(appSecret)) { parameter...
java
protected String toParameterString(boolean withJsonParameter, Parameter... parameters) { if (!isBlank(accessToken)) { parameters = parametersWithAdditionalParameter(Parameter.with(ACCESS_TOKEN_PARAM_NAME, accessToken), parameters); } if (!isBlank(accessToken) && !isBlank(appSecret)) { parameter...
[ "protected", "String", "toParameterString", "(", "boolean", "withJsonParameter", ",", "Parameter", "...", "parameters", ")", "{", "if", "(", "!", "isBlank", "(", "accessToken", ")", ")", "{", "parameters", "=", "parametersWithAdditionalParameter", "(", "Parameter", ...
Generate the parameter string to be included in the Facebook API request. @param withJsonParameter add additional parameter format with type json @param parameters Arbitrary number of extra parameters to include in the request. @return The parameter string to include in the Facebook API request. @throws FacebookJsonMa...
[ "Generate", "the", "parameter", "string", "to", "be", "included", "in", "the", "Facebook", "API", "request", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/DefaultFacebookClient.java#L875-L905
48,493
restfb/restfb
src/main/java/com/restfb/DefaultFacebookClient.java
DefaultFacebookClient.getFacebookGraphEndpointUrl
protected String getFacebookGraphEndpointUrl() { if (apiVersion.isUrlElementRequired()) { return getFacebookEndpointUrls().getGraphEndpoint() + '/' + apiVersion.getUrlElement(); } else { return getFacebookEndpointUrls().getGraphEndpoint(); } }
java
protected String getFacebookGraphEndpointUrl() { if (apiVersion.isUrlElementRequired()) { return getFacebookEndpointUrls().getGraphEndpoint() + '/' + apiVersion.getUrlElement(); } else { return getFacebookEndpointUrls().getGraphEndpoint(); } }
[ "protected", "String", "getFacebookGraphEndpointUrl", "(", ")", "{", "if", "(", "apiVersion", ".", "isUrlElementRequired", "(", ")", ")", "{", "return", "getFacebookEndpointUrls", "(", ")", ".", "getGraphEndpoint", "(", ")", "+", "'", "'", "+", "apiVersion", "...
Returns the base endpoint URL for the Graph API. @return The base endpoint URL for the Graph API.
[ "Returns", "the", "base", "endpoint", "URL", "for", "the", "Graph", "API", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/DefaultFacebookClient.java#L931-L937
48,494
restfb/restfb
src/main/java/com/restfb/DefaultFacebookClient.java
DefaultFacebookClient.getFacebookGraphVideoEndpointUrl
protected String getFacebookGraphVideoEndpointUrl() { if (apiVersion.isUrlElementRequired()) { return getFacebookEndpointUrls().getGraphVideoEndpoint() + '/' + apiVersion.getUrlElement(); } else { return getFacebookEndpointUrls().getGraphVideoEndpoint(); } }
java
protected String getFacebookGraphVideoEndpointUrl() { if (apiVersion.isUrlElementRequired()) { return getFacebookEndpointUrls().getGraphVideoEndpoint() + '/' + apiVersion.getUrlElement(); } else { return getFacebookEndpointUrls().getGraphVideoEndpoint(); } }
[ "protected", "String", "getFacebookGraphVideoEndpointUrl", "(", ")", "{", "if", "(", "apiVersion", ".", "isUrlElementRequired", "(", ")", ")", "{", "return", "getFacebookEndpointUrls", "(", ")", ".", "getGraphVideoEndpoint", "(", ")", "+", "'", "'", "+", "apiVer...
Returns the base endpoint URL for the Graph API's video upload functionality. @return The base endpoint URL for the Graph API's video upload functionality. @since 1.6.5
[ "Returns", "the", "base", "endpoint", "URL", "for", "the", "Graph", "API", "s", "video", "upload", "functionality", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/DefaultFacebookClient.java#L945-L951
48,495
restfb/restfb
src/main/java/com/restfb/JsonHelper.java
JsonHelper.getDoubleFrom
public Double getDoubleFrom(JsonValue json) { if (json.isNumber()) { return json.asDouble(); } else { return Double.valueOf(json.asString()); } }
java
public Double getDoubleFrom(JsonValue json) { if (json.isNumber()) { return json.asDouble(); } else { return Double.valueOf(json.asString()); } }
[ "public", "Double", "getDoubleFrom", "(", "JsonValue", "json", ")", "{", "if", "(", "json", ".", "isNumber", "(", ")", ")", "{", "return", "json", ".", "asDouble", "(", ")", ";", "}", "else", "{", "return", "Double", ".", "valueOf", "(", "json", ".",...
convert jsonvalue to a Double @param json @return
[ "convert", "jsonvalue", "to", "a", "Double" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/JsonHelper.java#L78-L84
48,496
restfb/restfb
src/main/java/com/restfb/JsonHelper.java
JsonHelper.getIntegerFrom
public Integer getIntegerFrom(JsonValue json) { if (json.isNumber()) { return json.asInt(); } else { return Integer.valueOf(json.asString()); } }
java
public Integer getIntegerFrom(JsonValue json) { if (json.isNumber()) { return json.asInt(); } else { return Integer.valueOf(json.asString()); } }
[ "public", "Integer", "getIntegerFrom", "(", "JsonValue", "json", ")", "{", "if", "(", "json", ".", "isNumber", "(", ")", ")", "{", "return", "json", ".", "asInt", "(", ")", ";", "}", "else", "{", "return", "Integer", ".", "valueOf", "(", "json", ".",...
convert jsonvalue to a Integer @param json @return
[ "convert", "jsonvalue", "to", "a", "Integer" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/JsonHelper.java#L92-L98
48,497
restfb/restfb
src/main/java/com/restfb/JsonHelper.java
JsonHelper.getStringFrom
public String getStringFrom(JsonValue json) { if (json.isString()) { return json.asString(); } else { return json.toString(); } }
java
public String getStringFrom(JsonValue json) { if (json.isString()) { return json.asString(); } else { return json.toString(); } }
[ "public", "String", "getStringFrom", "(", "JsonValue", "json", ")", "{", "if", "(", "json", ".", "isString", "(", ")", ")", "{", "return", "json", ".", "asString", "(", ")", ";", "}", "else", "{", "return", "json", ".", "toString", "(", ")", ";", "...
convert jsonvalue to a String @param json @return
[ "convert", "jsonvalue", "to", "a", "String" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/JsonHelper.java#L106-L112
48,498
restfb/restfb
src/main/java/com/restfb/JsonHelper.java
JsonHelper.getFloatFrom
public Float getFloatFrom(JsonValue json) { if (json.isNumber()) { return json.asFloat(); } else { return new BigDecimal(json.asString()).floatValue(); } }
java
public Float getFloatFrom(JsonValue json) { if (json.isNumber()) { return json.asFloat(); } else { return new BigDecimal(json.asString()).floatValue(); } }
[ "public", "Float", "getFloatFrom", "(", "JsonValue", "json", ")", "{", "if", "(", "json", ".", "isNumber", "(", ")", ")", "{", "return", "json", ".", "asFloat", "(", ")", ";", "}", "else", "{", "return", "new", "BigDecimal", "(", "json", ".", "asStri...
convert jsonvalue to a Float @param json @return
[ "convert", "jsonvalue", "to", "a", "Float" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/JsonHelper.java#L120-L126
48,499
restfb/restfb
src/main/java/com/restfb/JsonHelper.java
JsonHelper.getBigIntegerFrom
public BigInteger getBigIntegerFrom(JsonValue json) { if (json.isString()) { return new BigInteger(json.asString()); } else { return new BigInteger(json.toString()); } }
java
public BigInteger getBigIntegerFrom(JsonValue json) { if (json.isString()) { return new BigInteger(json.asString()); } else { return new BigInteger(json.toString()); } }
[ "public", "BigInteger", "getBigIntegerFrom", "(", "JsonValue", "json", ")", "{", "if", "(", "json", ".", "isString", "(", ")", ")", "{", "return", "new", "BigInteger", "(", "json", ".", "asString", "(", ")", ")", ";", "}", "else", "{", "return", "new",...
convert jsonvalue to a BigInteger @param json @return
[ "convert", "jsonvalue", "to", "a", "BigInteger" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/JsonHelper.java#L134-L140