Useful methods

These are some methods you might regularly use to create custom content.
What to do (usage goal) Class Method
Override to return a different key. This skips the schema’s config settings for name case/space handling. BIJsonSchemaMember getJsonName()
Override to append customized content to the current JSON stream via json.key() and json.value(), etc. The Boolean parameter indicates if the syntax of the keys are currently valid (for example, not inside an array) BIJsonSchemaMember process(JSONWriter json, boolean jsonKeysValid)
Override to react to events, such as the base item changing or subscription disabled. BJsonSchemaMember onSchemaEvent(BSchemaEvent event)
Quickly get a reference to the parent schema BJsonSchemaMember getSchema()
Write a JSON key with the schema’s current case and space-handling rules applied. JsonSchemaNameUtil writeKey(BIJsonSchemaMember member, JSONWriter jsonWriter, String name)
Convert any Java value to a native JSON type (String or Number or Boolean) with some default handling of some baja types, and filter out sensitive types. JsonSchemaUtil toJsonType(Object value, BJsonSchemaConfigFolder config)
Convert core Java type values (Numerics or Strings or Booleans) to BValue equivalents. If the parameter is already a BValue, this method returns a copy. JsonSchemaUtil toBValue(Object value)
Get a live resolved reference to the ord bindings target. BJsonSchemaBoundMember getOrdTarget() / getTarget()
Override the schema’s default behaviour for handling a subscription event from a binding target. Depending on the content, the schema’s default behaviour is to unsubscribe, ignore or request schema generation. BJsonSchemaBoundMember handleSubscriptionEvent(Subscription subscription, BComponentEvent event)
Override to return a different set of slot values for the resolved target. BJsonSchemaBoundSlotsContainer getPropertiesToIncludeInJson(target)
Implement to perform any lifecycle, cleanup or reporting task after a schema has completed output generation (or failed, in which case, the exception is non-null). BIPostProcessor postProcess(BJsonSchema schema, Exception exception)
Extract values from incoming JSON payloads using various methods. JsonKeyExtractUtil lookup*()
Implement to handle an incoming JSON payload or throw a RoutingFailedException if unable to process the message. BJsonInbound routeValue(BString message, Context cx)
Override to locate a control point by another means than the handle ord, for example by slot path or name. BJsonSetPointHandler lookupTarget(BString msg, String id)