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

org.klojang.path.SegmentWriter 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 SegmentWriter permits
    ArraySegmentWriter, BeanSegmentWriter,
    ListSegmentWriter, MapSegmentWriter, PrimitiveArraySegmentWriter {

  final boolean se;
  final KeyDeserializer kd;

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

  abstract boolean write(T obj, Path path, Object value);

  boolean deadEnd(PathWalkerException.Factory excFactory) {
    if (se) {
      return false;
    }
    throw excFactory.get();
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy