List of usage examples for org.springframework.beans.propertyeditors ClassEditor getValue
public Object getValue()
From source file:org.jspringbot.keyword.expression.engine.function.StaticMethodUtils.java
public static Method getMethod(Class clazz, String methodSignature) { Matcher matcher = METHOD_SIGNATURE_PATTERN.matcher(methodSignature); if (matcher.find()) { String methodName = matcher.group(2); String parameterTypes = matcher.group(3); List<Class> types = new ArrayList<Class>(); for (String parameterType : StringUtils.split(parameterTypes, ',')) { ClassEditor editor = new ClassEditor(); editor.setAsText(parameterType); types.add((Class) editor.getValue()); }/*from w w w. j a v a2 s. c om*/ return MethodUtils.getAccessibleMethod(clazz, methodName, types.toArray(new Class[types.size()])); } throw new IllegalStateException(String.format("Invalid method signature '%s' found.", methodSignature)); }
From source file:org.jspringbot.keyword.expression.engine.function.SupportedFunctionsManager.java
private void register(Function function) { ClassEditor editor = new ClassEditor(); editor.setAsText(function.getFunctionClass()); Class clazz = (Class) editor.getValue(); Method method = StaticMethodUtils.getMethod(clazz, function.getFunctionSignature()); functionMapper.setFunction(function.getPrefix(), function.getName(), method); }
From source file:org.springframework.beans.factory.support.DependencyInjectionAspectSupport.java
/** * Resolve this FQN//from w w w .j a v a2s. c om * @param className name of the class to resolve * @return the Class */ private Class classNameStringToClass(String className) { ClassEditor ce = new ClassEditor(); ce.setAsText(className); return (Class) ce.getValue(); }
From source file:org.springframework.richclient.application.support.DefaultPropertyEditorRegistry.java
/** * Adds a property editor to the registry extracting the object class, * property name and property editor class from the properties * "objectClass", "propertyName" and "propertyEditorClass". * /*from w ww. ja v a2 s.co m*/ * @param properties * the properties */ public void setPropertyEditor(Properties properties) { ClassEditor classEditor = new ClassEditor(); Class objectClass = null; String propertyName = null; Class propertyEditorClass = null; if (properties.get("objectClass") != null) { classEditor.setAsText((String) properties.get("objectClass")); objectClass = (Class) classEditor.getValue(); } propertyName = (String) properties.get("propertyName"); if (properties.get("propertyEditorClass") != null) { classEditor.setAsText((String) properties.get("propertyEditorClass")); propertyEditorClass = (Class) classEditor.getValue(); } else { throw new IllegalArgumentException("propertyEditorClass is required"); } if (propertyName != null) { setPropertyEditor(objectClass, propertyName, propertyEditorClass); } else if (objectClass != null) { setPropertyEditor(objectClass, propertyEditorClass); } else { throw new IllegalArgumentException("objectClass and/or propertyName are required"); } }