Package dev.getelements.elements.sdk.spi
Class DefaultElementLoaderFactory
java.lang.Object
dev.getelements.elements.sdk.spi.DefaultElementLoaderFactory
- All Implemented Interfaces:
ElementLoaderFactory
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.getelements.elements.sdk.ElementLoaderFactory
ElementLoaderFactory.ClassLoaderConstructor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindElementDefinitionRecord(ClassLoader classLoader, Attributes attributes, Predicate<ElementDefinitionRecord> selector) Finds theElementname, this will find theElementRecordassociated with it, throwing an exception if it is unable to find theElementDefinitionannotation.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 specifiedgetIsolatedLoader(Attributes attributes, ClassLoader baseClassLoader, ElementLoaderFactory.ClassLoaderConstructor classLoaderCtor, Predicate<ElementDefinitionRecord> selector) Scans the classpath, using the suppliedClassLoader, forElementinstances.getSharedLoader(ElementRecord elementRecord, ServiceLocator serviceLocator) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.getelements.elements.sdk.ElementLoaderFactory
getIsolatedLoader
-
Constructor Details
-
DefaultElementLoaderFactory
public DefaultElementLoaderFactory()
-
-
Method Details
-
getIsolatedLoader
public ElementLoader getIsolatedLoader(Attributes attributes, ClassLoader baseClassLoader, ElementLoaderFactory.ClassLoaderConstructor classLoaderCtor, Predicate<ElementDefinitionRecord> selector) Description copied from interface:ElementLoaderFactoryScans 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
ElementType.ISOLATED_CLASSPATHElement- Specified by:
getIsolatedLoaderin interfaceElementLoaderFactory- 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
-
findElementDefinitionRecord
public Optional<ElementDefinitionRecord> findElementDefinitionRecord(ClassLoader classLoader, Attributes attributes, Predicate<ElementDefinitionRecord> selector) Description copied from interface:ElementLoaderFactoryFinds theElementname, this will find theElementRecordassociated with it, throwing an exception if it is unable to find theElementDefinitionannotation. Used in constructing shared elements.- Specified by:
findElementDefinitionRecordin interfaceElementLoaderFactory- Parameters:
classLoader-attributes- the attributes to useselector- aPredicateto select a singleElementDefinitionRecordto load- Returns:
- the
ElementRecord
-
getElementRecordFromPackage
Description copied from interface:ElementLoaderFactoryGiven thePackage, this will find theElementRecordassociated with it, throwing an exception if it is unable to find theElementDefinitionannotation. Used in constructing shared elements.- Specified by:
getElementRecordFromPackagein interfaceElementLoaderFactory- Parameters:
attributes- the attributes to useaPackage- the package to scan- Returns:
- the
ElementRecord
-
getExposedServices
Description copied from interface:ElementLoaderFactoryScans the suppliedPackagefor specified- Specified by:
getExposedServicesin interfaceElementLoaderFactory- Parameters:
aPackage- a package to scan- Returns:
- a
Streamof allElementServiceRecords exposed by theElement
-