src/main/java/me/senseiwells/arucas/utils/ValueConverter.java
public <T extends S, S> Value convertFrom(final T object, Context context) throws CodeError {
		if (object == null) {
			return NullValue.NULL;
		}
		if (object instanceof Value value) {
			return value;
		}

		Class<?> baseClazz = object.getClass();
		Class<?> clazz = baseClazz;
		while (clazz != Object.class) {
			@SuppressWarnings("unchecked")
			Functions.BiFunction<S, Context, Value> converter = (Functions.BiFunction<S, Context, Value>) this.converterMap.get(clazz);
			if (converter != null) {
				return converter.apply(object, context);
			}
			clazz = clazz.getSuperclass();
		}
		for (Class<?> iClass : baseClazz.getInterfaces()) {
			@SuppressWarnings("unchecked")
			Functions.BiFunction<S, Context, Value> converter = (Functions.BiFunction<S, Context, Value>) this.converterMap.get(iClass);
			if (converter != null) {
				return converter.apply(object, context);
			}
		}

		if (this.arrayConverter != null && baseClazz.isArray()) {
			return this.arrayConverter.apply(this.boxPrimitiveArray(object), context);
		}

		return JavaValue.of(object);
	}
/**
	 * Converts a Java object into a Value<?> that is usable for
	 * Arucas. It searches for a suitable class match in the map,
	 * if it is unable to find one then it simply just returns a JavaValue
	 */
Converts a Java object into a Value that is usable for
Arucas. It searches for a suitable class match in the map,
if it is unable to find one then it simply just returns a JavaValue
Converts a Java object into a Value that is usable for Arucas . It searches for a suitable class match in the map if it is unable to find one then it simply just returns a JavaValue
public <T extends S, S> Value convertFrom(final T object, Context context) throws CodeError {
		if (object == null) {
			return NullValue.NULL;
		}
		if (object instanceof Value value) {
			return value;
		}
		Class<?> baseClazz = object.getClass();
		Class<?> clazz = baseClazz;
		while (clazz != Object.class) {
			@SuppressWarnings("unchecked")
			Functions.BiFunction<S, Context, Value> converter = (Functions.BiFunction<S, Context, Value>) this.converterMap.get(clazz);
			if (converter != null) {
				return converter.apply(object, context);
			}
			clazz = clazz.getSuperclass();
		}
		for (Class<?> iClass : baseClazz.getInterfaces()) {
			@SuppressWarnings("unchecked")
			Functions.BiFunction<S, Context, Value> converter = (Functions.BiFunction<S, Context, Value>) this.converterMap.get(iClass);
			if (converter != null) {
				return converter.apply(object, context);
			}
		}
		if (this.arrayConverter != null && baseClazz.isArray()) {
			return this.arrayConverter.apply(this.boxPrimitiveArray(object), context);
		}
		return JavaValue.of(object);
	}
public < T extends S , S > Value convertFrom ( final T object , Context context ) throws CodeError { if ( object == null ) { return NullValue . NULL ; } if ( object instanceof Value value ) { return value ; } Class < ? > baseClazz = object . getClass ( ) ; Class < ? > clazz = baseClazz ; while ( clazz != Object . class ) { @ SuppressWarnings ( "unchecked" ) Functions . BiFunction < S , Context , Value > converter = ( Functions . BiFunction < S , Context , Value > ) this . converterMap . get ( clazz ) ; if ( converter != null ) { return converter . apply ( object , context ) ; } clazz = clazz . getSuperclass ( ) ; } for ( Class < ? > iClass : baseClazz . getInterfaces ( ) ) { @ SuppressWarnings ( "unchecked" ) Functions . BiFunction < S , Context , Value > converter = ( Functions . BiFunction < S , Context , Value > ) this . converterMap . get ( iClass ) ; if ( converter != null ) { return converter . apply ( object , context ) ; } } if ( this . arrayConverter != null && baseClazz . isArray ( ) ) { return this . arrayConverter . apply ( this . boxPrimitiveArray ( object ) , context ) ; } return JavaValue . of ( object ) ; }
Converts a Java object into a Value<?> that is usable for
 Arucas.
Converts a Java object into a Value<? > that is usable for Arucas .