1 19 24 25 package org.netbeans.modules.javacore.parser; 26 27 import java.util.HashMap ; 28 import java.util.Map ; 29 import org.netbeans.jmi.javamodel.Field; 30 import org.netbeans.jmi.javamodel.ClassDefinition; 31 32 36 class MemberFieldScope implements ScopeMember { 37 private ClassDefinition javaClass; 38 private Map fields; 39 40 MemberFieldScope(ClassDefinition jcls) { 41 javaClass=jcls; 42 } 43 44 private void initFieldsMap() { 45 Object [] features=javaClass.getFeatures().toArray(); 46 47 fields=new HashMap (); 48 javaClass=null; 49 for(int i=0;i<features.length;i++) { 50 Object feature=features[i]; 51 52 if (feature instanceof Field) { 53 Field field=(Field)feature; 54 55 fields.put(field.getName(), field); 56 } 57 } 58 } 59 60 public Object lookup(Object key) { 61 if (fields==null) 62 initFieldsMap(); 63 return fields.get(key); 64 } 65 } 66 | Popular Tags |