001 /*
002 * Copyright (C) 2014 XStream Committers.
003 * All rights reserved.
004 *
005 * Created on 23. January 2014 by Joerg Schaible
006 */
007 package com.thoughtworks.xstream.security;
008
009 /**
010 * Permission for a type hierarchy with a name matching one in the provided list.
011 *
012 * @author Jörg Schaible
013 * @since 1.4.7
014 */
015 public class TypeHierarchyPermission implements TypePermission {
016
017 private Class type;
018
019 /**
020 * @since 1.4.7
021 */
022 public TypeHierarchyPermission(Class type) {
023 this.type = type;
024 }
025
026 public boolean allows(Class type) {
027 if (type == null)
028 return false;
029 return this.type.isAssignableFrom(type);
030 }
031
032 }