Interface ElementLoaderFactory
- All Known Implementing Classes:
DefaultElementLoaderFactory
ElementLoader factory. This loads an instance of a Element on-demand. When loading an
ElementType.ISOLATED_CLASSPATH Element, must supply a ClassLoader which is parented to-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault Optional<ElementDefinitionRecord> findElementDefinitionRecord(Attributes attributes, Predicate<ElementDefinitionRecord> selector) Finds theElementname, this will find theElementRecordassociated with it, throwing an exception if it is unable to find theElementDefinitionannotation.findElementDefinitionRecord(ClassLoader classLoader, Attributes attributes, Predicate<ElementDefinitionRecord> selector) Finds theElementname, this will find theElementRecordassociated with it, return an empty optional if it is unable to find theElementDefinitionannotation.static ElementLoaderFactoryGets a defaultElementLoaderFactoryvia theServiceLoaderinterface.getElementRecordFromPackage(Attributes attributes, Package aPackage) Given thePackage, this will find theElementRecordassociated with it, throwing an exception if it is unable to find theElementDefinitionannotation.getExposedServices(Package aPackage) Scans the suppliedPackagefor specifieddefault ElementLoadergetIsolatedLoader(Attributes attributes, ElementLoaderFactory.ClassLoaderConstructor classLoaderCtor) Scans the classpath, using the suppliedClassLoader, forElementinstances.default ElementLoadergetIsolatedLoader(Attributes attributes, ElementLoaderFactory.ClassLoaderConstructor classLoaderCtor, Predicate<ElementDefinitionRecord> selector) Scans the classpath, using the suppliedClassLoader, forElementinstances.default ElementLoadergetIsolatedLoader(Attributes attributes, ClassLoader baseClassLoader, ElementLoaderFactory.ClassLoaderConstructor classLoaderCtor) Scans the classpath, using the suppliedClassLoader, forElementinstances.default ElementLoadergetIsolatedLoader(Attributes attributes, ClassLoader baseClassLoader, ElementLoaderFactory.ClassLoaderConstructor classLoaderCtor, Predicate<ElementDefinitionRecord> selector) Scans the classpath, using the suppliedClassLoader, forElementinstances.default ElementLoadergetIsolatedLoaderWithParent(Attributes attributes, ClassLoader baseClassLoader, ElementLoaderFactory.ClassLoaderConstructor classLoaderCtor, Element element) Scans the classpath, using the suppliedClassLoader, forElementinstances.getIsolatedLoaderWithParent(Attributes attributes, ClassLoader baseClassLoader, ElementLoaderFactory.ClassLoaderConstructor classLoaderCtor, Element element, Predicate<ElementDefinitionRecord> selector) Scans the classpath, using the suppliedClassLoader, forElementinstances.getSharedLoader(ElementRecord elementRecord, ServiceLocator serviceLocator)
-
Method Details
-
getIsolatedLoader
default ElementLoader getIsolatedLoader(Attributes attributes, ElementLoaderFactory.ClassLoaderConstructor classLoaderCtor) Scans the classpath, using the supplied
ClassLoader, forElementinstances. If the element is found, then this returns an instance ofElementLoaderwhich can be used to instantiate theElement. With the suppliedClassLoader(from the suppliedFunctionthere must exist exactly oneElementDefinition.Results in a
The returnedElementType.ISOLATED_CLASSPATHElementElementLoaderwill use the bootstrap classpath with a filtered version of the supplied baseClassLoaderas the parent classloader.- Parameters:
attributes- the attributes to useclassLoaderCtor- theClassLoaderclassloader- Returns:
- the
ElementLoader
-
getIsolatedLoader
default ElementLoader getIsolatedLoader(Attributes attributes, ClassLoader baseClassLoader, ElementLoaderFactory.ClassLoaderConstructor classLoaderCtor) Scans the classpath, using the supplied
ClassLoader, forElementinstances. If the element is found, then this returns an instance ofElementLoaderwhich can be used to instantiate theElement. With the suppliedClassLoader(from the suppliedFunctionthere must exist exactly oneElementDefinition.Results in a
The returnedElementType.ISOLATED_CLASSPATHElementElementLoaderwill use the bootstrap classpath with a filtered version of the supplied baseClassLoaderas the parent classloader.- Parameters:
attributes- the attributes to usebaseClassLoader- the baseClassLoaderclassLoaderCtor- theClassLoaderclassloader- Returns:
- the
ElementLoader
-
getIsolatedLoader
default ElementLoader getIsolatedLoader(Attributes attributes, ElementLoaderFactory.ClassLoaderConstructor classLoaderCtor, Predicate<ElementDefinitionRecord> selector) Scans the classpath, using the supplied
ClassLoader, forElementinstances. If the element is found, then this returns an instance ofElementLoaderwhich can be used to instantiate theElement. With the suppliedClassLoader(from the suppliedFunctionthere must exist exactly oneElementDefinitionmatched by the suppliedPredicate.Results in a
The returnedElementType.ISOLATED_CLASSPATHElementElementLoaderwill use the bootstrap classpath with a filtered version of the supplied baseClassLoaderas the parent classloader.- Parameters:
attributes- the attributes to useclassLoaderCtor- theClassLoaderclassloaderselector- aPredicateto select a singleElementDefinitionRecordto load- Returns:
- the
ElementLoader
-
getIsolatedLoader
default ElementLoader getIsolatedLoader(Attributes attributes, ClassLoader baseClassLoader, ElementLoaderFactory.ClassLoaderConstructor classLoaderCtor, Predicate<ElementDefinitionRecord> selector) Scans the classpath, using the supplied
ClassLoader, forElementinstances. If the element is found, then this returns an instance ofElementLoaderwhich can be used to instantiate theElement. With the suppliedClassLoader(from the suppliedFunctionthere must exist exactly oneElementDefinitionwith the suppliedPredicate.Results in a
The returnedElementType.ISOLATED_CLASSPATHElementElementLoaderwill use the bootstrap classpath with a filtered version of the supplied baseClassLoaderas the parent classloader.- Parameters:
attributes- the attributes to usebaseClassLoader- the baseClassLoader, this will be ultimately be the parent forElement'sClassLoaderinstance.classLoaderCtor- theClassLoaderclassloaderselector- aPredicateto select a singleElementDefinitionRecordto load- Returns:
- the
ElementLoader
-
getIsolatedLoaderWithParent
default ElementLoader getIsolatedLoaderWithParent(Attributes attributes, ClassLoader baseClassLoader, ElementLoaderFactory.ClassLoaderConstructor classLoaderCtor, Element element) Scans the classpath, using the supplied
ClassLoader, forElementinstances. If the element is found, then this returns an instance ofElementLoaderwhich can be used to instantiate theElement. With the suppliedClassLoader(from the suppliedFunctionthere must exist exactly oneElementDefinitionwith the suppliedPredicate.Results in a
The returnedElementType.ISOLATED_CLASSPATHElementElementLoaderwill use theElement's classpath with a filtered version of the supplied baseClassLoaderas the parent classloader.- Parameters:
attributes- the attributes to usebaseClassLoader- the baseClassLoader, this will be ultimately be the parent forElement'sClassLoaderinstance.classLoaderCtor- theClassLoaderclassloader- Returns:
- the
ElementLoader
-
getIsolatedLoaderWithParent
ElementLoader getIsolatedLoaderWithParent(Attributes attributes, ClassLoader baseClassLoader, ElementLoaderFactory.ClassLoaderConstructor classLoaderCtor, Element element, Predicate<ElementDefinitionRecord> selector) Scans the classpath, using the supplied
ClassLoader, forElementinstances. If the element is found, then this returns an instance ofElementLoaderwhich can be used to instantiate theElement. With the suppliedClassLoader(from the suppliedFunctionthere must exist exactly oneElementDefinitionwith the suppliedPredicate.Results in a
The returnedElementType.ISOLATED_CLASSPATHElementElementLoaderwill use theElement's classpath with a filtered version of the supplied baseClassLoaderas the parent classloader.- Parameters:
attributes- the attributes to usebaseClassLoader- the baseClassLoader, this will be ultimately be the parent forElement'sClassLoaderinstance.classLoaderCtor- theClassLoaderclassloaderelement- the parentElementto use for the classloader isolation, may be null indicating that isolation should exist for the bootstrap classpath only.selector- aPredicateto select a singleElementDefinitionRecordto load- Returns:
- the
ElementLoader
-
findElementDefinitionRecord
default Optional<ElementDefinitionRecord> findElementDefinitionRecord(Attributes attributes, Predicate<ElementDefinitionRecord> selector) Finds theElementname, this will find theElementRecordassociated with it, throwing an exception if it is unable to find theElementDefinitionannotation. Used in constructing shared elements.- Parameters:
attributes- the attributes to useselector- aPredicateto select a singleElementDefinitionRecordto load- Returns:
- the
ElementRecord
-
findElementDefinitionRecord
Optional<ElementDefinitionRecord> findElementDefinitionRecord(ClassLoader classLoader, Attributes attributes, Predicate<ElementDefinitionRecord> selector) Finds theElementname, this will find theElementRecordassociated with it, return an empty optional if it is unable to find theElementDefinitionannotation. Used in constructing shared elements.- Parameters:
classLoader- the classloader to scanattributes- the attributes to useselector- aPredicateto select a singleElementDefinitionRecordto load- Returns:
- the
ElementRecord
-
getElementRecordFromPackage
Given thePackage, this will find theElementRecordassociated with it, throwing an exception if it is unable to find theElementDefinitionannotation. Used in constructing shared elements.- Parameters:
attributes- the attributes to useaPackage- the package to scan- Returns:
- the
ElementRecord
-
getExposedServices
Scans the suppliedPackagefor specified- Parameters:
aPackage- a package to scan- Returns:
- a
Streamof allElementServiceRecords exposed by theElement
-
getDefault
Gets a defaultElementLoaderFactoryvia theServiceLoaderinterface.- Returns:
- the
ElementLoaderFactory
-