1 19 20 package org.netbeans.modules.java.bridge; 21 22 import java.lang.reflect.Modifier ; 23 import java.beans.PropertyChangeEvent ; 24 25 import org.openide.src.*; 26 import org.netbeans.jmi.javamodel.Constructor; 27 28 class ConstructorElementImpl extends CallableImpl { 29 30 private ElementImpl.ElementListener callableListener; 31 32 private static final long serialVersionUID = 3379682002192002288L; 33 34 ConstructorElementImpl(DefaultLangModel model, Constructor constructor) { 35 super(model, constructor); 36 } 37 38 protected void setParent(ElementImpl impl) { 39 if (impl instanceof ClassElementImpl) { 40 this.declaringClassImpl = (ClassElementImpl)impl; 41 } 42 } 43 44 public Object readResolve() { 45 return null; 46 } 47 48 public void connectListener () { 49 callableListener = new CallableImpl.CallableListener (this); 50 callableListener.connect (); 51 } 52 53 protected Identifier createName(String dummy) { 54 if (getDeclaringImpl() != null) 55 return Identifier.create(getDeclaringImpl().getName().getSourceName()); 56 else 57 return super.createName(dummy); 58 } 59 60 63 protected void checkNameConstraints(Identifier name) throws SourceException { 64 super.checkNameConstraints(name); 65 if (!name.getName().equals(getDeclaringImpl().getName().getName())) { 68 throw new SourceException("Invalid constructor name: " + name); } 70 } 71 72 75 protected void checkModifierConstraints(int newMods) throws SourceException { 76 super.checkModifierConstraints(newMods); 77 if ((newMods & (Modifier.STATIC | Modifier.STRICT | Modifier.FINAL | 79 Modifier.ABSTRACT | Modifier.SYNCHRONIZED)) > 0) { 80 throw new SourceException("Invalid constructor modifiers : " + Modifier.toString(newMods)); 82 } 83 } 84 85 public String toString() { 86 return "ConstructorElementImpl[" + getName().getSourceName() + ", " + getParameters().length + " args]"; } 89 90 protected Element cloneSelf() { 91 ConstructorElement clone = new ConstructorElement(); 92 copyCallableProperties(clone); 93 return clone; 94 } 95 } | Popular Tags |