@Override protected IMirror createMirrorForFQN(String name) { try { Class<?> clazz = classFinder.forName(name); return createMirror(clazz); } catch (ClassNotFoundException e) { return null; } }
/** * @since 2.4 */ @Override public JvmType findTypeByName(String name, boolean binaryNestedTypeDelimiter) { if (isBinaryNestedTypeDelimiter(name, binaryNestedTypeDelimiter)) { return findTypeByName(name); } return doFindTypeByName(name); }
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; }
private JvmType findTypeByClass(Class<?> clazz) { IndexedJvmTypeAccess indexedJvmTypeAccess = getIndexedJvmTypeAccess(); URI resourceURI = uriHelper.createResourceURI(clazz); if (indexedJvmTypeAccess != null) { URI proxyURI = resourceURI.appendFragment(uriHelper.getFragment(clazz)); EObject candidate = indexedJvmTypeAccess.getIndexedJvmType(proxyURI, getResourceSet()); if (candidate instanceof JvmType) return (JvmType) candidate; } TypeResource result = (TypeResource) getResourceSet().getResource(resourceURI, true); return findTypeByClass(clazz, result); }
public URI createResourceURI(Type type) { StringBuilder uriBuilder = createURIBuilder(); createResourceURI(type, uriBuilder); return createURI(uriBuilder); }
@Inject public CachingClasspathTypeProviderFactory(ClassLoader classLoader) { super(classLoader); DeclaredTypeFactory factoryDelegate = new DeclaredTypeFactory(new ClassURIHelper()); reusedFactory = new CachingDeclaredTypeFactory(factoryDelegate); }
public ClassFinder getClassFinder() { if (classFinder == null) classFinder = new ClassFinder(classLoader); return classFinder; }
protected AbstractJvmTypeProvider(ResourceSet resourceSet, IndexedJvmTypeAccess indexedJvmTypeAccess) { if (resourceSet == null) throw new IllegalArgumentException("resourceSet may not be null"); this.indexedJvmTypeAccess = indexedJvmTypeAccess; this.resourceSet = resourceSet; registerProtocol(resourceSet); primitiveTypeFactory = new PrimitiveTypeFactory(); }
public ClasspathTypeProvider(ClassLoader classLoader, ResourceSet resourceSet, IndexedJvmTypeAccess indexedJvmTypeAccess) { super(resourceSet, indexedJvmTypeAccess); classFinder = createClassFinder(classLoader); uriHelper = createClassURIHelper(); declaredTypeFactory = createDeclaredTypeFactory(); }
public static URI computeTypeUri(final Class<?> topLevelClass) { return new ClassURIHelper().getFullURI(topLevelClass); }
private CachingDeclaredTypeFactory newClassReaderTypeFactory(ClassLoader classLoader) { DeclaredTypeFactory factoryDelegate = new DeclaredTypeFactory(new ClassFileBytesAccess(), classLoader); return new CachingDeclaredTypeFactory(factoryDelegate); }
@Override protected EObject getEObjectByID(final String id) { return this.m.getEObject(this, id, this.fallback); }
@Override public ClassMirror createMirror(Class<?> clazz) { return ClassMirror.createClassMirror(clazz, reusedFactory); }
protected AbstractClassFinder(ClassLoader classLoader, C nullValue, Map<String, C> cache) { this.classLoader = classLoader; this.nullValue = nullValue; this.cache = cache; this.classNameUtil = new ClassNameUtil(); }
protected URI toCommonTypesUri(Class<?> clazz) { URI result = uriHelper.getFullURI(clazz); return result; }
/** * {@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)); }
@Override public JvmType findTypeByName(String name, boolean binaryNestedTypeDelimiter) { if (isBinaryNestedTypeDelimiter(name, binaryNestedTypeDelimiter)) { return findTypeByName(name); } return doFindTypeByName(name); }
public ClassFinder getClassFinder() { if (classFinder == null) classFinder = new ClassFinder(classLoader); return classFinder; }
protected AbstractJvmTypeProvider(ResourceSet resourceSet, IndexedJvmTypeAccess indexedJvmTypeAccess, TypeResourceServices services) { if (resourceSet == null) throw new IllegalArgumentException("resourceSet may not be null"); this.indexedJvmTypeAccess = indexedJvmTypeAccess; this.resourceSet = resourceSet; registerProtocol(resourceSet); primitiveTypeFactory = new PrimitiveTypeFactory(); this.services = services; }
@Override public ClassMirror createMirror(Class<?> clazz) { return ClassMirror.createClassMirror(clazz, reusedFactory); }