Class ObjectIdGenerators.PropertyGenerator

java.lang.Object
cloud.opencode.base.json.identity.ObjectIdGenerator<Object>
cloud.opencode.base.json.identity.ObjectIdGenerators.PropertyGenerator
Enclosing class:
ObjectIdGenerators

public static class ObjectIdGenerators.PropertyGenerator extends ObjectIdGenerator<Object>
Property Generator - Uses an Existing Property as Object ID 属性生成器 - 使用现有属性作为对象 ID

A marker generator indicating that an existing property of the object should be used as its identity. The actual value is extracted from the property rather than generated.

一个标记生成器,指示应使用对象的现有属性作为其身份。 实际值从属性中提取而非生成。

Since:
JDK 25, opencode-base-json V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • PropertyGenerator

      public PropertyGenerator()
      Creates a generator with default scope (Object.class). 创建具有默认作用域(Object.class)的生成器。
    • PropertyGenerator

      public PropertyGenerator(Class<?> scope)
      Creates a generator with the specified scope. 创建具有指定作用域的生成器。
      Parameters:
      scope - the scope class - 作用域类
  • Method Details

    • generateId

      public Object generateId(Object forPojo)
      Description copied from class: ObjectIdGenerator
      Generates a unique identifier for the given object. 为给定对象生成唯一标识符。
      Specified by:
      generateId in class ObjectIdGenerator<Object>
      Parameters:
      forPojo - the object to generate an ID for - 要生成 ID 的对象
      Returns:
      the generated identifier - 生成的标识符
    • getScope

      public Class<?> getScope()
      Description copied from class: ObjectIdGenerator
      Returns the scope class used to determine ID uniqueness boundaries. 返回用于确定 ID 唯一性边界的作用域类。
      Specified by:
      getScope in class ObjectIdGenerator<Object>
      Returns:
      the scope class - 作用域类
    • canUseFor

      public boolean canUseFor(ObjectIdGenerator<?> gen)
      Description copied from class: ObjectIdGenerator
      Determines whether this generator can be used interchangeably with another. 确定此生成器是否可以与另一个互换使用。
      Specified by:
      canUseFor in class ObjectIdGenerator<Object>
      Parameters:
      gen - the other generator to check compatibility with - 要检查兼容性的另一个生成器
      Returns:
      true if compatible - 如果兼容则返回 true