|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.javacore.jmiimpl.javamodel; import java.lang.reflect.Modifier; import java.util.*; import javax.jmi.reflect.*; import javax.jmi.model.Attribute; import javax.jmi.model.GeneralizableElement; import org.netbeans.jmi.javamodel.*; /** * * @author Dusan Balek */ public class ArrayCloneMethod implements Method { private static final String typeName = "java.lang.Object"; // NOI18N private static final String MOF_ID_PREFIX = "ArrayCloneMethod:"; // NOI18N private ArrayImpl parent; private String mofId; private Type type; private MultipartId typeRef; ArrayCloneMethod(ArrayImpl parent) { this.parent = parent; mofId = MOF_ID_PREFIX + parent.refMofId(); type = ((JavaModelPackage) parent.refImmediatePackage()).getType().resolve(typeName); typeRef = new SyntheticMultipartId(this); } public List getAnnotations() { return Collections.EMPTY_LIST; } public StatementBlock getBody() { return null; } public String getBodyText() { return null; } public ClassDefinition getDeclaringClass() { return parent; } public int getDimCount() { return 0; } public int getEndOffset() { return 0; } public boolean isDeprecated() { return false; } public List getExceptionNames() { return Collections.EMPTY_LIST; } public List getExceptions() { return Collections.EMPTY_LIST; } public JavaDoc getJavadoc() { return null; } public String getJavadocText() { return null; } public int getModifiers() { return Modifier.PUBLIC; } public String getName() { return "clone"; // NOI18N } public List getParameters() { return Collections.EMPTY_LIST; } public int getPartEndOffset(ElementPartKind part) { return 0; } public int getPartStartOffset(ElementPartKind part) { return 0; } public Resource getResource() { return parent.getResource(); } public int getStartOffset() { return 0; } public Type getType() { return type; } public TypeReference getTypeName() { return typeRef; } public List getTypeParameters() { return Collections.EMPTY_LIST; } public List getChildren() { return Collections.EMPTY_LIST; } public boolean isValid() { return true; } public Collection findDependencies(boolean usages, boolean overridingMethods, boolean fromBaseClass) { return Collections.EMPTY_LIST; // [TODO] } public Collection getReferences() { return Collections.EMPTY_LIST; // [TODO] } public boolean signatureEquals(Method method) { return false; // [TODO] } public RefClass refClass() { return ((JavaModelPackage) parent.refImmediatePackage()).getField(); } public void refDelete() { // do nothing } public Object refGetValue(RefObject refObject) { if (!(refObject instanceof Attribute)) { throw new InvalidCallException(null, refObject); } return refGetValue(((Attribute) refObject).getName()); } public Object refGetValue(String str) { if ("dimCount".equals(str)) { // NOI18N return new Integer(getDimCount()); } else if ("javadoc".equals(str)) { // NOI18N return getJavadoc(); } else if ("javadocText".equals(str)) { // NOI18N return getJavadocText(); } else if ("modifiers".equals(str)) { // NOI18N return new Integer(getModifiers()); } else if ("name".equals(str)) { // NOI18N return getName(); } else if ("type".equals(str)) { // NOI18N return getType(); } else if ("typeName".equals(str)) { // NOI18N return getTypeName(); } else if ("exceptionNames".equals(str)) { // NOI18N return getExceptionNames(); } else if ("parameters".equals(str)) { // NOI18N return getParameters(); } else if ("body".equals(str)) { // NOI18N return getBody(); } else if ("bodyText".equals(str)) { // NOI18N return getBodyText(); } else if ("annotations".equals(str)) { // NOI18N return getAnnotations(); } else if ("typeParameters".equals(str)) { // NOI18N return getTypeParameters(); } throw new InvalidCallException(null, null, "Invalid attribute name: " + str); // NOI18N } public RefFeatured refImmediateComposite() { return parent; } public RefPackage refImmediatePackage() { return parent.refImmediatePackage(); } public Object refInvokeOperation(RefObject refObject, List list) throws RefException { throw new InvalidCallException(null, null); } public Object refInvokeOperation(String str, List list) throws RefException { throw new InvalidCallException(null, null); } public boolean refIsInstanceOf(RefObject objType, boolean considerSubtypes) { GeneralizableElement metaObject = (GeneralizableElement) refMetaObject(); return isInstanceOf(metaObject, objType, considerSubtypes); } private boolean isInstanceOf(GeneralizableElement metaObject, RefObject objType, boolean considerSubtypes) { if (metaObject.equals(objType)) return true; if (considerSubtypes) { Iterator it = metaObject.getSupertypes().iterator(); while (it.hasNext()) { if (isInstanceOf(((GeneralizableElement) it.next()), objType, true)) { return true; } } } return false; } public RefObject refMetaObject() { return refClass().refMetaObject(); } public String refMofId() { return mofId; } public RefFeatured refOutermostComposite() { return parent.refOutermostComposite(); } public RefPackage refOutermostPackage() { return parent.refOutermostPackage(); } public void refSetValue(String str, Object obj) { ArrayImpl.throwIsReadOnly(this); } public void refSetValue(RefObject refObject, Object obj) { ArrayImpl.throwIsReadOnly(this); } public Collection refVerifyConstraints(boolean param) { return Collections.EMPTY_LIST; } public void replaceChild(Element oldChild, Element newChild) { ArrayImpl.throwIsReadOnly(this); } public void setBody(StatementBlock newValue) { } public void setBodyText(String newValue) { } public void setDimCount(int newValue) { ArrayImpl.throwIsReadOnly(this, "dimCount"); // NOI18N } public void setJavadoc(JavaDoc newValue) { ArrayImpl.throwIsReadOnly(this, "javadoc"); // NOI18N } public void setJavadocText(String newValue) { ArrayImpl.throwIsReadOnly(this, "javadocText"); // NOI18N } public void setModifiers(int newValue) { ArrayImpl.throwIsReadOnly(this, "modifiers"); // NOI18N } public void setName(String newValue) { ArrayImpl.throwIsReadOnly(this, "name"); // NOI18N } public void setType(Type newValue) { ArrayImpl.throwIsReadOnly(this, "type"); // NOI18N } public void setTypeName(TypeReference newValue) { ArrayImpl.throwIsReadOnly(this, "typeName"); // NOI18N } public Element duplicate() { throw new UnsupportedOperationException(); } public void setDeprecated(boolean newValue) { ArrayImpl.throwIsReadOnly(this, "typeName"); // NOI18N } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.