Skip to main content

InstrumentCoreInfo.BuilderBase

Package: velox.api.layer1.data

Type: Class

Inheritance: java.lang.Object รขโ€ โ€™ InstrumentCoreInfo.BuilderBase

Type Parameters:

  • T - concrete builder class

Direct Known Subclasses: InstrumentCoreInfo.Builder, InstrumentInfo.BuilderBase

Enclosing class: InstrumentCoreInfo

Descriptionโ€‹

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

Fieldsโ€‹

symbolโ€‹

protected String symbol

exchangeโ€‹

protected String exchange

typeโ€‹

protected String type

Constructorsโ€‹

BuilderBaseโ€‹

public BuilderBase()

Methodsโ€‹

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)