1 /*
2 * Copyright (C) 2014 XStream Committers.
3 * All rights reserved.
4 *
5 * Created on 08. January 2014 by Joerg Schaible
6 */
7 package com.thoughtworks.xstream.security;
8
9 /**
10 * No permission for any type.
11 * <p>
12 * Can be used to skip any existing default permission.
13 * </p>
14 *
15 * @author Jörg Schaible
16 * @since 1.4.7
17 */
18 public class NoTypePermission implements TypePermission {
19
20 /**
21 * @since 1.4.7
22 */
23 public static final TypePermission NONE = new NoTypePermission();
24
25 public boolean allows(Class type) {
26 throw new ForbiddenClassException(type);
27 }
28
29 public int hashCode() {
30 return 1;
31 }
32
33 public boolean equals(Object obj) {
34 return obj != null && obj.getClass() == NoTypePermission.class;
35 }
36 }
37