@Override
    public  List<?> toList(Object object) {

        TypeType instanceType = TypeType.getInstanceType(object);

        switch (instanceType) {
            case NULL:
                return Lists.list((Object)null);


            case ARRAY:
            case ARRAY_INT:
            case ARRAY_BYTE:
            case ARRAY_SHORT:
            case ARRAY_FLOAT:
            case ARRAY_DOUBLE:
            case ARRAY_LONG:
            case ARRAY_STRING:
            case ARRAY_OBJECT:
                return Conversions.toList(object);

            case INSTANCE:
                if (Reflection.respondsTo(object, "toList")) {
                    return (List<?>) Reflection.invoke(object, "toList");
                }
                break;
        }
        return Lists.list(object);
    }
@ Override public List < ? > toList ( Object object ) { TypeType instanceType = TypeType . getInstanceType ( object ) ; switch ( instanceType ) { case NULL : return Lists . list ( ( Object ) null ) ; case ARRAY : case ARRAY_INT : case ARRAY_BYTE : case ARRAY_SHORT : case ARRAY_FLOAT : case ARRAY_DOUBLE : case ARRAY_LONG : case ARRAY_STRING : case ARRAY_OBJECT : return Conversions . toList ( object ) ; case INSTANCE : if ( Reflection . respondsTo ( object , "toList" ) ) { return ( List < ? > ) Reflection . invoke ( object , "toList" ) ; } break ; } return Lists . list ( object ) ; }
Convert an object to a list.

@param object the object we want to convert to a list
@return new list from an object