org.infinispan.cdi.common.util.Synthetic Maven / Gradle / Ivy
The newest version!
package org.infinispan.cdi.common.util;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
import jakarta.enterprise.util.AnnotationLiteral;
import jakarta.inject.Qualifier;
/**
*
* A synthetic qualifier that can be used to replace other user-supplied
* configuration at deployment.
*
*
*
*
* @author Stuart Douglas <[email protected]>
* @author Pete Muir
*/
@Retention(RetentionPolicy.RUNTIME)
@Qualifier
public @interface Synthetic {
long index();
String namespace();
public static class SyntheticLiteral extends AnnotationLiteral implements Synthetic {
private final Long index;
private final String namespace;
public SyntheticLiteral(String namespace, Long index) {
this.namespace = namespace;
this.index = index;
}
public long index() {
return index;
}
public String namespace() {
return namespace;
}
}
/**
*
* Provides a unique Synthetic qualifier for the specified namespace
*
*
*
* {@link Provider} is thread safe.
*
*
* @author Pete Muir
*/
public static class Provider {
// Map of generic Object to a SyntheticQualifier
private final Map