001package com.streamconverter.path; 002 003/** 004 * 最小限のPathインターフェース 005 * 006 * <p>このインターフェースは、StreamConverterで使用される様々な種類のパスセレクタ (TreePath、TreePath、CSVパス)の統一的な契約を提供します。 007 * 008 * <p>Don't Ask, Tell原則に従い、パス一致判定のみに特化した設計です。 009 * 010 * <p>このインターフェースは関数型インターフェースです。ラムダ式やメソッド参照で実装できます。 011 * 012 * <p>使用例: 013 * 014 * <pre>{@code 015 * IPath<JsonNode> rootPath = node -> node.isRoot(); 016 * IPath<Integer> evenColumnPath = col -> col % 2 == 0; 017 * }</pre> 018 * 019 * @param <T> コンテキスト型(TreePath=JsonNode, TreePath=List<String>, CSVPath=Integer) 020 */ 021@FunctionalInterface 022public interface IPath<T> { 023 024 /** 025 * 指定されたコンテキストがこのパスにマッチするか判定 026 * 027 * @param context 判定対象のコンテキスト 028 * @return マッチする場合true 029 */ 030 boolean matches(T context); 031}