1 20 21 package org.apache.directory.ldapstudio.browser.core.model; 22 23 24 import java.util.Arrays ; 25 import java.util.Iterator ; 26 27 28 40 public class AttributeHierarchy 41 { 42 43 44 private IEntry entry; 45 46 47 private String attributeDescription; 48 49 50 private IAttribute[] attributes; 51 52 53 60 public AttributeHierarchy( IEntry entry, String attributeDescription, IAttribute[] attributes ) 61 { 62 if ( entry == null || attributeDescription == null || attributes == null || attributes.length < 1 63 || attributes[0] == null ) 64 { 65 throw new IllegalArgumentException ( "Empty AttributeHierachie" ); 66 } 67 this.entry = entry; 68 this.attributeDescription = attributeDescription; 69 this.attributes = attributes; 70 } 71 72 73 78 public IAttribute[] getAttributes() 79 { 80 return attributes; 81 } 82 83 84 91 public boolean contains( IAttribute attribute ) 92 { 93 return Arrays.asList( attributes ).contains( attribute ); 94 } 95 96 97 102 public Iterator <IAttribute> iterator() 103 { 104 return Arrays.asList( attributes ).iterator(); 105 } 106 107 108 113 public IAttribute getAttribute() 114 { 115 return attributes[0]; 116 } 117 118 119 124 public int size() 125 { 126 return attributes.length; 127 } 128 129 130 135 public String getAttributeDescription() 136 { 137 return attributeDescription; 138 } 139 140 141 146 public IEntry getEntry() 147 { 148 return entry; 149 } 150 151 } 152 | Popular Tags |