This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git

commit 1d2e141f28f4e3b05c7742a5a516fd3fa574645c
Author: Thomas Vandahl <[email protected]>
AuthorDate: Sun Feb 1 16:20:11 2026 +0100

    Use records
---
 .../commons/jcs4/admin/CacheElementInfo.java       |  92 ++-----------
 .../apache/commons/jcs4/admin/CacheRegionInfo.java | 142 +++------------------
 .../org/apache/commons/jcs4/admin/JCSAdmin.jsp     |  40 +++---
 .../commons/jcs4/admin/AdminBeanUnitTest.java      |  10 +-
 4 files changed, 57 insertions(+), 227 deletions(-)

diff --git 
a/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/CacheElementInfo.java
 
b/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/CacheElementInfo.java
index c42bd6af..2ee38d6e 100644
--- 
a/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/CacheElementInfo.java
+++ 
b/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/CacheElementInfo.java
@@ -9,7 +9,7 @@ package org.apache.commons.jcs4.admin;
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *   https://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -19,90 +19,26 @@ package org.apache.commons.jcs4.admin;
  * under the License.
  */
 
-import java.beans.ConstructorProperties;
-
 /**
  * Stores info on a cache element for the template
  */
-public class CacheElementInfo
-{
+public record CacheElementInfo(
     /** Element key */
-    private final String key;
+    String key,
 
     /** Is it eternal */
-    private final boolean eternal;
+    boolean eternal,
 
     /** When it was created */
-    private final String createTime;
+    String createTime,
 
     /** Max life */
-    private final long maxLifeSeconds;
+    long maxLifeSeconds,
 
     /** When it will expire */
-    private final long expiresInSeconds;
-
-    /**
-     * Parameterized constructor
-     *
-        * @param key element key
-        * @param eternal is it eternal
-        * @param createTime when it was created
-        * @param maxLifeSeconds max life
-        * @param expiresInSeconds when it will expire
-        */
-    @ConstructorProperties({"key", "eternal", "createTime", "maxLifeSeconds", 
"expiresInSeconds"})
-    public CacheElementInfo(final String key, final boolean eternal, final 
String createTime,
-                       final long maxLifeSeconds, final long expiresInSeconds)
-    {
-       this.key = key;
-       this.eternal = eternal;
-       this.createTime = createTime;
-       this.maxLifeSeconds = maxLifeSeconds;
-       this.expiresInSeconds = expiresInSeconds;
-    }
-
-    /**
-     * @return the time the object was created
-     */
-    public String getCreateTime()
-    {
-        return this.createTime;
-    }
-
-    /**
-     * Ignored if isEternal
-     * @return how many seconds until this object expires.
-     */
-    public long getExpiresInSeconds()
-    {
-        return this.expiresInSeconds;
-    }
-
-    /**
-     * @return a string representation of the key
-     */
-    public String getKey()
-    {
-        return this.key;
-    }
-
-    /**
-     * Ignored if isEternal
-     * @return the longest this object can live.
-     */
-    public long getMaxLifeSeconds()
-    {
-        return this.maxLifeSeconds;
-    }
-
-    /**
-     * @return true if the item does not expire
-     */
-    public boolean isEternal()
-    {
-        return this.eternal;
-    }
-
+    long expiresInSeconds
+)
+{
     /**
      * @return string info on the item
      */
@@ -111,11 +47,11 @@ public class CacheElementInfo
     {
         final StringBuilder buf = new StringBuilder();
         buf.append( "\nCacheElementInfo " );
-        buf.append( "\n Key [" ).append( getKey() ).append( "]" );
-        buf.append( "\n Eternal [" ).append( isEternal() ).append( "]" );
-        buf.append( "\n CreateTime [" ).append( getCreateTime() ).append( "]" 
);
-        buf.append( "\n MaxLifeSeconds [" ).append( getMaxLifeSeconds() 
).append( "]" );
-        buf.append( "\n ExpiresInSeconds [" ).append( getExpiresInSeconds() 
).append( "]" );
+        buf.append( "\n Key [" ).append( key() ).append( "]" );
+        buf.append( "\n Eternal [" ).append( eternal() ).append( "]" );
+        buf.append( "\n CreateTime [" ).append( createTime() ).append( "]" );
+        buf.append( "\n MaxLifeSeconds [" ).append( maxLifeSeconds() ).append( 
"]" );
+        buf.append( "\n ExpiresInSeconds [" ).append( expiresInSeconds() 
).append( "]" );
 
         return buf.toString();
     }
diff --git 
a/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/CacheRegionInfo.java
 
b/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/CacheRegionInfo.java
index 8e248e8d..54f97a99 100644
--- 
a/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/CacheRegionInfo.java
+++ 
b/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/CacheRegionInfo.java
@@ -9,7 +9,7 @@ package org.apache.commons.jcs4.admin;
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
- *   https://www.apache.org/licenses/LICENSE-2.0
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
@@ -19,144 +19,38 @@ package org.apache.commons.jcs4.admin;
  * under the License.
  */
 
-import java.beans.ConstructorProperties;
-
 /**
  * Stores info on a cache region for the template
  */
-public class CacheRegionInfo
-{
+public record CacheRegionInfo(
     /** The name of the cache region */
-    private final String cacheName;
+    String cacheName,
 
     /** The size of the cache region */
-    private final int cacheSize;
+    int cacheSize,
 
     /** The status of the cache region */
-    private final String cacheStatus;
+    String cacheStatus,
 
     /** The statistics of the cache region */
-    private final String cacheStatistics;
+    String cacheStatistics,
 
     /** The number of memory hits in the cache region */
-    private final long hitCountRam;
+    long hitCountRam,
 
     /** The number of auxiliary hits in the cache region */
-    private final long hitCountAux;
+    long hitCountAux,
 
     /** The number of misses in the cache region because the items were not 
found */
-    private final long missCountNotFound;
+    long missCountNotFound,
 
     /** The number of misses in the cache region because the items were 
expired */
-    private final long missCountExpired;
+    long missCountExpired,
 
     /** The number of bytes counted so far, will be a total of all items */
-    private final long byteCount;
-
-    /**
-     * Parameterized constructor
-     *
-     * @param cacheName The name of the cache region
-     * @param cacheSize The size of the cache region
-     * @param cacheStatus The status of the cache region
-     * @param cacheStatistics The statistics of the cache region
-     * @param hitCountRam The number of memory hits in the cache region
-     * @param hitCountAux The number of auxiliary hits in the cache region
-     * @param missCountNotFound The number of misses in the cache region 
because the items were not found
-     * @param missCountExpired The number of misses in the cache region 
because the items were expired
-     * @param byteCount The number of bytes counted so far, will be a total of 
all items
-     */
-    @ConstructorProperties({"cacheName", "cacheSize", "cacheStatus", 
"cacheStatistics",
-        "hitCountRam", "hitCountAux", "missCountNotFound", "missCountExpired", 
"byteCount"})
-    public CacheRegionInfo(final String cacheName, final int cacheSize, final 
String cacheStatus,
-            final String cacheStatistics, final long hitCountRam, final long 
hitCountAux,
-            final long missCountNotFound, final long missCountExpired, final 
long byteCount)
-    {
-        this.cacheName = cacheName;
-        this.cacheSize = cacheSize;
-        this.cacheStatus = cacheStatus;
-        this.cacheStatistics = cacheStatistics;
-        this.hitCountRam = hitCountRam;
-        this.hitCountAux = hitCountAux;
-        this.missCountNotFound = missCountNotFound;
-        this.missCountExpired = missCountExpired;
-        this.byteCount = byteCount;
-    }
-
-    /**
-     * @return total byte count
-     */
-    public long getByteCount()
-    {
-        return this.byteCount;
-    }
-
-    /**
-     * @return the cacheName
-     */
-    public String getCacheName()
-    {
-        return this.cacheName;
-    }
-
-    /**
-     * @return the cacheSize
-     */
-    public int getCacheSize()
-    {
-        return this.cacheSize;
-    }
-
-    /**
-     * Return the statistics for the region.
-     *
-     * @return String
-     */
-    public String getCacheStatistics()
-    {
-        return this.cacheStatistics;
-    }
-
-    /**
-     * @return a status string
-     */
-    public String getCacheStatus()
-    {
-        return this.cacheStatus;
-    }
-
-    /**
-     * @return the hitCountAux
-     */
-    public long getHitCountAux()
-    {
-        return hitCountAux;
-    }
-
-    /**
-     * @return the hitCountRam
-     */
-    public long getHitCountRam()
-    {
-        return hitCountRam;
-    }
-
-    /**
-     * @return the missCountExpired
-     */
-    public long getMissCountExpired()
-    {
-        return missCountExpired;
-    }
-
-    /**
-     * @return the missCountNotFound
-     */
-    public long getMissCountNotFound()
-    {
-        return missCountNotFound;
-    }
-
+    long byteCount
+)
+{
     /**
      * @return string info on the region
      */
@@ -164,13 +58,13 @@ public class CacheRegionInfo
     public String toString()
     {
         final StringBuilder buf = new StringBuilder();
-        buf.append( "\nCacheRegionInfo " );
-        if ( cacheName != null )
+        buf.append("\nCacheRegionInfo ");
+        if (cacheName() != null)
         {
-            buf.append( "\n CacheName [" + cacheName + "]" );
-            buf.append( "\n Status [" + cacheStatus + "]" );
+            buf.append("\n CacheName [" + cacheName() + "]");
+            buf.append("\n Status [" + cacheStatus() + "]");
         }
-        buf.append( "\n ByteCount [" + getByteCount() + "]" );
+        buf.append("\n ByteCount [" + byteCount() + "]");
 
         return buf.toString();
     }
diff --git 
a/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/JCSAdmin.jsp 
b/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/JCSAdmin.jsp
index 4be1a443..07f90863 100644
--- a/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/JCSAdmin.jsp
+++ b/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/JCSAdmin.jsp
@@ -22,7 +22,7 @@
 <%@page import="org.apache.commons.jcs4.access.CacheAccess" %>
 <%@page import="org.apache.commons.jcs4.admin.CacheElementInfo" %>
 <%@page import="org.apache.commons.jcs4.admin.CacheRegionInfo" %>
-<%@page import="org.apache.commons.jcs4.engine.ICacheElement" %>
+<%@page import="org.apache.commons.jcs4.engine.behavior.ICacheElement" %>
 
 <jsp:useBean id="jcsBean" scope="request" 
class="org.apache.commons.jcs4.admin.JCSAdminBean" />
 
@@ -215,14 +215,14 @@
         {
 %>
   <tr>
-    <td><%=element.getKey()%></td>
-    <td><%=element.isEternal()%></td>
-    <td><%=element.getCreateTime()%></td>
-    <td><%=element.getMaxLifeSeconds()%></td>
-    <td><%=element.getExpiresInSeconds()%></td>
+    <td><%=element.key()%></td>
+    <td><%=element.eternal()%></td>
+    <td><%=element.createTime()%></td>
+    <td><%=element.maxLifeSeconds()%></td>
+    <td><%=element.expiresInSeconds()%></td>
     <td>
-      <a 
href="?action=item&cacheName=<%=cacheName%>&key=<%=element.getKey()%>"> View 
</a>
-      | <a 
href="?action=remove&cacheName=<%=cacheName%>&key=<%=element.getKey()%>"> 
Remove </a>
+      <a href="?action=item&cacheName=<%=cacheName%>&key=<%=element.key()%>"> 
View </a>
+      | <a 
href="?action=remove&cacheName=<%=cacheName%>&key=<%=element.key()%>"> Remove 
</a>
     </td>
   </tr>
 <%
@@ -259,7 +259,7 @@ which empties the entire cache.
         for (CacheRegionInfo record : records)
         {
 %>
-    <option 
value="<%=record.getCacheName()%>"><%=record.getCacheName()%></option>
+    <option value="<%=record.cacheName()%>"><%=record.cacheName()%></option>
 <%
         }
 %>
@@ -283,18 +283,18 @@ which empties the entire cache.
         {
 %>
   <tr>
-    <td><%=record.getCacheName()%></td>
-    <td><%=record.getCacheSize()%></td>
-    <td><%=record.getByteCount()%></td>
-    <td><%=record.getCacheStatus()%></td>
-    <td><%=record.getHitCountRam()%></td>
-    <td><%=record.getHitCountAux()%></td>
-    <td><%=record.getMissCountNotFound()%></td>
-    <td><%=record.getMissCountExpired()%></td>
+    <td><%=record.cacheName()%></td>
+    <td><%=record.cacheSize()%></td>
+    <td><%=record.byteCount()%></td>
+    <td><%=record.cacheStatus()%></td>
+    <td><%=record.hitCountRam()%></td>
+    <td><%=record.hitCountAux()%></td>
+    <td><%=record.missCountNotFound()%></td>
+    <td><%=record.missCountExpired()%></td>
     <td>
-      <a 
href="?action=regionSummary&cacheName=<%=record.getCacheName()%>">Summary</a>
-      | <a 
href="?action=detail&cacheName=<%=record.getCacheName()%>">Detail</a>
-      | <a href="javascript:decision('Clicking OK will remove all the data 
from the region 
[<%=record.getCacheName()%>]!','?action=clearRegion&cacheName=<%=record.getCacheName()%>')">Clear</a>
+      <a 
href="?action=regionSummary&cacheName=<%=record.cacheName()%>">Summary</a>
+      | <a href="?action=detail&cacheName=<%=record.cacheName()%>">Detail</a>
+      | <a href="javascript:decision('Clicking OK will remove all the data 
from the region 
[<%=record.cacheName()%>]!','?action=clearRegion&cacheName=<%=record.cacheName()%>')">Clear</a>
     </td>
   </tr>
 <%
diff --git 
a/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/admin/AdminBeanUnitTest.java
 
b/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/admin/AdminBeanUnitTest.java
index 54b07f1b..54fd0bdd 100644
--- 
a/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/admin/AdminBeanUnitTest.java
+++ 
b/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/admin/AdminBeanUnitTest.java
@@ -82,7 +82,7 @@ class AdminBeanUnitTest
         assertEquals( 1, elements.size(), "Wrong number of elements in the 
region." );
 
         final CacheElementInfo elementInfo = elements.get(0);
-        assertEquals( key, elementInfo.getKey(), "Wrong key." + elementInfo );
+        assertEquals( key, elementInfo.key(), "Wrong key." + elementInfo );
     }
 
     /**
@@ -108,13 +108,13 @@ class AdminBeanUnitTest
         for (final CacheRegionInfo info : regions)
         {
 
-            if ( info.getCacheName().equals( regionName ) )
+            if ( info.cacheName().equals( regionName ) )
             {
                 foundRegion = true;
 
-                assertTrue( info.getByteCount() > 5, "Byte count should be 
greater than 5." );
+                assertTrue( info.byteCount() > 5, "Byte count should be 
greater than 5." );
 
-                assertNotNull( info.getCacheStatistics(), "Should have stats." 
);
+                assertNotNull( info.cacheStatistics(), "Should have stats." );
             }
         }
 
@@ -146,7 +146,7 @@ class AdminBeanUnitTest
         assertEquals( 1, elements.size(), "Wrong number of elements in the 
region." );
 
         final CacheElementInfo elementInfo = elements.get(0);
-        assertEquals( key, elementInfo.getKey(), "Wrong key." );
+        assertEquals( key, elementInfo.key(), "Wrong key." );
 
         admin.removeItem( regionName, key );
 

Reply via email to