001/*
002 * Copyright (C) 2014 XStream Committers.
003 * All rights reserved.
004 *
005 * Created on 08. January 2014 by Joerg Schaible
006 */
007package com.thoughtworks.xstream.security;
008
009/**
010 * No permission for any type.
011 * <p>
012 * Can be used to skip any existing default permission.
013 * </p>
014 * 
015 * @author J&ouml;rg Schaible
016 * @since 1.4.7
017 */
018public class NoTypePermission implements TypePermission {
019
020    /**
021     * @since 1.4.7
022     */
023    public static final TypePermission NONE = new NoTypePermission();
024
025    public boolean allows(Class type) {
026        throw new ForbiddenClassException(type);
027    }
028
029    public int hashCode() {
030        return 1;
031    }
032
033    public boolean equals(Object obj) {
034        return obj != null && obj.getClass() == NoTypePermission.class;
035    }
036}