List of usage examples for java.lang Byte valueOf
public static Byte valueOf(String s) throws NumberFormatException
From source file:org.thymeleaf.util.EvaluationUtilTest.java
@Test public void convertToListTest() { {/*from w w w .jav a 2 s . co m*/ final List<Object> result = EvaluationUtil.evaluateAsList(null); Assert.assertTrue(result != null && result.size() == 0); } { final Set<Object> set = new LinkedHashSet<Object>(); set.add(Integer.valueOf(2)); set.add(Integer.valueOf(43)); final List<Object> list = new ArrayList<Object>(); list.add(Integer.valueOf(2)); list.add(Integer.valueOf(43)); final List<Object> result = EvaluationUtil.evaluateAsList(set); Assert.assertTrue(result != null && result instanceof List && list.equals(result)); } { final Map<Object, Object> map = new LinkedHashMap<Object, Object>(); map.put("a", Integer.valueOf(2)); map.put("b", Integer.valueOf(43)); final List<Object> list = new ArrayList<Object>(); list.add(new EvaluationUtil.MapEntry<Object, Object>("a", Integer.valueOf(2))); list.add(new EvaluationUtil.MapEntry<Object, Object>("b", Integer.valueOf(43))); final List<Object> result = EvaluationUtil.evaluateAsList(map); Assert.assertTrue(result != null && result instanceof List && list.equals(result)); } { final byte[] arr0 = new byte[0]; final List<Object> list0 = new ArrayList<Object>(); final List<Object> result0 = EvaluationUtil.evaluateAsList(arr0); Assert.assertTrue(result0 != null && result0 instanceof List && list0.equals(result0)); final byte[] arr = new byte[2]; arr[0] = (byte) 23; arr[1] = (byte) -127; final List<Object> list = new ArrayList<Object>(); list.add(Byte.valueOf((byte) 23)); list.add(Byte.valueOf((byte) -127)); final List<Object> result = EvaluationUtil.evaluateAsList(arr); Assert.assertTrue(result != null && result instanceof List && list.equals(result)); } { final short[] arr0 = new short[0]; final List<Object> list0 = new ArrayList<Object>(); final List<Object> result0 = EvaluationUtil.evaluateAsList(arr0); Assert.assertTrue(result0 != null && result0 instanceof List && list0.equals(result0)); final short[] arr = new short[2]; arr[0] = (short) 23; arr[1] = (short) -127; final List<Object> list = new ArrayList<Object>(); list.add(Short.valueOf((short) 23)); list.add(Short.valueOf((short) -127)); final List<Object> result = EvaluationUtil.evaluateAsList(arr); Assert.assertTrue(result != null && result instanceof List && list.equals(result)); } { final int[] arr0 = new int[0]; final List<Object> list0 = new ArrayList<Object>(); final List<Object> result0 = EvaluationUtil.evaluateAsList(arr0); Assert.assertTrue(result0 != null && result0 instanceof List && list0.equals(result0)); final int[] arr = new int[2]; arr[0] = 23; arr[1] = -127; final List<Object> list = new ArrayList<Object>(); list.add(Integer.valueOf(23)); list.add(Integer.valueOf(-127)); final List<Object> result = EvaluationUtil.evaluateAsList(arr); Assert.assertTrue(result != null && result instanceof List && list.equals(result)); } { final long[] arr0 = new long[0]; final List<Object> list0 = new ArrayList<Object>(); final List<Object> result0 = EvaluationUtil.evaluateAsList(arr0); Assert.assertTrue(result0 != null && result0 instanceof List && list0.equals(result0)); final long[] arr = new long[2]; arr[0] = 23L; arr[1] = -127L; final List<Object> list = new ArrayList<Object>(); list.add(Long.valueOf(23L)); list.add(Long.valueOf(-127L)); final List<Object> result = EvaluationUtil.evaluateAsList(arr); Assert.assertTrue(result != null && result instanceof List && list.equals(result)); } { final float[] arr0 = new float[0]; final List<Object> list0 = new ArrayList<Object>(); final List<Object> result0 = EvaluationUtil.evaluateAsList(arr0); Assert.assertTrue(result0 != null && result0 instanceof List && list0.equals(result0)); final float[] arr = new float[2]; arr[0] = 23.0f; arr[1] = -127.1f; final List<Object> list = new ArrayList<Object>(); list.add(Float.valueOf(23.0f)); list.add(Float.valueOf(-127.1f)); final List<Object> result = EvaluationUtil.evaluateAsList(arr); Assert.assertTrue(result != null && result instanceof List && result.size() == list.size()); for (int i = 0; i < result.size(); i++) { Assert.assertTrue(result.get(i) != null && result.get(i) instanceof Float && (((Float) result.get(i)).compareTo((Float) list.get(i)) == 0)); } } { final double[] arr0 = new double[0]; final List<Object> list0 = new ArrayList<Object>(); final List<Object> result0 = EvaluationUtil.evaluateAsList(arr0); Assert.assertTrue(result0 != null && result0 instanceof List && list0.equals(result0)); final double[] arr = new double[2]; arr[0] = 23.0d; arr[1] = -127.1d; final List<Object> list = new ArrayList<Object>(); list.add(Double.valueOf(23.0d)); list.add(Double.valueOf(-127.1d)); final List<Object> result = EvaluationUtil.evaluateAsList(arr); Assert.assertTrue(result != null && result instanceof List && result.size() == list.size()); for (int i = 0; i < result.size(); i++) { Assert.assertTrue(result.get(i) != null && result.get(i) instanceof Double && (((Double) result.get(i)).compareTo((Double) list.get(i)) == 0)); } } { final boolean[] arr0 = new boolean[0]; final List<Object> list0 = new ArrayList<Object>(); final List<Object> result0 = EvaluationUtil.evaluateAsList(arr0); Assert.assertTrue(result0 != null && result0 instanceof List && list0.equals(result0)); final boolean[] arr = new boolean[2]; arr[0] = true; arr[1] = false; final List<Object> list = new ArrayList<Object>(); list.add(Boolean.TRUE); list.add(Boolean.FALSE); final List<Object> result = EvaluationUtil.evaluateAsList(arr); Assert.assertTrue(result != null && result instanceof List && list.equals(result)); } { final char[] arr0 = new char[0]; final List<Object> list0 = new ArrayList<Object>(); final List<Object> result0 = EvaluationUtil.evaluateAsList(arr0); Assert.assertTrue(result0 != null && result0 instanceof List && list0.equals(result0)); final char[] arr = new char[3]; arr[0] = 'a'; arr[1] = 'x'; arr[2] = (char) 0; final List<Object> list = new ArrayList<Object>(); list.add(Character.valueOf('a')); list.add(Character.valueOf('x')); list.add(Character.valueOf((char) 0)); final List<Object> result = EvaluationUtil.evaluateAsList(arr); Assert.assertTrue(result != null && result instanceof List && list.equals(result)); } { final Class<?>[] arr0 = new Class<?>[0]; final List<Object> list0 = new ArrayList<Object>(); final List<Object> result0 = EvaluationUtil.evaluateAsList(arr0); Assert.assertTrue(result0 != null && result0 instanceof List && list0.equals(result0)); final Class<?>[] arr = new Class<?>[2]; arr[0] = EvaluationUtil.class; arr[1] = EvaluationUtilTest.class; final List<Object> list = new ArrayList<Object>(); list.add(EvaluationUtil.class); list.add(EvaluationUtilTest.class); final List<Object> result = EvaluationUtil.evaluateAsList(arr); Assert.assertTrue(result != null && result instanceof List && list.equals(result)); } { final List<Object> list = new ArrayList<Object>(); list.add(EvaluationUtil.class); final List<Object> result = EvaluationUtil.evaluateAsList(EvaluationUtil.class); Assert.assertTrue(result != null && result instanceof List && list.equals(result)); } }
From source file:org.apache.hadoop.hive.ql.exec.vector.RandomRowObjectSource.java
public static byte[] getRandBinary(Random r, int len) { byte[] bytes = new byte[len]; for (int j = 0; j < len; j++) { bytes[j] = Byte.valueOf((byte) r.nextInt()); }/*from w ww.j a v a2 s . c o m*/ return bytes; }
From source file:org.unitime.timetable.backup.SessionRestore.java
public void create(TableData.Table table) throws InstantiationException, IllegalAccessException, DocumentException { ClassMetadata metadata = iHibSessionFactory.getClassMetadata(table.getName()); if (metadata == null) return;//w ww . j av a2 s .c om PersistentClass mapping = _RootDAO.getConfiguration().getClassMapping(table.getName()); Map<String, Integer> lengths = new HashMap<String, Integer>(); for (String property : metadata.getPropertyNames()) { if ("org.unitime.timetable.model.CurriculumClassification.students" .equals(metadata.getEntityName() + "." + property)) continue; Type type = metadata.getPropertyType(property); if (type instanceof StringType) for (Iterator<?> i = mapping.getProperty(property).getColumnIterator(); i.hasNext();) { Object o = i.next(); if (o instanceof Column) { Column column = (Column) o; lengths.put(property, column.getLength()); } break; } } iProgress.setPhase(metadata.getEntityName().substring(metadata.getEntityName().lastIndexOf('.') + 1) + " [" + table.getRecordCount() + "]", table.getRecordCount()); for (TableData.Record record : table.getRecordList()) { iProgress.incProgress(); Object object = metadata.getMappedClass().newInstance(); for (String property : metadata.getPropertyNames()) { TableData.Element element = null; for (TableData.Element e : record.getElementList()) if (e.getName().equals(property)) { element = e; break; } if (element == null) continue; Object value = null; Type type = metadata.getPropertyType(property); if (type instanceof PrimitiveType) { if (type instanceof BooleanType) { value = new Boolean("true".equals(element.getValue(0))); } else if (type instanceof ByteType) { value = Byte.valueOf(element.getValue(0)); } else if (type instanceof CharacterType) { value = Character.valueOf(element.getValue(0).charAt(0)); } else if (type instanceof DoubleType) { value = Double.valueOf(element.getValue(0)); } else if (type instanceof FloatType) { value = Float.valueOf(element.getValue(0)); } else if (type instanceof IntegerType) { value = Integer.valueOf(element.getValue(0)); } else if (type instanceof LongType) { value = Long.valueOf(element.getValue(0)); } else if (type instanceof ShortType) { value = Short.valueOf(element.getValue(0)); } } else if (type instanceof DateType) { try { value = new SimpleDateFormat("dd MMMM yyyy", Localization.getJavaLocale()) .parse(element.getValue(0)); } catch (ParseException e) { value = new DateType().fromStringValue(element.getValue(0)); } } else if (type instanceof TimestampType) { value = new TimestampType().fromStringValue(element.getValue(0)); } else if (type instanceof StringType) { value = element.getValue(0); Integer len = lengths.get(property); if (len != null && value.toString().length() > len) { message("Value is too long, truncated (property " + metadata.getEntityName() + "." + property + ", length " + len + ")", record.getId()); value = value.toString().substring(0, len); } } else if (type instanceof BinaryType) { value = element.getValueBytes(0).toByteArray(); } else if (type instanceof CustomType && type.getReturnedClass().equals(Document.class)) { value = new SAXReader().read(new StringReader(element.getValue(0))); } else if (type instanceof EntityType) { } else if (type instanceof CollectionType) { } else { message("Unknown type " + type.getClass().getName() + " (property " + metadata.getEntityName() + "." + property + ", class " + type.getReturnedClass() + ")", record.getId()); } if (value != null) metadata.setPropertyValue(object, property, value); } add(new Entity(metadata, record, object, record.getId())); } }
From source file:at.tfr.securefs.process.ProcessFilesTest.java
@Test public void testCopyFilesByWalkNoOverwrite() throws Exception { // Given: target directory, the source file, a dummy target file toFilesPath = Files.createDirectories(toRoot.resolve(DATA_FILES)); final String data = "Hallo Echo"; try (OutputStream os = cp.getEncrypter(fromFile)) { IOUtils.write(data, os);//w w w. ja v a 2 s . co m } Thread.sleep(1000); Files.write(targetToFile, new byte[] { (byte) 0xCA }); // write dummy file // the timestamp of dummy target file is after source file!! Assert.assertTrue("dummy file stamp must be after source file", Files.getLastModifiedTime(targetToFile) .toInstant().isAfter(Files.getLastModifiedTime(fromFile).toInstant())); // When: copy files with "UPDATE" ProcessFiles pf = new ProcessFilesBean(new MockSecureFsCache()); ProcessFilesData cfd = new ProcessFilesData().setFromRootPath(fromRoot.toString()) .setToRootPath(toRoot.toString()).setAllowOverwriteExisting(true).setUpdate(true) .setProcessActive(true); pf.copy(fromRoot, toRoot, cp, newSecret, cfd); // Then: a target file is NOT overwritten: byte[] buf = new byte[data.getBytes().length]; int bytesRead; try (InputStream is = Files.newInputStream(targetToFile)) { bytesRead = IOUtils.read(is, buf); } Assert.assertTrue("target file was overwritten", bytesRead == 1); Assert.assertTrue("target file was overwritten, content not matches", Byte.valueOf((byte) 0xCA).equals((byte) buf[0])); }
From source file:org.apache.hadoop.hive.serde2.fast.RandomRowObjectSource.java
public Object randomObject(int column) { PrimitiveCategory primitiveCategory = primitiveCategories[column]; PrimitiveTypeInfo primitiveTypeInfo = primitiveTypeInfos[column]; switch (primitiveCategory) { case BOOLEAN: return Boolean.valueOf(r.nextInt(1) == 1); case BYTE:/*from ww w . j a v a 2 s .c o m*/ return Byte.valueOf((byte) r.nextInt()); case SHORT: return Short.valueOf((short) r.nextInt()); case INT: return Integer.valueOf(r.nextInt()); case LONG: return Long.valueOf(r.nextLong()); case DATE: return RandomTypeUtil.getRandDate(r); case FLOAT: return Float.valueOf(r.nextFloat() * 10 - 5); case DOUBLE: return Double.valueOf(r.nextDouble() * 10 - 5); case STRING: return RandomTypeUtil.getRandString(r); case CHAR: return getRandHiveChar(r, (CharTypeInfo) primitiveTypeInfo); case VARCHAR: return getRandHiveVarchar(r, (VarcharTypeInfo) primitiveTypeInfo); case BINARY: return getRandBinary(r, 1 + r.nextInt(100)); case TIMESTAMP: return RandomTypeUtil.getRandTimestamp(r); case INTERVAL_YEAR_MONTH: return getRandIntervalYearMonth(r); case INTERVAL_DAY_TIME: return getRandIntervalDayTime(r); case DECIMAL: return getRandHiveDecimal(r, (DecimalTypeInfo) primitiveTypeInfo); default: throw new Error("Unknown primitive category " + primitiveCategory); } }
From source file:br.gov.frameworkdemoiselle.ldap.internal.ClazzUtils.java
public static Object getValueAsFieldType(Field field, Object values, boolean cascade) { if (values instanceof String[]) { String[] valueArray = (String[]) values; if (valueArray == null || valueArray.length == 0) return null; if (field.getType().isAssignableFrom(String.class)) return valueArray[0]; if (field.getType().isArray()) if (field.getType().getComponentType().isAssignableFrom(String.class)) return valueArray; if (field.getType().isPrimitive()) { if (field.getType().isAssignableFrom(int.class)) return Integer.valueOf(valueArray[0]); if (field.getType().isAssignableFrom(long.class)) return Long.valueOf(valueArray[0]); if (field.getType().isAssignableFrom(double.class)) return Double.valueOf(valueArray[0]); if (field.getType().isAssignableFrom(float.class)) return Float.valueOf(valueArray[0]); if (field.getType().isAssignableFrom(short.class)) return Short.valueOf(valueArray[0]); if (field.getType().isAssignableFrom(byte.class)) return Byte.valueOf(valueArray[0]); }/* ww w. ja va2 s . c om*/ if (isAnnotationPresent(field.getType(), LDAPEntry.class, false)) return getMappedEntryObject(field.getType(), valueArray, cascade); if (field.getType().isAssignableFrom(ArrayList.class)) if (String.class.isAssignableFrom(Reflections.getGenericTypeArgument(field.getType(), 0))) return new ArrayList<String>(Arrays.asList(valueArray)); if (field.getType().isAssignableFrom(Integer.class)) return Integer.valueOf(valueArray[0]); if (field.getType().isAssignableFrom(Long.class)) return Long.valueOf(valueArray[0]); if (field.getType().isAssignableFrom(Double.class)) return Double.valueOf(valueArray[0]); if (field.getType().isAssignableFrom(Float.class)) return Float.valueOf(valueArray[0]); if (field.getType().isAssignableFrom(Short.class)) return Short.valueOf(valueArray[0]); if (field.getType().isAssignableFrom(Byte.class)) return Byte.valueOf(valueArray[0]); logger.error("Handling not implemented for field " + field.getName() + " with type " + field.getType().getSimpleName()); } else if (values instanceof byte[][]) { if (field.getType().isAssignableFrom(byte[][].class)) return values; if (field.getType().isAssignableFrom(byte[].class)) return ((byte[][]) values)[0]; logger.error("Binary data from LDAP can't be set in " + field.getName() + " with type " + field.getType().getSimpleName()); } logger.error("Object value should be String[] or byte[][]. The value type " + values.getClass() + " can't be set in " + field.getName() + " with type " + field.getType().getSimpleName()); return null; }
From source file:org.executequery.gui.importexport.AbstractImportExportWorker.java
/** * Sets the specified value in the specified position for the * specified java.sql.Type within the prepared statement. * * @param value - the value//w w w . ja v a 2 s .c o m * @param index - the position within the statement * @param sqlType - the SQL type * @param trim - whether to trim the whitespace from the value * @param df - the DataFormat object for date values */ protected void setValue(String value, int index, int sqlType, boolean trim, DateFormat df) throws Exception { if (value == null) { prepStmnt.setNull(index, sqlType); } else { switch (sqlType) { case Types.TINYINT: byte _byte = Byte.valueOf(value).byteValue(); prepStmnt.setShort(index, _byte); break; case Types.BIGINT: long _long = Long.valueOf(value).longValue(); prepStmnt.setLong(index, _long); break; case Types.SMALLINT: short _short = Short.valueOf(value).shortValue(); prepStmnt.setShort(index, _short); break; case Types.LONGVARCHAR: case Types.CHAR: case Types.VARCHAR: if (trim) { value = value.trim(); } prepStmnt.setString(index, value); break; case Types.BIT: case Types.BOOLEAN: String booleanValue = value; if ("t".equalsIgnoreCase(value)) { booleanValue = "true"; } else if ("f".equalsIgnoreCase(value)) { booleanValue = "false"; } boolean _boolean = Boolean.valueOf(booleanValue).booleanValue(); prepStmnt.setBoolean(index, _boolean); break; case Types.NUMERIC: case Types.DECIMAL: prepStmnt.setBigDecimal(index, new BigDecimal(value)); break; case Types.REAL: float _float = Float.valueOf(value).floatValue(); prepStmnt.setFloat(index, _float); break; case Types.FLOAT: case Types.DOUBLE: prepStmnt.setDouble(index, Double.parseDouble(value)); break; case Types.INTEGER: prepStmnt.setInt(index, Integer.parseInt(value)); break; case Types.DATE: case Types.TIME: case Types.TIMESTAMP: // if the date format is null, insert as a char value if (df != null) { java.util.Date j_datetime = df.parse(value); prepStmnt.setDate(index, new java.sql.Date(j_datetime.getTime())); } else { try { prepStmnt.setObject(index, value, sqlType); /* if (sqlType == Types.TIMESTAMP) { prepStmnt.setTimestamp(index, java.sql.Timestamp.valueOf(value)); } else if (sqlType == Types.TIME) { prepStmnt.setTime(index, java.sql.Time.valueOf(value)); } else { prepStmnt.setDate(index, java.sql.Date.valueOf(value)); } */ } // want a more useful message here than what will likely // be returned due to internal driver code on formatting // a SQL date value from string // (ie. could be parsing error, number format etc...) catch (Exception e) { throw new IllegalArgumentException("[ " + MiscUtils.getExceptionName(e) + " ] " + getBundle().getString("AbstractImportExportWorker.dateConversionError")); } } break; case Types.LONGVARBINARY: case Types.BINARY: case Types.BLOB: case Types.CLOB: prepStmnt.setBytes(index, Base64.decode(value)); break; default: prepStmnt.setObject(index, value); break; } } }
From source file:org.apache.hadoop.hive.ql.exec.TestExecDriver.java
/** * test reduce with multiple tagged inputs. */// w w w.j a va2 s . c o m @SuppressWarnings("unchecked") private void populateMapRedPlan3(Table src, Table src2) throws SemanticException { List<String> outputColumns = new ArrayList<String>(); for (int i = 0; i < 2; i++) { outputColumns.add("_col" + i); } // map-side work Operator<ReduceSinkDesc> op1 = OperatorFactory.get(PlanUtils.getReduceSinkDesc( Utilities.makeList(getStringColumn("key")), Utilities.makeList(getStringColumn("value")), outputColumns, true, Byte.valueOf((byte) 0), 1, -1, AcidUtils.Operation.NOT_ACID)); addMapWork(mr, src, "a", op1); Operator<ReduceSinkDesc> op2 = OperatorFactory.get(PlanUtils.getReduceSinkDesc( Utilities.makeList(getStringColumn("key")), Utilities.makeList(getStringColumn("key")), outputColumns, true, Byte.valueOf((byte) 1), Integer.MAX_VALUE, -1, AcidUtils.Operation.NOT_ACID)); addMapWork(mr, src2, "b", op2); ReduceWork rWork = new ReduceWork(); rWork.setNumReduceTasks(Integer.valueOf(1)); rWork.setNeedsTagging(true); rWork.setKeyDesc(op1.getConf().getKeySerializeInfo()); rWork.getTagToValueDesc().add(op1.getConf().getValueSerializeInfo()); mr.setReduceWork(rWork); rWork.getTagToValueDesc().add(op2.getConf().getValueSerializeInfo()); // reduce side work Operator<FileSinkDesc> op4 = OperatorFactory.get(new FileSinkDesc( new Path(tmpdir + File.separator + "mapredplan3.out"), Utilities.defaultTd, false)); Operator<SelectDesc> op5 = OperatorFactory.get(new SelectDesc( Utilities.makeList(new ExprNodeFieldDesc(TypeInfoFactory.stringTypeInfo, new ExprNodeColumnDesc(TypeInfoFactory.getListTypeInfo(TypeInfoFactory.stringTypeInfo), Utilities.ReduceField.VALUE.toString(), "", false), "0", false)), Utilities.makeList(outputColumns.get(0))), op4); rWork.setReducer(op5); }
From source file:net.sf.ezmorph.bean.BeanMorpherTest.java
public void testMorph_PrimitiveBean_to_ObjectBean() { PrimitiveBean primitiveBean = new PrimitiveBean(); primitiveBean.setPclass(Object.class); primitiveBean.setPstring("MORPH"); morpherRegistry.registerMorpher(new BeanMorpher(ObjectBean.class, morpherRegistry)); ObjectBean objectBean = (ObjectBean) morpherRegistry.morph(ObjectBean.class, primitiveBean); assertNotNull(objectBean);/*from www . ja va 2 s. co m*/ assertEquals(Boolean.FALSE, objectBean.getPboolean()); assertEquals(Byte.valueOf("0"), objectBean.getPbyte()); assertEquals(Short.valueOf("0"), objectBean.getPshort()); assertEquals(Integer.valueOf("0"), objectBean.getPint()); assertEquals(Long.valueOf("0"), objectBean.getPlong()); assertEquals(Float.valueOf("0"), objectBean.getPfloat()); assertEquals(Double.valueOf("0"), objectBean.getPdouble()); assertEquals(new Character('\0'), objectBean.getPchar()); assertEquals(null, objectBean.getParray()); assertEquals(null, objectBean.getPlist()); assertEquals(null, objectBean.getPbean()); assertEquals(null, objectBean.getPmap()); assertEquals("MORPH", objectBean.getPstring()); assertEquals(Object.class, objectBean.getPclass()); }
From source file:com.xwtec.xwserver.util.json.JSONArray.java
/** * Creates a java array from a JSONArray.<br> *///from w w w . j a va2s . com public static Object toArray(JSONArray jsonArray, JsonConfig jsonConfig) { Class objectClass = jsonConfig.getRootClass(); Map classMap = jsonConfig.getClassMap(); if (jsonArray.size() == 0) { return Array.newInstance(objectClass == null ? Object.class : objectClass, 0); } int[] dimensions = JSONArray.getDimensions(jsonArray); Object array = Array.newInstance(objectClass == null ? Object.class : objectClass, dimensions); int size = jsonArray.size(); for (int i = 0; i < size; i++) { Object value = jsonArray.get(i); if (JSONUtils.isNull(value)) { Array.set(array, i, null); } else { Class type = value.getClass(); if (JSONArray.class.isAssignableFrom(type)) { Array.set(array, i, toArray((JSONArray) value, objectClass, classMap)); } else if (String.class.isAssignableFrom(type) || Boolean.class.isAssignableFrom(type) || Character.class.isAssignableFrom(type) || JSONFunction.class.isAssignableFrom(type)) { if (objectClass != null && !objectClass.isAssignableFrom(type)) { value = JSONUtils.getMorpherRegistry().morph(objectClass, value); } Array.set(array, i, value); } else if (JSONUtils.isNumber(type)) { if (objectClass != null && (Byte.class.isAssignableFrom(objectClass) || Byte.TYPE.isAssignableFrom(objectClass))) { Array.set(array, i, Byte.valueOf(String.valueOf(value))); } else if (objectClass != null && (Short.class.isAssignableFrom(objectClass) || Short.TYPE.isAssignableFrom(objectClass))) { Array.set(array, i, Short.valueOf(String.valueOf(value))); } else { Array.set(array, i, value); } } else { if (objectClass != null) { JsonConfig jsc = jsonConfig.copy(); jsc.setRootClass(objectClass); jsc.setClassMap(classMap); Array.set(array, i, JSONObject.toBean((JSONObject) value, jsc)); } else { Array.set(array, i, JSONObject.toBean((JSONObject) value)); } } } } return array; }