Enum Class ReferenceType

java.lang.Object
java.lang.Enum<ReferenceType>
org.miaixz.bus.core.lang.ref.ReferenceType
All Implemented Interfaces:
Serializable, Comparable<ReferenceType>, Constable

public enum ReferenceType extends Enum<ReferenceType>
引用类型
Since:
Java 17+
Author:
Kimi Liu
  • Enum Constant Details

    • STRONG

      public static final ReferenceType STRONG
      强引用,不回收
    • SOFT

      public static final ReferenceType SOFT
      软引用,在GC报告内存不足时会被GC回收
    • WEAK

      public static final ReferenceType WEAK
      弱引用,在GC时发现弱引用会回收其对象
    • PHANTOM

      public static final ReferenceType PHANTOM
      虚引用,在GC时发现虚引用对象,会将PhantomReference插入ReferenceQueue。 此时对象未被真正回收,要等到ReferenceQueue被真正处理后才会被回收。
  • Method Details

    • values

      public static ReferenceType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ReferenceType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null