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

chrisdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 165cf66216 chore: Removed the PlcValues class as it was a relic from 
the pre-SPI3 times and is no longer used by anything but the matching test.
165cf66216 is described below

commit 165cf662164898a0f15ab72779170c5fb3e4ad2e
Author: Christofer Dutz <[email protected]>
AuthorDate: Fri Jun 12 11:58:39 2026 +0200

    chore: Removed the PlcValues class as it was a relic from the pre-SPI3 
times and is no longer used by anything but the matching test.
---
 .../apache/plc4x/java/spi/values/PlcValues.java    |  87 --------
 .../plc4x/java/spi/values/PlcValuesTest.java       | 240 ---------------------
 2 files changed, 327 deletions(-)

diff --git 
a/plc4j/spi/values/src/main/java/org/apache/plc4x/java/spi/values/PlcValues.java
 
b/plc4j/spi/values/src/main/java/org/apache/plc4x/java/spi/values/PlcValues.java
deleted file mode 100644
index c0f67025b2..0000000000
--- 
a/plc4j/spi/values/src/main/java/org/apache/plc4x/java/spi/values/PlcValues.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   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
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.plc4x.java.spi.values;
-
-import org.apache.plc4x.java.api.exceptions.PlcIncompatibleDatatypeException;
-import org.apache.plc4x.java.api.value.PlcValue;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-public class PlcValues {
-
-    private static final Logger LOGGER = 
LoggerFactory.getLogger(PlcValues.class);
-
-    private PlcValues() {
-    }
-
-    public static PlcValue of(List<PlcValue> list) {
-        return new PlcList(list);
-    }
-
-    public static PlcValue of(PlcValue... items) {
-        return new PlcList(Arrays.asList(items));
-    }
-
-    public static PlcValue of(String key, PlcValue value) {
-        return new PlcStruct(Collections.singletonMap(key, value));
-    }
-
-    public static PlcValue of(Map<String, PlcValue> map) {
-        return new PlcStruct(map);
-    }
-
-    public static PlcValue of(Object o) {
-        if (o == null) {
-            return new PlcNull();
-        }
-        try {
-            String simpleName = o.getClass().getSimpleName();
-            Class<?> clazz = o.getClass();
-            if (o instanceof List) {
-                simpleName = "List";
-                clazz = List.class;
-            } else if (clazz.isArray()) {
-                simpleName = "List";
-                clazz = List.class;
-                Object[] objectArray = (Object[]) o;
-                o = Arrays.asList(objectArray);
-            }
-            if (simpleName.equals("Boolean")) {
-                simpleName = "Bool";
-            }
-            // If it's one of the LocalDate, LocalTime or LocalDateTime, cut 
off the "Local".
-            if (simpleName.startsWith("Local")) {
-                simpleName = simpleName.substring(5);
-            }
-            Constructor<?> constructor = 
Class.forName(PlcValues.class.getPackage().getName() + ".Plc" + 
simpleName.toUpperCase()).getDeclaredConstructor(clazz);
-            return ((PlcValue) constructor.newInstance(o));
-        } catch (InstantiationException | IllegalAccessException | 
InvocationTargetException | NoSuchMethodException |
-                 ClassNotFoundException e) {
-            LOGGER.warn("Cannot wrap", e);
-            throw new PlcIncompatibleDatatypeException(o.getClass());
-        }
-    }
-}
diff --git 
a/plc4j/spi/values/src/test/java/org/apache/plc4x/java/spi/values/PlcValuesTest.java
 
b/plc4j/spi/values/src/test/java/org/apache/plc4x/java/spi/values/PlcValuesTest.java
deleted file mode 100644
index b83dfd7b71..0000000000
--- 
a/plc4j/spi/values/src/test/java/org/apache/plc4x/java/spi/values/PlcValuesTest.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   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
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.plc4x.java.spi.values;
-
-import org.apache.plc4x.java.api.exceptions.PlcIncompatibleDatatypeException;
-import org.apache.plc4x.java.api.value.PlcValue;
-import org.junit.jupiter.api.Test;
-
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-/**
- * Test class for PlcValues - Factory utility for creating PlcValue instances
- */
-class PlcValuesTest {
-
-    // ========== List Factory Methods ==========
-
-    @Test
-    void testOfList() {
-        List<PlcValue> values = Arrays.asList(
-            new PlcINT(1),
-            new PlcINT(2),
-            new PlcINT(3)
-        );
-        PlcValue result = PlcValues.of(values);
-
-        assertNotNull(result);
-        assertTrue(result instanceof PlcList);
-        assertTrue(result.isList());
-        assertEquals(3, result.getLength());
-    }
-
-    @Test
-    void testOfVarargs() {
-        PlcValue result = PlcValues.of(
-            new PlcINT(10),
-            new PlcINT(20),
-            new PlcINT(30)
-        );
-
-        assertNotNull(result);
-        assertTrue(result instanceof PlcList);
-        assertEquals(3, result.getLength());
-    }
-
-    @Test
-    void testOfVarargsEmpty() {
-        PlcValue result = PlcValues.of();
-        assertNotNull(result);
-        assertTrue(result instanceof PlcList);
-        assertEquals(0, result.getLength());
-    }
-
-    // ========== Struct Factory Methods ==========
-
-    @Test
-    void testOfSingleKeyValue() {
-        PlcValue result = PlcValues.of("key1", new PlcINT(42));
-
-        assertNotNull(result);
-        assertTrue(result instanceof PlcStruct);
-        assertTrue(result.isStruct());
-        assertTrue(result.hasKey("key1"));
-        assertEquals(new PlcINT(42), result.getValue("key1"));
-    }
-
-    @Test
-    void testOfMap() {
-        Map<String, PlcValue> map = new HashMap<>();
-        map.put("temperature", new PlcREAL(25.5f));
-        map.put("pressure", new PlcINT(100));
-
-        PlcValue result = PlcValues.of(map);
-
-        assertNotNull(result);
-        assertTrue(result instanceof PlcStruct);
-        assertEquals(2, result.getKeys().size());
-        assertTrue(result.hasKey("temperature"));
-        assertTrue(result.hasKey("pressure"));
-    }
-
-    // ========== Object Factory Method ==========
-
-    @Test
-    void testOfNull() {
-        PlcValue result = PlcValues.of((Object) null);
-        assertNotNull(result);
-        assertTrue(result instanceof PlcNull);
-        assertTrue(result.isNull());
-    }
-
-    @Test
-    void testOfBoolean() {
-        PlcValue result = PlcValues.of(true);
-        assertNotNull(result);
-        assertTrue(result instanceof PlcBOOL);
-        assertTrue(result.getBoolean());
-    }
-
-    @Test
-    void testOfInteger() {
-        // PlcValues.of(Object) uses reflection to map "Integer" -> 
"PlcINTEGER" class
-        // which doesn't exist - this is expected to fail for boxed types
-        assertThrows(PlcIncompatibleDatatypeException.class, () -> 
PlcValues.of(42));
-    }
-
-    @Test
-    void testOfLong() {
-        // PlcValues.of(Object) uses reflection to map "Long" -> "PlcLONG" 
class
-        // which doesn't exist - this is expected to fail for boxed types
-        assertThrows(PlcIncompatibleDatatypeException.class, () -> 
PlcValues.of(123456789L));
-    }
-
-    @Test
-    void testOfFloat() {
-        // PlcValues.of(Object) uses reflection to map "Float" -> "PlcFLOAT" 
class
-        // which doesn't exist - this is expected to fail for boxed types
-        assertThrows(PlcIncompatibleDatatypeException.class, () -> 
PlcValues.of(3.14f));
-    }
-
-    @Test
-    void testOfDouble() {
-        // PlcValues.of(Object) uses reflection to map "Double" -> "PlcDOUBLE" 
class
-        // which doesn't exist - this is expected to fail for boxed types
-        assertThrows(PlcIncompatibleDatatypeException.class, () -> 
PlcValues.of(2.718));
-    }
-
-    @Test
-    void testOfString() {
-        PlcValue result = PlcValues.of("test");
-        assertNotNull(result);
-        assertTrue(result instanceof PlcSTRING);
-        assertEquals("test", result.getString());
-    }
-
-    @Test
-    void testOfLocalDate() {
-        LocalDate date = LocalDate.of(2024, 1, 15);
-        PlcValue result = PlcValues.of(date);
-        assertNotNull(result);
-        // PlcValues.of() strips "Local" prefix, maps "Date" -> "PlcDATE"
-        assertTrue(result instanceof PlcDATE);
-        assertEquals(date, result.getDate());
-    }
-
-    @Test
-    void testOfLocalTime() {
-        // PlcValues.of() strips "Local" prefix, maps "Time" -> "PlcTIME"
-        // But LocalTime should map to PlcTIME_OF_DAY, not PlcTIME
-        // This is a known limitation of the reflection-based approach
-        assertThrows(PlcIncompatibleDatatypeException.class, () -> 
PlcValues.of(LocalTime.of(14, 30, 0)));
-    }
-
-    @Test
-    void testOfLocalDateTime() {
-        LocalDateTime dateTime = LocalDateTime.of(2024, 1, 15, 14, 30);
-        // PlcValues.of() strips "Local" prefix, maps "DateTime" -> 
"PlcDATETIME"
-        // But the class is actually PlcDATE_AND_TIME, not PlcDATETIME
-        assertThrows(PlcIncompatibleDatatypeException.class, () -> 
PlcValues.of(dateTime));
-    }
-
-    @Test
-    void testOfList_DirectCreation() {
-        List<String> stringList = Arrays.asList("a", "b", "c");
-        // PlcValues.of() maps "List" -> "PlcLIST" (uppercase)
-        // But the actual class is "PlcList" (camelCase)
-        assertThrows(PlcIncompatibleDatatypeException.class, () -> 
PlcValues.of((Object) stringList));
-    }
-
-    @Test
-    void testOfArray() {
-        Object[] array = new Object[]{1, 2, 3};
-        // PlcValues.of() converts array to List and tries "PlcLIST" 
(uppercase)
-        assertThrows(PlcIncompatibleDatatypeException.class, () -> 
PlcValues.of(array));
-    }
-
-    @Test
-    void testOfUnsupportedType() {
-        // An object that doesn't have a corresponding PlcValue type
-        class UnsupportedClass {
-        }
-        UnsupportedClass unsupported = new UnsupportedClass();
-
-        assertThrows(PlcIncompatibleDatatypeException.class, () -> 
PlcValues.of(unsupported));
-    }
-
-    // ========== Mixed Type Tests ==========
-
-    @Test
-    void testMixedTypeList() {
-        PlcValue result = PlcValues.of(
-            new PlcINT(1),
-            new PlcBOOL(true),
-            new PlcSTRING("test")
-        );
-
-        assertTrue(result instanceof PlcList);
-        PlcList list = (PlcList) result;
-        assertEquals(3, list.getLength());
-        assertTrue(list.getIndex(0) instanceof PlcINT);
-        assertTrue(list.getIndex(1) instanceof PlcBOOL);
-        assertTrue(list.getIndex(2) instanceof PlcSTRING);
-    }
-
-    @Test
-    void testNestedStructure() {
-        Map<String, PlcValue> innerMap = new HashMap<>();
-        innerMap.put("x", new PlcINT(1));
-        PlcStruct innerStruct = new PlcStruct(innerMap);
-
-        PlcValue result = PlcValues.of("data", innerStruct);
-
-        assertTrue(result instanceof PlcStruct);
-        assertTrue(result.getValue("data") instanceof PlcStruct);
-    }
-}

Reply via email to