public Object toObject()

in src/main/java/com/pastdev/jsch/nio/file/UnixSshFileSystemProvider.java [885:931]


        public Object toObject( String value ) {
            if ( this == isRegularFile ) {
                return "regular file".equals( value.toLowerCase() );
            }
            if ( this == isDirectory ) {
                return "directory".equals( value.toLowerCase() );
            }
            if ( this == isSymbolicLink ) {
                return "symbolic link".equals( value.toLowerCase() );
            }
            if ( this == isOther ) {
                return "other".equals( value.toLowerCase() );
            }
            if ( this == owner ) {
                return new StandardUserPrincipal( value );
            }
            if ( this == group ) {
                return new StandardGroupPrincipal( value );
            }
            if ( this == permissions ) {
                // need to remove leading 'd' and replace possible 's'
                char[] permissions = value.substring( 1 ).toCharArray();
                for ( int i = 0; i < 9; i++ ) {
                    if ( permissions[i] != '-' ) {
                        permissions[i] = allPermissions[i];
                    }
                }
                return PosixFilePermissions.fromString( new String( permissions ) );
            }
            if ( valueClass == Long.TYPE ) {
                return Long.parseLong( value );
            }
            if ( valueClass == BigDecimal.class ) {
                return new BigDecimal( value );
            }
            if ( valueClass == FileTime.class ) {
                long seconds = 0;
                try {
                    seconds = Long.parseLong( value );
                } catch ( NumberFormatException e ) {
                    //Do nothing. Some stat versions don't support creation date and potentionally other times.
                }
                return FileTime.fromMillis( seconds * 1000 );
            }

            return value;
        }