From bytes.

@param b
the b
@param clazz
the clazz
@return the object
194714
public static Object fromBytes(byte[] b, Class<?> clazz)
    {

        if (clazz.isAssignableFrom(String.class))
        {
            return Bytes.toString(b);
        }
        else if (clazz.equals(int.class) || clazz.isAssignableFrom(Integer.class))
        {
            return Bytes.toInt(b);
        }
        else if (clazz.equals(long.class) || clazz.isAssignableFrom(Long.class))
        {
            return Bytes.toLong(b);
        }
        else if (clazz.equals(boolean.class) || clazz.isAssignableFrom(Boolean.class))
        {
            return Bytes.toBoolean(b);
        }
        else if (clazz.equals(double.class) || clazz.isAssignableFrom(Double.class))
        {
            return Bytes.toDouble(b);
        }
        else if (clazz.equals(float.class) || clazz.isAssignableFrom(Float.class))
        {
            return Bytes.toFloat(b);
        }
        else if (clazz.equals(short.class) || clazz.isAssignableFrom(Short.class))
        {
            return Bytes.toShort(b);
        }
        else if (clazz.equals(BigDecimal.class))
        {
            return Bytes.toBigDecimal(b);
        }
        else
        {
            return PropertyAccessorFactory.getPropertyAccessor(clazz).fromBytes(clazz, b);
        }
    }
1075030
public Object newInstance(String clazz) {
        try {
            return Class.forName(clazz).newInstance();
        } catch (Exception e) {
            error(e);
            return null;
        }
    }
238906
static String fromBytes(final byte[] b) {
    try {
      return (String) fromBytes.invoke(null, b);
    } catch (Exception e) {
      throw new RuntimeException("fromBytes=" + fromBytes, e);
    }
  }
75296
public static Unmarshaller createUnmarshaller(Class clazz) {
		try {
			JAXBContext jaxbContext = getJaxbContext(clazz);
			return jaxbContext.createUnmarshaller();
		} catch (JAXBException e) {
			throw ExceptionUtil.unchecked(e);
		}
	}
512331
private <T> T get(Class<T> clazz) {
    try {
      return clazz.cast(get());
    } catch (ClassCastException e) {
      return null;
    }
  }
768177
public <T> T deserialize(Class<T> clazz, String stringContainingSerialisedInput) {
        T instance;
        try {
            instance = storageSerializer.deserialize(clazz, stringContainingSerialisedInput);
        } catch (SerializationException e) {
            throw new IllegalStateException("unable to serialise", e);
        }
        return instance;
    }
178500
public static String get(byte[] bytes, int from, int to) {
        final StringBuilder bld = new StringBuilder();
        for (int i = from; i < to; i++) {
            bld.append(Hex.get(bytes[i]));
        }
        return bld.toString();
    }
584203
public static byte[] readBlob(Object blob, boolean close) throws SQLException {
        byte[] result = null;
        InputStream input = null;

        //input = blob.getBinaryStream();
        try {
            input = (InputStream) MappingUtils.invokeFunction(blob, "getBinaryStream", new Class[]{}, new Object[]{});
        } catch (MjdbcException ex) {
            throw new MjdbcSQLException(ex);
        }

        result = toByteArray(input);

        if (close == true) {
            TypeHandlerUtils.closeQuietly(input);
        }

        return result;
    }
941937
public static <T> T fromByteArrayFst(byte[] data, Class<T> clazz) {
        return fromByteArrayFst(data, clazz, null);
    }
797890
public static <T> T deserialize(byte[] b, Class<T> clazz) {
		try (
			Pool<Kryo, RuntimeException>.Entry entry = kryoPool.borrow();
			Input input = new Input(b);
		) {
			T t = entry.getObject().readObject(input, clazz);
			entry.setValid(true);
			return t;
		} catch (KryoException e) {
			Log.w(e.getMessage());
			return null;
		}
	}
600349
public static <T extends Serializable> T newSerializableInstance(Class<T> clazz) {
      return OBJENESIS_SERIALIZER.newInstance(clazz);
   }
1185501
public static <T> T getBean(Class<T> clazz) {
        ApplicationContext appContext = getAppContext();
        
        try {
            return appContext == null ? null : appContext.getBean(clazz);
        } catch (Exception e) {
            return null;
        }
    }
96062
protected ByteBuffer objToBB(Object o)
    {
        if (o == null)
            return nullToBB();
        if (o instanceof java.lang.String)
            return ByteBuffer.wrap(new DataByteArray((String)o).get());
        if (o instanceof Integer)
            return Int32Type.instance.decompose((Integer)o);
        if (o instanceof Long)
            return LongType.instance.decompose((Long)o);
        if (o instanceof Float)
            return FloatType.instance.decompose((Float)o);
        if (o instanceof Double)
            return DoubleType.instance.decompose((Double)o);
        if (o instanceof UUID)
            return ByteBuffer.wrap(UUIDGen.decompose((UUID) o));
        if(o instanceof Tuple) {
            List<Object> objects = ((Tuple)o).getAll();
            //collections
            if (objects.size() > 0 && objects.get(0) instanceof String)
            {
                String collectionType = (String) objects.get(0);
                if ("set".equalsIgnoreCase(collectionType) ||
                        "list".equalsIgnoreCase(collectionType))
                    return objToListOrSetBB(objects.subList(1, objects.size()));
                else if ("map".equalsIgnoreCase(collectionType))
                    return objToMapBB(objects.subList(1, objects.size()));
                   
            }
            return objToCompositeBB(objects);
        }

        return ByteBuffer.wrap(((DataByteArray) o).get());
    }
257798
public static final Object deserialize(byte[] bytes) throws Exception {
		if (bytes == null || bytes.length < 4) {
			return new LinkedHashMap<>();
		}

		// Try to deserialize content as Object (type-safe serialization)
		if (bytes[0] == 1) {
			try {
				ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
				bais.skip(1);
				return new ObjectInputStream(bais).readObject();
			} catch (Throwable ignored) {
			}
		}

		// Read content as JSON
		String json = new String(Arrays.copyOfRange(bytes, 1, bytes.length), StandardCharsets.UTF_8);
		return TreeReaderRegistry.getReader(null).parse(json);
	}
1277379
@Override
    public <A> A fromXML(String xml, Class<A> clazz) {
        try {
            return xmlMapper().readValue(xml, clazz);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
1028878
public static <T extends Serializable>T fromBase64(byte[] bytes) throws IOException, ClassNotFoundException {
        return fromBase64(bytes, false);
    }
916897
public static <T> T readObjectFromFile(String file, Class<T> clazz) {
        return readObjectFromFile(file, clazz, false);
    }