Class RecursiveTypeRegistry
- java.lang.Object
-
- net.morimekta.providence.util.BaseTypeRegistry
-
- net.morimekta.providence.reflect.util.RecursiveTypeRegistry
-
- All Implemented Interfaces:
net.morimekta.providence.util.TypeRegistry,net.morimekta.providence.util.WritableTypeRegistry
- Direct Known Subclasses:
ProgramTypeRegistry
public class RecursiveTypeRegistry extends net.morimekta.providence.util.BaseTypeRegistryA registry that can reference each other recursively. Each registry will have a specific package context, and needs to be built up in a recursive manner. This way each type registry will only have access to the described types actually referenced and included in the given thrift program file.
-
-
Constructor Summary
Constructors Constructor Description RecursiveTypeRegistry(java.lang.String localProgramContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TgetConstantValue(java.lang.String constReference, java.lang.String programContext)<T extends net.morimekta.providence.descriptor.PDeclaredDescriptor<T>>
TgetDeclaredType(java.lang.String typeName, java.lang.String programContext)java.lang.StringgetLocalProgramContext()RecursiveTypeRegistrygetRegistryForProgramName(java.lang.String programName)Get the registry to be used for the specific program.net.morimekta.providence.descriptor.PServicegetService(java.lang.String serviceName, java.lang.String programContext)protected booleanisEmpty()<T> booleanregister(net.morimekta.providence.descriptor.PDeclaredDescriptor<T> declaredType)booleanregister(net.morimekta.providence.descriptor.PService service)voidregisterConstant(java.lang.String identifier, java.lang.String program, java.lang.Object value)voidregisterInclude(java.lang.String programName, RecursiveTypeRegistry registry)Register a recursive included registry.-
Methods inherited from class net.morimekta.providence.util.BaseTypeRegistry
finalTypename, getProvider, getServiceProvider, qualifiedNameFromIdAndContext, registerRecursively, registerRecursively, registerTypedef
-
-
-
-
Method Detail
-
getLocalProgramContext
public java.lang.String getLocalProgramContext()
-
getRegistryForProgramName
public RecursiveTypeRegistry getRegistryForProgramName(java.lang.String programName)
Get the registry to be used for the specific program. Search through all the included registries to find the best one.- Parameters:
programName- The program to find registry for.- Returns:
- The Recursive type registry or null of not found.
-
registerInclude
public void registerInclude(java.lang.String programName, RecursiveTypeRegistry registry)Register a recursive included registry.- Parameters:
programName- The program to be included.registry- The registry for the given program.
-
getDeclaredType
@Nonnull public <T extends net.morimekta.providence.descriptor.PDeclaredDescriptor<T>> T getDeclaredType(@Nonnull java.lang.String typeName, @Nonnull java.lang.String programContext)
-
getConstantValue
@Nullable public <T> T getConstantValue(@Nonnull java.lang.String constReference, @Nonnull java.lang.String programContext)
-
getService
@Nonnull public net.morimekta.providence.descriptor.PService getService(java.lang.String serviceName, java.lang.String programContext)
-
registerConstant
public void registerConstant(@Nonnull java.lang.String identifier, @Nonnull java.lang.String program, @Nonnull java.lang.Object value)
-
register
public boolean register(@Nonnull net.morimekta.providence.descriptor.PService service)
-
register
public <T> boolean register(net.morimekta.providence.descriptor.PDeclaredDescriptor<T> declaredType)
-
isEmpty
protected boolean isEmpty()
-
-