protected JvmType doTryFindInIndex(String name, boolean binaryNestedTypeDelimiter) throws UnknownNestedTypeException { IndexedJvmTypeAccess indexAccess = getIndexedJvmTypeAccess(); if (indexAccess != null) { JvmType result = doTryFindInIndex(name, indexAccess); if (result == null && !isBinaryNestedTypeDelimiter(name, binaryNestedTypeDelimiter)) { ClassNameVariants variants = new ClassNameVariants(name); while(result == null && variants.hasNext()) { String nextVariant = variants.next(); result = doTryFindInIndex(nextVariant, indexAccess); } } return result; } return null; }
protected JvmType tryFindTypeInIndex(String name, boolean binaryNestedTypeDelimiter) { try { TypeInResourceSetAdapter adapter = (TypeInResourceSetAdapter) EcoreUtil.getAdapter(getResourceSet().eAdapters(), TypeInResourceSetAdapter.class); if (adapter != null) { return adapter.tryFindTypeInIndex(name, this, binaryNestedTypeDelimiter); } else { return doTryFindInIndex(name, binaryNestedTypeDelimiter); } } catch(UnknownNestedTypeException e) { return null; } } }
public JvmType tryFindTypeInIndex(String name, AbstractRuntimeJvmTypeProvider typeProvider, boolean binaryNestedTypeDelimiter) throws UnknownNestedTypeException { JvmType result = typeByQueryString.get(name); if (result != null) { if (result.eIsProxy()) { typeByQueryString.remove(name); } else { return result; } } JvmType candidate = typeProvider.doTryFindInIndex(name, binaryNestedTypeDelimiter); if (candidate != null) { typeByQueryString.put(name, candidate); return candidate; } return null; }
@Override public TypeResource createResource(URI uri) { String qualifiedName = uri.lastSegment(); if (qualifiedName.lastIndexOf('$') != -1) { String outermostClassName = new BinaryClass(qualifiedName, classLoader).getOutermostClassName(); return super.createResource(URIHelperConstants.OBJECTS_URI.appendSegment(outermostClassName)); } return super.createResource(uri); }
private JvmType doTryFindInIndex(String name, IndexedJvmTypeAccess indexAccess) throws UnknownNestedTypeException { int index = name.indexOf('$'); if (index < 0) index = name.indexOf('['); String qualifiedNameString = index < 0 ? name : name.substring(0, index); List<String> nameSegments = Strings.split(qualifiedNameString, '.'); QualifiedName qualifiedName = QualifiedName.create(nameSegments); EObject candidate = indexAccess.getIndexedJvmType(qualifiedName, name, getResourceSet()); if (candidate instanceof JvmType) return (JvmType) candidate; return null; }
/** * {@inheritDoc} * * Also registers an URI converter that can resolve resource URIs that point * to nested types to their outermost declarator. */ @Override protected void registerProtocol(ResourceSet resourceSet) { super.registerProtocol(resourceSet); final URIConverter existing = resourceSet.getURIConverter(); resourceSet.setURIConverter(new JavaURIConverter(existing)); }