
com.gruelbox.transactionoutbox.spi.AbstractFullyQualifiedNameInstantiator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of transactionoutbox-core Show documentation
Show all versions of transactionoutbox-core Show documentation
A safe implementation of the transactional outbox pattern for Java (core library)
package com.gruelbox.transactionoutbox.spi;
import static com.gruelbox.transactionoutbox.spi.Utils.uncheckedly;
import com.gruelbox.transactionoutbox.Instantiator;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import lombok.extern.slf4j.Slf4j;
/**
* Abstract {@link Instantiator} implementation which simplifies the creation of implementations
* which instantiate based on the clazz FQN.
*/
@Slf4j
@SuperBuilder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public abstract class AbstractFullyQualifiedNameInstantiator implements Instantiator {
@Override
public final String getName(Class> clazz) {
return clazz.getName();
}
@Override
public final Object getInstance(String name) {
log.debug("Getting class by name [{}]", name);
return createInstance(uncheckedly(() -> Class.forName(name)));
}
protected abstract Object createInstance(Class> clazz);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy