CMicroServiceDescription
The class describes a microservice. A microservice consists of a microservice ID, descriptive text, and a list of messages that make up its API. The class is used when registering microservices.
Constructors
The first constructor takes the components of the class: a microservice ID, descriptive text, and a list of descriptions of records that make up its API.
public CMicroServiceDescription(@NotNull final IId aId, @NotNull final String aDescription, @NotNull final Collection<CDescriptionOfRecord> aApi);
The second constructor takes the API description from a list of generated record classes.
public CMicroServiceDescription(@NotNull final IId aId, @NotNull final String aDescription, @NotNull final Class<? extends IGeneratedRecord> @NotNull ... aClasses);
Factory methods
This method creates a microservice description from a record of type CRecordMicroService.
public static @NotNull CMicroServiceDescription fromRecord(@NotNull final CRecord aRecord) throws CException;
Getter
The components can be fetched via getter.
@NotNull public IId getId(); @NotNull public String getDescription(); @NotNull public Collection<CDescriptionOfRecord> getDescriptionOfRecords();
Setter
Individual record descriptions can be added to the API description.
public void addNanoService(@NotNull final CDescriptionOfRecord aDescriptionOfRecords);
Pack into a Record
For sending via message the data can be packed into a record of type CRecordMicroService.
public CRecord valueToRecord() throws CException;
Notice
The class supports the equals and hashCode methods as well as the Comparable
interface.