![JAR search and dependency download from the Maven repository](/logo.png)
org.klojang.path.SegmentReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of klojang-invoke Show documentation
Show all versions of klojang-invoke Show documentation
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.
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