All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.feilong.lib.xstream.security.PrimitiveTypePermission Maven / Gradle / Ivy

Go to download

feilong is a suite of core and expanded libraries that include utility classes, http, excel,cvs, io classes, and much much more.

There is a newer version: 4.0.8
Show newest version
/*
 * Copyright (C) 2014, 2017 XStream Committers.
 * All rights reserved.
 *
 * Created on 09. January 2014 by Joerg Schaible
 */
package com.feilong.lib.xstream.security;

import com.feilong.lib.xstream.core.util.Primitives;

/**
 * Permission for any primitive type and its boxed counterpart (excl. void).
 * 
 * @author Jörg Schaible
 * @since 1.4.7
 */
public class PrimitiveTypePermission implements TypePermission{

    /**
     * @since 1.4.7
     */
    public static final TypePermission PRIMITIVES = new PrimitiveTypePermission();

    @Override
    public boolean allows(Class type){
        return type != null && type != void.class && type != Void.class && type.isPrimitive() || Primitives.isBoxed(type);
    }

    @Override
    public int hashCode(){
        return 7;
    }

    @Override
    public boolean equals(Object obj){
        return obj != null && obj.getClass() == PrimitiveTypePermission.class;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy