Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 50 51 package org.apache.avalon.meta.info; 52 53 import java.io.Serializable ; 54 import java.util.Properties ; 55 56 62 public abstract class Descriptor 63 implements Serializable 64 { 65 private static final String [] EMPTY_SET = new String [0]; 66 67 70 private final Properties m_attributes; 71 72 76 protected Descriptor( final Properties attributes ) 77 { 78 m_attributes = attributes; 79 } 80 81 87 public String getAttribute( final String key ) 88 { 89 if ( null == m_attributes ) 90 { 91 return null; 92 } 93 else 94 { 95 return m_attributes.getProperty( key ); 96 } 97 } 98 99 106 public String getAttribute( final String key, 107 final String defaultValue ) 108 { 109 if ( null == m_attributes ) 110 { 111 return defaultValue; 112 } 113 else 114 { 115 return m_attributes.getProperty( key, defaultValue ); 116 } 117 } 118 119 124 public String [] getAttributeNames() 125 { 126 if ( null == m_attributes ) 127 { 128 return EMPTY_SET; 129 } 130 else 131 { 132 return (String []) m_attributes.keySet().toArray( EMPTY_SET ); 133 } 134 } 135 136 141 public boolean equals( Object other ) 142 { 143 if ( other instanceof Descriptor ) 144 { 145 Descriptor descriptor = (Descriptor) other; 146 if ( null == m_attributes ) return null == descriptor.m_attributes; 147 148 return m_attributes.equals( descriptor.m_attributes ); 149 } 150 return false; 151 } 152 153 157 public int hashCode() 158 { 159 if( m_attributes != null ) 160 { 161 return m_attributes.hashCode(); 162 } 163 else 164 { 165 return 1; 166 } 167 } 168 169 176 protected Properties getProperties() 177 { 178 return m_attributes; 179 } 180 } 181
| Popular Tags
|