1 19 package org.netbeans.modules.javacore.jmiimpl.javamodel; 20 21 import java.util.Arrays ; 22 import java.util.List ; 23 import org.netbeans.jmi.javamodel.*; 24 import org.netbeans.mdr.storagemodel.StorableClass; 25 import org.netbeans.modules.javacore.parser.TypeParamRef; 26 import org.netbeans.modules.javacore.parser.TypeRef; 27 28 32 public abstract class MethodClassImpl extends SemiPersistentClass implements MethodClass { 33 34 protected MethodClassImpl(StorableClass s) { 35 super(s); 36 } 37 38 42 public Method createMethod() { 43 return create(null, null, 0, null, null, null, null, null, null, null, null, 0); 44 } 45 46 public Method createMethod(java.lang.String name, List annotations, int modifiers, java.lang.String javadocText, JavaDoc javadoc, StatementBlock body, java.lang.String bodyText, List typeArguments, List parameters, List exceptionNames, TypeReference typeName, int dimCount) { 47 return create(name, annotations, modifiers, javadocText, javadoc, body, bodyText, typeArguments, parameters, exceptionNames, typeName, dimCount); 48 } 49 50 private Method create(java.lang.String name, List annotations, int modifiers, java.lang.String javadocText, JavaDoc javadoc, StatementBlock body, java.lang.String bodyText, List typeArguments, List parameters, List exceptionNames, TypeReference typeName, int dimCount) { 51 MethodImpl result = create(name, modifiers, null, null, false); 52 result.setNew(); 53 result.setData(annotations, javadocText, javadoc, body, bodyText, typeArguments, parameters, exceptionNames, typeName, dimCount); 54 return result; 55 } 56 57 public MethodImpl create(String name, int modifiers, TypeRef type, TypeParamRef[] exceptions, boolean isTransient) { 58 MethodImpl result; 59 if (isTransient) { 60 result = (MethodImpl) createTransient(); 61 boolean changes = result.disableChanges; 62 result.disableChanges = true; 63 try { 64 result.setName(name); 65 result.setModifiers(modifiers); 66 } finally { 67 result.disableChanges = changes; 68 } 69 } else { 70 result = (MethodImpl) super_createMethod(name, null, modifiers, null, null, null, null, null, null, null, null, 0); 71 } 72 result.setTypeRef(type); 73 result.setExceptionRefs(exceptions == null ? null : Arrays.asList(exceptions)); 74 return result; 75 } 76 77 protected abstract Method super_createMethod(); 78 protected abstract Method super_createMethod(java.lang.String name, List annotations, int modifiers, java.lang.String javadocText, JavaDoc javadoc, StatementBlock body, java.lang.String bodyText, List typeArguments, List parameters, List exceptionNames, TypeReference typeName, int dimCount); 79 } 80 | Popular Tags |