// Path: src/main/java/org/smallibs/suitcase/cases/Case.java
// public interface Case<T, R> {
// 
//     Optional<R> unapply(T t);
// 
//     interface WithoutCapture<T, R> extends Case<T, Result.WithoutCapture<R>> {
//         static <T, R> WithoutCapture<T, R> adapt(Case<T, Result.WithoutCapture<R>> aCase) {
//             return aCase::unapply;
//         }
//     }
// 
//     interface WithCapture<T, R> extends Case<T, Result.WithCapture<R>> {
//         static <T, R> WithCapture<T, R> adapt(Case<T, Result.WithCapture<R>> aCase) {
//             return aCase::unapply;
//         }
//     }
// 
// }
// 
// Path: src/main/java/org/smallibs/suitcase/cases/core/Cases.java
// public interface Cases {
// 
//     static <T> Var.WithoutInnerCapture<T, T> Var() {
//         return Var(Any());
//     }
// 
//     static <T> Var.WithoutInnerCapture<T, T> Var(T value) {
//         return Var(Constant(value));
//     }
// 
//     static <T> Var.WithoutInnerCapture<T, T> Var(Class<T> value) {
//         return Var(typeOf(value));
//     }
// 
//     static <T, R> Var.WithoutInnerCapture<T, R> Var(Case.WithoutCapture<T, R> value) {
//         return new Var.WithoutInnerCapture<>(value);
//     }
// 
//     static <T, R> Var.WithInnerCapture<T, R> Var(Case.WithCapture<T, R> value) {
//         return new Var.WithInnerCapture<>(value);
//     }
// 
//     static <T> Case.WithoutCapture<T, T> Constant(T value) {
//         return new Case0<T, T>(p -> Objects.deepEquals(p, value) ? Optional.of(p) : Optional.empty()).$();
//     }
// 
//     static <T> Case.WithoutCapture<T, T> Null() {
//         return new Null<>();
//     }
// 
//     static <T> Case.WithoutCapture<T, T> Any() {
//         return new Case0<T, T>(Optional::of).$();
//     }
// 
//     static <T> Case.WithoutCapture<T, T> typeOf(Class<T> type) {
//         return new Case0<T, T>(p -> p.getClass().isAssignableFrom(type) ? Optional.of(type.cast(p)) : Optional.empty()).$();
//     }
// }


import org.smallibs.suitcase.cases.Case;
import org.smallibs.suitcase.cases.core.Cases;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Optional;
                    //noinspection unchecked
                    return valueCase.unapply((R) method.invoke(object));
                } catch (IllegalAccessException | InvocationTargetException | ClassCastException consume) {
                    // Ignore
                }
            }

            return Optional.empty();
        }

        private Optional<C> unapplyFieldValue(T object, Field field) {
            if (Modifier.isPublic(field.getModifiers())) {
                return unapplyDirectFieldValue(object, field);
            } else {
                return unapplyGetterFieldValue(object, field);
            }
        }

        private Optional<C> unapplyDirectFieldValue(T object, Field field) {
            try {
                //noinspection unchecked
                return valueCase.unapply((R) field.get(object));
            } catch (IllegalAccessException | ClassCastException consume) {
                // Ignore
            }

            return Optional.empty();
        }

        private Optional<C> unapplyGetterFieldValue(T object, Field field) {
// Path: src/main/java/org/smallibs/suitcase/cases/Case.java
// public interface Case<T, R> {
// 
//     Optional<R> unapply(T t);
// 
//     interface WithoutCapture<T, R> extends Case<T, Result.WithoutCapture<R>> {
//         static <T, R> WithoutCapture<T, R> adapt(Case<T, Result.WithoutCapture<R>> aCase) {
//             return aCase::unapply;
//         }
//     }
// 
//     interface WithCapture<T, R> extends Case<T, Result.WithCapture<R>> {
//         static <T, R> WithCapture<T, R> adapt(Case<T, Result.WithCapture<R>> aCase) {
//             return aCase::unapply;
//         }
//     }
// 
// }
// 
// Path: src/main/java/org/smallibs/suitcase/cases/core/Cases.java
// public interface Cases {
// 
//     static <T> Var.WithoutInnerCapture<T, T> Var() {
//         return Var(Any());
//     }
// 
//     static <T> Var.WithoutInnerCapture<T, T> Var(T value) {
//         return Var(Constant(value));
//     }
// 
//     static <T> Var.WithoutInnerCapture<T, T> Var(Class<T> value) {
//         return Var(typeOf(value));
//     }
// 
//     static <T, R> Var.WithoutInnerCapture<T, R> Var(Case.WithoutCapture<T, R> value) {
//         return new Var.WithoutInnerCapture<>(value);
//     }
// 
//     static <T, R> Var.WithInnerCapture<T, R> Var(Case.WithCapture<T, R> value) {
//         return new Var.WithInnerCapture<>(value);
//     }
// 
//     static <T> Case.WithoutCapture<T, T> Constant(T value) {
//         return new Case0<T, T>(p -> Objects.deepEquals(p, value) ? Optional.of(p) : Optional.empty()).$();
//     }
// 
//     static <T> Case.WithoutCapture<T, T> Null() {
//         return new Null<>();
//     }
// 
//     static <T> Case.WithoutCapture<T, T> Any() {
//         return new Case0<T, T>(Optional::of).$();
//     }
// 
//     static <T> Case.WithoutCapture<T, T> typeOf(Class<T> type) {
//         return new Case0<T, T>(p -> p.getClass().isAssignableFrom(type) ? Optional.of(type.cast(p)) : Optional.empty()).$();
//     }
// }


// Path: src/main/java/org/smallibs/suitcase/cases/lang/Beans.java
import org.smallibs.suitcase.cases.Case;
import org.smallibs.suitcase.cases.core.Cases;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Optional;

                    //noinspection unchecked
                    return valueCase.unapply((R) method.invoke(object));
                } catch (IllegalAccessException | InvocationTargetException | ClassCastException consume) {
                    // Ignore
                }
            }

            return Optional.empty();
        }

        private Optional<C> unapplyFieldValue(T object, Field field) {
            if (Modifier.isPublic(field.getModifiers())) {
                return unapplyDirectFieldValue(object, field);
            } else {
                return unapplyGetterFieldValue(object, field);
            }
        }

        private Optional<C> unapplyDirectFieldValue(T object, Field field) {
            try {
                //noinspection unchecked
                return valueCase.unapply((R) field.get(object));
            } catch (IllegalAccessException | ClassCastException consume) {
                // Ignore
            }

            return Optional.empty();
        }

        private Optional<C> unapplyGetterFieldValue(T object, Field field) {
            try {