class FileNameUtil {

    public static String removeExtension(final Path path,
                                         final ResourceTypeDefinition type) {
        if (path == null) {
            return null;
        }
        final String fileName = path.getFileName();
        if (type == null) {
            return fileName;
        }
        return removeExtension(path,
                               type.getSuffix());
    }

}