Skip to content

Commit 025dc6d

Browse files
committed
refactoring
1 parent cfd3e5f commit 025dc6d

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
import com.igormaznitsa.jbbp.exceptions.JBBPIOException;
2020
import com.igormaznitsa.jbbp.mapper.Bin;
21+
import com.igormaznitsa.jbbp.mapper.JBBPMapper;
2122
import com.igormaznitsa.jbbp.model.JBBPFieldShort;
2223
import com.igormaznitsa.jbbp.utils.JBBPUtils;
23-
2424
import java.io.ByteArrayOutputStream;
2525
import java.io.IOException;
2626
import java.io.OutputStream;
@@ -998,12 +998,12 @@ protected void assertNotEnded() {
998998
* Save fields of an object marked by Bin annotation. Fields will be ordered
999999
* through {@link Bin#outOrder()} field, NB! By default Java doesn't keep field
10001000
* outOrder. Ordered fields of class will be saved into internal cache for speed
1001-
* but the cache can be reset through {@link #resetInsideClassCache()}
1001+
* but the cache can be reset through {@link JBBPMapper#clearFieldCache()}
10021002
*
10031003
* @param object an object to be saved into stream, must not be null
10041004
* @return the context
10051005
* @throws IOException it will be thrown for any transport error
1006-
* @see #resetInsideClassCache()
1006+
* @see JBBPMapper#clearFieldCache()
10071007
* @see Bin
10081008
* @since 1.1
10091009
*/
@@ -1015,14 +1015,14 @@ public JBBPOut Bin(final Object object) throws IOException {
10151015
* Save fields of an object marked by Bin annotation. Fields will be ordered
10161016
* through {@link Bin#outOrder()} field, NB! By default Java doesn't keep field
10171017
* outOrder. Ordered fields of class will be saved into internal cache for speed
1018-
* but the cache can be reset through {@link #resetInsideClassCache()}
1018+
* but the cache can be reset through {@link JBBPMapper#clearFieldCache()}
10191019
*
10201020
* @param object an object to be saved into stream, must not be null
10211021
* @param customFieldWriter a custom field writer to be used for saving of
10221022
* custom fields of the object, it can be null
10231023
* @return the context
10241024
* @throws IOException it will be thrown for any transport error
1025-
* @see #resetInsideClassCache()
1025+
* @see JBBPMapper#clearFieldCache()
10261026
* @see Bin
10271027
* @since 1.1
10281028
*/

jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/MappedFieldRecord.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ private static <T> T tryMakeInstance(
411411

412412

413413
interface FieldProcessor {
414+
@SuppressWarnings("unchecked")
414415
void apply(
415416
MappedFieldRecord record,
416417
JBBPFieldStruct rootStructure,

jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@
2020
import com.igormaznitsa.jbbp.io.JBBPBitOrder;
2121
import com.igormaznitsa.jbbp.io.JBBPByteOrder;
2222
import com.igormaznitsa.jbbp.model.JBBPAbstractField;
23-
2423
import java.io.ByteArrayOutputStream;
2524
import java.io.Closeable;
2625
import java.io.IOException;
27-
import java.lang.reflect.Array;
2826
import java.nio.ByteBuffer;
2927
import java.nio.charset.Charset;
3028
import java.util.ArrayList;
@@ -39,21 +37,15 @@
3937
*/
4038
public final class JBBPUtils {
4139

42-
public static final String [] ARRAY_STRING_EMPTY = new String[0];
40+
public static final String[] ARRAY_STRING_EMPTY = new String[0];
4341
public static final JBBPAbstractField[] ARRAY_FIELD_EMPTY = new JBBPAbstractField[0];
4442

43+
// Don't replace by StandardCharsets for Android compatibility!
4544
private static final Charset CHARSET_UTF8 = Charset.forName("UTF-8");
4645

4746
private JBBPUtils() {
4847
}
4948

50-
@SuppressWarnings("unchecked")
51-
public static <T> T[] makeSingletoneArray(final T value) {
52-
final Object[] result = (Object[])Array.newInstance(value.getClass(), 1);
53-
result[0] = value;
54-
return (T[])result;
55-
}
56-
5749
/**
5850
* Convert a string into its UTF8 representation.
5951
*

0 commit comments

Comments
 (0)