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

com.thoughtworks.xstream.security.NoPermission Maven / Gradle / Ivy

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

/**
 * Wrapper to negate another type permission.
 * 

* If the wrapped {@link TypePermission} allows the type, this instance will throw a {@link ForbiddenClassException} * instead. An instance of this permission cannot be used to allow a type. *

* * @author Jörg Schaible * @since 1.4.7 */ public class NoPermission implements TypePermission { private final TypePermission permission; /** * Construct a NoPermission. * * @param permission the permission to negate or null to forbid any type * @since 1.4.7 */ public NoPermission(final TypePermission permission) { this.permission = permission; } public boolean allows(final Class type) { if (permission == null || permission.allows(type)) { throw new ForbiddenClassException(type); } return false; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy