Example usage for org.apache.wicket.util.lang Objects convertValue

List of usage examples for org.apache.wicket.util.lang Objects convertValue

Introduction

In this page you can find the example usage for org.apache.wicket.util.lang Objects convertValue.

Prototype

public static <T> T convertValue(final Object value, final Class<T> toType) 

Source Link

Document

Convert between basic Java types, i.e.

Usage

From source file:org.wicketstuff.lazymodel.reflect.Evaluation.java

License:Apache License

/**
 * Create a proxy for the current type.// w  w  w  .j  av  a  2  s .c o m
 * <p>
 * If the result cannot be proxied, it is accessible via
 * {@link #lastNonProxyable}.
 * 
 * @return proxy or {@code null} if invocation result cannot be proxied
 */
@SuppressWarnings("unchecked")
public Object proxy() {
    Class clazz = Reflection.getClass(type);

    if (clazz.isPrimitive()) {
        lastNonProxyable.set(this);

        return Objects.convertValue(null, clazz);
    }

    Class proxyClass = proxyFactory.createClass(clazz);
    if (proxyClass == null) {
        lastNonProxyable.set(this);

        return null;
    }

    return clazz.cast(proxyFactory.createInstance(proxyClass, this));
}