|
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.util.Collection; import java.util.Collections; import javax.jmi.reflect.ConstraintViolationException; import org.netbeans.jmi.javamodel.Array; import org.netbeans.jmi.javamodel.ArrayClass; import org.netbeans.jmi.javamodel.Type; import org.netbeans.mdr.handlers.ClassProxyHandler; import org.netbeans.mdr.persistence.MOFID; import org.netbeans.mdr.persistence.StorageException; import org.netbeans.mdr.storagemodel.StorableBaseObject; import org.netbeans.mdr.storagemodel.StorableClass; import org.netbeans.mdr.util.DebugException; /** * * @author mm109185 */ public abstract class ArrayClassImpl extends ClassProxyHandler implements ArrayClass { private static final String MOFID_PREFIX = "array:"; // NOI18N private static final InstanceMap allInstances = new InstanceMap(); public ArrayClassImpl(StorableClass s) { super(s); } public Array createArray() { throw new ConstraintViolationException(this, refMetaObject(), "Cannot create instance of Array directly - use resolveArray instead."); // NOI18N } public Array createArray(java.util.List contents, org.netbeans.jmi.javamodel.MultipartId superClassName, java.util.List interfaceNames, String name) { throw new ConstraintViolationException(this, refMetaObject(), "Cannot create instance of Array directly - use resolveArray instead."); // NOI18N } public Array resolveArray(Type type) { if (type == null) return null; ArrayImpl result = (ArrayImpl) allInstances.get(type); if (result == null) { try { // [TODO] better unify immediate package and class proxy StorableBaseObject s = _getDelegate(); MOFID mofId = new MOFID(type.hashCode(), MOFID_PREFIX + type.refMofId()); DeferredObject o = new DeferredObject(mofId, s.getMdrStorage(), s.getImmediatePackageId(), s.getOutermostPackageId(), s.getMetaObject(), (StorableClass) s, null); result = (ArrayImpl) _getRepository().getHandler(o); result.type = type; allInstances.put(type, result); } catch (StorageException e) { throw new DebugException(); } } return result; } protected Collection _allOfClass(boolean recursive) { return Collections.unmodifiableCollection(allInstances.values()); } } |
... 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.