Package net.morimekta.providence.util
Interface TypeRegistry
-
- All Known Subinterfaces:
WritableTypeRegistry
- All Known Implementing Classes:
BaseTypeRegistry
,SimpleTypeRegistry
public interface TypeRegistry
Basic type registry used in managing content.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <T> T
getConstantValue(java.lang.String constReference, java.lang.String programContext)
This is to check to find a constant given the const name and program context.default <T extends PDeclaredDescriptor<T>>
TgetDeclaredType(java.lang.String typeName)
Get a declared type by its qualified type name.<T extends PDeclaredDescriptor<T>>
TgetDeclaredType(java.lang.String typeName, java.lang.String programContext)
Get the declared type with the given name and program context.default <E extends PEnumValue<E>>
PEnumDescriptor<E>getEnumType(java.lang.String typeName)
These extra casts needs to be there, otherwise we'd get this error: incompatible types: inference variable T has incompatible upper boundsdefault <M extends PMessage<M,F>,F extends PField>
PMessageDescriptor<M,F>getMessageType(java.lang.String typeName)
These extra casts needs to be there, otherwise we'd get this error: incompatible types: inference variable T has incompatible upper boundsPDescriptorProvider
getProvider(java.lang.String typeName, java.lang.String programContext, java.util.Map<java.lang.String,java.lang.String> annotations)
Given a type name and a package context, fetches the type provider for the given type.default PService
getService(java.lang.String serviceName)
Get a service definition from it's qualified service name.PService
getService(java.lang.String serviceName, java.lang.String programContext)
Get a service definition from the name and program context.PServiceProvider
getServiceProvider(java.lang.String serviceName, java.lang.String programContext)
Given a service name and program context, fetches the service provider for the given service.
-
-
-
Method Detail
-
getDeclaredType
@Nonnull <T extends PDeclaredDescriptor<T>> T getDeclaredType(@Nonnull java.lang.String typeName, @Nonnull java.lang.String programContext)
Get the declared type with the given name and program context.- Type Parameters:
T
- The described type.- Parameters:
typeName
- The type name.programContext
- The program context of the type.- Returns:
- The declared type descriptor.
-
getConstantValue
@Nullable <T> T getConstantValue(@Nonnull java.lang.String constReference, @Nonnull java.lang.String programContext)
This is to check to find a constant given the const name and program context. This will return null if the constant does not exist.- Type Parameters:
T
- The returned value type.- Parameters:
constReference
- The reference to the constant.programContext
- The current program context.- Returns:
- The const value or null.
-
getDeclaredType
@Nonnull default <T extends PDeclaredDescriptor<T>> T getDeclaredType(@Nonnull java.lang.String typeName)
Get a declared type by its qualified type name.- Type Parameters:
T
- The described type.- Parameters:
typeName
- The type name.- Returns:
- The type descriptor.
-
getMessageType
@Nonnull default <M extends PMessage<M,F>,F extends PField> PMessageDescriptor<M,F> getMessageType(@Nonnull java.lang.String typeName)
These extra casts needs to be there, otherwise we'd get this error: incompatible types: inference variable T has incompatible upper bounds
TODO: Figure out a way to fix the generic cast.net.morimekta.providence.descriptor.PDeclaredDescriptor<net.morimekta.providence.descriptor.PEnumDescriptor>, net.morimekta.providence.descriptor.PEnumDescriptor
- Type Parameters:
M
- The message type.F
- The message field type.- Parameters:
typeName
- The type name.- Returns:
- The message type descriptor.
-
getEnumType
@Nonnull default <E extends PEnumValue<E>> PEnumDescriptor<E> getEnumType(@Nonnull java.lang.String typeName)
These extra casts needs to be there, otherwise we'd get this error: incompatible types: inference variable T has incompatible upper bounds
TODO: Figure out a way to fix the generic cast.net.morimekta.providence.descriptor.PDeclaredDescriptor<net.morimekta.providence.descriptor.PEnumDescriptor>, net.morimekta.providence.descriptor.PEnumDescriptor
- Type Parameters:
E
- The enum value type.- Parameters:
typeName
- The type name.- Returns:
- The enum type descriptor.
-
getService
@Nonnull PService getService(java.lang.String serviceName, java.lang.String programContext)
Get a service definition from the name and program context.- Parameters:
serviceName
- The service name.programContext
- The program context name to get the service in.- Returns:
- The service or null if not found.
-
getService
@Nonnull default PService getService(java.lang.String serviceName)
Get a service definition from it's qualified service name.- Parameters:
serviceName
- The service name.- Returns:
- the service or null of not found.
-
getProvider
@Nonnull PDescriptorProvider getProvider(java.lang.String typeName, java.lang.String programContext, java.util.Map<java.lang.String,java.lang.String> annotations)
Given a type name and a package context, fetches the type provider for the given type.- Parameters:
typeName
- Name of type, without any spaces.programContext
- The program context of the reference.annotations
- Annotations affecting the type.- Returns:
- The type provider.
-
getServiceProvider
@Nonnull PServiceProvider getServiceProvider(java.lang.String serviceName, java.lang.String programContext)
Given a service name and program context, fetches the service provider for the given service.- Parameters:
serviceName
- Name of the service.programContext
- The program context of the reference.- Returns:
- The service provider.
-
-