Class InstrumentCoreInfo.BuilderBase<T extends InstrumentCoreInfo.BuilderBase<T>>

java.lang.Object
velox.api.layer1.data.InstrumentCoreInfo.BuilderBase<T>
Type Parameters:
T - concrete builder class
Direct Known Subclasses:
InstrumentCoreInfo.Builder, InstrumentInfo.BuilderBase
Enclosing class:
InstrumentCoreInfo

public abstract static class InstrumentCoreInfo.BuilderBase<T extends InstrumentCoreInfo.BuilderBase<T>> extends Object
Builder pattern for inheritance structures. It works like this:
     InstrumentCoreInfo.BuilderBase <----- InstrumentCoreInfo.Builder
                  ^
                  |
     InstrumentInfo.BuilderBase <--------- InstrumentInfo.Builder
                  ^
                  |
     InstrumentInfoDxfeed.Builder
 
If you want to add another builder to inheritance after last child (for example after InstrumentInfoDxfeed.Builder) you should split the exiting builder into concrete and abstract classes (like InstrumentInfoDxfeed.BuilderBase and InstrumentInfoDxfeed.Builder), and extend your new concrete builder from created abstract class, i.e. something like this:
     ...
     InstrumentInfo.BuilderBase <--------- InstrumentInfo.Builder
                  ^
                  |
     InstrumentInfoDxfeed.BuilderBase <-- InstrumentInfoDxfeed.Builder
                  ^
                  |
     InstrumentInfoNew.Builder
 
Also, there are several methods that you should overwrite for everything to work correctly:
- self(), build() - in the concrete builder class
- setFieldsFrom(InstrumentCoreInfo) - in the child builder base class with correct InstrumentInfo type
- InstrumentCoreInfo.toBuilder() - in the InstrumentInfo subclasses to ensure the correct builder class is created, otherwise you will lose some fields, and receive wrong InstrumentInfo subtype
  • Field Details

    • symbol

      protected String symbol
    • exchange

      protected String exchange
    • type

      protected String type
  • Constructor Details

    • BuilderBase

      public BuilderBase()
  • Method Details

    • self

      protected abstract T self()
    • build

      public abstract InstrumentCoreInfo build()
    • setFieldsFrom

      public T setFieldsFrom(InstrumentCoreInfo info)
    • getSymbol

      public String getSymbol()
    • setSymbol

      public T setSymbol(String symbol)
    • getExchange

      public String getExchange()
    • setExchange

      public T setExchange(String exchange)
    • getType

      public String getType()
    • setType

      public T setType(String type)