
net.sf.cglib.core.internal.CustomizerRegistry Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cglib-jdk9 Show documentation
Show all versions of cglib-jdk9 Show documentation
cglib is a powerful, high performance and quality Code Generation Library, It is used to extend JAVA classes and implements interfaces at runtime.
The newest version!
package net.sf.cglib.core.internal;
import net.sf.cglib.core.Customizer;
import net.sf.cglib.core.FieldTypeCustomizer;
import net.sf.cglib.core.KeyFactoryCustomizer;
import java.util.*;
public class CustomizerRegistry {
private final Class[] customizerTypes;
private Map> customizers = new HashMap>();
public CustomizerRegistry(Class[] customizerTypes) {
this.customizerTypes = customizerTypes;
}
public void add(KeyFactoryCustomizer customizer) {
Class extends KeyFactoryCustomizer> klass = customizer.getClass();
for (Class type : customizerTypes) {
if (type.isAssignableFrom(klass)) {
List list = customizers.get(type);
if (list == null) {
customizers.put(type, list = new ArrayList());
}
list.add(customizer);
}
}
}
public List get(Class klass) {
List list = customizers.get(klass);
if (list == null) {
return Collections.emptyList();
}
return (List) list;
}
/**
* @deprecated Only to keep backward compatibility.
*/
@Deprecated
public static CustomizerRegistry singleton(Customizer customizer)
{
CustomizerRegistry registry = new CustomizerRegistry(new Class[]{Customizer.class});
registry.add(customizer);
return registry;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy