
org.xillium.base.util.ValueOf Maven / Gradle / Ivy
package org.xillium.base.util;
import java.lang.reflect.*;
import java.util.Arrays;
import java.util.regex.Pattern;
import org.xillium.base.Functor;
import org.xillium.base.beans.Beans;
import org.xillium.base.type.typeinfo;
/**
* A ValueOf is a utility to convert a String representation into a value of a given type. Conversion is
* possible if the type defines one of the following.
*
* - a static method {@code valueOf(String text)}
* - a static method {@code valueOf(Class>... types, String text)}
* - a constructor {@code
(String text)}
*
* If none of these mechanisms are available, construction of ValueOf fails with an IllegalArgumentException.
*
* If the given type is an array, the String reprensentation is first split around commas and then converted
* to the element type of the array.
*/
public class ValueOf implements Functor
© 2015 - 2025 Weber Informatics LLC | Privacy Policy