Example usage for java.lang Void TYPE

List of usage examples for java.lang Void TYPE

Introduction

In this page you can find the example usage for java.lang Void TYPE.

Prototype

Class TYPE

To view the source code for java.lang Void TYPE.

Click Source Link

Document

The Class object representing the pseudo-type corresponding to the keyword void .

Usage

From source file:com.helpinput.propertyeditors.PropertyEditorRegister.java

private static boolean addProperty(Class<? extends PropertyEditor> propertyEditorType, Property propertyAnn,
        Map<Method, Object> setMethodAndValues) {

    final String methodName = Commons.getSetterName(propertyAnn.name());

    if (!Utils.hasLength(methodName))
        return false;

    Method method = Utils.findMethod(propertyEditorType, methodName);

    if (method == null || !method.getReturnType().equals(Void.TYPE))
        return false;

    Class<?>[] parameterTypes = method.getParameterTypes();

    if (parameterTypes == null || parameterTypes.length != 1)
        return false;

    try {// w w w  .  ja  v  a2  s.  co  m
        Class<?> parameterType = parameterTypes[0];
        Object realValue = ConvertUtils.convert(propertyAnn.value(), parameterType);
        setMethodAndValues.put(method, realValue);
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
    return true;
}

From source file:net.paslavsky.springrest.MetadataBuilder.java

MetadataBuilder() {
    metadata = new RestMethodMetadata();
    metadata.setHttpMethod(HttpMethod.GET);
    metadata.setMethodReturnType(Void.TYPE);
    metadata.setResponseClass(Void.class);
    metadata.setQueryParameters(new HashMap<String, Integer>());
    metadata.setUriVarParameters(new HashMap<String, Integer>());
    metadata.setRequestHeaderParameters(new HashMap<String, Integer>());
}

From source file:org.reindeer.redis.JedisCallbackFilter.java

@Override
public int accept(Method method) {
    if ("finalize".equals(method.getName()) && method.getParameterTypes().length == 0
            && method.getReturnType() == Void.TYPE) {
        return 0;
    }//from   w  w  w.jav a 2  s  .co  m
    return 1;
}

From source file:org.impalaframework.spring.DebuggingInterceptor.java

public Object invoke(MethodInvocation invocation) throws Throwable {

    logger.debug("Calling method " + invocation);
    Class<?> returnType = invocation.getMethod().getReturnType();

    if (Void.TYPE.equals(returnType))
        return null;
    if (Byte.TYPE.equals(returnType))
        return (byte) 0;
    if (Short.TYPE.equals(returnType))
        return (short) 0;
    if (Integer.TYPE.equals(returnType))
        return (int) 0;
    if (Long.TYPE.equals(returnType))
        return 0L;
    if (Float.TYPE.equals(returnType))
        return 0f;
    if (Double.TYPE.equals(returnType))
        return 0d;
    if (Boolean.TYPE.equals(returnType))
        return false;

    return null;/*from  w ww. jav  a 2s.co m*/
}

From source file:com.ysheng.auth.common.restful.util.JsonSerializer.java

/**
 * Deserializes a JSON string to an object.
 *
 * @param serialized The JSON string that contains the serialized object.
 * @param typeReference The type reference of the object.
 * @param <T> The type of the object.
 * @return An object deserialized from the string.
 * @throws IOException The error that contains detail information.
 *//*w  w w . java2s .c  om*/
public static <T> T deserialize(HttpEntity serialized, TypeReference<T> typeReference) throws IOException {
    if (typeReference.getType() == Void.TYPE) {
        return null;
    }

    return objectMapper.readValue(serialized.getContent(), typeReference);
}

From source file:griffon.plugins.domain.methods.MethodSignature.java

public MethodSignature(@Nonnull String methodName) {
    this(false, Void.TYPE, methodName, EMPTY_CLASS_ARRAY);
}

From source file:Main.java

/**
 * Creates a class identifier of form Labc/abc;, from a Class.
 *//*from  ww  w .  j  a  va 2 s .c  om*/
public static String ci(Class n) {
    if (n.isArray()) {
        n = n.getComponentType();
        if (n.isPrimitive()) {
            if (n == Byte.TYPE) {
                return "[B";
            } else if (n == Boolean.TYPE) {
                return "[Z";
            } else if (n == Short.TYPE) {
                return "[S";
            } else if (n == Character.TYPE) {
                return "[C";
            } else if (n == Integer.TYPE) {
                return "[I";
            } else if (n == Float.TYPE) {
                return "[F";
            } else if (n == Double.TYPE) {
                return "[D";
            } else if (n == Long.TYPE) {
                return "[J";
            } else {
                throw new RuntimeException("Unrecognized type in compiler: " + n.getName());
            }
        } else {
            return "[" + ci(n);
        }
    } else {
        if (n.isPrimitive()) {
            if (n == Byte.TYPE) {
                return "B";
            } else if (n == Boolean.TYPE) {
                return "Z";
            } else if (n == Short.TYPE) {
                return "S";
            } else if (n == Character.TYPE) {
                return "C";
            } else if (n == Integer.TYPE) {
                return "I";
            } else if (n == Float.TYPE) {
                return "F";
            } else if (n == Double.TYPE) {
                return "D";
            } else if (n == Long.TYPE) {
                return "J";
            } else if (n == Void.TYPE) {
                return "V";
            } else {
                throw new RuntimeException("Unrecognized type in compiler: " + n.getName());
            }
        } else {
            return "L" + p(n) + ";";
        }
    }
}

From source file:griffon.plugins.domain.methods.MethodSignature.java

public MethodSignature(@Nonnull String methodName, Class<?>... parameterTypes) {
    this(false, Void.TYPE, methodName, parameterTypes);
}

From source file:springfox.documentation.schema.Types.java

public static boolean isVoid(ResolvedType returnType) {
    return Void.class.equals(returnType.getErasedType()) || Void.TYPE.equals(returnType.getErasedType());
}

From source file:pl.bristleback.server.bristle.conf.resolver.action.ResponseResolver.java

ActionResponseInformation resolveResponse(Method action) {
    ActionResponseInformation responseInformation = new ActionResponseInformation();

    Class<?> actionReturnType = action.getReturnType();
    if (actionReturnType.equals(Void.class) || actionReturnType.equals(Void.TYPE)) {
        responseInformation.setVoidResponse(true);
    }/*from   w ww.ja v a2s  .  c  om*/

    resolveResponseSerialization(action, responseInformation);

    return responseInformation;
}