Class TraitFactory.ServiceFactory

java.lang.Object
software.amazon.smithy.model.traits.TraitFactory.ServiceFactory
All Implemented Interfaces:
TraitFactory
Enclosing interface:
TraitFactory

public static final class TraitFactory.ServiceFactory extends Object implements TraitFactory
Default TraitFactory backed by a map of TraitService providers.

Retains the classloader used to discover the providers (when known) and passes it to TraitService.createTrait(ShapeId, Node, ClassLoader) so providers can resolve classloader-sensitive components from the same closure the model is assembled against.

  • Method Details

    • createTrait

      public Optional<Trait> createTrait(ShapeId id, ShapeId target, Node value)
      Description copied from interface: TraitFactory
      Creates and configures a trait using model trait data.
      Specified by:
      createTrait in interface TraitFactory
      Parameters:
      id - Shape ID of the trait.
      target - Shape that the trait is applied on.
      value - The Node value of the trait.
      Returns:
      Returns the created trait wrapped in an Optional.