All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.klojang.path.SegmentReader Maven / Gradle / Ivy

Go to download

Klojang Invoke is a Java module focused on path-based object access and dynamic invocation. Its central classes are the Path class and the PathWalker class. The Path class captures a path through an object graph. For example "employee.address.city". The PathWalker class lets you read from and write to a wide variety of types using Path objects.

There is a newer version: 21.1.0
Show newest version
package org.klojang.path;

abstract sealed class SegmentReader permits ArraySegmentReader, BeanSegmentReader,
    CollectionSegmentReader, MapSegmentReader, PrimitiveArraySegmentReader {

  final boolean se;
  final KeyDeserializer kd;

  SegmentReader(boolean suppressExceptions, KeyDeserializer keyDeserializer) {
    this.se = suppressExceptions;
    this.kd = keyDeserializer;
  }

  abstract Object read(T obj, Path path, int segment);

  Object deadEnd(PathWalkerException.Factory excFactory) {
    if (se) {
      return null;
    }
    throw excFactory.get();
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy