001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 * 019 */ 020package org.apache.directory.api.ldap.aci.protectedItem; 021 022 023import org.apache.directory.api.ldap.aci.ProtectedItem; 024import org.apache.directory.api.ldap.model.filter.ExprNode; 025 026 027/** 028 * The contents of entries (possibly a family member) which are restricted 029 * to those that have object class values that satisfy the predicate defined 030 * by Refinement (see 12.3.5), together (in the case of an ancestor or other 031 * family member) with the entry contents as a whole of each subordinate 032 * family member entry; it does not necessarily include the information in 033 * these entries. 034 */ 035public class ClassesItem extends ProtectedItem 036{ 037 /** The classes refinement. */ 038 private final ExprNode classes; 039 040 041 /** 042 * Creates a new instance. 043 * 044 * @param classes refinement 045 */ 046 public ClassesItem( ExprNode classes ) 047 { 048 this.classes = classes; 049 } 050 051 052 /** 053 * Gets the classes refinement. 054 * 055 * @return the classes refinement 056 */ 057 public ExprNode getClasses() 058 { 059 return classes; 060 } 061 062 063 /** 064 * {@inheritDoc} 065 */ 066 @Override 067 public int hashCode() 068 { 069 int hash = 37; 070 hash = hash * 17 + getClass().getName().hashCode(); 071 return hash; 072 } 073 074 075 /** 076 * {@inheritDoc} 077 */ 078 @Override 079 public boolean equals( Object o ) 080 { 081 if ( this == o ) 082 { 083 return true; 084 } 085 086 if ( o instanceof ClassesItem ) 087 { 088 ClassesItem that = ( ClassesItem ) o; 089 return this.classes.equals( that.classes ); 090 } 091 092 return false; 093 } 094 095 096 /** 097 * {@inheritDoc} 098 */ 099 @Override 100 public String toString() 101 { 102 StringBuilder buf = new StringBuilder(); 103 104 buf.append( "classes " ); 105 classes.printRefinementToBuffer( buf ); 106 107 return buf.toString(); 108 } 109}