Record Class FeatureGroup

java.lang.Object
java.lang.Record
cloud.opencode.base.feature.FeatureGroup
Record Components:
name - the group name | 组名称
description - the group description | 组描述
featureKeys - the set of feature keys in this group | 此组中的功能键集合

Security | 安全性:

  • Thread-safe: Yes (immutable record) - 线程安全: 是(不可变记录)
  • Null-safe: Partial (validates inputs) - 空值安全: 部分(验证输入)

public record FeatureGroup(String name, String description, Set<String> featureKeys) extends Record
Feature Group 功能组

Immutable record representing a group of related features.

表示一组相关功能的不可变记录。

Features | 主要功能:

  • Group features by name - 按名称分组功能
  • Check membership - 检查成员资格
  • Immutable feature key set - 不可变功能键集合

Usage Examples | 使用示例:

FeatureGroup group = new FeatureGroup("payment", "Payment features",
    Set.of("pay-v2", "pay-refund"));
boolean contains = group.contains("pay-v2"); // true
int size = group.size(); // 2
Since:
JDK 25, opencode-base-feature V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • FeatureGroup

      public FeatureGroup(String name, String description, Set<String> featureKeys)
      Compact constructor with validation 带验证的紧凑构造函数
  • Method Details

    • contains

      public boolean contains(String key)
      Check if this group contains the given feature key 检查此组是否包含给定的功能键
      Parameters:
      key - the feature key | 功能键
      Returns:
      true if contains | 如果包含返回true
    • size

      public int size()
      Get the number of features in this group 获取此组中的功能数量
      Returns:
      the size | 大小
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • featureKeys

      public Set<String> featureKeys()
      Returns the value of the featureKeys record component.
      Returns:
      the value of the featureKeys record component