
com.cedarsoft.utils.ChildDetectorManager Maven / Gradle / Ivy
The newest version!
package com.cedarsoft.utils;
import org.jetbrains.annotations.NotNull;
import java.util.Map;
/**
* Manages {@link ChildDetector}s
*/
public class ChildDetectorManager {
@NotNull
private final TypeRegistry> registry;
public ChildDetectorManager() {
this( true );
}
public ChildDetectorManager( boolean registerSuperTypes ) {
registry = new TypeRegistry>( registerSuperTypes );
}
public void addChildDetector( @NotNull Class
parentType, @NotNull ChildDetector
childDetector ) {
registry.addElement( parentType, childDetector );
}
public void setChildDetectors( Map, ChildDetector, ?>> childDetectors ) {
registry.setElements( childDetectors );
}
@NotNull
public ChildDetector
getChildDetector( @NotNull Class
parentType ) throws IllegalArgumentException {
return ( ChildDetector
) registry.getElement( parentType );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy