Package net.morimekta.providence.util
Interface WritableTypeRegistry
-
- All Superinterfaces:
TypeRegistry
- All Known Implementing Classes:
BaseTypeRegistry
,SimpleTypeRegistry
public interface WritableTypeRegistry extends TypeRegistry
Registry for declared types referenced in a specific program context. The registry itself does not have a context per se, as these may reference each other recursively.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> boolean
register(PDeclaredDescriptor<T> declaredType)
Register a declared type.boolean
register(PService service)
Services are not handled as "declared types", so they need to be registered separately.void
registerConstant(java.lang.String identifier, java.lang.String program, java.lang.Object value)
Register a constant value.<T> void
registerRecursively(PDeclaredDescriptor<T> declaredType)
Register a declared type recursively.void
registerRecursively(PService service)
Register the service recursively.void
registerTypedef(java.lang.String identifier, java.lang.String program, java.lang.String target)
Registers a typedef definition.-
Methods inherited from interface net.morimekta.providence.util.TypeRegistry
getConstantValue, getDeclaredType, getDeclaredType, getEnumType, getMessageType, getProvider, getService, getService, getServiceProvider
-
-
-
-
Method Detail
-
registerTypedef
void registerTypedef(@Nonnull java.lang.String identifier, @Nonnull java.lang.String program, @Nonnull java.lang.String target)
Registers a typedef definition.- Parameters:
identifier
- The typedef name (the alias) to put.program
- The program context of the typedef.target
- The qualified name that the name represents.
-
registerConstant
void registerConstant(@Nonnull java.lang.String identifier, @Nonnull java.lang.String program, @Nonnull java.lang.Object value)
Register a constant value.- Parameters:
identifier
- The constant identifier name.program
- The program context for the constant.value
- The parsed value.
-
register
boolean register(@Nonnull PService service)
Services are not handled as "declared types", so they need to be registered separately.- Parameters:
service
- the service to register.- Returns:
- True if the service was registered and not already known.
-
registerRecursively
void registerRecursively(@Nonnull PService service)
Register the service recursively. E.g. if the service extends a different service, make sure to register that service too.- Parameters:
service
- the service to register.
-
register
<T> boolean register(PDeclaredDescriptor<T> declaredType)
Register a declared type.- Type Parameters:
T
- The declared java type.- Parameters:
declaredType
- The descriptor for the type.- Returns:
- True if the type was registered
-
registerRecursively
<T> void registerRecursively(PDeclaredDescriptor<T> declaredType)
Register a declared type recursively. If the type is a message, then iterate through the fields and register those types recursively.- Type Parameters:
T
- The declared java type.- Parameters:
declaredType
- The descriptor for the type.
-
-