no.mnemonic.commons.container.plugins.impl.ComponentLifecycleAspectHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of container Show documentation
Show all versions of container Show documentation
Container managing components and their aspects
The newest version!
package no.mnemonic.commons.container.plugins.impl;
import no.mnemonic.commons.component.LifecycleAspect;
import no.mnemonic.commons.component.ValidationAspect;
import no.mnemonic.commons.container.plugins.ComponentLifecycleHandler;
public class ComponentLifecycleAspectHandler implements ComponentLifecycleHandler {
@Override
public boolean appliesTo(Object obj) {
return obj != null && obj instanceof LifecycleAspect;
}
@Override
public void startComponent(Object obj) {
if (obj == null) return;
if (!(obj instanceof LifecycleAspect)) throw new IllegalArgumentException("Invalid type: " + obj.getClass());
((LifecycleAspect)obj).startComponent();
}
@Override
public void stopComponent(Object obj) {
if (obj == null) return;
if (!(obj instanceof LifecycleAspect)) throw new IllegalArgumentException("Invalid type: " + obj.getClass());
((LifecycleAspect)obj).stopComponent();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy