diff --git a/build.gradle b/build.gradle index 9f056cce9..869cc2db7 100644 --- a/build.gradle +++ b/build.gradle @@ -70,14 +70,16 @@ configure(leafProjects) { dependency group: 'com.epam.deltix', name: 'dfp', version: dfpVersion dependency group: 'com.epam.deltix', name: 'hd-date-time', version: hdTimeVersion - dependency 'org.apache.commons:commons-lang3:3.4' + dependency 'org.apache.commons:commons-lang3:3.7' dependency 'javax.mail:mail:1.4.7' dependency 'com.google.code.findbugs:jsr305:3.0.2' dependency 'com.google.code.findbugs:annotations:3.0.1' + dependency 'com.epam.deltix:containers:3.1.2' + // dependency 'org.mockito:mockito-core:1.10.19' - dependencySet (group: 'com.epam.deltix', version: '3.0.0') { + dependencySet (group: 'com.epam.deltix', version: gflogVersion) { entry 'gflog-api' entry 'gflog-core' entry 'gflog-jul' @@ -98,6 +100,11 @@ configure(leafProjects) { isReleaseVersion = !version.endsWith("SNAPSHOT") } + java { + withJavadocJar() + withSourcesJar() + } + // archivesBaseName = 'timebase-commons' + project.path.replaceAll(':', '-') repositories { diff --git a/collections/build.gradle b/collections/build.gradle index 3ec2a409a..bd8512f19 100644 --- a/collections/build.gradle +++ b/collections/build.gradle @@ -11,11 +11,11 @@ buildscript { apply plugin: 'velocity' dependencies { - implementation 'com.epam.deltix:dfp' - implementation 'com.epam.deltix:hd-date-time' - implementation 'com.epam.deltix:gflog-api' + api project(':timebase-lang') - implementation project(':timebase-lang') + implementation group: 'com.epam.deltix', name: 'hd-date-time', version: hdTimeVersion + implementation group: 'com.epam.deltix', name: 'dfp', version: dfpVersion + implementation group: 'com.epam.deltix', name: 'gflog-api', version: gflogVersion testImplementation 'commons-collections:commons-collections:3.2.1' } diff --git a/gradle.properties b/gradle.properties index 4a9d7b983..343ec44b9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,7 @@ #Thu Feb 11 09:31:42 UTC 2021 -version=6.0.58-SNAPSHOT -dfpVersion=0.11.01 -hdTimeVersion=0.2.4 +version=6.0.63-SNAPSHOT +dfpVersion=0.11.25 +hdTimeVersion=0.2.11 +gflogVersion=3.0.1 group=com.epam.deltix -vendor=EPAM \ No newline at end of file +vendor=EPAM diff --git a/lang/build.gradle b/lang/build.gradle index 79ca61949..14700453c 100644 --- a/lang/build.gradle +++ b/lang/build.gradle @@ -5,13 +5,11 @@ plugins { description = 'Timebase commons-lang set of utilities' dependencies { - //implementation 'com.epam.deltix:dfp' - //implementation 'com.epam.deltix:hd-date-time' - + implementation group: 'com.epam.deltix', name: 'dfp', version: dfpVersion implementation group: 'com.epam.deltix', name: 'hd-date-time', version: hdTimeVersion - implementation 'com.epam.deltix:gflog-api' - implementation 'com.epam.deltix:gflog-core' + implementation group: 'com.epam.deltix', name: 'gflog-api', version: gflogVersion + implementation group: 'com.epam.deltix', name: 'gflog-core', version: gflogVersion // For JMH-based tests testImplementation 'org.openjdk.jmh:jmh-core' diff --git a/lang/src/main/java/com/epam/deltix/util/annotations/Alphanumeric.java b/lang/src/main/java/com/epam/deltix/util/annotations/Alphanumeric.java new file mode 100644 index 000000000..5030d284c --- /dev/null +++ b/lang/src/main/java/com/epam/deltix/util/annotations/Alphanumeric.java @@ -0,0 +1,31 @@ +/* + * Copyright 2021 EPAM Systems, Inc + * + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. Licensed under the Apache License, + * Version 2.0 (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.epam.deltix.util.annotations; + +import java.lang.annotation.*; + +/** + * Marks field/parameter/local-variable/method-return-type of long type which should be considered as Alphanumeric type. + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD}) +public @interface Alphanumeric { + + int value() default 10; + +} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegerDataTypeInfo.java b/lang/src/main/java/com/epam/deltix/util/annotations/Bool.java similarity index 66% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegerDataTypeInfo.java rename to lang/src/main/java/com/epam/deltix/util/annotations/Bool.java index fd661b73e..b9ec926c4 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegerDataTypeInfo.java +++ b/lang/src/main/java/com/epam/deltix/util/annotations/Bool.java @@ -14,17 +14,15 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.epam.deltix.timebase.messages.schema; +package com.epam.deltix.util.annotations; -import java.lang.Override; +import java.lang.annotation.*; /** - * Schema definition of integer data type. + * Marks field/parameter/local-variable/method-return-type of byte type which should be considered as boolean type. */ -public interface IntegerDataTypeInfo extends IntegralDataTypeInfo { - /** - * Method copies state to a given instance - */ - @Override - IntegerDataTypeInfo clone(); -} \ No newline at end of file +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD}) +public @interface Bool { +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BooleanDataTypeInfo.java b/lang/src/main/java/com/epam/deltix/util/annotations/TimeOfDay.java similarity index 65% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/BooleanDataTypeInfo.java rename to lang/src/main/java/com/epam/deltix/util/annotations/TimeOfDay.java index fc70951c6..cca73c3cf 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BooleanDataTypeInfo.java +++ b/lang/src/main/java/com/epam/deltix/util/annotations/TimeOfDay.java @@ -14,17 +14,15 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.epam.deltix.timebase.messages.schema; +package com.epam.deltix.util.annotations; -import java.lang.Override; +import java.lang.annotation.*; /** - * Schema definition of boolean data type. + * Marks field/parameter/local-variable/method-return-type of int type which should be considered as time-of-day type. */ -public interface BooleanDataTypeInfo extends DataTypeInfo { - /** - * Method copies state to a given instance - */ - @Override - BooleanDataTypeInfo clone(); -} \ No newline at end of file +@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +@Inherited +public @interface TimeOfDay { +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/CharDataTypeInfo.java b/lang/src/main/java/com/epam/deltix/util/annotations/TimestampMs.java similarity index 65% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/CharDataTypeInfo.java rename to lang/src/main/java/com/epam/deltix/util/annotations/TimestampMs.java index bf3eac51d..25a8edd06 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/CharDataTypeInfo.java +++ b/lang/src/main/java/com/epam/deltix/util/annotations/TimestampMs.java @@ -14,17 +14,15 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.epam.deltix.timebase.messages.schema; +package com.epam.deltix.util.annotations; -import java.lang.Override; +import java.lang.annotation.*; /** - * Schema definition of char data type. + * Marks field/parameter/local-variable/method-return-type of long type which should be considered as timestamp milliseconds type. */ -public interface CharDataTypeInfo extends DataTypeInfo { - /** - * Method copies state to a given instance - */ - @Override - CharDataTypeInfo clone(); -} \ No newline at end of file +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD}) +public @interface TimestampMs { +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DateTimeDataTypeInfo.java b/lang/src/main/java/com/epam/deltix/util/annotations/TimestampNs.java similarity index 65% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/DateTimeDataTypeInfo.java rename to lang/src/main/java/com/epam/deltix/util/annotations/TimestampNs.java index 778a80fb1..d8ffc421e 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DateTimeDataTypeInfo.java +++ b/lang/src/main/java/com/epam/deltix/util/annotations/TimestampNs.java @@ -14,17 +14,15 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.epam.deltix.timebase.messages.schema; +package com.epam.deltix.util.annotations; -import java.lang.Override; +import java.lang.annotation.*; /** - * Schema definition of date-time data type. + * Marks field/parameter/local-variable/method-return-type of long type which should be considered as timestamp nanoseconds type. */ -public interface DateTimeDataTypeInfo extends DataTypeInfo { - /** - * Method copies state to a given instance - */ - @Override - DateTimeDataTypeInfo clone(); -} \ No newline at end of file +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.METHOD}) +public @interface TimestampNs { +} diff --git a/messages/build.gradle b/messages/build.gradle index f30ed8a13..161ec152e 100644 --- a/messages/build.gradle +++ b/messages/build.gradle @@ -2,9 +2,9 @@ plugins { id 'me.champeau.gradle.jmh' version '0.4.5' apply false } -configurations { - dojoGenerator -} +//configurations { +// dojoGenerator +//} //def generatedDirectory = file('build/generated-src/main') //sourceSets.main.java.srcDirs generatedDirectory @@ -21,15 +21,15 @@ configurations { description = 'Timebase Messages Interfaces' dependencies { - //dojoGenerator group: 'deltix', name: 'dojo-generator', version: '3.0.10' + //dojoGenerator group: 'deltix', name: 'dojo-generator', version: '3.0.12' - implementation project(":timebase-collections") - implementation project(":timebase-lang") + api project(":timebase-collections") + api project(":timebase-lang") - implementation 'com.epam.deltix:dfp' - implementation 'com.epam.deltix:hd-date-time' - implementation 'com.epam.deltix:gflog-api' + implementation group: 'com.epam.deltix', name: 'gflog-api', version: gflogVersion + implementation group: 'com.epam.deltix', name: 'dfp', version: dfpVersion + implementation group: 'com.epam.deltix', name: 'hd-date-time', version: hdTimeVersion - implementation 'org.apache.commons:commons-lang3' + implementation 'org.apache.commons:commons-lang3:3.7' implementation 'com.epam.deltix:containers:3.1.2' } \ No newline at end of file diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/InstrumentMessage.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/InstrumentMessage.lux index fa846a363..92075f7a1 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/InstrumentMessage.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/InstrumentMessage.lux @@ -13,13 +13,12 @@ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - */ +*/ namespace EPAM.Deltix.Timebase.Messages; option JavaPackage = "com.epam.deltix.timebase.messages"; /// Base class for all messages that could be written in Timebase. [Serializable] -[OldElementName("deltix.qsrv.hf.pub.InstrumentMessage")] [SchemaElement(Name = "com.epam.deltix.timebase.messages.InstrumentMessage", Title = "Instrument Message")] [GenerateReadOnlyInterface("MessageInfo")][GenerateReadWriteInterface("MessageInterface")] [Ignore] diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/MarketMessage.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/MarketMessage.lux new file mode 100644 index 000000000..f3a9ac597 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/MarketMessage.lux @@ -0,0 +1,45 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. + */ +namespace EPAM.Deltix.Timebase.Messages; +option JavaPackage = "com.epam.deltix.timebase.messages"; + +/// Most financial market-related messages subclass this abstract class. +[SchemaElement(Name = "com.epam.deltix.timebase.messages.MarketMessage", Title = "Market Message")] +[GenerateReadOnlyInterface][GenerateReadWriteInterface] +class MarketMessage : InstrumentMessage { + + /// Exchange Time is measured in milliseconds that passed since January 1, 1970 UTC + [SchemaType(DataType = SchemaDataType.TIMESTAMP)] + [SchemaElement(Description = "Original Timestamp")] + Timestamp? OriginalTimestamp; + + /// Identifies currency in which quantity is denominated (for currencies this must be base or term currency) + /// using 'alphanumeric' encoding + [SchemaElement] + [SchemaType(DataType = SchemaDataType.VARCHAR, Encoding = "ALPHANUMERIC(10)")] + Int64? Currency; + + /// Market specific identifier of the given event in a sequence of market events. + [SchemaElement] + Int64? SequenceNumber; + + /// Identifies market data source. Different sessions of same connector + /// to a same data provider should have different id. + [SchemaType(DataType = SchemaDataType.VARCHAR, Encoding = "ALPHANUMERIC(10)")] + [SchemaElement] + Int64? SourceId; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Qql/Argument.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Qql/Argument.lux new file mode 100644 index 000000000..35416f499 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Qql/Argument.lux @@ -0,0 +1,36 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. + */ +namespace EPAM.Deltix.Timebase.Messages.Qql; +option JavaPackage = "com.epam.deltix.timebase.messages.qql"; + +import EPAM.Deltix.Timebase.Messages.*; +import EPAM.Deltix.Timebase.Messages.Schema.*; + +/// Describes QQL function argument +[SchemaElement(Name = "com.epam.deltix.timebase.messages.qql.Argument", Title = "Argument")] +class Argument { + + /// Argument name + [SchemaElement()] + [SchemaType(IsNullable = false)] + Text Name; + + /// Data type + [SchemaElement()] + [SchemaType(DataType = SchemaDataType.OBJECT, NestedTypes = { typeof(FieldType) }, IsNullable = false)] + FieldType DataType; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Qql/InitArgument.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Qql/InitArgument.lux new file mode 100644 index 000000000..a1336e8e9 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Qql/InitArgument.lux @@ -0,0 +1,32 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. + */ +namespace EPAM.Deltix.Timebase.Messages.Qql; +option JavaPackage = "com.epam.deltix.timebase.messages.qql"; + +import EPAM.Deltix.Timebase.Messages.*; +import EPAM.Deltix.Timebase.Messages.Schema.*; + +/// Describes QQL function init argument +[SchemaElement(Name = "com.epam.deltix.timebase.messages.qql.InitArgument", Title = "InitArgument")] +class InitArgument: Argument { + + // Default value + [SchemaElement()] + [SchemaType()] + Text? DefaultValue; + +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Qql/StatefulFunctionMessage.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Qql/StatefulFunctionMessage.lux new file mode 100644 index 000000000..79f94a576 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Qql/StatefulFunctionMessage.lux @@ -0,0 +1,45 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. + */ +namespace EPAM.Deltix.Timebase.Messages.Qql; +option JavaPackage = "com.epam.deltix.timebase.messages.qql"; + +import EPAM.Deltix.Timebase.Messages.*; +import EPAM.Deltix.Timebase.Messages.Schema.*; + +/// Message that describes QQL stateful function +[SchemaElement(Name = "com.epam.deltix.timebase.messages.qql.StatefulFunctionMessage", Title = "StatefulFunctionMessage")] +class StatefulFunctionMessage : InstrumentMessage { + + /// Function identifier + [SchemaElement()] + [SchemaType(IsNullable = false)] + Text Id; + + // Function init arguments + [SchemaElement()] + [SchemaArrayType(ElementTypes = { typeof(InitArgument) }, IsNullable = false, IsElementNullable = false)] + List InitArguments; + + // Function arguments + [SchemaElement()] + [SchemaArrayType(ElementTypes = { typeof(Argument) }, IsNullable = false, IsElementNullable = false)] + List Arguments; + + [SchemaElement()] + [SchemaType(DataType = SchemaDataType.OBJECT, NestedTypes = { typeof(FieldType) }, IsNullable = false)] + FieldType ReturnType; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Qql/StatelessFunctionMessage.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Qql/StatelessFunctionMessage.lux new file mode 100644 index 000000000..6bad613a7 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Qql/StatelessFunctionMessage.lux @@ -0,0 +1,40 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. + */ +namespace EPAM.Deltix.Timebase.Messages.Qql; +option JavaPackage = "com.epam.deltix.timebase.messages.qql"; + +import EPAM.Deltix.Timebase.Messages.*; +import EPAM.Deltix.Timebase.Messages.Schema.*; + +/// Message that describes QQL stateless function +[SchemaElement(Name = "com.epam.deltix.timebase.messages.qql.StatelessFunctionMessage", Title = "StatelessFunctionMessage")] +class StatelessFunctionMessage : InstrumentMessage { + + /// Function identifier + [SchemaElement()] + [SchemaType(IsNullable = false)] + Text Id; + + // Function arguments + [SchemaElement()] + [SchemaArrayType(ElementTypes = { typeof(Argument) }, IsNullable = false, IsElementNullable = false)] + List Arguments; + + [SchemaElement()] + [SchemaType(DataType = SchemaDataType.OBJECT, NestedTypes = { typeof(FieldType) }, IsNullable = false)] + FieldType ReturnType; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/NamedDescriptor.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/Descriptor.lux similarity index 90% rename from messages/schema/EPAM/Deltix/Timebase/Messages/Schema/NamedDescriptor.lux rename to messages/schema/EPAM/Deltix/Timebase/Messages/Schema/Descriptor.lux index 4f353218c..b058d2cb8 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/NamedDescriptor.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/Descriptor.lux @@ -21,9 +21,8 @@ import EPAM.Deltix.Timebase.Messages.*; /// This is a base class for schema nodes. [Abstract] -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.NamedDescriptor", Title = "NamedDescriptor")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class NamedDescriptor { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.Descriptor", Title = "Descriptor")] +class Descriptor { /// Node name. [SchemaElement] @@ -39,4 +38,4 @@ class NamedDescriptor { [SchemaElement] [SchemaType(IsNullable=true)] Text? Description; -} \ No newline at end of file +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/ClassDescriptorRef.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/DescriptorRef.lux similarity index 88% rename from messages/schema/EPAM/Deltix/Timebase/Messages/Schema/ClassDescriptorRef.lux rename to messages/schema/EPAM/Deltix/Timebase/Messages/Schema/DescriptorRef.lux index 17a5ae809..d64ddfe94 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/ClassDescriptorRef.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/DescriptorRef.lux @@ -20,11 +20,10 @@ option JavaPackage = "com.epam.deltix.timebase.messages.schema"; import EPAM.Deltix.Timebase.Messages.*; /// Schema definition for a reference to class descriptor. -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.ClassDescriptorRef", Title = "ClassDescriptorRef")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class ClassDescriptorRef { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.DescriptorRef", Title = "DescriptorRef")] +class DescriptorRef { /// Node name. [SchemaElement] [SchemaType(IsNullable=false)] Text Name; -} \ No newline at end of file +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/EnumValue.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/EnumConstant.lux similarity index 91% rename from messages/schema/EPAM/Deltix/Timebase/Messages/Schema/EnumValue.lux rename to messages/schema/EPAM/Deltix/Timebase/Messages/Schema/EnumConstant.lux index af20782c0..d291a79d1 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/EnumValue.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/EnumConstant.lux @@ -20,9 +20,9 @@ option JavaPackage = "com.epam.deltix.timebase.messages.schema"; import EPAM.Deltix.Timebase.Messages.*; /// Schema definition for a single enumeration value. -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.EnumValue", Title = "EnumValue")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class EnumValue { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.EnumConstant", Title = "EnumConstant")] + +class EnumConstant { /// Enumeration symbol. [SchemaElement] @@ -33,4 +33,4 @@ class EnumValue { [SchemaElement] [SchemaType(IsNullable=false)] Int16 Value; -} \ No newline at end of file +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/EnumClassDescriptor.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/EnumDescriptor.lux similarity index 83% rename from messages/schema/EPAM/Deltix/Timebase/Messages/Schema/EnumClassDescriptor.lux rename to messages/schema/EPAM/Deltix/Timebase/Messages/Schema/EnumDescriptor.lux index 1b374d19e..8ad85c2ff 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/EnumClassDescriptor.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/EnumDescriptor.lux @@ -20,18 +20,17 @@ option JavaPackage = "com.epam.deltix.timebase.messages.schema"; import EPAM.Deltix.Timebase.Messages.*; /// Schema definition for enumeration class. -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.EnumClassDescriptor", Title = "EnumClassDescriptor")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class EnumClassDescriptor : ClassDescriptor { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.EnumDescriptor", Title = "EnumDescriptor")] +class EnumDescriptor : UniqueDescriptor { /// List of values of enumeration. [SchemaElement] [SchemaArrayType(IsNullable = false, IsElementNullable = false, - ElementTypes = { typeof(EnumValue) })] - List Values; + ElementTypes = { typeof(EnumConstant) })] + List Values; /// True, if enumeration represents a bitmask. [SchemaElement] [SchemaType(IsNullable=false)] Boolean IsBitmask; -} \ No newline at end of file +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/DataField.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/Field.lux similarity index 68% rename from messages/schema/EPAM/Deltix/Timebase/Messages/Schema/DataField.lux rename to messages/schema/EPAM/Deltix/Timebase/Messages/Schema/Field.lux index 18501b0ff..e4bae67ea 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/DataField.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/Field.lux @@ -21,24 +21,25 @@ import EPAM.Deltix.Timebase.Messages.*; /// This is a base class for schema data field. [Abstract] -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.DataField", Title = "DataField")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class DataField : NamedDescriptor { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.Field", Title = "Field")] + +class Field : Descriptor { /// Data type of a field. [SchemaElement] [SchemaType(IsNullable=false, DataType = SchemaDataType.OBJECT, NestedTypes = { - typeof(ArrayDataType), - typeof(BinaryDataType), - typeof(BooleanDataType), - typeof(CharDataType), - typeof(ClassDataType), - typeof(DateTimeDataType), - typeof(EnumDataType), - typeof(FloatDataType), - typeof(IntegerDataType), - typeof(TimeOfDayDataType), - typeof(VarcharDataType) + typeof(ArrayFieldType), + typeof(BinaryFieldType), + typeof(BooleanFieldType), + typeof(CharFieldType), + typeof(ClassFieldType), + typeof(DateTimeFieldType), + typeof(EnumFieldType), + typeof(FloatFieldType), + typeof(IntegerFieldType), + typeof(TimeOfDayFieldType), + typeof(VarcharFieldType) })] - DataType DataType; -} \ No newline at end of file + FieldType Type; +} + diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/DataType.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/FieldType.lux similarity index 63% rename from messages/schema/EPAM/Deltix/Timebase/Messages/Schema/DataType.lux rename to messages/schema/EPAM/Deltix/Timebase/Messages/Schema/FieldType.lux index b253b3484..6554943ae 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/DataType.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/FieldType.lux @@ -21,9 +21,8 @@ import EPAM.Deltix.Timebase.Messages.*; /// This is a base class for schema data types. [Abstract] -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.DataType", Title = "DataType")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class DataType { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.FieldType", Title = "FieldType")] +class FieldType { /// Binary representation (encoding) of a field in database and protocol. [SchemaElement] @@ -34,13 +33,17 @@ class DataType { [SchemaElement] [SchemaType(IsNullable=false)] Boolean IsNullable; + + [SchemaElement] + [SchemaType(IsNullable=false)] + Text BaseName; } /// This is a base class for numeric data types. [Abstract] -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.IntegralDataType", Title = "IntegralDataType")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class IntegralDataType : DataType { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.IntegralFieldType", Title = "IntegralFieldType")] + +class IntegralFieldType : FieldType { /// String definition for minimum constraint. [SchemaElement] @@ -54,32 +57,34 @@ class IntegralDataType : DataType { } /// Schema definition of array data type. -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.ArrayDataType", Title = "ArrayDataType")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class ArrayDataType : DataType { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.ArrayFieldType", Title = "ArrayFieldType")] + +class ArrayFieldType : FieldType { /// Array element data type. [SchemaElement] [SchemaType(IsNullable=false, DataType = SchemaDataType.OBJECT, NestedTypes = { - //typeof(ArrayDataType), - typeof(BinaryDataType), - typeof(BooleanDataType), - typeof(CharDataType), - typeof(ClassDataType), - typeof(DateTimeDataType), - typeof(EnumDataType), - typeof(FloatDataType), - typeof(IntegerDataType), - typeof(TimeOfDayDataType), - typeof(VarcharDataType) + //typeof(ArrayFieldType), + typeof(BinaryFieldType), + typeof(BooleanFieldType), + typeof(CharFieldType), + typeof(ClassFieldType), + typeof(DateTimeFieldType), + typeof(EnumFieldType), + typeof(FloatFieldType), + typeof(IntegerFieldType), + typeof(TimeOfDayFieldType), + typeof(VarcharFieldType) })] - DataType ElementType; + FieldType ElementType; + + override Text BaseName = "ARRAY"; } /// Schema definition of binary data type. -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.BinaryDataType", Title = "BinaryDataType")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class BinaryDataType : DataType { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.BinaryFieldType", Title = "BinaryFieldType")] + +class BinaryFieldType : FieldType { /// Maximum field length in bytes. [SchemaElement] @@ -90,78 +95,104 @@ class BinaryDataType : DataType { [SchemaElement] [SchemaType(IsNullable=true, Minimum="0", Maximum="9")] UInt16? CompressionLevel; + + override Text BaseName = "BINARY"; } /// Schema definition of boolean data type. -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.BooleanDataType", Title = "BooleanDataType")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class BooleanDataType : DataType { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.BooleanFieldType", Title = "BooleanFieldType")] + +class BooleanFieldType : FieldType { + + override Text BaseName = "BOOLEAN"; + } /// Schema definition of char data type. -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.CharDataType", Title = "CharDataType")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class CharDataType : DataType { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.CharFieldType", Title = "CharFieldType")] + +class CharFieldType : FieldType { + + override Text BaseName = "CHAR"; + } /// Schema definition of class data type. -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.ClassDataType", Title = "ClassDataType")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class ClassDataType : DataType { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.ClassFieldType", Title = "ClassFieldType")] + +class ClassFieldType : FieldType { /// Definitions for nested schema classes. [SchemaElement] [SchemaArrayType(IsNullable = false, IsElementNullable = false, - ElementTypes = { typeof(ClassDescriptorRef) })] - List TypeDescriptors; + ElementTypes = { typeof(DescriptorRef) })] + List TypeDescriptors; + + override Text BaseName = "OBJECT"; + } /// Schema definition of date-time data type. -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.DateTimeDataType", Title = "DateTimeDataType")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class DateTimeDataType : DataType { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.DateTimeFieldType", Title = "DateTimeFieldType")] + +class DateTimeFieldType : FieldType { + + override Text BaseName = "TIMESTAMP"; + } /// Schema definition of enum data type. -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.EnumDataType", Title = "EnumDataType")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class EnumDataType : DataType { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.EnumFieldType", Title = "EnumFieldType")] + +class EnumFieldType : FieldType { /// Definition for enumeration class. [SchemaElement] [SchemaType(IsNullable=false, DataType = SchemaDataType.OBJECT, NestedTypes = { - typeof(ClassDescriptorRef) + typeof(DescriptorRef) })] - ClassDescriptorRef TypeDescriptor; + DescriptorRef TypeDescriptor; + + override Text BaseName = "ENUM"; + } /// Schema definition of float data type. -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.FloatDataType", Title = "FloatDataType")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class FloatDataType : IntegralDataType { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.FloatFieldType", Title = "FloatFieldType")] + +class FloatFieldType : IntegralFieldType { /// Scale. [SchemaElement] [SchemaType(IsNullable=true)] UInt16? Scale; + + override Text BaseName = "FLOAT"; + } /// Schema definition of integer data type. -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.IntegerDataType", Title = "IntegerDataType")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class IntegerDataType : IntegralDataType { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.IntegerFieldType", Title = "IntegerFieldType")] + +class IntegerFieldType : IntegralFieldType { + + override Text BaseName = "INTEGER"; + } /// Schema definition of time-of-day data type. -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.TimeOfDayDataType", Title = "TimeOfDayDataType")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class TimeOfDayDataType : DataType { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.TimeOfDayFieldType", Title = "TimeOfDayFieldType")] + +class TimeOfDayFieldType : FieldType { + + override Text BaseName = "TIME_OF_DAY"; + } /// Schema definition of varchar data type. -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.VarcharDataType", Title = "VarcharDataType")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class VarcharDataType : DataType { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.VarcharFieldType", Title = "VarcharFieldType")] + +class VarcharFieldType : FieldType { /// True, if field allows line breaks. [SchemaElement] @@ -177,4 +208,8 @@ class VarcharDataType : DataType { [SchemaElement] [SchemaType(IsNullable=true)] UInt32? Length; -} \ No newline at end of file + + override Text BaseName = "VARCHAR"; + +} + diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/NonStaticDataField.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/NonStaticField.lux similarity index 86% rename from messages/schema/EPAM/Deltix/Timebase/Messages/Schema/NonStaticDataField.lux rename to messages/schema/EPAM/Deltix/Timebase/Messages/Schema/NonStaticField.lux index 47148a9f2..855a1500a 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/NonStaticDataField.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/NonStaticField.lux @@ -1,3 +1,4 @@ + /* Copyright 2021 EPAM Systems, Inc @@ -20,12 +21,12 @@ option JavaPackage = "com.epam.deltix.timebase.messages.schema"; import EPAM.Deltix.Timebase.Messages.*; /// Schema definition for non-static data field. -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.NonStaticDataField", Title = "NonStaticDataField")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class NonStaticDataField : DataField { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.NonStaticField", Title = "NonStaticField")] + +class NonStaticField : Field { /// True, if field is defined as a primary key. - /// The propery is applicable for unique streams only. + /// The property is applicable for unique streams only. [SchemaElement] [SchemaType(IsNullable=true)] Boolean? IsPrimaryKey; @@ -34,4 +35,4 @@ class NonStaticDataField : DataField { [SchemaElement] [SchemaType(IsNullable=true)] Text? RelativeTo; -} \ No newline at end of file +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaChangeMessage.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaChangeMessage.lux index ef24446cc..0565e2e57 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaChangeMessage.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaChangeMessage.lux @@ -21,20 +21,20 @@ import EPAM.Deltix.Timebase.Messages.*; /// Message tha defines a change in stream schema. [SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.SchemaChangeMessage", Title = "SchemaChangeMessage")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] + class SchemaChangeMessage : InstrumentMessage { /// Previous schema state. [SchemaElement] [SchemaArrayType(IsNullable = true, IsElementNullable = false, - ElementTypes = { typeof(RecordClassDescriptor), typeof(EnumClassDescriptor) })] - List? PreviousState; + ElementTypes = { typeof(TypeDescriptor), typeof(EnumDescriptor) })] + List? PreviousState; /// New schema state. [SchemaElement] [SchemaArrayType(IsNullable = false, IsElementNullable = false, - ElementTypes = { typeof(RecordClassDescriptor), typeof(EnumClassDescriptor) })] - List NewState; + ElementTypes = { typeof(TypeDescriptor), typeof(EnumDescriptor) })] + List NewState; /// New schema state. [SchemaElement] @@ -45,4 +45,4 @@ class SchemaChangeMessage : InstrumentMessage { /// Message version [SchemaElement] UInt64 Version; -} \ No newline at end of file +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaDescriptorChangeAction.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaDescriptorChangeAction.lux index 8ad052227..30a501609 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaDescriptorChangeAction.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaDescriptorChangeAction.lux @@ -21,22 +21,22 @@ import EPAM.Deltix.Timebase.Messages.*; /// Class which defines a change to schema descriptor. [SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.SchemaDescriptorChangeAction", Title = "SchemaDescriptorChangeAction")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] + class SchemaDescriptorChangeAction { /// Previous descriptor state. [SchemaElement] [SchemaType(IsNullable=true, DataType = SchemaDataType.OBJECT, NestedTypes = { - typeof(RecordClassDescriptor), typeof(EnumClassDescriptor) + typeof(TypeDescriptor), typeof(EnumDescriptor) })] - ClassDescriptor? PreviousState; + UniqueDescriptor? PreviousState; /// New descriptor state. [SchemaElement] [SchemaType(IsNullable=true, DataType = SchemaDataType.OBJECT, NestedTypes = { - typeof(RecordClassDescriptor), typeof(EnumClassDescriptor) + typeof(TypeDescriptor), typeof(EnumDescriptor) })] - ClassDescriptor? NewState; + UniqueDescriptor? NewState; /// Bitmask that defines the changes that were applied to the descriptor. [SchemaElement] @@ -56,4 +56,4 @@ class SchemaDescriptorChangeAction { [SchemaArrayType(IsNullable = true, IsElementNullable = false, ElementTypes = { typeof(SchemaFieldChangeAction) })] List? FieldChangeActions; -} \ No newline at end of file +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaDescriptorChangeType.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaDescriptorChangeType.lux index 1a6667198..9fdc2a5a4 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaDescriptorChangeType.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaDescriptorChangeType.lux @@ -19,9 +19,7 @@ option JavaPackage = "com.epam.deltix.timebase.messages.schema"; import EPAM.Deltix.Timebase.Messages.*; - /// Type of descriptor change. -[Bitmask] [SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.SchemaDescriptorChangeType", Title = "SchemaDescriptorChangeType")] enum SchemaDescriptorChangeType { /// Add operation. @@ -39,4 +37,4 @@ enum SchemaDescriptorChangeType { /// Content type change operation. [SchemaElement(Name = "CONTENT_TYPE_CHANGE")] CONTENT_TYPE_CHANGE = 0x10; -} \ No newline at end of file +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaDescriptorTransformation.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaDescriptorTransformation.lux index c556e45cb..1c8e644aa 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaDescriptorTransformation.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaDescriptorTransformation.lux @@ -21,11 +21,11 @@ import EPAM.Deltix.Timebase.Messages.*; /// Class which defines a transformation that is applied to the descriptor. [SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.SchemaDescriptorTransformation", Title = "SchemaDescriptorTransformation")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] + class SchemaDescriptorTransformation { /// Defines the transformation type that was applied to the descriptor. [SchemaElement] [SchemaType(IsNullable=false)] SchemaDescriptorTransformationType TransformationType; -} \ No newline at end of file +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaDescriptorTransformationType.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaDescriptorTransformationType.lux index cb869b379..4dd8462d8 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaDescriptorTransformationType.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaDescriptorTransformationType.lux @@ -14,6 +14,7 @@ License for the specific language governing permissions and limitations under the License. */ + namespace EPAM.Deltix.Timebase.Messages.Schema; option JavaPackage = "com.epam.deltix.timebase.messages.schema"; @@ -25,4 +26,4 @@ enum SchemaDescriptorTransformationType { /// Drop record operation. [SchemaElement(Name = "DROP_RECORD")] DROP_RECORD = 0; -} \ No newline at end of file +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaFieldChangeAction.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaFieldChangeAction.lux index 16bfdea0a..845678165 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaFieldChangeAction.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaFieldChangeAction.lux @@ -21,22 +21,22 @@ import EPAM.Deltix.Timebase.Messages.*; /// Class which defines a change to schema field. [SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.SchemaFieldChangeAction", Title = "SchemaFieldChangeAction")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] + class SchemaFieldChangeAction { /// Previous data field state. [SchemaElement] [SchemaType(IsNullable=true, DataType = SchemaDataType.OBJECT, NestedTypes = { - typeof(StaticDataField), typeof(NonStaticDataField) + typeof(StaticField), typeof(NonStaticField) })] - DataField? PreviousState; + Field? PreviousState; /// New descriptor state. [SchemaElement] [SchemaType(IsNullable=true, DataType = SchemaDataType.OBJECT, NestedTypes = { - typeof(StaticDataField), typeof(NonStaticDataField) + typeof(StaticField), typeof(NonStaticField) })] - DataField? NewState; + Field? NewState; /// Bitmask that defines the changes that were applied to the field. [SchemaElement] @@ -49,4 +49,4 @@ class SchemaFieldChangeAction { typeof(SchemaFieldDataTransformation) })] SchemaFieldDataTransformation? DataTransformation; -} \ No newline at end of file +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaFieldChangeType.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaFieldChangeType.lux index 67dc01a4b..386ca2e21 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaFieldChangeType.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaFieldChangeType.lux @@ -20,7 +20,6 @@ option JavaPackage = "com.epam.deltix.timebase.messages.schema"; import EPAM.Deltix.Timebase.Messages.*; /// Type of field change. -[Bitmask] [SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.SchemaFieldChangeType", Title = "SchemaFieldChangeType")] enum SchemaFieldChangeType { /// Add field or enumeration value operation. @@ -56,4 +55,4 @@ enum SchemaFieldChangeType { /// Change field relation attribute operation. [SchemaElement(Name = "RELATION_CHANGE")] RELATION_CHANGE = 0x400; -} \ No newline at end of file +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaFieldDataTransformation.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaFieldDataTransformation.lux index b62ab3dcd..60a9b9932 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaFieldDataTransformation.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/SchemaFieldDataTransformation.lux @@ -21,7 +21,7 @@ import EPAM.Deltix.Timebase.Messages.*; /// Class which defines a transformation that is applied to a data field. [SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.SchemaFieldDataTransformation", Title = "SchemaFieldDataTransformation")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] + class SchemaFieldDataTransformation { /// Defines the transformation that was applied to the field. @@ -33,4 +33,4 @@ class SchemaFieldDataTransformation { [SchemaElement] [SchemaType(IsNullable=true)] Text? DefaultValue; -} \ No newline at end of file +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/StaticDataField.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/StaticField.lux similarity index 88% rename from messages/schema/EPAM/Deltix/Timebase/Messages/Schema/StaticDataField.lux rename to messages/schema/EPAM/Deltix/Timebase/Messages/Schema/StaticField.lux index a262ee93a..f394f05d6 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/StaticDataField.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/StaticField.lux @@ -20,9 +20,9 @@ option JavaPackage = "com.epam.deltix.timebase.messages.schema"; import EPAM.Deltix.Timebase.Messages.*; /// Schema definition for static data field. -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.StaticDataField", Title = "StaticDataField")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class StaticDataField : DataField { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.StaticField", Title = "StaticField")] + +class StaticField : Field { /// Value constant for a field. [SchemaElement] diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/StreamMessage.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/StreamMessage.lux new file mode 100644 index 000000000..85e9b4008 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/StreamMessage.lux @@ -0,0 +1,51 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. + */ +namespace EPAM.Deltix.Timebase.Messages.Schema; +option JavaPackage = "com.epam.deltix.timebase.messages.schema"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Message that describes TimeBase stream +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.StreamMessage", Title = "StreamMessage")] + +class StreamMessage : InstrumentMessage { + + /// Stream key + [SchemaElement()] + [SchemaType(IsNullable = false)] + Text Key; + + /// Stream name + [SchemaElement()] + [SchemaType(IsNullable = true)] + Text? Name; + + /// Stream description + [SchemaElement()] + [SchemaType(IsNullable = true)] + Text? Description; + + /// Top types in stream schema + [SchemaElement()] + [SchemaArrayType(ElementTypes = { typeof(TypeDescriptor) }, IsNullable = false, IsElementNullable = false)] + List TopTypes; + + /// All types in stream schema + [SchemaElement()] + [SchemaArrayType(ElementTypes = { typeof(TypeDescriptor), typeof(EnumDescriptor) }, IsNullable = false, IsElementNullable = false)] + List AllTypes; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/RecordClassDescriptor.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/TypeDescriptor.lux similarity index 69% rename from messages/schema/EPAM/Deltix/Timebase/Messages/Schema/RecordClassDescriptor.lux rename to messages/schema/EPAM/Deltix/Timebase/Messages/Schema/TypeDescriptor.lux index f8e6b4149..890fb30d0 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/RecordClassDescriptor.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/TypeDescriptor.lux @@ -20,30 +20,30 @@ option JavaPackage = "com.epam.deltix.timebase.messages.schema"; import EPAM.Deltix.Timebase.Messages.*; /// Schema definition for a class. -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.RecordClassDescriptor", Title = "RecordClassDescriptor")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class RecordClassDescriptor : ClassDescriptor { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.TypeDescriptor", Title = "TypeDescriptor")] - /// Defines parent RecordClassDescriptor if exist. +class TypeDescriptor : UniqueDescriptor { + + /// Defines parent TypeDescriptor if exist. [SchemaElement] [SchemaType(IsNullable=true, DataType = SchemaDataType.OBJECT, NestedTypes = { - typeof(RecordClassDescriptor) + typeof(TypeDescriptor) })] - RecordClassDescriptor? Parent; + TypeDescriptor? Parent; - /// Defines if current RecordClassDescriptor is abstract. + /// Defines if current TypeDescriptor is abstract. [SchemaElement] [SchemaType(IsNullable=false)] Boolean IsAbstract; - /// Defines if current RecordClassDescriptor is content class. + /// Defines if current TypeDescriptor is content class. [SchemaElement] - [SchemaType(IsNullable=true)] + [SchemaType(IsNullable=false)] Boolean IsContentClass; /// List of fields of a class. [SchemaElement] [SchemaArrayType(IsNullable = false, IsElementNullable = false, - ElementTypes = { typeof(StaticDataField), typeof(NonStaticDataField) })] - List DataFields; -} \ No newline at end of file + ElementTypes = { typeof(StaticField), typeof(NonStaticField) })] + List Fields; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/ClassDescriptor.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/UniqueDescriptor.lux similarity index 88% rename from messages/schema/EPAM/Deltix/Timebase/Messages/Schema/ClassDescriptor.lux rename to messages/schema/EPAM/Deltix/Timebase/Messages/Schema/UniqueDescriptor.lux index b322f8b7b..f289eb994 100644 --- a/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/ClassDescriptor.lux +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Schema/UniqueDescriptor.lux @@ -21,9 +21,9 @@ import EPAM.Deltix.Timebase.Messages.*; /// Schema definition for a schema node. [Abstract] -[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.ClassDescriptor", Title = "ClassDescriptor")] -[GenerateReadOnlyInterface][GenerateReadWriteInterface] -class ClassDescriptor : NamedDescriptor { +[SchemaElement(Name = "com.epam.deltix.timebase.messages.schema.UniqueDescriptor", Title = "UniqueDescriptor")] + +class UniqueDescriptor : Descriptor { /// Optional GUID for this node. [SchemaElement] [SchemaType(IsNullable=true)] diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/AggressorSide.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/AggressorSide.lux new file mode 100644 index 000000000..59d22f44d --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/AggressorSide.lux @@ -0,0 +1,31 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Side of quote or trade. Buy or Sell. +[SchemaElement(Name = "deltix.timebase.api.messages.AggressorSide", Title = "Aggressor Side")] +enum AggressorSide { + /// Buy side. + [SchemaElement(Name = "BUY")] + BUY = 0; + /// Sell side. + [SchemaElement(Name = "SELL")] + SELL = 1; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/BaseEntry.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/BaseEntry.lux new file mode 100644 index 000000000..a68eb6582 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/BaseEntry.lux @@ -0,0 +1,43 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Base class for market data entry to be included in package (PackageHeader). +[SchemaElement(Name = "com.epam.deltix.timebase.messages.universal.BaseEntry", Title = "Base Entry")] +[GenerateReadOnlyInterface][GenerateReadWriteInterface] +class BaseEntry { + + /// Exchange code compressed to long using ALPHANUMERIC(10) encoding. + /// see #getExchange() + [SchemaElement(Title = "Exchange Code")] + [SchemaType(Encoding = "ALPHANUMERIC(10)", DataType = SchemaDataType.VARCHAR)] + Int64? ExchangeId; + + /// True, if quote (or trade) comes from an implied Order book. + [SchemaElement(Title = "Is Implied")] + [SchemaType(DataType = SchemaDataType.BOOLEAN)] + Boolean? IsImplied; + + /// Special field designed to store multiple derivative instruments' updates + /// into single package. Most of the time should be static null. + [SchemaElement(Title = "Contract ID")] + [SchemaType(Encoding = "ALPHANUMERIC(10)", DataType = SchemaDataType.VARCHAR)] + Int64? ContractId; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/BasePriceEntry.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/BasePriceEntry.lux new file mode 100644 index 000000000..9c3c29d19 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/BasePriceEntry.lux @@ -0,0 +1,56 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// This is base class for price entry. +[SchemaElement(Name = "com.epam.deltix.timebase.messages.universal.BasePriceEntry", Title = "Base Price Entry")] +[GenerateReadOnlyInterface][GenerateReadWriteInterface] +class BasePriceEntry : BaseEntry { + + /// Ask, Bid or Trade price. + [SchemaElement(Title = "Price")] + [SchemaType(DataType = SchemaDataType.FLOAT, Encoding = "DECIMAL64")] + Decimal Price; + + /// Ask, Bid or Trade quantity. + [SchemaElement(Title = "Size")] + [SchemaType(DataType = SchemaDataType.FLOAT, Encoding = "DECIMAL64")] + Decimal? Size; + + /// Numbers of orders. + [SchemaElement(Title = "Number Of Orders")] + Int64? NumberOfOrders; + + /// Quote ID. In Forex market, for example, quote ID can be referenced in + /// TradeOrders (to identify market maker's quote/rate we want to deal with). + /// Each market maker usually keeps this ID unique per session per day. This + /// is a alpha-numeric text text field that can reach 64 characters or more, + + /// depending on market maker. + [Identifier] + [SchemaElement(Title = "Quote ID")] + Text? QuoteId; + + /// Id of participant (or broker ID). + + [Identifier] + [SchemaElement(Title = "Participant")] + Text? ParticipantId; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/BookResetEntry.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/BookResetEntry.lux new file mode 100644 index 000000000..e83471c52 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/BookResetEntry.lux @@ -0,0 +1,42 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ + +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// This entry used for empty snapshot indication. It is necessary because PackageHeader has no field exchangeId. +/// You should use this entry only for empty snapshot (both sides are empty) case. +[SchemaElement(Name = "com.epam.deltix.timebase.messages.universal.BookResetEntry", Title = "Book Reset Entry")] +[GenerateReadOnlyInterface][GenerateReadWriteInterface] +class BookResetEntry : BaseEntry { + + /// Deprecated as of November 2019. No longer used. BookResetEntry now applies to both sides of Order Book and must be used only in snapshot package types. + /// Previous meaning: Quote side. Bid or Ask. + /// Ask = Sell limit order. + /// Bid = Buy limit order. + [Obsolete] + [SchemaType(IsNullable = true)] + [SchemaElement(Title = "Side")] + QuoteSide Side; + + /// Data Model Type to identify what book we should reset. + [SchemaType(IsNullable = false)] + [SchemaElement(Title = "Model Type")] + DataModelType ModelType; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/BookUpdateAction.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/BookUpdateAction.lux new file mode 100644 index 000000000..41dc8ab7b --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/BookUpdateAction.lux @@ -0,0 +1,41 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Directs how to update an Order Book for L2 format. +[SchemaElement(Name = "deltix.timebase.api.messages.BookUpdateAction", Title = "Book Update Action")] +enum BookUpdateAction { + + /// Quote is inserted (automatically shifts existing levels down). INSERT action is sent if there is a new price level. + /// Client systems should then shift price levels down, and delete any price levels past the defined depth of the book. + [SchemaElement(Name = "INSERT")] + INSERT = 0; + + /// Update of an existing quote. The UPDATE action is sent to update characteristics of a price level without changing the price itself, + /// or impacting any other prices on the book. The change data block is sent to update the order count and / or quantity for a price level. + /// The UPDATE is not sent when the price changes at a given price level. + [SchemaElement(Name = "UPDATE")] + UPDATE = 1; + + /// Quote at given price level is deleted. Client systems should shift prices below the data block up to the price level vacated by the deleted price level. + /// If available, an add data block will be sent to fill in the last price level. + [SchemaElement(Name = "DELETE")] + DELETE = 2; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/DataModelType.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/DataModelType.lux new file mode 100644 index 000000000..570b15631 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/DataModelType.lux @@ -0,0 +1,39 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Level of data model. +enum DataModelType { + /// Level One (best bid and best offer) + [SchemaElement(Name = "LEVEL_ONE")] + LEVEL_ONE = 0; + + /// Level Two. Market by level. More details than LEVEL_ONE. + [SchemaElement(Name = "LEVEL_TWO")] + LEVEL_TWO = 1; + + /// Level Three. Market by Order. The most detailed view of the market. + [SchemaElement(Name = "LEVEL_THREE")] + LEVEL_THREE = 2; + + /// Maximal level of details availabe in input market data. + [SchemaElement(Name = "MAX")] + MAX = 3; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/InsertType.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/InsertType.lux new file mode 100644 index 000000000..1b809e3ac --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/InsertType.lux @@ -0,0 +1,36 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Insert type needs to distinguish between AddFront and AddBack. +[SchemaElement(Name = "com.epam.deltix.timebase.messages.universal.InsertType", Title = "Insert Type")] +enum InsertType { + /// Add back. + [SchemaElement(Name = "ADD_BACK")] + ADD_BACK = 0; + + /// Add front. + [SchemaElement(Name = "ADD_FRONT")] + ADD_FRONT = 1; + + /// Add by time. + [SchemaElement(Name = "ADD_BEFORE")] + ADD_BEFORE = 2; +} \ No newline at end of file diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/L1Entry.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/L1Entry.lux new file mode 100644 index 000000000..f047ad363 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/L1Entry.lux @@ -0,0 +1,42 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ + +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; +/// This class may represent both exchange-local top of the book (BBO) as well as National Best Bid Offer (NBBO). +/// You can use method {getIsNational()} to filter out NBBO messages. +/// This is always a one side quote, unlike old BestBidOfferMessage which is two-side (with nullable properties). +[SchemaElement(Name = "com.epam.deltix.timebase.messages.universal.L1Entry", Title = "L1Entry")] +[GenerateReadOnlyInterface][GenerateReadWriteInterface] +class L1Entry : BasePriceEntry { + + /// return 1 if this BBO quote represents the national best, 0 if this BBO is regional + /// and BooleanDataType.NULL if the property is undefined. In case of NBBO you can inspect {#getExchangeId()} + /// to see what exchange/ECN has the national best price. + [SchemaElement(Title = "Is National")] + [SchemaType(DataType = SchemaDataType.BOOLEAN)] + Boolean? IsNational; + + /// Quote side. Bid or Ask. + /// Ask = Sell limit order. + /// Bid = Buy limit order. + [SchemaType(IsNullable = false)] + [SchemaElement(Title = "Side")] + QuoteSide Side; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/L2EntryNew.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/L2EntryNew.lux new file mode 100644 index 000000000..d5248c83f --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/L2EntryNew.lux @@ -0,0 +1,43 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ + +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Reports incremental L2-updates: insert, delete or update of one line in Order Book either on ask or bid side. +/// It also can encode L2-snapshot entry. Note L2 is level oriented depth-of-the-book format and should be used +/// whenever price or integer index is used to locate book changes. It does support individual quotes book of +/// arbitrary depth. But if incremental changes key is a quoteId L3Entry should be used instead. +[GenerateReadOnlyInterface][GenerateReadWriteInterface] +[SchemaElement(Name = "com.epam.deltix.timebase.messages.universal.L2EntryNew", Title = "L2EntryNew")] +class L2EntryNew : BasePriceEntry { + + /// Market Depth / Price Level. + /// This value is zero-based (top of the book will have depth=0). + [SchemaType(IsNullable = false)] + [SchemaElement(Title = "Level Index")] + Int16 Level; + + /// Quote side. Bid or Ask. + /// Ask = Sell limit order. + /// Bid = Buy limit order. + [SchemaType(IsNullable = false)] + [SchemaElement(Title = "Side")] + QuoteSide Side; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/L2EntryUpdate.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/L2EntryUpdate.lux new file mode 100644 index 000000000..f974d21b5 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/L2EntryUpdate.lux @@ -0,0 +1,50 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Reports incremental L2-updates: insert, delete or update of one line in Order Book either on ask or bid side. +/// It also can encode L2-snapshot entry. Note L2 is level oriented depth-of-the-book format and should be used +/// whenever price or integer index is used to locate book changes. It does support individual quotes book of +/// arbitrary depth. But if incremental changes key is a quoteId L3Entry should be used instead. +[GenerateReadOnlyInterface][GenerateReadWriteInterface] +[SchemaElement(Name = "com.epam.deltix.timebase.messages.universal.L2EntryUpdate", Title = "L2EntryUpdate")] +class L2EntryUpdate : BasePriceEntry { + + /// Market Depth / Price Level. + /// This value is zero-based (top of the book will have depth=0). + [SchemaType(IsNullable = false)] + [SchemaElement(Title = "Level Index")] + Int16 Level; + + /// Directs how to update an Order Book + ///

+ /// symbol, instrumentType, exchangeCode, marketMakerCode, depth fields constitute the composite key + /// to identify the order book record. + ///

. + [SchemaType(IsNullable = false)] + [SchemaElement(Title = "Action")] + BookUpdateAction Action; + + /// Quote side. Bid or Ask. + /// Ask = Sell limit order. + /// Bid = Buy limit order. + [SchemaElement(Title = "Side")] + QuoteSide? Side; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/L3EntryNew.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/L3EntryNew.lux new file mode 100644 index 000000000..13c785b32 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/L3EntryNew.lux @@ -0,0 +1,46 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Reports incremental L3-updates: new, cancel, modify and replace of one quote in Order Book either on ask or bid side. +/// It also can encode L3-snapshot entry. Note L3 is quote oriented depth-of-the-book format and should be used +/// whenever quoteId is used to locate book changes. +[SchemaElement(Name = "com.epam.deltix.timebase.messages.universal.L3EntryNew", Title = "L3EntryNew")] +[GenerateReadOnlyInterface][GenerateReadWriteInterface] +class L3EntryNew : BasePriceEntry { + + /// Quote side. Bid or Ask. + /// Ask = Sell limit order. + /// Bid = Buy limit order. + [SchemaType(IsNullable = false)] + [SchemaElement(Title = "Side")] + QuoteSide Side; + + /// Insert type. Add front or Add back. + //[Title(Value = "InsertType")] + [SchemaElement] + InsertType InsertType; + + /// In case of InsertType = ADD_BEFORE represents the id of the quote that should be after inserted. + [Identifier] + [SchemaType(IsNullable = true)] + [SchemaElement] + Text? InsertBeforeQuoteId; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/L3EntryUpdate.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/L3EntryUpdate.lux new file mode 100644 index 000000000..cdd3460a2 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/L3EntryUpdate.lux @@ -0,0 +1,43 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Reports incremental L3-updates: new, cancel, modify and replace of one quote in Order Book either on ask or bid side. +/// It also can encode L3-snapshot entry. Note L3 is quote oriented depth-of-the-book format and should be used +/// whenever quoteId is used to locate book changes. +[GenerateReadOnlyInterface][GenerateReadWriteInterface] +[SchemaElement(Name = "com.epam.deltix.timebase.messages.universal.L3EntryUpdate", Title = "L3 Entry Update")] +class L3EntryUpdate : BasePriceEntry { + + /// Directs how to update an Order Book + ///

+ /// symbol, instrumentType, exchangeCode, quoteId fields constitute the composite key + /// to identify the order book record. + ///

. + [SchemaType(IsNullable = false)] + [SchemaElement(Title = "Action")] + QuoteUpdateAction Action; + + /// Quote side. Bid or Ask. + /// Ask = Sell limit order. + /// Bid = Buy limit order. + [SchemaElement(Title = "Side")] + QuoteSide? Side; +} \ No newline at end of file diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/PackageHeader.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/PackageHeader.lux new file mode 100644 index 000000000..742a750ae --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/PackageHeader.lux @@ -0,0 +1,37 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Represents market data package. +[GenerateReadOnlyInterface][GenerateReadWriteInterface] +[SchemaElement(Name = "com.epam.deltix.timebase.messages.universal.PackageHeader", Title = "Package Header")] +class PackageHeader : MarketMessage { + + /// Message package content. Array of individual entries. + /// Typical entries classes are L1Entry, L2Entry, L3Entry, TradeEntry. + [SchemaElement(Title = "Entries")] + [SchemaArrayType(IsNullable = false, IsElementNullable = false, ElementTypes = { typeof(TradeEntry), typeof(L1Entry), typeof(L2EntryNew), typeof(L2EntryUpdate), typeof(L3EntryNew), typeof(L3EntryUpdate), typeof(BookResetEntry), typeof(StatisticsEntry)})] + List Entries; + + /// Package type needs to distinguish between incremental changes and different types of snapshot. + [SchemaType(IsNullable = false)] + [SchemaElement(Title = "Package Type")] + PackageType PackageType; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/PackageType.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/PackageType.lux new file mode 100644 index 000000000..bef04b335 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/PackageType.lux @@ -0,0 +1,37 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Package type needs to distinguish between incremental changes and different types of snapshot. +[SchemaElement(Name = "com.epam.deltix.timebase.messages.universal.PackageType", Title = "Package Type")] +enum PackageType { + + /// Vendor snapshot. + [SchemaElement(Name = "VENDOR_SNAPSHOT")] + VENDOR_SNAPSHOT = 0; + + /// Periodical snapshot. + [SchemaElement(Name = "PERIODICAL_SNAPSHOT")] + PERIODICAL_SNAPSHOT = 1; + + /// Incremental update. + [SchemaElement(Name = "INCREMENTAL_UPDATE")] + INCREMENTAL_UPDATE = 2; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/QuoteSide.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/QuoteSide.lux new file mode 100644 index 000000000..9ee7d9630 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/QuoteSide.lux @@ -0,0 +1,30 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Side of quote. Bid and Ask . +enum QuoteSide { + /// Bid for quote. + [SchemaElement(Name = "BID")] + BID = 0; + /// Ask for quote. + [SchemaElement(Name = "ASK")] + ASK = 1; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/QuoteUpdateAction.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/QuoteUpdateAction.lux new file mode 100644 index 000000000..0aabdcf64 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/QuoteUpdateAction.lux @@ -0,0 +1,36 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Directs how to update an Order Book for L3 format. +enum QuoteUpdateAction { + + /// Delete quote (meaning trader cancel it). + [SchemaElement(Name = "CANCEL")] + CANCEL = 0; + + /// Modify quote content (meaning that quote safe its position in order). + [SchemaElement(Name = "MODIFY")] + MODIFY = 1; + + /// Modify quote content (meaning that quote lose its position in order). + [SchemaElement(Name = "REPLACE")] + REPLACE = 2; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/StatisticsEntry.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/StatisticsEntry.lux new file mode 100644 index 000000000..9b5fbcfa1 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/StatisticsEntry.lux @@ -0,0 +1,40 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Represents arbitrary exchange event. +[SchemaElement(Name = "com.epam.deltix.timebase.messages.universal.StatisticsEntry", Title = "StatisticsEntry")] +[GenerateReadOnlyInterface][GenerateReadWriteInterface] +class StatisticsEntry : BaseEntry { + + /// Type of the event and meaning of the value. + /// Not nullable, use StatisticsType.Custom if unknown/non-mapped + [SchemaElement(Title = "Type")] + StatisticsType Type; + + /// Generic field to store value. Meaning is depends on StatisticsType + [SchemaElement(Title = "Value")] + [SchemaType(DataType = SchemaDataType.FLOAT, Encoding = "DECIMAL64", IsNullable = true)] + Decimal? Value; + + /// Original event type, vendor specific. + [SchemaElement(Title = "OriginalType")] + Text? OriginalType; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/StatisticsType.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/StatisticsType.lux new file mode 100644 index 000000000..0e685095c --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/StatisticsType.lux @@ -0,0 +1,77 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Represents type of event and its value for StatisticsEntry. +[SchemaElement(Name = "com.epam.deltix.timebase.messages.universal.StatisticsType", Title = "Statistics Type")] +enum StatisticsType { + + /// Custom. + [SchemaElement(Name = "CUSTOM")] + CUSTOM = 1; + + /// Opening price. + [SchemaElement(Name = "OPENING_PRICE")] + OPENING_PRICE = 2; + + /// Closing price. + [SchemaElement(Name = "CLOSING_PRICE")] + CLOSING_PRICE = 3; + + /// Settlement price. + [SchemaElement(Name = "SETTLEMENT_PRICE")] + SETTLEMENT_PRICE = 4; + + /// Trading session high price. + [SchemaElement(Name = "TRADING_SESSION_HIGH_PRICE")] + TRADING_SESSION_HIGH_PRICE = 5; + + /// Trading session low price. + [SchemaElement(Name = "TRADING_SESSION_LOW_PRICE")] + TRADING_SESSION_LOW_PRICE = 6; + + /// Trading session vwap price. + [SchemaElement(Name = "TRADING_SESSION_VWAP_PRICE")] + TRADING_SESSION_VWAP_PRICE = 7; + + /// Trade volume. + [SchemaElement(Name = "TRADE_VOLUME")] + TRADE_VOLUME = 8; + + /// Open interest. + [SchemaElement(Name = "OPEN_INTEREST")] + OPEN_INTEREST = 9; + + /// Session high bid. + [SchemaElement(Name = "SESSION_HIGH_BID")] + SESSION_HIGH_BID = 10; + + /// Session low offer. + [SchemaElement(Name = "SESSION_LOW_OFFER")] + SESSION_LOW_OFFER = 11; + + /// Auction clearing price. + [SchemaElement(Name = "AUCTION_CLEARING_PRICE")] + AUCTION_CLEARING_PRICE = 12; + + /// Fixing priceq. + [SchemaElement(Name = "FIXING_PRICE")] + FIXING_PRICE = 13; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/TradeEntry.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/TradeEntry.lux new file mode 100644 index 000000000..5b26dd964 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/TradeEntry.lux @@ -0,0 +1,89 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Basic information about a market trade. +[GenerateReadOnlyInterface][GenerateReadWriteInterface] +[SchemaElement(Name = "com.epam.deltix.timebase.messages.universal.TradeEntry", Title = "Trade Entry")] +class TradeEntry : BaseEntry { + + /// Ask, Bid or Trade price. + [SchemaElement(Title = "Price")] + [SchemaType(DataType = SchemaDataType.FLOAT, Encoding = "DECIMAL64")] + Decimal? Price; + + /// Ask, Bid or Trade quantity. + [SchemaElement(Title = "Size")] + [SchemaType(DataType = SchemaDataType.FLOAT, Encoding = "DECIMAL64")] + Decimal? Size; + + /// Market specific trade condition. + [SchemaElement(Title = "Condition")] + [SchemaType(Encoding = "UTF8")] + Text? Condition; + + /// Explains the meaning of the given price and/or size. + /// The value is null for regular trades. + [SchemaElement(Title = "Trade Type")] + TradeType? TradeType; + + /// Seller number of orders involved in match. + [SchemaElement(Title = "Seller Number Of Orders")] + Int64? SellerNumberOfOrders; + + /// Buyer number of orders involved in match. + [SchemaElement(Title = "Buyer Number Of Orders")] + Int64? BuyerNumberOfOrders; + + /// ID of seller order. + + [Identifier] + [SchemaElement(Title = "Seller Order ID")] + Text? SellerOrderId; + + /// ID of buyer order. + + [Identifier] + [SchemaElement(Title = "Buyer Order ID")] + Text? BuyerOrderId; + + /// Seller participant ID (or broker ID) for trader that submit selling order. + + [Identifier] + [SchemaElement(Title = "Seller Participant ID")] + Text? SellerParticipantId; + + /// Buyer participant ID (or broker ID) for trader that submit buying order. + + [Identifier] + [SchemaElement(Title = "Buyer Participant ID")] + Text? BuyerParticipantId; + + /// Trade side. Sell or Buy. + /// For Trade it's aggressor side, i.e. side from where market order has came. + [SchemaElement(Title = "Side")] + AggressorSide? Side; + + /// Id of particular execution event (ExecutionId, TradeId, MatchId) + + [Identifier] + [SchemaElement(Title = "Match ID")] + Text? MatchId; +} diff --git a/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/TradeType.lux b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/TradeType.lux new file mode 100644 index 000000000..a6f625f82 --- /dev/null +++ b/messages/schema/EPAM/Deltix/Timebase/Messages/Universal/TradeType.lux @@ -0,0 +1,45 @@ +/* + Copyright 2021 EPAM Systems, Inc + + See the NOTICE file distributed with this work for additional information + regarding copyright ownership. Licensed under the Apache License, + Version 2.0 (the "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + License for the specific language governing permissions and limitations under + the License. +*/ +namespace EPAM.Deltix.Timebase.Messages.Universal; +option JavaPackage = "com.epam.deltix.timebase.messages.universal"; + +import EPAM.Deltix.Timebase.Messages.*; + +/// Explains the meaning of the given price and/or size. +enum TradeType { + + /// Regular trade. + [SchemaElement(Name = "REGULAR_TRADE")] + REGULAR_TRADE = 0; + + /// Auction price. + [SchemaElement(Name = "AUCTION_CLEARING_PRICE")] + AUCTION_CLEARING_PRICE = 1; + + /// Trade correction. + [SchemaElement(Name = "CORRECTION")] + CORRECTION = 2; + + /// Trade cancellation. + [OldElementName("CANCELATION")] + [SchemaElement(Name = "CANCELLATION")] + CANCELLATION = 3; + + /// Not regular trade of unknown type. + [SchemaElement(Name = "UNKNOWN")] + UNKNOWN = 20; +} diff --git a/messages/schema/JavaTimeBaseGenerator.json b/messages/schema/JavaTimeBaseGenerator.json index 432de93b6..688d30d76 100644 --- a/messages/schema/JavaTimeBaseGenerator.json +++ b/messages/schema/JavaTimeBaseGenerator.json @@ -15,5 +15,5 @@ "RECORD_INTERFACE" : "com.epam.deltix.timebase.messages.RecordInterface", "MARKET_MESSAGE_TYPE" : "com.epam.deltix.timebase.api.MarketMessageType", "CONSTANT_CLASS_NAME": "com.epam.deltix.timebase.messages.TypeConstants", - "COLLECTIONS_PACKAGE_NAME": "deltix.util.collections.generated" + "COLLECTIONS_PACKAGE_NAME": "com.epam.deltix.util.collections.generated" } diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/Bitmask.java b/messages/src/main/java/com/epam/deltix/timebase/messages/Bitmask.java index e2ae0bccf..59adc047f 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/Bitmask.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/Bitmask.java @@ -1,19 +1,3 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages; import java.lang.annotation.ElementType; @@ -26,4 +10,4 @@ ElementType.TYPE} ) public @interface Bitmask { -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/Identifier.java b/messages/src/main/java/com/epam/deltix/timebase/messages/Identifier.java index f407eda0a..ae4e15aa4 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/Identifier.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/Identifier.java @@ -1,19 +1,3 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages; import java.lang.annotation.ElementType; @@ -24,4 +8,4 @@ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE }) public @interface Identifier { -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/IdentityKeyInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/IdentityKeyInterface.java index 7754fc2a6..4fd03618f 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/IdentityKeyInterface.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/IdentityKeyInterface.java @@ -1,23 +1,5 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages; -import java.lang.CharSequence; - /** */ public interface IdentityKeyInterface extends IdentityKey { @@ -43,4 +25,4 @@ public interface IdentityKeyInterface extends IdentityKey { * Instrument name. */ void nullifySymbol(); -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/MarketMessage.java b/messages/src/main/java/com/epam/deltix/timebase/messages/MarketMessage.java new file mode 100644 index 000000000..cc3629b1b --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/MarketMessage.java @@ -0,0 +1,340 @@ +package com.epam.deltix.timebase.messages; + +/** + * Most financial market-related messages subclass this abstract class. + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.MarketMessage", + title = "Market Message" +) +public class MarketMessage extends InstrumentMessage implements MarketMessageInterface { + public static final String CLASS_NAME = MarketMessage.class.getName(); + + /** + * Exchange Time is measured in milliseconds that passed since January 1, 1970 UTC + */ + protected long originalTimestamp = TypeConstants.TIMESTAMP_UNKNOWN; + + /** + * Identifies currency in which quantity is denominated (for currencies this must be base or term currency) + * using 'alphanumeric' encoding + */ + protected long currency = TypeConstants.INT64_NULL; + + /** + * Market specific identifier of the given event in a sequence of market events. + */ + protected long sequenceNumber = TypeConstants.INT64_NULL; + + /** + * Identifies market data source. Different sessions of same connector + * to a same data provider should have different id. + */ + protected long sourceId = TypeConstants.INT64_NULL; + + /** + * Exchange Time is measured in milliseconds that passed since January 1, 1970 UTC + * @return Original Timestamp + */ + @SchemaType( + dataType = SchemaDataType.TIMESTAMP + ) + @SchemaElement( + description = "Original Timestamp" + ) + public long getOriginalTimestamp() { + return originalTimestamp; + } + + /** + * Exchange Time is measured in milliseconds that passed since January 1, 1970 UTC + * @param value - Original Timestamp + */ + public void setOriginalTimestamp(long value) { + this.originalTimestamp = value; + } + + /** + * Exchange Time is measured in milliseconds that passed since January 1, 1970 UTC + * @return true if Original Timestamp is not null + */ + public boolean hasOriginalTimestamp() { + return originalTimestamp != TypeConstants.TIMESTAMP_UNKNOWN; + } + + /** + * Exchange Time is measured in milliseconds that passed since January 1, 1970 UTC + */ + public void nullifyOriginalTimestamp() { + this.originalTimestamp = TypeConstants.TIMESTAMP_UNKNOWN; + } + + /** + * Identifies currency in which quantity is denominated (for currencies this must be base or term currency) + * using 'alphanumeric' encoding + * @return Currency + */ + @SchemaElement + @SchemaType( + encoding = "ALPHANUMERIC(10)", + dataType = SchemaDataType.VARCHAR + ) + public long getCurrency() { + return currency; + } + + /** + * Identifies currency in which quantity is denominated (for currencies this must be base or term currency) + * using 'alphanumeric' encoding + * @param value - Currency + */ + public void setCurrency(long value) { + this.currency = value; + } + + /** + * Identifies currency in which quantity is denominated (for currencies this must be base or term currency) + * using 'alphanumeric' encoding + * @return true if Currency is not null + */ + public boolean hasCurrency() { + return currency != TypeConstants.INT64_NULL; + } + + /** + * Identifies currency in which quantity is denominated (for currencies this must be base or term currency) + * using 'alphanumeric' encoding + */ + public void nullifyCurrency() { + this.currency = TypeConstants.INT64_NULL; + } + + /** + * Market specific identifier of the given event in a sequence of market events. + * @return Sequence Number + */ + @SchemaElement + public long getSequenceNumber() { + return sequenceNumber; + } + + /** + * Market specific identifier of the given event in a sequence of market events. + * @param value - Sequence Number + */ + public void setSequenceNumber(long value) { + this.sequenceNumber = value; + } + + /** + * Market specific identifier of the given event in a sequence of market events. + * @return true if Sequence Number is not null + */ + public boolean hasSequenceNumber() { + return sequenceNumber != TypeConstants.INT64_NULL; + } + + /** + * Market specific identifier of the given event in a sequence of market events. + */ + public void nullifySequenceNumber() { + this.sequenceNumber = TypeConstants.INT64_NULL; + } + + /** + * Identifies market data source. Different sessions of same connector + * to a same data provider should have different id. + * @return Source Id + */ + @SchemaType( + encoding = "ALPHANUMERIC(10)", + dataType = SchemaDataType.VARCHAR + ) + @SchemaElement + public long getSourceId() { + return sourceId; + } + + /** + * Identifies market data source. Different sessions of same connector + * to a same data provider should have different id. + * @param value - Source Id + */ + public void setSourceId(long value) { + this.sourceId = value; + } + + /** + * Identifies market data source. Different sessions of same connector + * to a same data provider should have different id. + * @return true if Source Id is not null + */ + public boolean hasSourceId() { + return sourceId != TypeConstants.INT64_NULL; + } + + /** + * Identifies market data source. Different sessions of same connector + * to a same data provider should have different id. + */ + public void nullifySourceId() { + this.sourceId = TypeConstants.INT64_NULL; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + @Override + protected MarketMessage createInstance() { + return new MarketMessage(); + } + + /** + * Method nullifies all instance properties + */ + @Override + public MarketMessage nullify() { + super.nullify(); + nullifyOriginalTimestamp(); + nullifyCurrency(); + nullifySequenceNumber(); + nullifySourceId(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + @Override + public MarketMessage reset() { + super.reset(); + originalTimestamp = TypeConstants.TIMESTAMP_UNKNOWN; + currency = TypeConstants.INT64_NULL; + sequenceNumber = TypeConstants.INT64_NULL; + sourceId = TypeConstants.INT64_NULL; + return this; + } + + /** + * Method copies state to a given instance + */ + @Override + public MarketMessage clone() { + MarketMessage t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + boolean superEquals = super.equals(obj); + if (!superEquals) return false; + if (!(obj instanceof MarketMessageInfo)) return false; + MarketMessageInfo other =(MarketMessageInfo)obj; + if (hasOriginalTimestamp() != other.hasOriginalTimestamp()) return false; + if (hasOriginalTimestamp() && getOriginalTimestamp() != other.getOriginalTimestamp()) return false; + if (hasCurrency() != other.hasCurrency()) return false; + if (hasCurrency() && getCurrency() != other.getCurrency()) return false; + if (hasSequenceNumber() != other.hasSequenceNumber()) return false; + if (hasSequenceNumber() && getSequenceNumber() != other.getSequenceNumber()) return false; + if (hasSourceId() != other.hasSourceId()) return false; + if (hasSourceId() && getSourceId() != other.getSourceId()) return false; + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = super.hashCode(); + if (hasOriginalTimestamp()) { + hash = hash * 31 + ((int)(getOriginalTimestamp() ^ (getOriginalTimestamp() >>> 32))); + } + if (hasCurrency()) { + hash = hash * 31 + ((int)(getCurrency() ^ (getCurrency() >>> 32))); + } + if (hasSequenceNumber()) { + hash = hash * 31 + ((int)(getSequenceNumber() ^ (getSequenceNumber() >>> 32))); + } + if (hasSourceId()) { + hash = hash * 31 + ((int)(getSourceId() ^ (getSourceId() >>> 32))); + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + @Override + public MarketMessage copyFrom(RecordInfo template) { + super.copyFrom(template); + if (template instanceof MarketMessageInfo) { + MarketMessageInfo t = (MarketMessageInfo)template; + if (t.hasOriginalTimestamp()) { + setOriginalTimestamp(t.getOriginalTimestamp()); + } else { + nullifyOriginalTimestamp(); + } + if (t.hasCurrency()) { + setCurrency(t.getCurrency()); + } else { + nullifyCurrency(); + } + if (t.hasSequenceNumber()) { + setSequenceNumber(t.getSequenceNumber()); + } else { + nullifySequenceNumber(); + } + if (t.hasSourceId()) { + setSourceId(t.getSourceId()); + } else { + nullifySourceId(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"MarketMessage\""); + if (hasOriginalTimestamp()) { + str.append(", \"originalTimestamp\": \"").append(getOriginalTimestamp()).append("\""); + } + if (hasCurrency()) { + str.append(", \"currency\": ").append(getCurrency()); + } + if (hasSequenceNumber()) { + str.append(", \"sequenceNumber\": ").append(getSequenceNumber()); + } + if (hasSourceId()) { + str.append(", \"sourceId\": ").append(getSourceId()); + } + if (hasTimeStampMs()) { + str.append(", \"timeStampMs\": \"").append(getTimeStampMs()).append("\""); + } + if (hasSymbol()) { + str.append(", \"symbol\": \"").append(getSymbol()).append("\""); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/MarketMessageInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/MarketMessageInfo.java new file mode 100644 index 000000000..342e5aab9 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/MarketMessageInfo.java @@ -0,0 +1,64 @@ +package com.epam.deltix.timebase.messages; + +/** + * Most financial market-related messages subclass this abstract class. + */ +public interface MarketMessageInfo extends MessageInfo { + /** + * Exchange Time is measured in milliseconds that passed since January 1, 1970 UTC + * @return Original Timestamp + */ + long getOriginalTimestamp(); + + /** + * Exchange Time is measured in milliseconds that passed since January 1, 1970 UTC + * @return true if Original Timestamp is not null + */ + boolean hasOriginalTimestamp(); + + /** + * Identifies currency in which quantity is denominated (for currencies this must be base or term currency) + * using 'alphanumeric' encoding + * @return Currency + */ + long getCurrency(); + + /** + * Identifies currency in which quantity is denominated (for currencies this must be base or term currency) + * using 'alphanumeric' encoding + * @return true if Currency is not null + */ + boolean hasCurrency(); + + /** + * Market specific identifier of the given event in a sequence of market events. + * @return Sequence Number + */ + long getSequenceNumber(); + + /** + * Market specific identifier of the given event in a sequence of market events. + * @return true if Sequence Number is not null + */ + boolean hasSequenceNumber(); + + /** + * Identifies market data source. Different sessions of same connector + * to a same data provider should have different id. + * @return Source Id + */ + long getSourceId(); + + /** + * Identifies market data source. Different sessions of same connector + * to a same data provider should have different id. + * @return true if Source Id is not null + */ + boolean hasSourceId(); + + /** + * Method copies state to a given instance + */ + @Override + MarketMessageInfo clone(); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/MarketMessageInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/MarketMessageInterface.java new file mode 100644 index 000000000..25469f6ea --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/MarketMessageInterface.java @@ -0,0 +1,69 @@ +package com.epam.deltix.timebase.messages; + +/** + * Most financial market-related messages subclass this abstract class. + */ +public interface MarketMessageInterface extends MarketMessageInfo, MessageInterface { + /** + * Exchange Time is measured in milliseconds that passed since January 1, 1970 UTC + * @param value - Original Timestamp + */ + void setOriginalTimestamp(long value); + + /** + * Exchange Time is measured in milliseconds that passed since January 1, 1970 UTC + */ + void nullifyOriginalTimestamp(); + + /** + * Identifies currency in which quantity is denominated (for currencies this must be base or term currency) + * using 'alphanumeric' encoding + * @param value - Currency + */ + void setCurrency(long value); + + /** + * Identifies currency in which quantity is denominated (for currencies this must be base or term currency) + * using 'alphanumeric' encoding + */ + void nullifyCurrency(); + + /** + * Market specific identifier of the given event in a sequence of market events. + * @param value - Sequence Number + */ + void setSequenceNumber(long value); + + /** + * Market specific identifier of the given event in a sequence of market events. + */ + void nullifySequenceNumber(); + + /** + * Identifies market data source. Different sessions of same connector + * to a same data provider should have different id. + * @param value - Source Id + */ + void setSourceId(long value); + + /** + * Identifies market data source. Different sessions of same connector + * to a same data provider should have different id. + */ + void nullifySourceId(); + + /** + * Method nullifies all instance properties + */ + @Override + MarketMessageInterface nullify(); + + /** + * Resets all instance properties to their default values + */ + @Override + MarketMessageInterface reset(); + + @Override + MarketMessageInterface copyFrom(RecordInfo template); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/MessageInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/MessageInfo.java index a9e71b2ff..6fe4df0a7 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/MessageInfo.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/MessageInfo.java @@ -1,24 +1,5 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages; -import java.lang.CharSequence; -import java.lang.Override; - /** * Base class for all messages that could be written in Timebase. */ @@ -72,4 +53,4 @@ public interface MessageInfo extends RecordInfo { */ @Override MessageInfo clone(); -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/MessageInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/MessageInterface.java index d62148f2e..a27b76192 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/MessageInterface.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/MessageInterface.java @@ -1,24 +1,5 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages; -import java.lang.CharSequence; -import java.lang.Override; - /** * Base class for all messages that could be written in Timebase. */ @@ -78,4 +59,4 @@ public interface MessageInterface extends MessageInfo, RecordInterface { @Override MessageInterface copyFrom(RecordInfo template); -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/OldElementName.java b/messages/src/main/java/com/epam/deltix/timebase/messages/OldElementName.java index 25b92a0ca..4699802fe 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/OldElementName.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/OldElementName.java @@ -1,22 +1,5 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages; -import java.lang.String; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -28,4 +11,4 @@ ) public @interface OldElementName { String value(); -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/PrimaryKey.java b/messages/src/main/java/com/epam/deltix/timebase/messages/PrimaryKey.java index 67e820f83..4a7ead76c 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/PrimaryKey.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/PrimaryKey.java @@ -1,19 +1,3 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages; import java.lang.annotation.ElementType; @@ -26,4 +10,4 @@ ElementType.METHOD, ElementType.FIELD} ) public @interface PrimaryKey { -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/RelativeTo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/RelativeTo.java index 257f981e0..e4c7e86d2 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/RelativeTo.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/RelativeTo.java @@ -1,22 +1,5 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages; -import java.lang.String; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -24,8 +7,8 @@ @Retention(RetentionPolicy.RUNTIME) @Target( { - ElementType.TYPE, ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD} + ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE} ) public @interface RelativeTo { String value(); -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaArrayType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaArrayType.java index 87af5b82b..f6f2b1bfb 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaArrayType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaArrayType.java @@ -1,23 +1,5 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages; -import java.lang.Class; -import java.lang.String; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -43,4 +25,4 @@ Class[] elementTypes() default { } ; -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaDataType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaDataType.java index e14431a51..f1e9f6430 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaDataType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaDataType.java @@ -1,19 +1,3 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages; /** @@ -130,4 +114,4 @@ public static SchemaDataType strictValueOf(int number) { } return value; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaElement.java b/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaElement.java index 08f95f960..bdcfb39f9 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaElement.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaElement.java @@ -1,22 +1,5 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages; -import java.lang.String; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -32,4 +15,4 @@ String title() default ""; String description() default ""; -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaGuid.java b/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaGuid.java index 48fd4d5c1..16a2f3c2f 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaGuid.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaGuid.java @@ -1,22 +1,5 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages; -import java.lang.String; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -28,4 +11,4 @@ ) public @interface SchemaGuid { String value(); -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaIgnore.java b/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaIgnore.java index aac18c5ee..e0edbcb59 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaIgnore.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaIgnore.java @@ -1,19 +1,3 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages; import java.lang.annotation.ElementType; @@ -26,4 +10,4 @@ ElementType.TYPE, ElementType.METHOD, ElementType.FIELD} ) public @interface SchemaIgnore { -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaStaticType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaStaticType.java index fd0c73c3e..627e5120c 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaStaticType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaStaticType.java @@ -1,22 +1,5 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages; -import java.lang.String; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -30,4 +13,4 @@ String value(); SchemaDataType dataType() default SchemaDataType.DEFAULT; -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaType.java index a76e4b270..9bb69d3f9 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/SchemaType.java @@ -1,23 +1,5 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages; -import java.lang.Class; -import java.lang.String; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -41,4 +23,4 @@ Class[] nestedTypes() default { } ; -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/TypeConstants.java b/messages/src/main/java/com/epam/deltix/timebase/messages/TypeConstants.java index 38c920d7c..dab557a99 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/TypeConstants.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/TypeConstants.java @@ -1,24 +1,7 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages; import com.epam.deltix.dfp.Decimal; import com.epam.deltix.dfp.Decimal64Utils; -import java.lang.String; /** */ @@ -125,4 +108,4 @@ public class TypeConstants { /** */ public static final long ALPHANUMERIC_NULL = Long.MIN_VALUE; -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/qql/Argument.java b/messages/src/main/java/com/epam/deltix/timebase/messages/qql/Argument.java new file mode 100644 index 000000000..be3c9bd38 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/qql/Argument.java @@ -0,0 +1,229 @@ +package com.epam.deltix.timebase.messages.qql; + +import com.epam.deltix.containers.BinaryAsciiString; +import com.epam.deltix.containers.CharSequenceUtils; +import com.epam.deltix.containers.MutableString; +import com.epam.deltix.timebase.messages.*; +import com.epam.deltix.timebase.messages.schema.FieldType; + +/** + * Describes QQL function argument + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.qql.Argument", + title = "Argument" +) +public class Argument implements RecordInterface { + public static final String CLASS_NAME = Argument.class.getName(); + + /** + * Argument name + */ + protected CharSequence name = null; + + /** + * Data type + */ + protected FieldType dataType = null; + + /** + * Argument name + * @return Name + */ + @SchemaElement + @SchemaType( + isNullable = false + ) + public CharSequence getName() { + return name; + } + + /** + * Argument name + * @param value - Name + */ + public void setName(CharSequence value) { + this.name = value; + } + + /** + * Argument name + * @return true if Name is not null + */ + public boolean hasName() { + return name != null; + } + + /** + * Argument name + */ + public void nullifyName() { + this.name = null; + } + + /** + * Data type + * @return Data Type + */ + @SchemaElement + @SchemaType( + isNullable = false, + dataType = SchemaDataType.OBJECT, + nestedTypes = { + FieldType.class} + + ) + public FieldType getDataType() { + return dataType; + } + + /** + * Data type + * @param value - Data Type + */ + public void setDataType(FieldType value) { + this.dataType = value; + } + + /** + * Data type + * @return true if Data Type is not null + */ + public boolean hasDataType() { + return dataType != null; + } + + /** + * Data type + */ + public void nullifyDataType() { + this.dataType = null; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + protected Argument createInstance() { + return new Argument(); + } + + /** + * Method nullifies all instance properties + */ + public Argument nullify() { + nullifyName(); + nullifyDataType(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + public Argument reset() { + name = null; + dataType = null; + return this; + } + + /** + * Method copies state to a given instance + */ + public Argument clone() { + Argument t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (!(obj instanceof Argument)) return false; + Argument other =(Argument)obj; + if (hasName() != other.hasName()) return false; + if (hasName()) { + if (getName().length() != other.getName().length()) return false; else { + CharSequence s1 = getName(); + CharSequence s2 = other.getName(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } + if (hasDataType() != other.hasDataType()) return false; + if (hasDataType() && !(getDataType().equals(other.getDataType()))) return false; + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = 0; + if (hasName()) { + hash = hash * 31 + getName().hashCode(); + } + if (hasDataType()) { + hash = hash * 31 + getDataType().hashCode(); + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + public Argument copyFrom(RecordInfo template) { + if (template instanceof Argument) { + Argument t = (Argument)template; + if (t.hasName()) { + if (hasName() && getName() instanceof StringBuilder) { + ((StringBuilder)getName()).setLength(0); + } else { + setName(new StringBuilder()); + } + ((StringBuilder)getName()).append(t.getName()); + } else { + nullifyName(); + } + if (t.hasDataType()) { + t.setDataType((FieldType) getDataType().clone()); + } else { + nullifyDataType(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"Argument\""); + if (hasName()) { + str.append(", \"name\": \"").append(getName()).append("\""); + } + if (hasDataType()) { + str.append(", \"dataType\": "); + getDataType().toString(str); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/qql/InitArgument.java b/messages/src/main/java/com/epam/deltix/timebase/messages/qql/InitArgument.java new file mode 100644 index 000000000..124508e67 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/qql/InitArgument.java @@ -0,0 +1,181 @@ +package com.epam.deltix.timebase.messages.qql; + +import com.epam.deltix.containers.BinaryAsciiString; +import com.epam.deltix.containers.CharSequenceUtils; +import com.epam.deltix.containers.MutableString; +import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.RecordInterface; +import com.epam.deltix.timebase.messages.SchemaElement; +import com.epam.deltix.timebase.messages.SchemaType; + +/** + * Describes QQL function init argument + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.qql.InitArgument", + title = "InitArgument" +) +public class InitArgument extends Argument implements RecordInterface { + public static final String CLASS_NAME = InitArgument.class.getName(); + + /** + */ + protected CharSequence defaultValue = null; + + /** + * @return Default Value + */ + @SchemaElement + @SchemaType + public CharSequence getDefaultValue() { + return defaultValue; + } + + /** + * @param value - Default Value + */ + public void setDefaultValue(CharSequence value) { + this.defaultValue = value; + } + + /** + * @return true if Default Value is not null + */ + public boolean hasDefaultValue() { + return defaultValue != null; + } + + /** + */ + public void nullifyDefaultValue() { + this.defaultValue = null; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + @Override + protected InitArgument createInstance() { + return new InitArgument(); + } + + /** + * Method nullifies all instance properties + */ + @Override + public InitArgument nullify() { + super.nullify(); + nullifyDefaultValue(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + @Override + public InitArgument reset() { + super.reset(); + defaultValue = null; + return this; + } + + /** + * Method copies state to a given instance + */ + @Override + public InitArgument clone() { + InitArgument t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + boolean superEquals = super.equals(obj); + if (!superEquals) return false; + if (!(obj instanceof InitArgument)) return false; + InitArgument other =(InitArgument)obj; + if (hasDefaultValue() != other.hasDefaultValue()) return false; + if (hasDefaultValue()) { + if (getDefaultValue().length() != other.getDefaultValue().length()) return false; else { + CharSequence s1 = getDefaultValue(); + CharSequence s2 = other.getDefaultValue(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = super.hashCode(); + if (hasDefaultValue()) { + hash = hash * 31 + getDefaultValue().hashCode(); + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + @Override + public InitArgument copyFrom(RecordInfo template) { + super.copyFrom(template); + if (template instanceof InitArgument) { + InitArgument t = (InitArgument)template; + if (t.hasDefaultValue()) { + if (hasDefaultValue() && getDefaultValue() instanceof StringBuilder) { + ((StringBuilder)getDefaultValue()).setLength(0); + } else { + setDefaultValue(new StringBuilder()); + } + ((StringBuilder)getDefaultValue()).append(t.getDefaultValue()); + } else { + nullifyDefaultValue(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"InitArgument\""); + if (hasDefaultValue()) { + str.append(", \"defaultValue\": \"").append(getDefaultValue()).append("\""); + } + if (hasName()) { + str.append(", \"name\": \"").append(getName()).append("\""); + } + if (hasDataType()) { + str.append(", \"dataType\": "); + getDataType().toString(str); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/qql/StatefulFunctionMessage.java b/messages/src/main/java/com/epam/deltix/timebase/messages/qql/StatefulFunctionMessage.java new file mode 100644 index 000000000..a8f69a544 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/qql/StatefulFunctionMessage.java @@ -0,0 +1,407 @@ +package com.epam.deltix.timebase.messages.qql; + +import com.epam.deltix.containers.BinaryAsciiString; +import com.epam.deltix.containers.CharSequenceUtils; +import com.epam.deltix.containers.MutableString; +import com.epam.deltix.timebase.messages.*; +import com.epam.deltix.timebase.messages.schema.FieldType; +import com.epam.deltix.util.collections.generated.ObjectArrayList; + +/** + * Message that describes QQL stateful function + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.qql.StatefulFunctionMessage", + title = "StatefulFunctionMessage" +) +public class StatefulFunctionMessage extends InstrumentMessage implements RecordInterface { + public static final String CLASS_NAME = StatefulFunctionMessage.class.getName(); + + /** + * Function identifier + */ + protected CharSequence id = null; + + /** + */ + protected ObjectArrayList initArguments = null; + + /** + */ + protected ObjectArrayList arguments = null; + + /** + */ + protected FieldType returnType = null; + + /** + * Function identifier + * @return Id + */ + @SchemaElement + @SchemaType( + isNullable = false + ) + public CharSequence getId() { + return id; + } + + /** + * Function identifier + * @param value - Id + */ + public void setId(CharSequence value) { + this.id = value; + } + + /** + * Function identifier + * @return true if Id is not null + */ + public boolean hasId() { + return id != null; + } + + /** + * Function identifier + */ + public void nullifyId() { + this.id = null; + } + + /** + * @return Init Arguments + */ + @SchemaElement + @SchemaArrayType( + isNullable = false, + isElementNullable = false, + elementTypes = { + InitArgument.class} + + ) + public ObjectArrayList getInitArguments() { + return initArguments; + } + + /** + * @param value - Init Arguments + */ + public void setInitArguments(ObjectArrayList value) { + this.initArguments = value; + } + + /** + * @return true if Init Arguments is not null + */ + public boolean hasInitArguments() { + return initArguments != null; + } + + /** + */ + public void nullifyInitArguments() { + this.initArguments = null; + } + + /** + * @return Arguments + */ + @SchemaElement + @SchemaArrayType( + isNullable = false, + isElementNullable = false, + elementTypes = { + Argument.class} + + ) + public ObjectArrayList getArguments() { + return arguments; + } + + /** + * @param value - Arguments + */ + public void setArguments(ObjectArrayList value) { + this.arguments = value; + } + + /** + * @return true if Arguments is not null + */ + public boolean hasArguments() { + return arguments != null; + } + + /** + */ + public void nullifyArguments() { + this.arguments = null; + } + + /** + * @return Return Type + */ + @SchemaElement + @SchemaType( + isNullable = false, + dataType = SchemaDataType.OBJECT, + nestedTypes = { + FieldType.class} + + ) + public FieldType getReturnType() { + return returnType; + } + + /** + * @param value - Return Type + */ + public void setReturnType(FieldType value) { + this.returnType = value; + } + + /** + * @return true if Return Type is not null + */ + public boolean hasReturnType() { + return returnType != null; + } + + /** + */ + public void nullifyReturnType() { + this.returnType = null; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + @Override + protected StatefulFunctionMessage createInstance() { + return new StatefulFunctionMessage(); + } + + /** + * Method nullifies all instance properties + */ + @Override + public StatefulFunctionMessage nullify() { + super.nullify(); + nullifyId(); + nullifyInitArguments(); + nullifyArguments(); + nullifyReturnType(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + @Override + public StatefulFunctionMessage reset() { + super.reset(); + id = null; + initArguments = null; + arguments = null; + returnType = null; + return this; + } + + /** + * Method copies state to a given instance + */ + @Override + public StatefulFunctionMessage clone() { + StatefulFunctionMessage t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + boolean superEquals = super.equals(obj); + if (!superEquals) return false; + if (!(obj instanceof StatefulFunctionMessage)) return false; + StatefulFunctionMessage other =(StatefulFunctionMessage)obj; + if (hasId() != other.hasId()) return false; + if (hasId()) { + if (getId().length() != other.getId().length()) return false; else { + CharSequence s1 = getId(); + CharSequence s2 = other.getId(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } + if (hasInitArguments() != other.hasInitArguments()) return false; + if (hasInitArguments()) { + if (getInitArguments().size() != other.getInitArguments().size()) return false; + else for (int j = 0; j < getInitArguments().size(); ++j) { + if ((getInitArguments().get(j) != null) != (other.getInitArguments().get(j) != null)) return false; + if (getInitArguments().get(j) != null && !getInitArguments().get(j).equals(other.getInitArguments().get(j))) return false; + } + } + if (hasArguments() != other.hasArguments()) return false; + if (hasArguments()) { + if (getArguments().size() != other.getArguments().size()) return false; + else for (int j = 0; j < getArguments().size(); ++j) { + if ((getArguments().get(j) != null) != (other.getArguments().get(j) != null)) return false; + if (getArguments().get(j) != null && !getArguments().get(j).equals(other.getArguments().get(j))) return false; + } + } + if (hasReturnType() != other.hasReturnType()) return false; + if (hasReturnType() && !(getReturnType().equals(other.getReturnType()))) return false; + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = super.hashCode(); + if (hasId()) { + hash = hash * 31 + getId().hashCode(); + } + if (hasInitArguments()) { + for (int j = 0; j < getInitArguments().size(); ++j) { + hash ^= getInitArguments().get(j).hashCode(); + } + } + if (hasArguments()) { + for (int j = 0; j < getArguments().size(); ++j) { + hash ^= getArguments().get(j).hashCode(); + } + } + if (hasReturnType()) { + hash = hash * 31 + getReturnType().hashCode(); + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + @Override + public StatefulFunctionMessage copyFrom(RecordInfo template) { + super.copyFrom(template); + if (template instanceof StatefulFunctionMessage) { + StatefulFunctionMessage t = (StatefulFunctionMessage)template; + if (t.hasId()) { + if (hasId() && getId() instanceof StringBuilder) { + ((StringBuilder)getId()).setLength(0); + } else { + setId(new StringBuilder()); + } + ((StringBuilder)getId()).append(t.getId()); + } else { + nullifyId(); + } + if (t.hasInitArguments()) { + if (!hasInitArguments()) { + setInitArguments(new ObjectArrayList(t.getInitArguments().size())); + } else { + getInitArguments().clear(); + } + for (int i = 0; i < t.getInitArguments().size(); ++i) ((ObjectArrayList)getInitArguments()).add((InitArgument)t.getInitArguments().get(i).clone()); + } else { + nullifyInitArguments(); + } + if (t.hasArguments()) { + if (!hasArguments()) { + setArguments(new ObjectArrayList(t.getArguments().size())); + } else { + getArguments().clear(); + } + for (int i = 0; i < t.getArguments().size(); ++i) ((ObjectArrayList)getArguments()).add((Argument)t.getArguments().get(i).clone()); + } else { + nullifyArguments(); + } + if (t.hasReturnType()) { + t.setReturnType((FieldType) getReturnType().clone()); + } else { + nullifyReturnType(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"StatefulFunctionMessage\""); + if (hasId()) { + str.append(", \"id\": \"").append(getId()).append("\""); + } + if (hasInitArguments()) { + str.append(", \"initArguments\": ["); + if (getInitArguments().size() > 0) { + if (getInitArguments().get(0) == null) { + str.append("null"); + } else { + getInitArguments().get(0).toString(str); + } + } + for (int i = 1; i < getInitArguments().size(); ++i) { + str.append(", "); + if (getInitArguments().get(i) == null) { + str.append("null"); + } else { + getInitArguments().get(i).toString(str); + } + } + str.append("]"); + } + if (hasArguments()) { + str.append(", \"arguments\": ["); + if (getArguments().size() > 0) { + if (getArguments().get(0) == null) { + str.append("null"); + } else { + getArguments().get(0).toString(str); + } + } + for (int i = 1; i < getArguments().size(); ++i) { + str.append(", "); + if (getArguments().get(i) == null) { + str.append("null"); + } else { + getArguments().get(i).toString(str); + } + } + str.append("]"); + } + if (hasReturnType()) { + str.append(", \"returnType\": "); + getReturnType().toString(str); + } + if (hasTimeStampMs()) { + str.append(", \"timeStampMs\": \"").append(getTimeStampMs()).append("\""); + } + if (hasSymbol()) { + str.append(", \"symbol\": \"").append(getSymbol()).append("\""); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/qql/StatelessFunctionMessage.java b/messages/src/main/java/com/epam/deltix/timebase/messages/qql/StatelessFunctionMessage.java new file mode 100644 index 000000000..40083ea1c --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/qql/StatelessFunctionMessage.java @@ -0,0 +1,324 @@ +package com.epam.deltix.timebase.messages.qql; + +import com.epam.deltix.containers.BinaryAsciiString; +import com.epam.deltix.containers.CharSequenceUtils; +import com.epam.deltix.containers.MutableString; +import com.epam.deltix.timebase.messages.*; +import com.epam.deltix.timebase.messages.schema.FieldType; +import com.epam.deltix.util.collections.generated.ObjectArrayList; + +/** + * Message that describes QQL stateless function + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.qql.StatelessFunctionMessage", + title = "StatelessFunctionMessage" +) +public class StatelessFunctionMessage extends InstrumentMessage implements RecordInterface { + public static final String CLASS_NAME = StatelessFunctionMessage.class.getName(); + + /** + * Function identifier + */ + protected CharSequence id = null; + + /** + */ + protected ObjectArrayList arguments = null; + + /** + */ + protected FieldType returnType = null; + + /** + * Function identifier + * @return Id + */ + @SchemaElement + @SchemaType( + isNullable = false + ) + public CharSequence getId() { + return id; + } + + /** + * Function identifier + * @param value - Id + */ + public void setId(CharSequence value) { + this.id = value; + } + + /** + * Function identifier + * @return true if Id is not null + */ + public boolean hasId() { + return id != null; + } + + /** + * Function identifier + */ + public void nullifyId() { + this.id = null; + } + + /** + * @return Arguments + */ + @SchemaElement + @SchemaArrayType( + isNullable = false, + isElementNullable = false, + elementTypes = { + Argument.class} + + ) + public ObjectArrayList getArguments() { + return arguments; + } + + /** + * @param value - Arguments + */ + public void setArguments(ObjectArrayList value) { + this.arguments = value; + } + + /** + * @return true if Arguments is not null + */ + public boolean hasArguments() { + return arguments != null; + } + + /** + */ + public void nullifyArguments() { + this.arguments = null; + } + + /** + * @return Return Type + */ + @SchemaElement + @SchemaType( + isNullable = false, + dataType = SchemaDataType.OBJECT, + nestedTypes = { + FieldType.class} + + ) + public FieldType getReturnType() { + return returnType; + } + + /** + * @param value - Return Type + */ + public void setReturnType(FieldType value) { + this.returnType = value; + } + + /** + * @return true if Return Type is not null + */ + public boolean hasReturnType() { + return returnType != null; + } + + /** + */ + public void nullifyReturnType() { + this.returnType = null; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + @Override + protected StatelessFunctionMessage createInstance() { + return new StatelessFunctionMessage(); + } + + /** + * Method nullifies all instance properties + */ + @Override + public StatelessFunctionMessage nullify() { + super.nullify(); + nullifyId(); + nullifyArguments(); + nullifyReturnType(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + @Override + public StatelessFunctionMessage reset() { + super.reset(); + id = null; + arguments = null; + returnType = null; + return this; + } + + /** + * Method copies state to a given instance + */ + @Override + public StatelessFunctionMessage clone() { + StatelessFunctionMessage t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + boolean superEquals = super.equals(obj); + if (!superEquals) return false; + if (!(obj instanceof StatelessFunctionMessage)) return false; + StatelessFunctionMessage other =(StatelessFunctionMessage)obj; + if (hasId() != other.hasId()) return false; + if (hasId()) { + if (getId().length() != other.getId().length()) return false; else { + CharSequence s1 = getId(); + CharSequence s2 = other.getId(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } + if (hasArguments() != other.hasArguments()) return false; + if (hasArguments()) { + if (getArguments().size() != other.getArguments().size()) return false; + else for (int j = 0; j < getArguments().size(); ++j) { + if ((getArguments().get(j) != null) != (other.getArguments().get(j) != null)) return false; + if (getArguments().get(j) != null && !getArguments().get(j).equals(other.getArguments().get(j))) return false; + } + } + if (hasReturnType() != other.hasReturnType()) return false; + if (hasReturnType() && !(getReturnType().equals(other.getReturnType()))) return false; + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = super.hashCode(); + if (hasId()) { + hash = hash * 31 + getId().hashCode(); + } + if (hasArguments()) { + for (int j = 0; j < getArguments().size(); ++j) { + hash ^= getArguments().get(j).hashCode(); + } + } + if (hasReturnType()) { + hash = hash * 31 + getReturnType().hashCode(); + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + @Override + public StatelessFunctionMessage copyFrom(RecordInfo template) { + super.copyFrom(template); + if (template instanceof StatelessFunctionMessage) { + StatelessFunctionMessage t = (StatelessFunctionMessage)template; + if (t.hasId()) { + if (hasId() && getId() instanceof StringBuilder) { + ((StringBuilder)getId()).setLength(0); + } else { + setId(new StringBuilder()); + } + ((StringBuilder)getId()).append(t.getId()); + } else { + nullifyId(); + } + if (t.hasArguments()) { + if (!hasArguments()) { + setArguments(new ObjectArrayList(t.getArguments().size())); + } else { + getArguments().clear(); + } + for (int i = 0; i < t.getArguments().size(); ++i) ((ObjectArrayList)getArguments()).add((Argument)t.getArguments().get(i).clone()); + } else { + nullifyArguments(); + } + if (t.hasReturnType()) { + t.setReturnType((FieldType) getReturnType().clone()); + } else { + nullifyReturnType(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"StatelessFunctionMessage\""); + if (hasId()) { + str.append(", \"id\": \"").append(getId()).append("\""); + } + if (hasArguments()) { + str.append(", \"arguments\": ["); + if (getArguments().size() > 0) { + if (getArguments().get(0) == null) { + str.append("null"); + } else { + getArguments().get(0).toString(str); + } + } + for (int i = 1; i < getArguments().size(); ++i) { + str.append(", "); + if (getArguments().get(i) == null) { + str.append("null"); + } else { + getArguments().get(i).toString(str); + } + } + str.append("]"); + } + if (hasReturnType()) { + str.append(", \"returnType\": "); + getReturnType().toString(str); + } + if (hasTimeStampMs()) { + str.append(", \"timeStampMs\": \"").append(getTimeStampMs()).append("\""); + } + if (hasSymbol()) { + str.append(", \"symbol\": \"").append(getSymbol()).append("\""); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ArrayDataTypeInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ArrayDataTypeInfo.java deleted file mode 100644 index 22d54f4aa..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ArrayDataTypeInfo.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import java.lang.Override; - -/** - * Schema definition of array data type. - */ -public interface ArrayDataTypeInfo extends DataTypeInfo { - /** - * Array element data type. - * @return Element Type - */ - DataTypeInfo getElementType(); - - /** - * Array element data type. - * @return true if Element Type is not null - */ - boolean hasElementType(); - - /** - * Method copies state to a given instance - */ - @Override - ArrayDataTypeInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ArrayDataTypeInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ArrayDataTypeInterface.java deleted file mode 100644 index fe6a9cbb4..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ArrayDataTypeInterface.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.Override; - -/** - * Schema definition of array data type. - */ -public interface ArrayDataTypeInterface extends ArrayDataTypeInfo, DataTypeInterface { - /** - * Array element data type. - * @param value - Element Type - */ - void setElementType(DataTypeInfo value); - - /** - * Array element data type. - */ - void nullifyElementType(); - - /** - * Method nullifies all instance properties - */ - @Override - ArrayDataTypeInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - ArrayDataTypeInterface reset(); - - @Override - ArrayDataTypeInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ArrayDataType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ArrayFieldType.java similarity index 54% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/ArrayDataType.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/ArrayFieldType.java index 94963c267..a85606492 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ArrayDataType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ArrayFieldType.java @@ -1,45 +1,26 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import com.epam.deltix.timebase.messages.SchemaDataType; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; +import com.epam.deltix.timebase.messages.*; /** * Schema definition of array data type. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.ArrayDataType", - title = "ArrayDataType" + name = "com.epam.deltix.timebase.messages.schema.ArrayFieldType", + title = "ArrayFieldType" ) -public class ArrayDataType extends DataType implements ArrayDataTypeInterface { - public static final String CLASS_NAME = ArrayDataType.class.getName(); +public class ArrayFieldType extends FieldType implements RecordInterface { + public static final String CLASS_NAME = ArrayFieldType.class.getName(); /** * Array element data type. */ - protected DataTypeInfo elementType = null; + protected FieldType elementType = null; + + public ArrayFieldType() { + super(); + baseName = "ARRAY"; + } /** * Array element data type. @@ -50,10 +31,10 @@ public class ArrayDataType extends DataType implements ArrayDataTypeInterface { isNullable = false, dataType = SchemaDataType.OBJECT, nestedTypes = { - BinaryDataType.class, BooleanDataType.class, CharDataType.class, ClassDataType.class, DateTimeDataType.class, EnumDataType.class, FloatDataType.class, IntegerDataType.class, TimeOfDayDataType.class, VarcharDataType.class} + BinaryFieldType.class, BooleanFieldType.class, CharFieldType.class, ClassFieldType.class, DateTimeFieldType.class, EnumFieldType.class, FloatFieldType.class, IntegerFieldType.class, TimeOfDayFieldType.class, VarcharFieldType.class} ) - public DataTypeInfo getElementType() { + public FieldType getElementType() { return elementType; } @@ -61,7 +42,7 @@ public DataTypeInfo getElementType() { * Array element data type. * @param value - Element Type */ - public void setElementType(DataTypeInfo value) { + public void setElementType(FieldType value) { this.elementType = value; } @@ -80,20 +61,51 @@ public void nullifyElementType() { this.elementType = null; } + /** + * @return Base Name + */ + @Override + public CharSequence getBaseName() { + return baseName; + } + + /** + * @param value - Base Name + */ + @Override + public void setBaseName(CharSequence value) { + this.baseName = value; + } + + /** + * @return true if Base Name is not null + */ + @Override + public boolean hasBaseName() { + return baseName != null; + } + + /** + */ + @Override + public void nullifyBaseName() { + this.baseName = null; + } + /** * Creates new instance of this class. * @return new instance of this class. */ @Override - protected ArrayDataType createInstance() { - return new ArrayDataType(); + protected ArrayFieldType createInstance() { + return new ArrayFieldType(); } /** * Method nullifies all instance properties */ @Override - public ArrayDataType nullify() { + public ArrayFieldType nullify() { super.nullify(); nullifyElementType(); return this; @@ -103,7 +115,7 @@ public ArrayDataType nullify() { * Resets all instance properties to their default values */ @Override - public ArrayDataType reset() { + public ArrayFieldType reset() { super.reset(); elementType = null; return this; @@ -113,8 +125,8 @@ public ArrayDataType reset() { * Method copies state to a given instance */ @Override - public ArrayDataType clone() { - ArrayDataType t = createInstance(); + public ArrayFieldType clone() { + ArrayFieldType t = createInstance(); t.copyFrom(this); return t; } @@ -127,8 +139,8 @@ public boolean equals(Object obj) { if (this == obj) return true; boolean superEquals = super.equals(obj); if (!superEquals) return false; - if (!(obj instanceof ArrayDataTypeInfo)) return false; - ArrayDataTypeInfo other =(ArrayDataTypeInfo)obj; + if (!(obj instanceof ArrayFieldType)) return false; + ArrayFieldType other =(ArrayFieldType)obj; if (hasElementType() != other.hasElementType()) return false; if (hasElementType() && !(getElementType().equals(other.getElementType()))) return false; return true; @@ -151,16 +163,12 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ @Override - public ArrayDataType copyFrom(RecordInfo template) { + public ArrayFieldType copyFrom(RecordInfo template) { super.copyFrom(template); - if (template instanceof ArrayDataTypeInfo) { - ArrayDataTypeInfo t = (ArrayDataTypeInfo)template; + if (template instanceof ArrayFieldType) { + ArrayFieldType t = (ArrayFieldType)template; if (t.hasElementType()) { - if (hasElementType() && getElementType() instanceof RecordInterface) { - ((RecordInterface)getElementType()).copyFrom(t.getElementType()); - } else { - setElementType((DataTypeInfo)t.getElementType().clone()); - } + t.setElementType((FieldType) getElementType().clone()); } else { nullifyElementType(); } @@ -182,7 +190,7 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"ArrayDataType\""); + str.append("{ \"$type\": \"ArrayFieldType\""); if (hasElementType()) { str.append(", \"elementType\": "); getElementType().toString(str); @@ -193,7 +201,10 @@ public StringBuilder toString(StringBuilder str) { if (hasIsNullable()) { str.append(", \"isNullable\": ").append(isNullable()); } + if (hasBaseName()) { + str.append(", \"baseName\": \"").append(getBaseName()).append("\""); + } str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BinaryDataTypeInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BinaryDataTypeInfo.java deleted file mode 100644 index cd928bf8b..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BinaryDataTypeInfo.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import java.lang.Override; - -/** - * Schema definition of binary data type. - */ -public interface BinaryDataTypeInfo extends DataTypeInfo { - /** - * Maximum field length in bytes. - * @return Max Size - */ - int getMaxSize(); - - /** - * Maximum field length in bytes. - * @return true if Max Size is not null - */ - boolean hasMaxSize(); - - /** - * Compression level for binary data. - * @return Compression Level - */ - short getCompressionLevel(); - - /** - * Compression level for binary data. - * @return true if Compression Level is not null - */ - boolean hasCompressionLevel(); - - /** - * Method copies state to a given instance - */ - @Override - BinaryDataTypeInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BinaryDataTypeInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BinaryDataTypeInterface.java deleted file mode 100644 index a89badb42..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BinaryDataTypeInterface.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.Override; - -/** - * Schema definition of binary data type. - */ -public interface BinaryDataTypeInterface extends BinaryDataTypeInfo, DataTypeInterface { - /** - * Maximum field length in bytes. - * @param value - Max Size - */ - void setMaxSize(int value); - - /** - * Maximum field length in bytes. - */ - void nullifyMaxSize(); - - /** - * Compression level for binary data. - * @param value - Compression Level - */ - void setCompressionLevel(short value); - - /** - * Compression level for binary data. - */ - void nullifyCompressionLevel(); - - /** - * Method nullifies all instance properties - */ - @Override - BinaryDataTypeInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - BinaryDataTypeInterface reset(); - - @Override - BinaryDataTypeInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BinaryDataType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BinaryFieldType.java similarity index 64% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/BinaryDataType.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/BinaryFieldType.java index 910ec1b5a..a80715fc7 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BinaryDataType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BinaryFieldType.java @@ -1,39 +1,16 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import com.epam.deltix.timebase.messages.TypeConstants; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; +import com.epam.deltix.timebase.messages.*; /** * Schema definition of binary data type. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.BinaryDataType", - title = "BinaryDataType" + name = "com.epam.deltix.timebase.messages.schema.BinaryFieldType", + title = "BinaryFieldType" ) -public class BinaryDataType extends DataType implements BinaryDataTypeInterface { - public static final String CLASS_NAME = BinaryDataType.class.getName(); +public class BinaryFieldType extends FieldType implements RecordInterface { + public static final String CLASS_NAME = BinaryFieldType.class.getName(); /** * Maximum field length in bytes. @@ -45,6 +22,11 @@ public class BinaryDataType extends DataType implements BinaryDataTypeInterface */ protected short compressionLevel = TypeConstants.INT16_NULL; + public BinaryFieldType() { + super(); + baseName = "BINARY"; + } + /** * Maximum field length in bytes. * @return Max Size @@ -70,14 +52,14 @@ public void setMaxSize(int value) { * @return true if Max Size is not null */ public boolean hasMaxSize() { - return maxSize != com.epam.deltix.timebase.messages.TypeConstants.INT32_NULL; + return maxSize != TypeConstants.INT32_NULL; } /** * Maximum field length in bytes. */ public void nullifyMaxSize() { - this.maxSize = com.epam.deltix.timebase.messages.TypeConstants.INT32_NULL; + this.maxSize = TypeConstants.INT32_NULL; } /** @@ -107,14 +89,45 @@ public void setCompressionLevel(short value) { * @return true if Compression Level is not null */ public boolean hasCompressionLevel() { - return compressionLevel != com.epam.deltix.timebase.messages.TypeConstants.INT16_NULL; + return compressionLevel != TypeConstants.INT16_NULL; } /** * Compression level for binary data. */ public void nullifyCompressionLevel() { - this.compressionLevel = com.epam.deltix.timebase.messages.TypeConstants.INT16_NULL; + this.compressionLevel = TypeConstants.INT16_NULL; + } + + /** + * @return Base Name + */ + @Override + public CharSequence getBaseName() { + return baseName; + } + + /** + * @param value - Base Name + */ + @Override + public void setBaseName(CharSequence value) { + this.baseName = value; + } + + /** + * @return true if Base Name is not null + */ + @Override + public boolean hasBaseName() { + return baseName != null; + } + + /** + */ + @Override + public void nullifyBaseName() { + this.baseName = null; } /** @@ -122,15 +135,15 @@ public void nullifyCompressionLevel() { * @return new instance of this class. */ @Override - protected BinaryDataType createInstance() { - return new BinaryDataType(); + protected BinaryFieldType createInstance() { + return new BinaryFieldType(); } /** * Method nullifies all instance properties */ @Override - public BinaryDataType nullify() { + public BinaryFieldType nullify() { super.nullify(); nullifyMaxSize(); nullifyCompressionLevel(); @@ -141,10 +154,10 @@ public BinaryDataType nullify() { * Resets all instance properties to their default values */ @Override - public BinaryDataType reset() { + public BinaryFieldType reset() { super.reset(); - maxSize = com.epam.deltix.timebase.messages.TypeConstants.INT32_NULL; - compressionLevel = com.epam.deltix.timebase.messages.TypeConstants.INT16_NULL; + maxSize = TypeConstants.INT32_NULL; + compressionLevel = TypeConstants.INT16_NULL; return this; } @@ -152,8 +165,8 @@ public BinaryDataType reset() { * Method copies state to a given instance */ @Override - public BinaryDataType clone() { - BinaryDataType t = createInstance(); + public BinaryFieldType clone() { + BinaryFieldType t = createInstance(); t.copyFrom(this); return t; } @@ -166,8 +179,8 @@ public boolean equals(Object obj) { if (this == obj) return true; boolean superEquals = super.equals(obj); if (!superEquals) return false; - if (!(obj instanceof BinaryDataTypeInfo)) return false; - BinaryDataTypeInfo other =(BinaryDataTypeInfo)obj; + if (!(obj instanceof BinaryFieldType)) return false; + BinaryFieldType other =(BinaryFieldType)obj; if (hasMaxSize() != other.hasMaxSize()) return false; if (hasMaxSize() && getMaxSize() != other.getMaxSize()) return false; if (hasCompressionLevel() != other.hasCompressionLevel()) return false; @@ -195,10 +208,10 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ @Override - public BinaryDataType copyFrom(RecordInfo template) { + public BinaryFieldType copyFrom(RecordInfo template) { super.copyFrom(template); - if (template instanceof BinaryDataTypeInfo) { - BinaryDataTypeInfo t = (BinaryDataTypeInfo)template; + if (template instanceof BinaryFieldType) { + BinaryFieldType t = (BinaryFieldType)template; if (t.hasMaxSize()) { setMaxSize(t.getMaxSize()); } else { @@ -227,7 +240,7 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"BinaryDataType\""); + str.append("{ \"$type\": \"BinaryFieldType\""); if (hasMaxSize()) { str.append(", \"maxSize\": ").append(getMaxSize()); } @@ -240,7 +253,10 @@ public StringBuilder toString(StringBuilder str) { if (hasIsNullable()) { str.append(", \"isNullable\": ").append(isNullable()); } + if (hasBaseName()) { + str.append(", \"baseName\": \"").append(getBaseName()).append("\""); + } str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BooleanDataTypeInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BooleanDataTypeInterface.java deleted file mode 100644 index a28d67042..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BooleanDataTypeInterface.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.Override; - -/** - * Schema definition of boolean data type. - */ -public interface BooleanDataTypeInterface extends BooleanDataTypeInfo, DataTypeInterface { - /** - * Method nullifies all instance properties - */ - @Override - BooleanDataTypeInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - BooleanDataTypeInterface reset(); - - @Override - BooleanDataTypeInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BooleanDataType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BooleanFieldType.java similarity index 56% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/BooleanDataType.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/BooleanFieldType.java index a324f419c..8eea5a806 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BooleanDataType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/BooleanFieldType.java @@ -1,52 +1,69 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.RecordInterface; import com.epam.deltix.timebase.messages.SchemaElement; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; /** * Schema definition of boolean data type. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.BooleanDataType", - title = "BooleanDataType" + name = "com.epam.deltix.timebase.messages.schema.BooleanFieldType", + title = "BooleanFieldType" ) -public class BooleanDataType extends DataType implements BooleanDataTypeInterface { - public static final String CLASS_NAME = BooleanDataType.class.getName(); +public class BooleanFieldType extends FieldType implements RecordInterface { + public static final String CLASS_NAME = BooleanFieldType.class.getName(); + + public BooleanFieldType() { + super(); + baseName = "BOOLEAN"; + } + + /** + * @return Base Name + */ + @Override + public CharSequence getBaseName() { + return baseName; + } + + /** + * @param value - Base Name + */ + @Override + public void setBaseName(CharSequence value) { + this.baseName = value; + } + + /** + * @return true if Base Name is not null + */ + @Override + public boolean hasBaseName() { + return baseName != null; + } + + /** + */ + @Override + public void nullifyBaseName() { + this.baseName = null; + } /** * Creates new instance of this class. * @return new instance of this class. */ @Override - protected BooleanDataType createInstance() { - return new BooleanDataType(); + protected BooleanFieldType createInstance() { + return new BooleanFieldType(); } /** * Method nullifies all instance properties */ @Override - public BooleanDataType nullify() { + public BooleanFieldType nullify() { super.nullify(); return this; } @@ -55,7 +72,7 @@ public BooleanDataType nullify() { * Resets all instance properties to their default values */ @Override - public BooleanDataType reset() { + public BooleanFieldType reset() { super.reset(); return this; } @@ -64,8 +81,8 @@ public BooleanDataType reset() { * Method copies state to a given instance */ @Override - public BooleanDataType clone() { - BooleanDataType t = createInstance(); + public BooleanFieldType clone() { + BooleanFieldType t = createInstance(); t.copyFrom(this); return t; } @@ -78,7 +95,8 @@ public boolean equals(Object obj) { if (this == obj) return true; boolean superEquals = super.equals(obj); if (!superEquals) return false; - if (!(obj instanceof BooleanDataTypeInfo)) return false; + if (!(obj instanceof BooleanFieldType)) return false; + BooleanFieldType other =(BooleanFieldType)obj; return true; } @@ -96,8 +114,11 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ @Override - public BooleanDataType copyFrom(RecordInfo template) { + public BooleanFieldType copyFrom(RecordInfo template) { super.copyFrom(template); + if (template instanceof BooleanFieldType) { + BooleanFieldType t = (BooleanFieldType)template; + } return this; } @@ -115,14 +136,17 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"BooleanDataType\""); + str.append("{ \"$type\": \"BooleanFieldType\""); if (hasEncoding()) { str.append(", \"encoding\": \"").append(getEncoding()).append("\""); } if (hasIsNullable()) { str.append(", \"isNullable\": ").append(isNullable()); } + if (hasBaseName()) { + str.append(", \"baseName\": \"").append(getBaseName()).append("\""); + } str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/CharDataTypeInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/CharDataTypeInterface.java deleted file mode 100644 index 3a8059029..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/CharDataTypeInterface.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.Override; - -/** - * Schema definition of char data type. - */ -public interface CharDataTypeInterface extends CharDataTypeInfo, DataTypeInterface { - /** - * Method nullifies all instance properties - */ - @Override - CharDataTypeInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - CharDataTypeInterface reset(); - - @Override - CharDataTypeInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/CharDataType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/CharFieldType.java similarity index 57% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/CharDataType.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/CharFieldType.java index 99686417b..e8835830e 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/CharDataType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/CharFieldType.java @@ -1,52 +1,69 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.RecordInterface; import com.epam.deltix.timebase.messages.SchemaElement; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; /** * Schema definition of char data type. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.CharDataType", - title = "CharDataType" + name = "com.epam.deltix.timebase.messages.schema.CharFieldType", + title = "CharFieldType" ) -public class CharDataType extends DataType implements CharDataTypeInterface { - public static final String CLASS_NAME = CharDataType.class.getName(); +public class CharFieldType extends FieldType implements RecordInterface { + public static final String CLASS_NAME = CharFieldType.class.getName(); + + public CharFieldType() { + super(); + baseName = "CHAR"; + } + + /** + * @return Base Name + */ + @Override + public CharSequence getBaseName() { + return baseName; + } + + /** + * @param value - Base Name + */ + @Override + public void setBaseName(CharSequence value) { + this.baseName = value; + } + + /** + * @return true if Base Name is not null + */ + @Override + public boolean hasBaseName() { + return baseName != null; + } + + /** + */ + @Override + public void nullifyBaseName() { + this.baseName = null; + } /** * Creates new instance of this class. * @return new instance of this class. */ @Override - protected CharDataType createInstance() { - return new CharDataType(); + protected CharFieldType createInstance() { + return new CharFieldType(); } /** * Method nullifies all instance properties */ @Override - public CharDataType nullify() { + public CharFieldType nullify() { super.nullify(); return this; } @@ -55,7 +72,7 @@ public CharDataType nullify() { * Resets all instance properties to their default values */ @Override - public CharDataType reset() { + public CharFieldType reset() { super.reset(); return this; } @@ -64,8 +81,8 @@ public CharDataType reset() { * Method copies state to a given instance */ @Override - public CharDataType clone() { - CharDataType t = createInstance(); + public CharFieldType clone() { + CharFieldType t = createInstance(); t.copyFrom(this); return t; } @@ -78,7 +95,8 @@ public boolean equals(Object obj) { if (this == obj) return true; boolean superEquals = super.equals(obj); if (!superEquals) return false; - if (!(obj instanceof CharDataTypeInfo)) return false; + if (!(obj instanceof CharFieldType)) return false; + CharFieldType other =(CharFieldType)obj; return true; } @@ -96,8 +114,11 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ @Override - public CharDataType copyFrom(RecordInfo template) { + public CharFieldType copyFrom(RecordInfo template) { super.copyFrom(template); + if (template instanceof CharFieldType) { + CharFieldType t = (CharFieldType)template; + } return this; } @@ -115,14 +136,17 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"CharDataType\""); + str.append("{ \"$type\": \"CharFieldType\""); if (hasEncoding()) { str.append(", \"encoding\": \"").append(getEncoding()).append("\""); } if (hasIsNullable()) { str.append(", \"isNullable\": ").append(isNullable()); } + if (hasBaseName()) { + str.append(", \"baseName\": \"").append(getBaseName()).append("\""); + } str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDataTypeInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDataTypeInfo.java deleted file mode 100644 index 33030b552..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDataTypeInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.util.collections.generated.ObjectList; -import java.lang.Override; - -/** - * Schema definition of class data type. - */ -public interface ClassDataTypeInfo extends DataTypeInfo { - /** - * Definitions for nested schema classes. - * @return Type Descriptors - */ - ObjectList getTypeDescriptors(); - - /** - * Definitions for nested schema classes. - * @return true if Type Descriptors is not null - */ - boolean hasTypeDescriptors(); - - /** - * Method copies state to a given instance - */ - @Override - ClassDataTypeInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDataTypeInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDataTypeInterface.java deleted file mode 100644 index 3d894ccd0..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDataTypeInterface.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.util.collections.generated.ObjectArrayList; -import com.epam.deltix.util.collections.generated.ObjectArrayList; -import java.lang.Override; - -/** - * Schema definition of class data type. - */ -public interface ClassDataTypeInterface extends ClassDataTypeInfo, DataTypeInterface { - /** - * Definitions for nested schema classes. - * @param value - Type Descriptors - */ - void setTypeDescriptors(ObjectArrayList value); - - /** - * Definitions for nested schema classes. - */ - void nullifyTypeDescriptors(); - - /** - * Method nullifies all instance properties - */ - @Override - ClassDataTypeInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - ClassDataTypeInterface reset(); - - @Override - ClassDataTypeInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptorInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptorInfo.java deleted file mode 100644 index 5ffe7a165..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptorInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import java.lang.CharSequence; -import java.lang.Override; - -/** - * Schema definition for a schema node. - */ -public interface ClassDescriptorInfo extends NamedDescriptorInfo { - /** - * Optional GUID for this node. - * @return Guid - */ - CharSequence getGuid(); - - /** - * Optional GUID for this node. - * @return true if Guid is not null - */ - boolean hasGuid(); - - /** - * Method copies state to a given instance - */ - @Override - ClassDescriptorInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptorInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptorInterface.java deleted file mode 100644 index 0675fe31d..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptorInterface.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.CharSequence; -import java.lang.Override; - -/** - * Schema definition for a schema node. - */ -public interface ClassDescriptorInterface extends ClassDescriptorInfo, NamedDescriptorInterface { - /** - * Optional GUID for this node. - * @param value - Guid - */ - void setGuid(CharSequence value); - - /** - * Optional GUID for this node. - */ - void nullifyGuid(); - - /** - * Method nullifies all instance properties - */ - @Override - ClassDescriptorInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - ClassDescriptorInterface reset(); - - @Override - ClassDescriptorInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptorRefInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptorRefInfo.java deleted file mode 100644 index 061444b26..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptorRefInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.CharSequence; -import java.lang.Override; - -/** - * Schema definition for a reference to class descriptor. - */ -public interface ClassDescriptorRefInfo extends RecordInfo { - /** - * Node name. - * @return Name - */ - CharSequence getName(); - - /** - * Node name. - * @return true if Name is not null - */ - boolean hasName(); - - /** - * Method copies state to a given instance - */ - @Override - ClassDescriptorRefInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptorRefInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptorRefInterface.java deleted file mode 100644 index 4d1d55a30..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptorRefInterface.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import java.lang.CharSequence; -import java.lang.Override; - -/** - * Schema definition for a reference to class descriptor. - */ -public interface ClassDescriptorRefInterface extends ClassDescriptorRefInfo, RecordInterface { - /** - * Node name. - * @param value - Name - */ - void setName(CharSequence value); - - /** - * Node name. - */ - void nullifyName(); - - /** - * Method nullifies all instance properties - */ - @Override - ClassDescriptorRefInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - ClassDescriptorRefInterface reset(); - - @Override - ClassDescriptorRefInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDataType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassFieldType.java similarity index 67% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDataType.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassFieldType.java index 27c11c054..ee1e2cc89 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDataType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassFieldType.java @@ -1,44 +1,30 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.RecordInterface; import com.epam.deltix.timebase.messages.SchemaArrayType; import com.epam.deltix.timebase.messages.SchemaElement; import com.epam.deltix.util.collections.generated.ObjectArrayList; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; /** * Schema definition of class data type. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.ClassDataType", - title = "ClassDataType" + name = "com.epam.deltix.timebase.messages.schema.ClassFieldType", + title = "ClassFieldType" ) -public class ClassDataType extends DataType implements ClassDataTypeInterface { - public static final String CLASS_NAME = ClassDataType.class.getName(); +public class ClassFieldType extends FieldType implements RecordInterface { + public static final String CLASS_NAME = ClassFieldType.class.getName(); /** * Definitions for nested schema classes. */ - protected ObjectArrayList typeDescriptors = null; + protected ObjectArrayList typeDescriptors = null; + + public ClassFieldType() { + super(); + baseName = "OBJECT"; + } /** * Definitions for nested schema classes. @@ -49,10 +35,10 @@ public class ClassDataType extends DataType implements ClassDataTypeInterface { isNullable = false, isElementNullable = false, elementTypes = { - ClassDescriptorRef.class} + DescriptorRef.class} ) - public ObjectArrayList getTypeDescriptors() { + public ObjectArrayList getTypeDescriptors() { return typeDescriptors; } @@ -60,7 +46,7 @@ public ObjectArrayList getTypeDescriptors() { * Definitions for nested schema classes. * @param value - Type Descriptors */ - public void setTypeDescriptors(ObjectArrayList value) { + public void setTypeDescriptors(ObjectArrayList value) { this.typeDescriptors = value; } @@ -79,20 +65,51 @@ public void nullifyTypeDescriptors() { this.typeDescriptors = null; } + /** + * @return Base Name + */ + @Override + public CharSequence getBaseName() { + return baseName; + } + + /** + * @param value - Base Name + */ + @Override + public void setBaseName(CharSequence value) { + this.baseName = value; + } + + /** + * @return true if Base Name is not null + */ + @Override + public boolean hasBaseName() { + return baseName != null; + } + + /** + */ + @Override + public void nullifyBaseName() { + this.baseName = null; + } + /** * Creates new instance of this class. * @return new instance of this class. */ @Override - protected ClassDataType createInstance() { - return new ClassDataType(); + protected ClassFieldType createInstance() { + return new ClassFieldType(); } /** * Method nullifies all instance properties */ @Override - public ClassDataType nullify() { + public ClassFieldType nullify() { super.nullify(); nullifyTypeDescriptors(); return this; @@ -102,7 +119,7 @@ public ClassDataType nullify() { * Resets all instance properties to their default values */ @Override - public ClassDataType reset() { + public ClassFieldType reset() { super.reset(); typeDescriptors = null; return this; @@ -112,8 +129,8 @@ public ClassDataType reset() { * Method copies state to a given instance */ @Override - public ClassDataType clone() { - ClassDataType t = createInstance(); + public ClassFieldType clone() { + ClassFieldType t = createInstance(); t.copyFrom(this); return t; } @@ -126,8 +143,8 @@ public boolean equals(Object obj) { if (this == obj) return true; boolean superEquals = super.equals(obj); if (!superEquals) return false; - if (!(obj instanceof ClassDataTypeInfo)) return false; - ClassDataTypeInfo other =(ClassDataTypeInfo)obj; + if (!(obj instanceof ClassFieldType)) return false; + ClassFieldType other =(ClassFieldType)obj; if (hasTypeDescriptors() != other.hasTypeDescriptors()) return false; if (hasTypeDescriptors()) { if (getTypeDescriptors().size() != other.getTypeDescriptors().size()) return false; @@ -158,17 +175,17 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ @Override - public ClassDataType copyFrom(RecordInfo template) { + public ClassFieldType copyFrom(RecordInfo template) { super.copyFrom(template); - if (template instanceof ClassDataTypeInfo) { - ClassDataTypeInfo t = (ClassDataTypeInfo)template; + if (template instanceof ClassFieldType) { + ClassFieldType t = (ClassFieldType)template; if (t.hasTypeDescriptors()) { if (!hasTypeDescriptors()) { - setTypeDescriptors(new ObjectArrayList(t.getTypeDescriptors().size())); + setTypeDescriptors(new ObjectArrayList(t.getTypeDescriptors().size())); } else { getTypeDescriptors().clear(); } - for (int i = 0; i < t.getTypeDescriptors().size(); ++i) ((ObjectArrayList)getTypeDescriptors()).add((ClassDescriptorRefInfo)t.getTypeDescriptors().get(i).clone()); + for (int i = 0; i < t.getTypeDescriptors().size(); ++i) ((ObjectArrayList)getTypeDescriptors()).add((DescriptorRef)t.getTypeDescriptors().get(i).clone()); } else { nullifyTypeDescriptors(); } @@ -190,7 +207,7 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"ClassDataType\""); + str.append("{ \"$type\": \"ClassFieldType\""); if (hasTypeDescriptors()) { str.append(", \"typeDescriptors\": ["); if (getTypeDescriptors().size() > 0) { @@ -216,7 +233,10 @@ public StringBuilder toString(StringBuilder str) { if (hasIsNullable()) { str.append(", \"isNullable\": ").append(isNullable()); } + if (hasBaseName()) { + str.append(", \"baseName\": \"").append(getBaseName()).append("\""); + } str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataField.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataField.java deleted file mode 100644 index b332c02cb..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataField.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import com.epam.deltix.timebase.messages.SchemaDataType; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; -import java.lang.UnsupportedOperationException; - -/** - * This is a base class for schema data field. - */ -@SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.DataField", - title = "DataField" -) -public abstract class DataField extends NamedDescriptor implements DataFieldInterface { - public static final String CLASS_NAME = DataField.class.getName(); - - /** - * Data type of a field. - */ - protected DataTypeInfo dataType = null; - - /** - * Data type of a field. - * @return Data Type - */ - @SchemaElement - @SchemaType( - isNullable = false, - dataType = SchemaDataType.OBJECT, - nestedTypes = { - ArrayDataType.class, BinaryDataType.class, BooleanDataType.class, CharDataType.class, ClassDataType.class, DateTimeDataType.class, EnumDataType.class, FloatDataType.class, IntegerDataType.class, TimeOfDayDataType.class, VarcharDataType.class} - - ) - public DataTypeInfo getDataType() { - return dataType; - } - - /** - * Data type of a field. - * @param value - Data Type - */ - public void setDataType(DataTypeInfo value) { - this.dataType = value; - } - - /** - * Data type of a field. - * @return true if Data Type is not null - */ - public boolean hasDataType() { - return dataType != null; - } - - /** - * Data type of a field. - */ - public void nullifyDataType() { - this.dataType = null; - } - - /** - * Creates new instance of this class. - * @return new instance of this class. - */ - @Override - protected DataField createInstance() { - throw new UnsupportedOperationException(); - } - - /** - * Method nullifies all instance properties - */ - @Override - public DataField nullify() { - super.nullify(); - nullifyDataType(); - return this; - } - - /** - * Resets all instance properties to their default values - */ - @Override - public DataField reset() { - super.reset(); - dataType = null; - return this; - } - - /** - * Method copies state to a given instance - */ - @Override - public DataField clone() { - DataField t = createInstance(); - t.copyFrom(this); - return t; - } - - /** - * Indicates whether some other object is "equal to" this one. - */ - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - boolean superEquals = super.equals(obj); - if (!superEquals) return false; - if (!(obj instanceof DataFieldInfo)) return false; - DataFieldInfo other =(DataFieldInfo)obj; - if (hasDataType() != other.hasDataType()) return false; - if (hasDataType() && !(getDataType().equals(other.getDataType()))) return false; - return true; - } - - /** - * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. - */ - @Override - public int hashCode() { - int hash = super.hashCode(); - if (hasDataType()) { - hash = hash * 31 + getDataType().hashCode(); - } - return hash; - } - - /** - * Method copies state to a given instance - * @param template class instance that should be used as a copy source - */ - @Override - public DataField copyFrom(RecordInfo template) { - super.copyFrom(template); - if (template instanceof DataFieldInfo) { - DataFieldInfo t = (DataFieldInfo)template; - if (t.hasDataType()) { - if (hasDataType() && getDataType() instanceof RecordInterface) { - ((RecordInterface)getDataType()).copyFrom(t.getDataType()); - } else { - setDataType((DataTypeInfo)t.getDataType().clone()); - } - } else { - nullifyDataType(); - } - } - return this; - } - - /** - * @return a string representation of this class object. - */ - @Override - public String toString() { - StringBuilder str = new StringBuilder(); - return toString(str).toString(); - } - - /** - * @return a string representation of this class object. - */ - @Override - public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"DataField\""); - if (hasDataType()) { - str.append(", \"dataType\": "); - getDataType().toString(str); - } - if (hasName()) { - str.append(", \"name\": \"").append(getName()).append("\""); - } - if (hasTitle()) { - str.append(", \"title\": \"").append(getTitle()).append("\""); - } - if (hasDescription()) { - str.append(", \"description\": \"").append(getDescription()).append("\""); - } - str.append("}"); - return str; - } -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataFieldInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataFieldInfo.java deleted file mode 100644 index 8db83f1e9..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataFieldInfo.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import java.lang.Override; - -/** - * This is a base class for schema data field. - */ -public interface DataFieldInfo extends NamedDescriptorInfo { - /** - * Data type of a field. - * @return Data Type - */ - DataTypeInfo getDataType(); - - /** - * Data type of a field. - * @return true if Data Type is not null - */ - boolean hasDataType(); - - /** - * Method copies state to a given instance - */ - @Override - DataFieldInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataFieldInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataFieldInterface.java deleted file mode 100644 index 183a52375..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataFieldInterface.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.Override; - -/** - * This is a base class for schema data field. - */ -public interface DataFieldInterface extends DataFieldInfo, NamedDescriptorInterface { - /** - * Data type of a field. - * @param value - Data Type - */ - void setDataType(DataTypeInfo value); - - /** - * Data type of a field. - */ - void nullifyDataType(); - - /** - * Method nullifies all instance properties - */ - @Override - DataFieldInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - DataFieldInterface reset(); - - @Override - DataFieldInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataTypeInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataTypeInfo.java deleted file mode 100644 index 5550b1988..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataTypeInfo.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.CharSequence; -import java.lang.Override; - -/** - * This is a base class for schema data types. - */ -public interface DataTypeInfo extends RecordInfo { - /** - * Binary representation (encoding) of a field in database and protocol. - * @return Encoding - */ - CharSequence getEncoding(); - - /** - * Binary representation (encoding) of a field in database and protocol. - * @return true if Encoding is not null - */ - boolean hasEncoding(); - - /** - * True, if schema design allows the field to be nullable. - * @return Is Nullable - */ - boolean isNullable(); - - /** - * True, if schema design allows the field to be nullable. - * @return true if Is Nullable is not null - */ - boolean hasIsNullable(); - - /** - * Method copies state to a given instance - */ - @Override - DataTypeInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataTypeInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataTypeInterface.java deleted file mode 100644 index 63b2ad929..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataTypeInterface.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import java.lang.CharSequence; -import java.lang.Override; - -/** - * This is a base class for schema data types. - */ -public interface DataTypeInterface extends DataTypeInfo, RecordInterface { - /** - * Binary representation (encoding) of a field in database and protocol. - * @param value - Encoding - */ - void setEncoding(CharSequence value); - - /** - * Binary representation (encoding) of a field in database and protocol. - */ - void nullifyEncoding(); - - /** - * True, if schema design allows the field to be nullable. - * @param value - Is Nullable - */ - void setIsNullable(boolean value); - - /** - * True, if schema design allows the field to be nullable. - */ - void nullifyIsNullable(); - - /** - * Method nullifies all instance properties - */ - @Override - DataTypeInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - DataTypeInterface reset(); - - @Override - DataTypeInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DateTimeDataTypeInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DateTimeDataTypeInterface.java deleted file mode 100644 index f17b5a81d..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DateTimeDataTypeInterface.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.Override; - -/** - * Schema definition of date-time data type. - */ -public interface DateTimeDataTypeInterface extends DateTimeDataTypeInfo, DataTypeInterface { - /** - * Method nullifies all instance properties - */ - @Override - DateTimeDataTypeInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - DateTimeDataTypeInterface reset(); - - @Override - DateTimeDataTypeInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DateTimeDataType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DateTimeFieldType.java similarity index 55% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/DateTimeDataType.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/DateTimeFieldType.java index ebdb1bf62..f0ea8925d 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DateTimeDataType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DateTimeFieldType.java @@ -1,52 +1,69 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.RecordInterface; import com.epam.deltix.timebase.messages.SchemaElement; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; /** * Schema definition of date-time data type. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.DateTimeDataType", - title = "DateTimeDataType" + name = "com.epam.deltix.timebase.messages.schema.DateTimeFieldType", + title = "DateTimeFieldType" ) -public class DateTimeDataType extends DataType implements DateTimeDataTypeInterface { - public static final String CLASS_NAME = DateTimeDataType.class.getName(); +public class DateTimeFieldType extends FieldType implements RecordInterface { + public static final String CLASS_NAME = DateTimeFieldType.class.getName(); + + public DateTimeFieldType() { + super(); + baseName = "TIMESTAMP"; + } + + /** + * @return Base Name + */ + @Override + public CharSequence getBaseName() { + return baseName; + } + + /** + * @param value - Base Name + */ + @Override + public void setBaseName(CharSequence value) { + this.baseName = value; + } + + /** + * @return true if Base Name is not null + */ + @Override + public boolean hasBaseName() { + return baseName != null; + } + + /** + */ + @Override + public void nullifyBaseName() { + this.baseName = null; + } /** * Creates new instance of this class. * @return new instance of this class. */ @Override - protected DateTimeDataType createInstance() { - return new DateTimeDataType(); + protected DateTimeFieldType createInstance() { + return new DateTimeFieldType(); } /** * Method nullifies all instance properties */ @Override - public DateTimeDataType nullify() { + public DateTimeFieldType nullify() { super.nullify(); return this; } @@ -55,7 +72,7 @@ public DateTimeDataType nullify() { * Resets all instance properties to their default values */ @Override - public DateTimeDataType reset() { + public DateTimeFieldType reset() { super.reset(); return this; } @@ -64,8 +81,8 @@ public DateTimeDataType reset() { * Method copies state to a given instance */ @Override - public DateTimeDataType clone() { - DateTimeDataType t = createInstance(); + public DateTimeFieldType clone() { + DateTimeFieldType t = createInstance(); t.copyFrom(this); return t; } @@ -78,7 +95,8 @@ public boolean equals(Object obj) { if (this == obj) return true; boolean superEquals = super.equals(obj); if (!superEquals) return false; - if (!(obj instanceof DateTimeDataTypeInfo)) return false; + if (!(obj instanceof DateTimeFieldType)) return false; + DateTimeFieldType other =(DateTimeFieldType)obj; return true; } @@ -96,8 +114,11 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ @Override - public DateTimeDataType copyFrom(RecordInfo template) { + public DateTimeFieldType copyFrom(RecordInfo template) { super.copyFrom(template); + if (template instanceof DateTimeFieldType) { + DateTimeFieldType t = (DateTimeFieldType)template; + } return this; } @@ -115,14 +136,17 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"DateTimeDataType\""); + str.append("{ \"$type\": \"DateTimeFieldType\""); if (hasEncoding()) { str.append(", \"encoding\": \"").append(getEncoding()).append("\""); } if (hasIsNullable()) { str.append(", \"isNullable\": ").append(isNullable()); } + if (hasBaseName()) { + str.append(", \"baseName\": \"").append(getBaseName()).append("\""); + } str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NamedDescriptor.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/Descriptor.java similarity index 80% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/NamedDescriptor.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/Descriptor.java index 4d3d5c074..ceddab22a 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NamedDescriptor.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/Descriptor.java @@ -1,43 +1,22 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import java.lang.CharSequence; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; -import java.lang.UnsupportedOperationException; import com.epam.deltix.containers.BinaryAsciiString; import com.epam.deltix.containers.CharSequenceUtils; import com.epam.deltix.containers.MutableString; +import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.RecordInterface; +import com.epam.deltix.timebase.messages.SchemaElement; +import com.epam.deltix.timebase.messages.SchemaType; /** * This is a base class for schema nodes. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.NamedDescriptor", - title = "NamedDescriptor" + name = "com.epam.deltix.timebase.messages.schema.Descriptor", + title = "Descriptor" ) -public abstract class NamedDescriptor implements NamedDescriptorInterface { - public static final String CLASS_NAME = NamedDescriptor.class.getName(); +public abstract class Descriptor implements RecordInterface { + public static final String CLASS_NAME = Descriptor.class.getName(); /** * Node name. @@ -163,14 +142,14 @@ public void nullifyDescription() { * Creates new instance of this class. * @return new instance of this class. */ - protected NamedDescriptor createInstance() { + protected Descriptor createInstance() { throw new UnsupportedOperationException(); } /** * Method nullifies all instance properties */ - public NamedDescriptor nullify() { + public Descriptor nullify() { nullifyName(); nullifyTitle(); nullifyDescription(); @@ -180,7 +159,7 @@ public NamedDescriptor nullify() { /** * Resets all instance properties to their default values */ - public NamedDescriptor reset() { + public Descriptor reset() { name = null; title = null; description = null; @@ -190,8 +169,8 @@ public NamedDescriptor reset() { /** * Method copies state to a given instance */ - public NamedDescriptor clone() { - NamedDescriptor t = createInstance(); + public Descriptor clone() { + Descriptor t = createInstance(); t.copyFrom(this); return t; } @@ -202,8 +181,8 @@ public NamedDescriptor clone() { @Override public boolean equals(Object obj) { if (this == obj) return true; - if (!(obj instanceof NamedDescriptorInfo)) return false; - NamedDescriptorInfo other =(NamedDescriptorInfo)obj; + if (!(obj instanceof Descriptor)) return false; + Descriptor other =(Descriptor)obj; if (hasName() != other.hasName()) return false; if (hasName()) { if (getName().length() != other.getName().length()) return false; else { @@ -265,9 +244,9 @@ public int hashCode() { * Method copies state to a given instance * @param template class instance that should be used as a copy source */ - public NamedDescriptor copyFrom(RecordInfo template) { - if (template instanceof NamedDescriptorInfo) { - NamedDescriptorInfo t = (NamedDescriptorInfo)template; + public Descriptor copyFrom(RecordInfo template) { + if (template instanceof Descriptor) { + Descriptor t = (Descriptor)template; if (t.hasName()) { if (hasName() && getName() instanceof StringBuilder) { ((StringBuilder)getName()).setLength(0); @@ -316,7 +295,7 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"NamedDescriptor\""); + str.append("{ \"$type\": \"Descriptor\""); if (hasName()) { str.append(", \"name\": \"").append(getName()).append("\""); } @@ -329,4 +308,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptorRef.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DescriptorRef.java similarity index 66% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptorRef.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/DescriptorRef.java index 349f922c7..bc7aef211 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptorRef.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DescriptorRef.java @@ -1,42 +1,22 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import java.lang.CharSequence; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; import com.epam.deltix.containers.BinaryAsciiString; import com.epam.deltix.containers.CharSequenceUtils; import com.epam.deltix.containers.MutableString; +import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.RecordInterface; +import com.epam.deltix.timebase.messages.SchemaElement; +import com.epam.deltix.timebase.messages.SchemaType; /** * Schema definition for a reference to class descriptor. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.ClassDescriptorRef", - title = "ClassDescriptorRef" + name = "com.epam.deltix.timebase.messages.schema.DescriptorRef", + title = "DescriptorRef" ) -public class ClassDescriptorRef implements ClassDescriptorRefInterface { - public static final String CLASS_NAME = ClassDescriptorRef.class.getName(); +public class DescriptorRef implements RecordInterface { + public static final String CLASS_NAME = DescriptorRef.class.getName(); /** * Node name. @@ -82,14 +62,14 @@ public void nullifyName() { * Creates new instance of this class. * @return new instance of this class. */ - protected ClassDescriptorRef createInstance() { - return new ClassDescriptorRef(); + protected DescriptorRef createInstance() { + return new DescriptorRef(); } /** * Method nullifies all instance properties */ - public ClassDescriptorRef nullify() { + public DescriptorRef nullify() { nullifyName(); return this; } @@ -97,7 +77,7 @@ public ClassDescriptorRef nullify() { /** * Resets all instance properties to their default values */ - public ClassDescriptorRef reset() { + public DescriptorRef reset() { name = null; return this; } @@ -105,8 +85,8 @@ public ClassDescriptorRef reset() { /** * Method copies state to a given instance */ - public ClassDescriptorRef clone() { - ClassDescriptorRef t = createInstance(); + public DescriptorRef clone() { + DescriptorRef t = createInstance(); t.copyFrom(this); return t; } @@ -117,8 +97,8 @@ public ClassDescriptorRef clone() { @Override public boolean equals(Object obj) { if (this == obj) return true; - if (!(obj instanceof ClassDescriptorRefInfo)) return false; - ClassDescriptorRefInfo other =(ClassDescriptorRefInfo)obj; + if (!(obj instanceof DescriptorRef)) return false; + DescriptorRef other =(DescriptorRef)obj; if (hasName() != other.hasName()) return false; if (hasName()) { if (getName().length() != other.getName().length()) return false; else { @@ -150,9 +130,9 @@ public int hashCode() { * Method copies state to a given instance * @param template class instance that should be used as a copy source */ - public ClassDescriptorRef copyFrom(RecordInfo template) { - if (template instanceof ClassDescriptorRefInfo) { - ClassDescriptorRefInfo t = (ClassDescriptorRefInfo)template; + public DescriptorRef copyFrom(RecordInfo template) { + if (template instanceof DescriptorRef) { + DescriptorRef t = (DescriptorRef)template; if (t.hasName()) { if (hasName() && getName() instanceof StringBuilder) { ((StringBuilder)getName()).setLength(0); @@ -181,11 +161,11 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"ClassDescriptorRef\""); + str.append("{ \"$type\": \"DescriptorRef\""); if (hasName()) { str.append(", \"name\": \"").append(getName()).append("\""); } str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumClassDescriptorInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumClassDescriptorInfo.java deleted file mode 100644 index e8a127146..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumClassDescriptorInfo.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.util.collections.generated.ObjectList; -import java.lang.Override; - -/** - * Schema definition for enumeration class. - */ -public interface EnumClassDescriptorInfo extends ClassDescriptorInfo { - /** - * List of values of enumeration. - * @return Values - */ - ObjectList getValues(); - - /** - * List of values of enumeration. - * @return true if Values is not null - */ - boolean hasValues(); - - /** - * True, if enumeration represents a bitmask. - * @return Is Bitmask - */ - boolean isBitmask(); - - /** - * True, if enumeration represents a bitmask. - * @return true if Is Bitmask is not null - */ - boolean hasIsBitmask(); - - /** - * Method copies state to a given instance - */ - @Override - EnumClassDescriptorInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumClassDescriptorInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumClassDescriptorInterface.java deleted file mode 100644 index 1bd332885..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumClassDescriptorInterface.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.util.collections.generated.ObjectArrayList; -import java.lang.Override; - -/** - * Schema definition for enumeration class. - */ -public interface EnumClassDescriptorInterface extends EnumClassDescriptorInfo, ClassDescriptorInterface { - /** - * List of values of enumeration. - * @param value - Values - */ - void setValues(ObjectArrayList value); - - /** - * List of values of enumeration. - */ - void nullifyValues(); - - /** - * True, if enumeration represents a bitmask. - * @param value - Is Bitmask - */ - void setIsBitmask(boolean value); - - /** - * True, if enumeration represents a bitmask. - */ - void nullifyIsBitmask(); - - /** - * Method nullifies all instance properties - */ - @Override - EnumClassDescriptorInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - EnumClassDescriptorInterface reset(); - - @Override - EnumClassDescriptorInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumValue.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumConstant.java similarity index 68% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumValue.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumConstant.java index 0ed19e263..2592ace1e 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumValue.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumConstant.java @@ -1,43 +1,19 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import com.epam.deltix.timebase.messages.TypeConstants; -import java.lang.CharSequence; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; import com.epam.deltix.containers.BinaryAsciiString; import com.epam.deltix.containers.CharSequenceUtils; import com.epam.deltix.containers.MutableString; +import com.epam.deltix.timebase.messages.*; /** * Schema definition for a single enumeration value. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.EnumValue", - title = "EnumValue" + name = "com.epam.deltix.timebase.messages.schema.EnumConstant", + title = "EnumConstant" ) -public class EnumValue implements EnumValueInterface { - public static final String CLASS_NAME = EnumValue.class.getName(); +public class EnumConstant implements RecordInterface { + public static final String CLASS_NAME = EnumConstant.class.getName(); /** * Enumeration symbol. @@ -109,28 +85,28 @@ public void setValue(short value) { * @return true if Value is not null */ public boolean hasValue() { - return value != com.epam.deltix.timebase.messages.TypeConstants.INT16_NULL; + return value != TypeConstants.INT16_NULL; } /** * Enumeration value. */ public void nullifyValue() { - this.value = com.epam.deltix.timebase.messages.TypeConstants.INT16_NULL; + this.value = TypeConstants.INT16_NULL; } /** * Creates new instance of this class. * @return new instance of this class. */ - protected EnumValue createInstance() { - return new EnumValue(); + protected EnumConstant createInstance() { + return new EnumConstant(); } /** * Method nullifies all instance properties */ - public EnumValue nullify() { + public EnumConstant nullify() { nullifySymbol(); nullifyValue(); return this; @@ -139,17 +115,17 @@ public EnumValue nullify() { /** * Resets all instance properties to their default values */ - public EnumValue reset() { + public EnumConstant reset() { symbol = null; - value = com.epam.deltix.timebase.messages.TypeConstants.INT16_NULL; + value = TypeConstants.INT16_NULL; return this; } /** * Method copies state to a given instance */ - public EnumValue clone() { - EnumValue t = createInstance(); + public EnumConstant clone() { + EnumConstant t = createInstance(); t.copyFrom(this); return t; } @@ -160,8 +136,8 @@ public EnumValue clone() { @Override public boolean equals(Object obj) { if (this == obj) return true; - if (!(obj instanceof EnumValueInfo)) return false; - EnumValueInfo other =(EnumValueInfo)obj; + if (!(obj instanceof EnumConstant)) return false; + EnumConstant other =(EnumConstant)obj; if (hasSymbol() != other.hasSymbol()) return false; if (hasSymbol()) { if (getSymbol().length() != other.getSymbol().length()) return false; else { @@ -198,9 +174,9 @@ public int hashCode() { * Method copies state to a given instance * @param template class instance that should be used as a copy source */ - public EnumValue copyFrom(RecordInfo template) { - if (template instanceof EnumValueInfo) { - EnumValueInfo t = (EnumValueInfo)template; + public EnumConstant copyFrom(RecordInfo template) { + if (template instanceof EnumConstant) { + EnumConstant t = (EnumConstant)template; if (t.hasSymbol()) { if (hasSymbol() && getSymbol() instanceof StringBuilder) { ((StringBuilder)getSymbol()).setLength(0); @@ -234,7 +210,7 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"EnumValue\""); + str.append("{ \"$type\": \"EnumConstant\""); if (hasSymbol()) { str.append(", \"symbol\": \"").append(getSymbol()).append("\""); } @@ -244,4 +220,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumDataTypeInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumDataTypeInfo.java deleted file mode 100644 index f3f527091..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumDataTypeInfo.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import java.lang.Override; - -/** - * Schema definition of enum data type. - */ -public interface EnumDataTypeInfo extends DataTypeInfo { - /** - * Definition for enumeration class. - * @return Type Descriptor - */ - ClassDescriptorRefInfo getTypeDescriptor(); - - /** - * Definition for enumeration class. - * @return true if Type Descriptor is not null - */ - boolean hasTypeDescriptor(); - - /** - * Method copies state to a given instance - */ - @Override - EnumDataTypeInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumDataTypeInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumDataTypeInterface.java deleted file mode 100644 index 7adf6d4a4..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumDataTypeInterface.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.Override; - -/** - * Schema definition of enum data type. - */ -public interface EnumDataTypeInterface extends EnumDataTypeInfo, DataTypeInterface { - /** - * Definition for enumeration class. - * @param value - Type Descriptor - */ - void setTypeDescriptor(ClassDescriptorRefInfo value); - - /** - * Definition for enumeration class. - */ - void nullifyTypeDescriptor(); - - /** - * Method nullifies all instance properties - */ - @Override - EnumDataTypeInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - EnumDataTypeInterface reset(); - - @Override - EnumDataTypeInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumClassDescriptor.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumDescriptor.java similarity index 66% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumClassDescriptor.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumDescriptor.java index f05cd04d5..063246120 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumClassDescriptor.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumDescriptor.java @@ -1,46 +1,22 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.SchemaArrayType; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import com.epam.deltix.timebase.messages.TypeConstants; +import com.epam.deltix.timebase.messages.*; import com.epam.deltix.util.collections.generated.ObjectArrayList; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; /** * Schema definition for enumeration class. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.EnumClassDescriptor", - title = "EnumClassDescriptor" + name = "com.epam.deltix.timebase.messages.schema.EnumDescriptor", + title = "EnumDescriptor" ) -public class EnumClassDescriptor extends ClassDescriptor implements EnumClassDescriptorInterface { - public static final String CLASS_NAME = EnumClassDescriptor.class.getName(); +public class EnumDescriptor extends UniqueDescriptor implements RecordInterface { + public static final String CLASS_NAME = EnumDescriptor.class.getName(); /** * List of values of enumeration. */ - protected ObjectArrayList values = null; + protected ObjectArrayList values = null; /** * True, if enumeration represents a bitmask. @@ -56,10 +32,10 @@ public class EnumClassDescriptor extends ClassDescriptor implements EnumClassDes isNullable = false, isElementNullable = false, elementTypes = { - EnumValue.class} + EnumConstant.class} ) - public ObjectArrayList getValues() { + public ObjectArrayList getValues() { return values; } @@ -67,7 +43,7 @@ public ObjectArrayList getValues() { * List of values of enumeration. * @param value - Values */ - public void setValues(ObjectArrayList value) { + public void setValues(ObjectArrayList value) { this.values = value; } @@ -111,14 +87,14 @@ public void setIsBitmask(boolean value) { * @return true if Is Bitmask is not null */ public boolean hasIsBitmask() { - return isBitmask != com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; + return isBitmask != TypeConstants.BOOLEAN_NULL; } /** * True, if enumeration represents a bitmask. */ public void nullifyIsBitmask() { - this.isBitmask = com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; + this.isBitmask = TypeConstants.BOOLEAN_NULL; } /** @@ -126,15 +102,15 @@ public void nullifyIsBitmask() { * @return new instance of this class. */ @Override - protected EnumClassDescriptor createInstance() { - return new EnumClassDescriptor(); + protected EnumDescriptor createInstance() { + return new EnumDescriptor(); } /** * Method nullifies all instance properties */ @Override - public EnumClassDescriptor nullify() { + public EnumDescriptor nullify() { super.nullify(); nullifyValues(); nullifyIsBitmask(); @@ -145,10 +121,10 @@ public EnumClassDescriptor nullify() { * Resets all instance properties to their default values */ @Override - public EnumClassDescriptor reset() { + public EnumDescriptor reset() { super.reset(); values = null; - isBitmask = com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; + isBitmask = TypeConstants.BOOLEAN_NULL; return this; } @@ -156,8 +132,8 @@ public EnumClassDescriptor reset() { * Method copies state to a given instance */ @Override - public EnumClassDescriptor clone() { - EnumClassDescriptor t = createInstance(); + public EnumDescriptor clone() { + EnumDescriptor t = createInstance(); t.copyFrom(this); return t; } @@ -170,8 +146,8 @@ public boolean equals(Object obj) { if (this == obj) return true; boolean superEquals = super.equals(obj); if (!superEquals) return false; - if (!(obj instanceof EnumClassDescriptorInfo)) return false; - EnumClassDescriptorInfo other =(EnumClassDescriptorInfo)obj; + if (!(obj instanceof EnumDescriptor)) return false; + EnumDescriptor other =(EnumDescriptor)obj; if (hasValues() != other.hasValues()) return false; if (hasValues()) { if (getValues().size() != other.getValues().size()) return false; @@ -207,17 +183,17 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ @Override - public EnumClassDescriptor copyFrom(RecordInfo template) { + public EnumDescriptor copyFrom(RecordInfo template) { super.copyFrom(template); - if (template instanceof EnumClassDescriptorInfo) { - EnumClassDescriptorInfo t = (EnumClassDescriptorInfo)template; + if (template instanceof EnumDescriptor) { + EnumDescriptor t = (EnumDescriptor)template; if (t.hasValues()) { if (!hasValues()) { - setValues(new ObjectArrayList(t.getValues().size())); + setValues(new ObjectArrayList(t.getValues().size())); } else { getValues().clear(); } - for (int i = 0; i < t.getValues().size(); ++i) ((ObjectArrayList)getValues()).add((EnumValueInfo)t.getValues().get(i).clone()); + for (int i = 0; i < t.getValues().size(); ++i) ((ObjectArrayList)getValues()).add((EnumConstant)t.getValues().get(i).clone()); } else { nullifyValues(); } @@ -244,7 +220,7 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"EnumClassDescriptor\""); + str.append("{ \"$type\": \"EnumDescriptor\""); if (hasValues()) { str.append(", \"values\": ["); if (getValues().size() > 0) { @@ -282,4 +258,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumDataType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumFieldType.java similarity index 56% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumDataType.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumFieldType.java index 634fda106..67284e18d 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumDataType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumFieldType.java @@ -1,45 +1,26 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import com.epam.deltix.timebase.messages.SchemaDataType; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; +import com.epam.deltix.timebase.messages.*; /** * Schema definition of enum data type. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.EnumDataType", - title = "EnumDataType" + name = "com.epam.deltix.timebase.messages.schema.EnumFieldType", + title = "EnumFieldType" ) -public class EnumDataType extends DataType implements EnumDataTypeInterface { - public static final String CLASS_NAME = EnumDataType.class.getName(); +public class EnumFieldType extends FieldType implements RecordInterface { + public static final String CLASS_NAME = EnumFieldType.class.getName(); /** * Definition for enumeration class. */ - protected ClassDescriptorRefInfo typeDescriptor = null; + protected DescriptorRef typeDescriptor = null; + + public EnumFieldType() { + super(); + baseName = "ENUM"; + } /** * Definition for enumeration class. @@ -50,10 +31,10 @@ public class EnumDataType extends DataType implements EnumDataTypeInterface { isNullable = false, dataType = SchemaDataType.OBJECT, nestedTypes = { - ClassDescriptorRef.class} + DescriptorRef.class} ) - public ClassDescriptorRefInfo getTypeDescriptor() { + public DescriptorRef getTypeDescriptor() { return typeDescriptor; } @@ -61,7 +42,7 @@ public ClassDescriptorRefInfo getTypeDescriptor() { * Definition for enumeration class. * @param value - Type Descriptor */ - public void setTypeDescriptor(ClassDescriptorRefInfo value) { + public void setTypeDescriptor(DescriptorRef value) { this.typeDescriptor = value; } @@ -80,20 +61,51 @@ public void nullifyTypeDescriptor() { this.typeDescriptor = null; } + /** + * @return Base Name + */ + @Override + public CharSequence getBaseName() { + return baseName; + } + + /** + * @param value - Base Name + */ + @Override + public void setBaseName(CharSequence value) { + this.baseName = value; + } + + /** + * @return true if Base Name is not null + */ + @Override + public boolean hasBaseName() { + return baseName != null; + } + + /** + */ + @Override + public void nullifyBaseName() { + this.baseName = null; + } + /** * Creates new instance of this class. * @return new instance of this class. */ @Override - protected EnumDataType createInstance() { - return new EnumDataType(); + protected EnumFieldType createInstance() { + return new EnumFieldType(); } /** * Method nullifies all instance properties */ @Override - public EnumDataType nullify() { + public EnumFieldType nullify() { super.nullify(); nullifyTypeDescriptor(); return this; @@ -103,7 +115,7 @@ public EnumDataType nullify() { * Resets all instance properties to their default values */ @Override - public EnumDataType reset() { + public EnumFieldType reset() { super.reset(); typeDescriptor = null; return this; @@ -113,8 +125,8 @@ public EnumDataType reset() { * Method copies state to a given instance */ @Override - public EnumDataType clone() { - EnumDataType t = createInstance(); + public EnumFieldType clone() { + EnumFieldType t = createInstance(); t.copyFrom(this); return t; } @@ -127,8 +139,8 @@ public boolean equals(Object obj) { if (this == obj) return true; boolean superEquals = super.equals(obj); if (!superEquals) return false; - if (!(obj instanceof EnumDataTypeInfo)) return false; - EnumDataTypeInfo other =(EnumDataTypeInfo)obj; + if (!(obj instanceof EnumFieldType)) return false; + EnumFieldType other =(EnumFieldType)obj; if (hasTypeDescriptor() != other.hasTypeDescriptor()) return false; if (hasTypeDescriptor() && !(getTypeDescriptor().equals(other.getTypeDescriptor()))) return false; return true; @@ -151,16 +163,12 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ @Override - public EnumDataType copyFrom(RecordInfo template) { + public EnumFieldType copyFrom(RecordInfo template) { super.copyFrom(template); - if (template instanceof EnumDataTypeInfo) { - EnumDataTypeInfo t = (EnumDataTypeInfo)template; + if (template instanceof EnumFieldType) { + EnumFieldType t = (EnumFieldType)template; if (t.hasTypeDescriptor()) { - if (hasTypeDescriptor() && getTypeDescriptor() instanceof RecordInterface) { - ((RecordInterface)getTypeDescriptor()).copyFrom(t.getTypeDescriptor()); - } else { - setTypeDescriptor((ClassDescriptorRefInfo)t.getTypeDescriptor().clone()); - } + t.setTypeDescriptor((DescriptorRef) getTypeDescriptor().clone()); } else { nullifyTypeDescriptor(); } @@ -182,7 +190,7 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"EnumDataType\""); + str.append("{ \"$type\": \"EnumFieldType\""); if (hasTypeDescriptor()) { str.append(", \"typeDescriptor\": "); getTypeDescriptor().toString(str); @@ -193,7 +201,10 @@ public StringBuilder toString(StringBuilder str) { if (hasIsNullable()) { str.append(", \"isNullable\": ").append(isNullable()); } + if (hasBaseName()) { + str.append(", \"baseName\": \"").append(getBaseName()).append("\""); + } str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumValueInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumValueInfo.java deleted file mode 100644 index 2f69fbee0..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumValueInfo.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.CharSequence; -import java.lang.Override; - -/** - * Schema definition for a single enumeration value. - */ -public interface EnumValueInfo extends RecordInfo { - /** - * Enumeration symbol. - * @return Symbol - */ - CharSequence getSymbol(); - - /** - * Enumeration symbol. - * @return true if Symbol is not null - */ - boolean hasSymbol(); - - /** - * Enumeration value. - * @return Value - */ - short getValue(); - - /** - * Enumeration value. - * @return true if Value is not null - */ - boolean hasValue(); - - /** - * Method copies state to a given instance - */ - @Override - EnumValueInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumValueInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumValueInterface.java deleted file mode 100644 index 1df97cdc7..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/EnumValueInterface.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import java.lang.CharSequence; -import java.lang.Override; - -/** - * Schema definition for a single enumeration value. - */ -public interface EnumValueInterface extends EnumValueInfo, RecordInterface { - /** - * Enumeration symbol. - * @param value - Symbol - */ - void setSymbol(CharSequence value); - - /** - * Enumeration symbol. - */ - void nullifySymbol(); - - /** - * Enumeration value. - * @param value - Value - */ - void setValue(short value); - - /** - * Enumeration value. - */ - void nullifyValue(); - - /** - * Method nullifies all instance properties - */ - @Override - EnumValueInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - EnumValueInterface reset(); - - @Override - EnumValueInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/Field.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/Field.java new file mode 100644 index 000000000..55f675b7f --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/Field.java @@ -0,0 +1,174 @@ +package com.epam.deltix.timebase.messages.schema; + +import com.epam.deltix.timebase.messages.*; + +/** + * This is a base class for schema data field. + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.schema.Field", + title = "Field" +) +public abstract class Field extends Descriptor implements RecordInterface { + public static final String CLASS_NAME = Field.class.getName(); + + /** + * Data type of a field. + */ + protected FieldType type = null; + + /** + * Data type of a field. + * @return Type + */ + @SchemaElement + @SchemaType( + isNullable = false, + dataType = SchemaDataType.OBJECT, + nestedTypes = { + ArrayFieldType.class, BinaryFieldType.class, BooleanFieldType.class, CharFieldType.class, ClassFieldType.class, DateTimeFieldType.class, EnumFieldType.class, FloatFieldType.class, IntegerFieldType.class, TimeOfDayFieldType.class, VarcharFieldType.class} + + ) + public FieldType getType() { + return type; + } + + /** + * Data type of a field. + * @param value - Type + */ + public void setType(FieldType value) { + this.type = value; + } + + /** + * Data type of a field. + * @return true if Type is not null + */ + public boolean hasType() { + return type != null; + } + + /** + * Data type of a field. + */ + public void nullifyType() { + this.type = null; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + @Override + protected Field createInstance() { + throw new UnsupportedOperationException(); + } + + /** + * Method nullifies all instance properties + */ + @Override + public Field nullify() { + super.nullify(); + nullifyType(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + @Override + public Field reset() { + super.reset(); + type = null; + return this; + } + + /** + * Method copies state to a given instance + */ + @Override + public Field clone() { + Field t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + boolean superEquals = super.equals(obj); + if (!superEquals) return false; + if (!(obj instanceof Field)) return false; + Field other =(Field)obj; + if (hasType() != other.hasType()) return false; + if (hasType() && !(getType().equals(other.getType()))) return false; + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = super.hashCode(); + if (hasType()) { + hash = hash * 31 + getType().hashCode(); + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + @Override + public Field copyFrom(RecordInfo template) { + super.copyFrom(template); + if (template instanceof Field) { + Field t = (Field)template; + if (t.hasType()) { + t.setType((FieldType) getType().clone()); + } else { + nullifyType(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"Field\""); + if (hasType()) { + str.append(", \"type\": "); + getType().toString(str); + } + if (hasName()) { + str.append(", \"name\": \"").append(getName()).append("\""); + } + if (hasTitle()) { + str.append(", \"title\": \"").append(getTitle()).append("\""); + } + if (hasDescription()) { + str.append(", \"description\": \"").append(getDescription()).append("\""); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/FieldType.java similarity index 66% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataType.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/FieldType.java index 6fdaa2bef..9ad5689d5 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/DataType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/FieldType.java @@ -1,44 +1,19 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import com.epam.deltix.timebase.messages.TypeConstants; -import java.lang.CharSequence; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; -import java.lang.UnsupportedOperationException; import com.epam.deltix.containers.BinaryAsciiString; import com.epam.deltix.containers.CharSequenceUtils; import com.epam.deltix.containers.MutableString; +import com.epam.deltix.timebase.messages.*; /** * This is a base class for schema data types. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.DataType", - title = "DataType" + name = "com.epam.deltix.timebase.messages.schema.FieldType", + title = "FieldType" ) -public abstract class DataType implements DataTypeInterface { - public static final String CLASS_NAME = DataType.class.getName(); +public abstract class FieldType implements RecordInterface { + public static final String CLASS_NAME = FieldType.class.getName(); /** * Binary representation (encoding) of a field in database and protocol. @@ -50,6 +25,10 @@ public abstract class DataType implements DataTypeInterface { */ protected byte isNullable = TypeConstants.BOOLEAN_NULL; + /** + */ + protected CharSequence baseName = null; + /** * Binary representation (encoding) of a field in database and protocol. * @return Encoding @@ -110,47 +89,80 @@ public void setIsNullable(boolean value) { * @return true if Is Nullable is not null */ public boolean hasIsNullable() { - return isNullable != com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; + return isNullable != TypeConstants.BOOLEAN_NULL; } /** * True, if schema design allows the field to be nullable. */ public void nullifyIsNullable() { - this.isNullable = com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; + this.isNullable = TypeConstants.BOOLEAN_NULL; + } + + /** + * @return Base Name + */ + @SchemaElement + @SchemaType( + isNullable = false + ) + public CharSequence getBaseName() { + return baseName; + } + + /** + * @param value - Base Name + */ + public void setBaseName(CharSequence value) { + this.baseName = value; + } + + /** + * @return true if Base Name is not null + */ + public boolean hasBaseName() { + return baseName != null; + } + + /** + */ + public void nullifyBaseName() { + this.baseName = null; } /** * Creates new instance of this class. * @return new instance of this class. */ - protected DataType createInstance() { + protected FieldType createInstance() { throw new UnsupportedOperationException(); } /** * Method nullifies all instance properties */ - public DataType nullify() { + public FieldType nullify() { nullifyEncoding(); nullifyIsNullable(); + nullifyBaseName(); return this; } /** * Resets all instance properties to their default values */ - public DataType reset() { + public FieldType reset() { encoding = null; - isNullable = com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; + isNullable = TypeConstants.BOOLEAN_NULL; + baseName = null; return this; } /** * Method copies state to a given instance */ - public DataType clone() { - DataType t = createInstance(); + public FieldType clone() { + FieldType t = createInstance(); t.copyFrom(this); return t; } @@ -161,8 +173,8 @@ public DataType clone() { @Override public boolean equals(Object obj) { if (this == obj) return true; - if (!(obj instanceof DataTypeInfo)) return false; - DataTypeInfo other =(DataTypeInfo)obj; + if (!(obj instanceof FieldType)) return false; + FieldType other =(FieldType)obj; if (hasEncoding() != other.hasEncoding()) return false; if (hasEncoding()) { if (getEncoding().length() != other.getEncoding().length()) return false; else { @@ -177,6 +189,18 @@ public boolean equals(Object obj) { } if (hasIsNullable() != other.hasIsNullable()) return false; if (hasIsNullable() && isNullable() != other.isNullable()) return false; + if (hasBaseName() != other.hasBaseName()) return false; + if (hasBaseName()) { + if (getBaseName().length() != other.getBaseName().length()) return false; else { + CharSequence s1 = getBaseName(); + CharSequence s2 = other.getBaseName(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } return true; } @@ -192,6 +216,9 @@ public int hashCode() { if (hasIsNullable()) { hash = hash * 31 + (isNullable() ? 1231 : 1237); } + if (hasBaseName()) { + hash = hash * 31 + getBaseName().hashCode(); + } return hash; } @@ -199,9 +226,9 @@ public int hashCode() { * Method copies state to a given instance * @param template class instance that should be used as a copy source */ - public DataType copyFrom(RecordInfo template) { - if (template instanceof DataTypeInfo) { - DataTypeInfo t = (DataTypeInfo)template; + public FieldType copyFrom(RecordInfo template) { + if (template instanceof FieldType) { + FieldType t = (FieldType)template; if (t.hasEncoding()) { if (hasEncoding() && getEncoding() instanceof StringBuilder) { ((StringBuilder)getEncoding()).setLength(0); @@ -217,6 +244,16 @@ public DataType copyFrom(RecordInfo template) { } else { nullifyIsNullable(); } + if (t.hasBaseName()) { + if (hasBaseName() && getBaseName() instanceof StringBuilder) { + ((StringBuilder)getBaseName()).setLength(0); + } else { + setBaseName(new StringBuilder()); + } + ((StringBuilder)getBaseName()).append(t.getBaseName()); + } else { + nullifyBaseName(); + } } return this; } @@ -235,14 +272,17 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"DataType\""); + str.append("{ \"$type\": \"FieldType\""); if (hasEncoding()) { str.append(", \"encoding\": \"").append(getEncoding()).append("\""); } if (hasIsNullable()) { str.append(", \"isNullable\": ").append(isNullable()); } + if (hasBaseName()) { + str.append(", \"baseName\": \"").append(getBaseName()).append("\""); + } str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/FloatDataTypeInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/FloatDataTypeInfo.java deleted file mode 100644 index 643307c68..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/FloatDataTypeInfo.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import java.lang.Override; - -/** - * Schema definition of float data type. - */ -public interface FloatDataTypeInfo extends IntegralDataTypeInfo { - /** - * Scale. - * @return Scale - */ - short getScale(); - - /** - * Scale. - * @return true if Scale is not null - */ - boolean hasScale(); - - /** - * Method copies state to a given instance - */ - @Override - FloatDataTypeInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/FloatDataTypeInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/FloatDataTypeInterface.java deleted file mode 100644 index f8bed69fe..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/FloatDataTypeInterface.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.Override; - -/** - * Schema definition of float data type. - */ -public interface FloatDataTypeInterface extends FloatDataTypeInfo, IntegralDataTypeInterface { - /** - * Scale. - * @param value - Scale - */ - void setScale(short value); - - /** - * Scale. - */ - void nullifyScale(); - - /** - * Method nullifies all instance properties - */ - @Override - FloatDataTypeInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - FloatDataTypeInterface reset(); - - @Override - FloatDataTypeInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/FloatDataType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/FloatFieldType.java similarity index 59% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/FloatDataType.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/FloatFieldType.java index c3fb9228f..69addb025 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/FloatDataType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/FloatFieldType.java @@ -1,45 +1,27 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import com.epam.deltix.timebase.messages.TypeConstants; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; +import com.epam.deltix.timebase.messages.*; /** * Schema definition of float data type. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.FloatDataType", - title = "FloatDataType" + name = "com.epam.deltix.timebase.messages.schema.FloatFieldType", + title = "FloatFieldType" ) -public class FloatDataType extends IntegralDataType implements FloatDataTypeInterface { - public static final String CLASS_NAME = FloatDataType.class.getName(); +public class FloatFieldType extends IntegralFieldType implements RecordInterface { + public static final String CLASS_NAME = FloatFieldType.class.getName(); /** * Scale. */ protected short scale = TypeConstants.INT16_NULL; + public FloatFieldType() { + super(); + baseName = "FLOAT"; + } + /** * Scale. * @return Scale @@ -65,14 +47,45 @@ public void setScale(short value) { * @return true if Scale is not null */ public boolean hasScale() { - return scale != com.epam.deltix.timebase.messages.TypeConstants.INT16_NULL; + return scale != TypeConstants.INT16_NULL; } /** * Scale. */ public void nullifyScale() { - this.scale = com.epam.deltix.timebase.messages.TypeConstants.INT16_NULL; + this.scale = TypeConstants.INT16_NULL; + } + + /** + * @return Base Name + */ + @Override + public CharSequence getBaseName() { + return baseName; + } + + /** + * @param value - Base Name + */ + @Override + public void setBaseName(CharSequence value) { + this.baseName = value; + } + + /** + * @return true if Base Name is not null + */ + @Override + public boolean hasBaseName() { + return baseName != null; + } + + /** + */ + @Override + public void nullifyBaseName() { + this.baseName = null; } /** @@ -80,15 +93,15 @@ public void nullifyScale() { * @return new instance of this class. */ @Override - protected FloatDataType createInstance() { - return new FloatDataType(); + protected FloatFieldType createInstance() { + return new FloatFieldType(); } /** * Method nullifies all instance properties */ @Override - public FloatDataType nullify() { + public FloatFieldType nullify() { super.nullify(); nullifyScale(); return this; @@ -98,9 +111,9 @@ public FloatDataType nullify() { * Resets all instance properties to their default values */ @Override - public FloatDataType reset() { + public FloatFieldType reset() { super.reset(); - scale = com.epam.deltix.timebase.messages.TypeConstants.INT16_NULL; + scale = TypeConstants.INT16_NULL; return this; } @@ -108,8 +121,8 @@ public FloatDataType reset() { * Method copies state to a given instance */ @Override - public FloatDataType clone() { - FloatDataType t = createInstance(); + public FloatFieldType clone() { + FloatFieldType t = createInstance(); t.copyFrom(this); return t; } @@ -122,8 +135,8 @@ public boolean equals(Object obj) { if (this == obj) return true; boolean superEquals = super.equals(obj); if (!superEquals) return false; - if (!(obj instanceof FloatDataTypeInfo)) return false; - FloatDataTypeInfo other =(FloatDataTypeInfo)obj; + if (!(obj instanceof FloatFieldType)) return false; + FloatFieldType other =(FloatFieldType)obj; if (hasScale() != other.hasScale()) return false; if (hasScale() && getScale() != other.getScale()) return false; return true; @@ -146,10 +159,10 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ @Override - public FloatDataType copyFrom(RecordInfo template) { + public FloatFieldType copyFrom(RecordInfo template) { super.copyFrom(template); - if (template instanceof FloatDataTypeInfo) { - FloatDataTypeInfo t = (FloatDataTypeInfo)template; + if (template instanceof FloatFieldType) { + FloatFieldType t = (FloatFieldType)template; if (t.hasScale()) { setScale(t.getScale()); } else { @@ -173,7 +186,7 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"FloatDataType\""); + str.append("{ \"$type\": \"FloatFieldType\""); if (hasScale()) { str.append(", \"scale\": ").append(getScale()); } @@ -189,7 +202,10 @@ public StringBuilder toString(StringBuilder str) { if (hasIsNullable()) { str.append(", \"isNullable\": ").append(isNullable()); } + if (hasBaseName()) { + str.append(", \"baseName\": \"").append(getBaseName()).append("\""); + } str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegerDataTypeInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegerDataTypeInterface.java deleted file mode 100644 index 8317923f6..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegerDataTypeInterface.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.Override; - -/** - * Schema definition of integer data type. - */ -public interface IntegerDataTypeInterface extends IntegerDataTypeInfo, IntegralDataTypeInterface { - /** - * Method nullifies all instance properties - */ - @Override - IntegerDataTypeInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - IntegerDataTypeInterface reset(); - - @Override - IntegerDataTypeInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegerDataType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegerFieldType.java similarity index 58% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegerDataType.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegerFieldType.java index aa097f96a..2018fc413 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegerDataType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegerFieldType.java @@ -1,52 +1,69 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.RecordInterface; import com.epam.deltix.timebase.messages.SchemaElement; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; /** * Schema definition of integer data type. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.IntegerDataType", - title = "IntegerDataType" + name = "com.epam.deltix.timebase.messages.schema.IntegerFieldType", + title = "IntegerFieldType" ) -public class IntegerDataType extends IntegralDataType implements IntegerDataTypeInterface { - public static final String CLASS_NAME = IntegerDataType.class.getName(); +public class IntegerFieldType extends IntegralFieldType implements RecordInterface { + public static final String CLASS_NAME = IntegerFieldType.class.getName(); + + public IntegerFieldType() { + super(); + baseName = "INTEGER"; + } + + /** + * @return Base Name + */ + @Override + public CharSequence getBaseName() { + return baseName; + } + + /** + * @param value - Base Name + */ + @Override + public void setBaseName(CharSequence value) { + this.baseName = value; + } + + /** + * @return true if Base Name is not null + */ + @Override + public boolean hasBaseName() { + return baseName != null; + } + + /** + */ + @Override + public void nullifyBaseName() { + this.baseName = null; + } /** * Creates new instance of this class. * @return new instance of this class. */ @Override - protected IntegerDataType createInstance() { - return new IntegerDataType(); + protected IntegerFieldType createInstance() { + return new IntegerFieldType(); } /** * Method nullifies all instance properties */ @Override - public IntegerDataType nullify() { + public IntegerFieldType nullify() { super.nullify(); return this; } @@ -55,7 +72,7 @@ public IntegerDataType nullify() { * Resets all instance properties to their default values */ @Override - public IntegerDataType reset() { + public IntegerFieldType reset() { super.reset(); return this; } @@ -64,8 +81,8 @@ public IntegerDataType reset() { * Method copies state to a given instance */ @Override - public IntegerDataType clone() { - IntegerDataType t = createInstance(); + public IntegerFieldType clone() { + IntegerFieldType t = createInstance(); t.copyFrom(this); return t; } @@ -78,7 +95,8 @@ public boolean equals(Object obj) { if (this == obj) return true; boolean superEquals = super.equals(obj); if (!superEquals) return false; - if (!(obj instanceof IntegerDataTypeInfo)) return false; + if (!(obj instanceof IntegerFieldType)) return false; + IntegerFieldType other =(IntegerFieldType)obj; return true; } @@ -96,8 +114,11 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ @Override - public IntegerDataType copyFrom(RecordInfo template) { + public IntegerFieldType copyFrom(RecordInfo template) { super.copyFrom(template); + if (template instanceof IntegerFieldType) { + IntegerFieldType t = (IntegerFieldType)template; + } return this; } @@ -115,7 +136,7 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"IntegerDataType\""); + str.append("{ \"$type\": \"IntegerFieldType\""); if (hasMinValue()) { str.append(", \"minValue\": \"").append(getMinValue()).append("\""); } @@ -128,7 +149,10 @@ public StringBuilder toString(StringBuilder str) { if (hasIsNullable()) { str.append(", \"isNullable\": ").append(isNullable()); } + if (hasBaseName()) { + str.append(", \"baseName\": \"").append(getBaseName()).append("\""); + } str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegralDataTypeInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegralDataTypeInfo.java deleted file mode 100644 index f9bfddabf..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegralDataTypeInfo.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import java.lang.CharSequence; -import java.lang.Override; - -/** - * This is a base class for numeric data types. - */ -public interface IntegralDataTypeInfo extends DataTypeInfo { - /** - * String definition for minimum constraint. - * @return Min Value - */ - CharSequence getMinValue(); - - /** - * String definition for minimum constraint. - * @return true if Min Value is not null - */ - boolean hasMinValue(); - - /** - * String definition for maximum constraint. - * @return Max Value - */ - CharSequence getMaxValue(); - - /** - * String definition for maximum constraint. - * @return true if Max Value is not null - */ - boolean hasMaxValue(); - - /** - * Method copies state to a given instance - */ - @Override - IntegralDataTypeInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegralDataTypeInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegralDataTypeInterface.java deleted file mode 100644 index 28156d0c6..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegralDataTypeInterface.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.CharSequence; -import java.lang.Override; - -/** - * This is a base class for numeric data types. - */ -public interface IntegralDataTypeInterface extends IntegralDataTypeInfo, DataTypeInterface { - /** - * String definition for minimum constraint. - * @param value - Min Value - */ - void setMinValue(CharSequence value); - - /** - * String definition for minimum constraint. - */ - void nullifyMinValue(); - - /** - * String definition for maximum constraint. - * @param value - Max Value - */ - void setMaxValue(CharSequence value); - - /** - * String definition for maximum constraint. - */ - void nullifyMaxValue(); - - /** - * Method nullifies all instance properties - */ - @Override - IntegralDataTypeInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - IntegralDataTypeInterface reset(); - - @Override - IntegralDataTypeInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegralDataType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegralFieldType.java similarity index 78% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegralDataType.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegralFieldType.java index 021e0e899..47a0f194d 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegralDataType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/IntegralFieldType.java @@ -1,43 +1,22 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import java.lang.CharSequence; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; -import java.lang.UnsupportedOperationException; import com.epam.deltix.containers.BinaryAsciiString; import com.epam.deltix.containers.CharSequenceUtils; import com.epam.deltix.containers.MutableString; +import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.RecordInterface; +import com.epam.deltix.timebase.messages.SchemaElement; +import com.epam.deltix.timebase.messages.SchemaType; /** * This is a base class for numeric data types. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.IntegralDataType", - title = "IntegralDataType" + name = "com.epam.deltix.timebase.messages.schema.IntegralFieldType", + title = "IntegralFieldType" ) -public abstract class IntegralDataType extends DataType implements IntegralDataTypeInterface { - public static final String CLASS_NAME = IntegralDataType.class.getName(); +public abstract class IntegralFieldType extends FieldType implements RecordInterface { + public static final String CLASS_NAME = IntegralFieldType.class.getName(); /** * String definition for minimum constraint. @@ -124,7 +103,7 @@ public void nullifyMaxValue() { * @return new instance of this class. */ @Override - protected IntegralDataType createInstance() { + protected IntegralFieldType createInstance() { throw new UnsupportedOperationException(); } @@ -132,7 +111,7 @@ protected IntegralDataType createInstance() { * Method nullifies all instance properties */ @Override - public IntegralDataType nullify() { + public IntegralFieldType nullify() { super.nullify(); nullifyMinValue(); nullifyMaxValue(); @@ -143,7 +122,7 @@ public IntegralDataType nullify() { * Resets all instance properties to their default values */ @Override - public IntegralDataType reset() { + public IntegralFieldType reset() { super.reset(); minValue = null; maxValue = null; @@ -154,8 +133,8 @@ public IntegralDataType reset() { * Method copies state to a given instance */ @Override - public IntegralDataType clone() { - IntegralDataType t = createInstance(); + public IntegralFieldType clone() { + IntegralFieldType t = createInstance(); t.copyFrom(this); return t; } @@ -168,8 +147,8 @@ public boolean equals(Object obj) { if (this == obj) return true; boolean superEquals = super.equals(obj); if (!superEquals) return false; - if (!(obj instanceof IntegralDataTypeInfo)) return false; - IntegralDataTypeInfo other =(IntegralDataTypeInfo)obj; + if (!(obj instanceof IntegralFieldType)) return false; + IntegralFieldType other =(IntegralFieldType)obj; if (hasMinValue() != other.hasMinValue()) return false; if (hasMinValue()) { if (getMinValue().length() != other.getMinValue().length()) return false; else { @@ -217,10 +196,10 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ @Override - public IntegralDataType copyFrom(RecordInfo template) { + public IntegralFieldType copyFrom(RecordInfo template) { super.copyFrom(template); - if (template instanceof IntegralDataTypeInfo) { - IntegralDataTypeInfo t = (IntegralDataTypeInfo)template; + if (template instanceof IntegralFieldType) { + IntegralFieldType t = (IntegralFieldType)template; if (t.hasMinValue()) { if (hasMinValue() && getMinValue() instanceof StringBuilder) { ((StringBuilder)getMinValue()).setLength(0); @@ -259,7 +238,7 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"IntegralDataType\""); + str.append("{ \"$type\": \"IntegralFieldType\""); if (hasMinValue()) { str.append(", \"minValue\": \"").append(getMinValue()).append("\""); } @@ -272,7 +251,10 @@ public StringBuilder toString(StringBuilder str) { if (hasIsNullable()) { str.append(", \"isNullable\": ").append(isNullable()); } + if (hasBaseName()) { + str.append(", \"baseName\": \"").append(getBaseName()).append("\""); + } str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NamedDescriptorInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NamedDescriptorInfo.java deleted file mode 100644 index e8277ce72..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NamedDescriptorInfo.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.CharSequence; -import java.lang.Override; - -/** - * This is a base class for schema nodes. - */ -public interface NamedDescriptorInfo extends RecordInfo { - /** - * Node name. - * @return Name - */ - CharSequence getName(); - - /** - * Node name. - * @return true if Name is not null - */ - boolean hasName(); - - /** - * Node title. - * @return Title - */ - CharSequence getTitle(); - - /** - * Node title. - * @return true if Title is not null - */ - boolean hasTitle(); - - /** - * Node description. - * @return Description - */ - CharSequence getDescription(); - - /** - * Node description. - * @return true if Description is not null - */ - boolean hasDescription(); - - /** - * Method copies state to a given instance - */ - @Override - NamedDescriptorInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NamedDescriptorInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NamedDescriptorInterface.java deleted file mode 100644 index c0e93c6b8..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NamedDescriptorInterface.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import java.lang.CharSequence; -import java.lang.Override; - -/** - * This is a base class for schema nodes. - */ -public interface NamedDescriptorInterface extends NamedDescriptorInfo, RecordInterface { - /** - * Node name. - * @param value - Name - */ - void setName(CharSequence value); - - /** - * Node name. - */ - void nullifyName(); - - /** - * Node title. - * @param value - Title - */ - void setTitle(CharSequence value); - - /** - * Node title. - */ - void nullifyTitle(); - - /** - * Node description. - * @param value - Description - */ - void setDescription(CharSequence value); - - /** - * Node description. - */ - void nullifyDescription(); - - /** - * Method nullifies all instance properties - */ - @Override - NamedDescriptorInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - NamedDescriptorInterface reset(); - - @Override - NamedDescriptorInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NonStaticDataFieldInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NonStaticDataFieldInfo.java deleted file mode 100644 index 9c4943c99..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NonStaticDataFieldInfo.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import java.lang.CharSequence; -import java.lang.Override; - -/** - * Schema definition for non-static data field. - */ -public interface NonStaticDataFieldInfo extends DataFieldInfo { - /** - * True, if field is defined as a primary key. - * The propery is applicable for unique streams only. - * @return Is Primary Key - */ - boolean isPrimaryKey(); - - /** - * True, if field is defined as a primary key. - * The propery is applicable for unique streams only. - * @return true if Is Primary Key is not null - */ - boolean hasIsPrimaryKey(); - - /** - * If specified, the field value will be encoded as a difference with a field defined in a RelativeTo property. - * @return Relative To - */ - CharSequence getRelativeTo(); - - /** - * If specified, the field value will be encoded as a difference with a field defined in a RelativeTo property. - * @return true if Relative To is not null - */ - boolean hasRelativeTo(); - - /** - * Method copies state to a given instance - */ - @Override - NonStaticDataFieldInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NonStaticDataFieldInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NonStaticDataFieldInterface.java deleted file mode 100644 index 1c39da585..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NonStaticDataFieldInterface.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.CharSequence; -import java.lang.Override; - -/** - * Schema definition for non-static data field. - */ -public interface NonStaticDataFieldInterface extends NonStaticDataFieldInfo, DataFieldInterface { - /** - * True, if field is defined as a primary key. - * The propery is applicable for unique streams only. - * @param value - Is Primary Key - */ - void setIsPrimaryKey(boolean value); - - /** - * True, if field is defined as a primary key. - * The propery is applicable for unique streams only. - */ - void nullifyIsPrimaryKey(); - - /** - * If specified, the field value will be encoded as a difference with a field defined in a RelativeTo property. - * @param value - Relative To - */ - void setRelativeTo(CharSequence value); - - /** - * If specified, the field value will be encoded as a difference with a field defined in a RelativeTo property. - */ - void nullifyRelativeTo(); - - /** - * Method nullifies all instance properties - */ - @Override - NonStaticDataFieldInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - NonStaticDataFieldInterface reset(); - - @Override - NonStaticDataFieldInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NonStaticDataField.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NonStaticField.java similarity index 69% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/NonStaticDataField.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/NonStaticField.java index 0a82189b5..c005b3eec 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NonStaticDataField.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/NonStaticField.java @@ -1,47 +1,23 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import com.epam.deltix.timebase.messages.TypeConstants; -import java.lang.CharSequence; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; import com.epam.deltix.containers.BinaryAsciiString; import com.epam.deltix.containers.CharSequenceUtils; import com.epam.deltix.containers.MutableString; +import com.epam.deltix.timebase.messages.*; /** * Schema definition for non-static data field. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.NonStaticDataField", - title = "NonStaticDataField" + name = "com.epam.deltix.timebase.messages.schema.NonStaticField", + title = "NonStaticField" ) -public class NonStaticDataField extends DataField implements NonStaticDataFieldInterface { - public static final String CLASS_NAME = NonStaticDataField.class.getName(); +public class NonStaticField extends Field implements RecordInterface { + public static final String CLASS_NAME = NonStaticField.class.getName(); /** * True, if field is defined as a primary key. - * The propery is applicable for unique streams only. + * The property is applicable for unique streams only. */ protected byte isPrimaryKey = TypeConstants.BOOLEAN_NULL; @@ -52,7 +28,7 @@ public class NonStaticDataField extends DataField implements NonStaticDataFieldI /** * True, if field is defined as a primary key. - * The propery is applicable for unique streams only. + * The property is applicable for unique streams only. * @return Is Primary Key */ @SchemaElement @@ -65,7 +41,7 @@ public boolean isPrimaryKey() { /** * True, if field is defined as a primary key. - * The propery is applicable for unique streams only. + * The property is applicable for unique streams only. * @param value - Is Primary Key */ public void setIsPrimaryKey(boolean value) { @@ -74,19 +50,19 @@ public void setIsPrimaryKey(boolean value) { /** * True, if field is defined as a primary key. - * The propery is applicable for unique streams only. + * The property is applicable for unique streams only. * @return true if Is Primary Key is not null */ public boolean hasIsPrimaryKey() { - return isPrimaryKey != com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; + return isPrimaryKey != TypeConstants.BOOLEAN_NULL; } /** * True, if field is defined as a primary key. - * The propery is applicable for unique streams only. + * The property is applicable for unique streams only. */ public void nullifyIsPrimaryKey() { - this.isPrimaryKey = com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; + this.isPrimaryKey = TypeConstants.BOOLEAN_NULL; } /** @@ -129,15 +105,15 @@ public void nullifyRelativeTo() { * @return new instance of this class. */ @Override - protected NonStaticDataField createInstance() { - return new NonStaticDataField(); + protected NonStaticField createInstance() { + return new NonStaticField(); } /** * Method nullifies all instance properties */ @Override - public NonStaticDataField nullify() { + public NonStaticField nullify() { super.nullify(); nullifyIsPrimaryKey(); nullifyRelativeTo(); @@ -148,9 +124,9 @@ public NonStaticDataField nullify() { * Resets all instance properties to their default values */ @Override - public NonStaticDataField reset() { + public NonStaticField reset() { super.reset(); - isPrimaryKey = com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; + isPrimaryKey = TypeConstants.BOOLEAN_NULL; relativeTo = null; return this; } @@ -159,8 +135,8 @@ public NonStaticDataField reset() { * Method copies state to a given instance */ @Override - public NonStaticDataField clone() { - NonStaticDataField t = createInstance(); + public NonStaticField clone() { + NonStaticField t = createInstance(); t.copyFrom(this); return t; } @@ -173,8 +149,8 @@ public boolean equals(Object obj) { if (this == obj) return true; boolean superEquals = super.equals(obj); if (!superEquals) return false; - if (!(obj instanceof NonStaticDataFieldInfo)) return false; - NonStaticDataFieldInfo other =(NonStaticDataFieldInfo)obj; + if (!(obj instanceof NonStaticField)) return false; + NonStaticField other =(NonStaticField)obj; if (hasIsPrimaryKey() != other.hasIsPrimaryKey()) return false; if (hasIsPrimaryKey() && isPrimaryKey() != other.isPrimaryKey()) return false; if (hasRelativeTo() != other.hasRelativeTo()) return false; @@ -212,10 +188,10 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ @Override - public NonStaticDataField copyFrom(RecordInfo template) { + public NonStaticField copyFrom(RecordInfo template) { super.copyFrom(template); - if (template instanceof NonStaticDataFieldInfo) { - NonStaticDataFieldInfo t = (NonStaticDataFieldInfo)template; + if (template instanceof NonStaticField) { + NonStaticField t = (NonStaticField)template; if (t.hasIsPrimaryKey()) { setIsPrimaryKey(t.isPrimaryKey()); } else { @@ -249,16 +225,16 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"NonStaticDataField\""); + str.append("{ \"$type\": \"NonStaticField\""); if (hasIsPrimaryKey()) { str.append(", \"isPrimaryKey\": ").append(isPrimaryKey()); } if (hasRelativeTo()) { str.append(", \"relativeTo\": \"").append(getRelativeTo()).append("\""); } - if (hasDataType()) { - str.append(", \"dataType\": "); - getDataType().toString(str); + if (hasType()) { + str.append(", \"type\": "); + getType().toString(str); } if (hasName()) { str.append(", \"name\": \"").append(getName()).append("\""); @@ -272,4 +248,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/RecordClassDescriptor.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/RecordClassDescriptor.java deleted file mode 100644 index f41b0d012..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/RecordClassDescriptor.java +++ /dev/null @@ -1,406 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import com.epam.deltix.timebase.messages.SchemaArrayType; -import com.epam.deltix.timebase.messages.SchemaDataType; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import com.epam.deltix.timebase.messages.TypeConstants; -import com.epam.deltix.util.collections.generated.ObjectArrayList; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; - -/** - * Schema definition for a class. - */ -@SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.RecordClassDescriptor", - title = "RecordClassDescriptor" -) -public class RecordClassDescriptor extends ClassDescriptor implements RecordClassDescriptorInterface { - public static final String CLASS_NAME = RecordClassDescriptor.class.getName(); - - /** - * Defines parent RecordClassDescriptor if exist. - */ - protected RecordClassDescriptorInfo parent = null; - - /** - * Defines if current RecordClassDescriptor is abstract. - */ - protected byte isAbstract = TypeConstants.BOOLEAN_NULL; - - /** - * Defines if current RecordClassDescriptor is content class. - */ - protected byte isContentClass = TypeConstants.BOOLEAN_NULL; - - /** - * List of fields of a class. - */ - protected ObjectArrayList dataFields = null; - - /** - * Defines parent RecordClassDescriptor if exist. - * @return Parent - */ - @SchemaElement - @SchemaType( - isNullable = true, - dataType = SchemaDataType.OBJECT, - nestedTypes = { - RecordClassDescriptor.class} - - ) - public RecordClassDescriptorInfo getParent() { - return parent; - } - - /** - * Defines parent RecordClassDescriptor if exist. - * @param value - Parent - */ - public void setParent(RecordClassDescriptorInfo value) { - this.parent = value; - } - - /** - * Defines parent RecordClassDescriptor if exist. - * @return true if Parent is not null - */ - public boolean hasParent() { - return parent != null; - } - - /** - * Defines parent RecordClassDescriptor if exist. - */ - public void nullifyParent() { - this.parent = null; - } - - /** - * Defines if current RecordClassDescriptor is abstract. - * @return Is Abstract - */ - @SchemaElement - @SchemaType( - isNullable = false - ) - public boolean isAbstract() { - return isAbstract == 1; - } - - /** - * Defines if current RecordClassDescriptor is abstract. - * @param value - Is Abstract - */ - public void setIsAbstract(boolean value) { - this.isAbstract = (byte)(value ? 1 : 0); - } - - /** - * Defines if current RecordClassDescriptor is abstract. - * @return true if Is Abstract is not null - */ - public boolean hasIsAbstract() { - return isAbstract != com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; - } - - /** - * Defines if current RecordClassDescriptor is abstract. - */ - public void nullifyIsAbstract() { - this.isAbstract = com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; - } - - /** - * Defines if current RecordClassDescriptor is content class. - * @return Is Content Class - */ - @SchemaElement - @SchemaType( - isNullable = true - ) - public boolean isContentClass() { - return isContentClass == 1; - } - - /** - * Defines if current RecordClassDescriptor is content class. - * @param value - Is Content Class - */ - public void setIsContentClass(boolean value) { - this.isContentClass = (byte)(value ? 1 : 0); - } - - /** - * Defines if current RecordClassDescriptor is content class. - * @return true if Is Content Class is not null - */ - public boolean hasIsContentClass() { - return isContentClass != com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; - } - - /** - * Defines if current RecordClassDescriptor is content class. - */ - public void nullifyIsContentClass() { - this.isContentClass = com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; - } - - /** - * List of fields of a class. - * @return Data Fields - */ - @SchemaElement - @SchemaArrayType( - isNullable = false, - isElementNullable = false, - elementTypes = { - StaticDataField.class, NonStaticDataField.class} - - ) - public ObjectArrayList getDataFields() { - return dataFields; - } - - /** - * List of fields of a class. - * @param value - Data Fields - */ - public void setDataFields(ObjectArrayList value) { - this.dataFields = value; - } - - /** - * List of fields of a class. - * @return true if Data Fields is not null - */ - public boolean hasDataFields() { - return dataFields != null; - } - - /** - * List of fields of a class. - */ - public void nullifyDataFields() { - this.dataFields = null; - } - - /** - * Creates new instance of this class. - * @return new instance of this class. - */ - @Override - protected RecordClassDescriptor createInstance() { - return new RecordClassDescriptor(); - } - - /** - * Method nullifies all instance properties - */ - @Override - public RecordClassDescriptor nullify() { - super.nullify(); - nullifyParent(); - nullifyIsAbstract(); - nullifyIsContentClass(); - nullifyDataFields(); - return this; - } - - /** - * Resets all instance properties to their default values - */ - @Override - public RecordClassDescriptor reset() { - super.reset(); - parent = null; - isAbstract = com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; - isContentClass = com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; - dataFields = null; - return this; - } - - /** - * Method copies state to a given instance - */ - @Override - public RecordClassDescriptor clone() { - RecordClassDescriptor t = createInstance(); - t.copyFrom(this); - return t; - } - - /** - * Indicates whether some other object is "equal to" this one. - */ - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - boolean superEquals = super.equals(obj); - if (!superEquals) return false; - if (!(obj instanceof RecordClassDescriptorInfo)) return false; - RecordClassDescriptorInfo other =(RecordClassDescriptorInfo)obj; - if (hasParent() != other.hasParent()) return false; - if (hasParent() && !(getParent().equals(other.getParent()))) return false; - if (hasIsAbstract() != other.hasIsAbstract()) return false; - if (hasIsAbstract() && isAbstract() != other.isAbstract()) return false; - if (hasIsContentClass() != other.hasIsContentClass()) return false; - if (hasIsContentClass() && isContentClass() != other.isContentClass()) return false; - if (hasDataFields() != other.hasDataFields()) return false; - if (hasDataFields()) { - if (getDataFields().size() != other.getDataFields().size()) return false; - else for (int j = 0; j < getDataFields().size(); ++j) { - if ((getDataFields().get(j) != null) != (other.getDataFields().get(j) != null)) return false; - if (getDataFields().get(j) != null && !getDataFields().get(j).equals(other.getDataFields().get(j))) return false; - } - } - return true; - } - - /** - * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. - */ - @Override - public int hashCode() { - int hash = super.hashCode(); - if (hasParent()) { - hash = hash * 31 + getParent().hashCode(); - } - if (hasIsAbstract()) { - hash = hash * 31 + (isAbstract() ? 1231 : 1237); - } - if (hasIsContentClass()) { - hash = hash * 31 + (isContentClass() ? 1231 : 1237); - } - if (hasDataFields()) { - for (int j = 0; j < getDataFields().size(); ++j) { - hash ^= getDataFields().get(j).hashCode(); - } - } - return hash; - } - - /** - * Method copies state to a given instance - * @param template class instance that should be used as a copy source - */ - @Override - public RecordClassDescriptor copyFrom(RecordInfo template) { - super.copyFrom(template); - if (template instanceof RecordClassDescriptorInfo) { - RecordClassDescriptorInfo t = (RecordClassDescriptorInfo)template; - if (t.hasParent()) { - if (hasParent() && getParent() instanceof RecordInterface) { - ((RecordInterface)getParent()).copyFrom(t.getParent()); - } else { - setParent((RecordClassDescriptorInfo)t.getParent().clone()); - } - } else { - nullifyParent(); - } - if (t.hasIsAbstract()) { - setIsAbstract(t.isAbstract()); - } else { - nullifyIsAbstract(); - } - if (t.hasIsContentClass()) { - setIsContentClass(t.isContentClass()); - } else { - nullifyIsContentClass(); - } - if (t.hasDataFields()) { - if (!hasDataFields()) { - setDataFields(new ObjectArrayList(t.getDataFields().size())); - } else { - getDataFields().clear(); - } - for (int i = 0; i < t.getDataFields().size(); ++i) ((ObjectArrayList)getDataFields()).add((DataFieldInfo)t.getDataFields().get(i).clone()); - } else { - nullifyDataFields(); - } - } - return this; - } - - /** - * @return a string representation of this class object. - */ - @Override - public String toString() { - StringBuilder str = new StringBuilder(); - return toString(str).toString(); - } - - /** - * @return a string representation of this class object. - */ - @Override - public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"RecordClassDescriptor\""); - if (hasParent()) { - str.append(", \"parent\": "); - getParent().toString(str); - } - if (hasIsAbstract()) { - str.append(", \"isAbstract\": ").append(isAbstract()); - } - if (hasIsContentClass()) { - str.append(", \"isContentClass\": ").append(isContentClass()); - } - if (hasDataFields()) { - str.append(", \"dataFields\": ["); - if (getDataFields().size() > 0) { - if (getDataFields().get(0) == null) { - str.append("null"); - } else { - getDataFields().get(0).toString(str); - } - } - for (int i = 1; i < getDataFields().size(); ++i) { - str.append(", "); - if (getDataFields().get(i) == null) { - str.append("null"); - } else { - getDataFields().get(i).toString(str); - } - } - str.append("]"); - } - if (hasGuid()) { - str.append(", \"guid\": \"").append(getGuid()).append("\""); - } - if (hasName()) { - str.append(", \"name\": \"").append(getName()).append("\""); - } - if (hasTitle()) { - str.append(", \"title\": \"").append(getTitle()).append("\""); - } - if (hasDescription()) { - str.append(", \"description\": \"").append(getDescription()).append("\""); - } - str.append("}"); - return str; - } -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/RecordClassDescriptorInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/RecordClassDescriptorInfo.java deleted file mode 100644 index 169b58e20..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/RecordClassDescriptorInfo.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.util.collections.generated.ObjectList; -import java.lang.Override; - -/** - * Schema definition for a class. - */ -public interface RecordClassDescriptorInfo extends ClassDescriptorInfo { - /** - * Defines parent RecordClassDescriptor if exist. - * @return Parent - */ - RecordClassDescriptorInfo getParent(); - - /** - * Defines parent RecordClassDescriptor if exist. - * @return true if Parent is not null - */ - boolean hasParent(); - - /** - * Defines if current RecordClassDescriptor is abstract. - * @return Is Abstract - */ - boolean isAbstract(); - - /** - * Defines if current RecordClassDescriptor is abstract. - * @return true if Is Abstract is not null - */ - boolean hasIsAbstract(); - - /** - * Defines if current RecordClassDescriptor is content class. - * @return Is Content Class - */ - boolean isContentClass(); - - /** - * Defines if current RecordClassDescriptor is content class. - * @return true if Is Content Class is not null - */ - boolean hasIsContentClass(); - - /** - * List of fields of a class. - * @return Data Fields - */ - ObjectList getDataFields(); - - /** - * List of fields of a class. - * @return true if Data Fields is not null - */ - boolean hasDataFields(); - - /** - * Method copies state to a given instance - */ - @Override - RecordClassDescriptorInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/RecordClassDescriptorInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/RecordClassDescriptorInterface.java deleted file mode 100644 index f197e8ff1..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/RecordClassDescriptorInterface.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.util.collections.generated.ObjectArrayList; -import java.lang.Override; - -/** - * Schema definition for a class. - */ -public interface RecordClassDescriptorInterface extends RecordClassDescriptorInfo, ClassDescriptorInterface { - /** - * Defines parent RecordClassDescriptor if exist. - * @param value - Parent - */ - void setParent(RecordClassDescriptorInfo value); - - /** - * Defines parent RecordClassDescriptor if exist. - */ - void nullifyParent(); - - /** - * Defines if current RecordClassDescriptor is abstract. - * @param value - Is Abstract - */ - void setIsAbstract(boolean value); - - /** - * Defines if current RecordClassDescriptor is abstract. - */ - void nullifyIsAbstract(); - - /** - * Defines if current RecordClassDescriptor is content class. - * @param value - Is Content Class - */ - void setIsContentClass(boolean value); - - /** - * Defines if current RecordClassDescriptor is content class. - */ - void nullifyIsContentClass(); - - /** - * List of fields of a class. - * @param value - Data Fields - */ - void setDataFields(ObjectArrayList value); - - /** - * List of fields of a class. - */ - void nullifyDataFields(); - - /** - * Method nullifies all instance properties - */ - @Override - RecordClassDescriptorInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - RecordClassDescriptorInterface reset(); - - @Override - RecordClassDescriptorInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaChangeMessage.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaChangeMessage.java index 46e504b5d..8eefe94a4 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaChangeMessage.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaChangeMessage.java @@ -1,31 +1,7 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.InstrumentMessage; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.SchemaArrayType; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.TypeConstants; +import com.epam.deltix.timebase.messages.*; import com.epam.deltix.util.collections.generated.ObjectArrayList; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; /** * Message tha defines a change in stream schema. @@ -34,23 +10,23 @@ name = "com.epam.deltix.timebase.messages.schema.SchemaChangeMessage", title = "SchemaChangeMessage" ) -public class SchemaChangeMessage extends InstrumentMessage implements SchemaChangeMessageInterface { +public class SchemaChangeMessage extends InstrumentMessage implements RecordInterface { public static final String CLASS_NAME = SchemaChangeMessage.class.getName(); /** * Previous schema state. */ - protected ObjectArrayList previousState = null; + protected ObjectArrayList previousState = null; /** * New schema state. */ - protected ObjectArrayList newState = null; + protected ObjectArrayList newState = null; /** * New schema state. */ - protected ObjectArrayList descriptorChangeActions = null; + protected ObjectArrayList descriptorChangeActions = null; /** * Message version @@ -66,10 +42,10 @@ public class SchemaChangeMessage extends InstrumentMessage implements SchemaChan isNullable = true, isElementNullable = false, elementTypes = { - RecordClassDescriptor.class, EnumClassDescriptor.class} + TypeDescriptor.class, EnumDescriptor.class} ) - public ObjectArrayList getPreviousState() { + public ObjectArrayList getPreviousState() { return previousState; } @@ -77,7 +53,7 @@ public ObjectArrayList getPreviousState() { * Previous schema state. * @param value - Previous State */ - public void setPreviousState(ObjectArrayList value) { + public void setPreviousState(ObjectArrayList value) { this.previousState = value; } @@ -105,10 +81,10 @@ public void nullifyPreviousState() { isNullable = false, isElementNullable = false, elementTypes = { - RecordClassDescriptor.class, EnumClassDescriptor.class} + TypeDescriptor.class, EnumDescriptor.class} ) - public ObjectArrayList getNewState() { + public ObjectArrayList getNewState() { return newState; } @@ -116,7 +92,7 @@ public ObjectArrayList getNewState() { * New schema state. * @param value - New State */ - public void setNewState(ObjectArrayList value) { + public void setNewState(ObjectArrayList value) { this.newState = value; } @@ -147,7 +123,7 @@ public void nullifyNewState() { SchemaDescriptorChangeAction.class} ) - public ObjectArrayList getDescriptorChangeActions() { + public ObjectArrayList getDescriptorChangeActions() { return descriptorChangeActions; } @@ -155,7 +131,7 @@ public ObjectArrayList getDescriptorChangeActi * New schema state. * @param value - Descriptor Change Actions */ - public void setDescriptorChangeActions(ObjectArrayList value) { + public void setDescriptorChangeActions(ObjectArrayList value) { this.descriptorChangeActions = value; } @@ -196,14 +172,14 @@ public void setVersion(long value) { * @return true if Version is not null */ public boolean hasVersion() { - return version != com.epam.deltix.timebase.messages.TypeConstants.INT64_NULL; + return version != TypeConstants.INT64_NULL; } /** * Message version */ public void nullifyVersion() { - this.version = com.epam.deltix.timebase.messages.TypeConstants.INT64_NULL; + this.version = TypeConstants.INT64_NULL; } /** @@ -237,7 +213,7 @@ public SchemaChangeMessage reset() { previousState = null; newState = null; descriptorChangeActions = null; - version = com.epam.deltix.timebase.messages.TypeConstants.INT64_NULL; + version = TypeConstants.INT64_NULL; return this; } @@ -259,8 +235,8 @@ public boolean equals(Object obj) { if (this == obj) return true; boolean superEquals = super.equals(obj); if (!superEquals) return false; - if (!(obj instanceof SchemaChangeMessageInfo)) return false; - SchemaChangeMessageInfo other =(SchemaChangeMessageInfo)obj; + if (!(obj instanceof SchemaChangeMessage)) return false; + SchemaChangeMessage other =(SchemaChangeMessage)obj; if (hasPreviousState() != other.hasPreviousState()) return false; if (hasPreviousState()) { if (getPreviousState().size() != other.getPreviousState().size()) return false; @@ -324,35 +300,35 @@ public int hashCode() { @Override public SchemaChangeMessage copyFrom(RecordInfo template) { super.copyFrom(template); - if (template instanceof SchemaChangeMessageInfo) { - SchemaChangeMessageInfo t = (SchemaChangeMessageInfo)template; + if (template instanceof SchemaChangeMessage) { + SchemaChangeMessage t = (SchemaChangeMessage)template; if (t.hasPreviousState()) { if (!hasPreviousState()) { - setPreviousState(new ObjectArrayList(t.getPreviousState().size())); + setPreviousState(new ObjectArrayList(t.getPreviousState().size())); } else { getPreviousState().clear(); } - for (int i = 0; i < t.getPreviousState().size(); ++i) ((ObjectArrayList)getPreviousState()).add((ClassDescriptorInfo)t.getPreviousState().get(i).clone()); + for (int i = 0; i < t.getPreviousState().size(); ++i) ((ObjectArrayList)getPreviousState()).add((UniqueDescriptor)t.getPreviousState().get(i).clone()); } else { nullifyPreviousState(); } if (t.hasNewState()) { if (!hasNewState()) { - setNewState(new ObjectArrayList(t.getNewState().size())); + setNewState(new ObjectArrayList(t.getNewState().size())); } else { getNewState().clear(); } - for (int i = 0; i < t.getNewState().size(); ++i) ((ObjectArrayList)getNewState()).add((ClassDescriptorInfo)t.getNewState().get(i).clone()); + for (int i = 0; i < t.getNewState().size(); ++i) ((ObjectArrayList)getNewState()).add((UniqueDescriptor)t.getNewState().get(i).clone()); } else { nullifyNewState(); } if (t.hasDescriptorChangeActions()) { if (!hasDescriptorChangeActions()) { - setDescriptorChangeActions(new ObjectArrayList(t.getDescriptorChangeActions().size())); + setDescriptorChangeActions(new ObjectArrayList(t.getDescriptorChangeActions().size())); } else { getDescriptorChangeActions().clear(); } - for (int i = 0; i < t.getDescriptorChangeActions().size(); ++i) ((ObjectArrayList)getDescriptorChangeActions()).add((SchemaDescriptorChangeActionInfo)t.getDescriptorChangeActions().get(i).clone()); + for (int i = 0; i < t.getDescriptorChangeActions().size(); ++i) ((ObjectArrayList)getDescriptorChangeActions()).add((SchemaDescriptorChangeAction)t.getDescriptorChangeActions().get(i).clone()); } else { nullifyDescriptorChangeActions(); } @@ -449,4 +425,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaChangeMessageInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaChangeMessageInfo.java deleted file mode 100644 index 69209351e..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaChangeMessageInfo.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.MessageInfo; -import com.epam.deltix.util.collections.generated.ObjectList; -import java.lang.Override; - -/** - * Message tha defines a change in stream schema. - */ -public interface SchemaChangeMessageInfo extends MessageInfo { - /** - * Previous schema state. - * @return Previous State - */ - ObjectList getPreviousState(); - - /** - * Previous schema state. - * @return true if Previous State is not null - */ - boolean hasPreviousState(); - - /** - * New schema state. - * @return New State - */ - ObjectList getNewState(); - - /** - * New schema state. - * @return true if New State is not null - */ - boolean hasNewState(); - - /** - * New schema state. - * @return Descriptor Change Actions - */ - ObjectList getDescriptorChangeActions(); - - /** - * New schema state. - * @return true if Descriptor Change Actions is not null - */ - boolean hasDescriptorChangeActions(); - - /** - * Message version - * @return Version - */ - long getVersion(); - - /** - * Message version - * @return true if Version is not null - */ - boolean hasVersion(); - - /** - * Method copies state to a given instance - */ - @Override - SchemaChangeMessageInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaChangeMessageInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaChangeMessageInterface.java deleted file mode 100644 index 76f0fa767..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaChangeMessageInterface.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.MessageInterface; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.util.collections.generated.ObjectArrayList; -import java.lang.Override; - -/** - * Message tha defines a change in stream schema. - */ -public interface SchemaChangeMessageInterface extends SchemaChangeMessageInfo, MessageInterface { - /** - * Previous schema state. - * @param value - Previous State - */ - void setPreviousState(ObjectArrayList value); - - /** - * Previous schema state. - */ - void nullifyPreviousState(); - - /** - * New schema state. - * @param value - New State - */ - void setNewState(ObjectArrayList value); - - /** - * New schema state. - */ - void nullifyNewState(); - - /** - * New schema state. - * @param value - Descriptor Change Actions - */ - void setDescriptorChangeActions(ObjectArrayList value); - - /** - * New schema state. - */ - void nullifyDescriptorChangeActions(); - - /** - * Message version - * @param value - Version - */ - void setVersion(long value); - - /** - * Message version - */ - void nullifyVersion(); - - /** - * Method nullifies all instance properties - */ - @Override - SchemaChangeMessageInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - SchemaChangeMessageInterface reset(); - - @Override - SchemaChangeMessageInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorChangeAction.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorChangeAction.java index e7a791b63..5b27698cf 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorChangeAction.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorChangeAction.java @@ -1,32 +1,7 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import com.epam.deltix.timebase.messages.SchemaArrayType; -import com.epam.deltix.timebase.messages.SchemaDataType; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; +import com.epam.deltix.timebase.messages.*; import com.epam.deltix.util.collections.generated.ObjectArrayList; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; /** * Class which defines a change to schema descriptor. @@ -35,18 +10,18 @@ name = "com.epam.deltix.timebase.messages.schema.SchemaDescriptorChangeAction", title = "SchemaDescriptorChangeAction" ) -public class SchemaDescriptorChangeAction implements SchemaDescriptorChangeActionInterface { +public class SchemaDescriptorChangeAction implements RecordInterface { public static final String CLASS_NAME = SchemaDescriptorChangeAction.class.getName(); /** * Previous descriptor state. */ - protected ClassDescriptorInfo previousState = null; + protected UniqueDescriptor previousState = null; /** * New descriptor state. */ - protected ClassDescriptorInfo newState = null; + protected UniqueDescriptor newState = null; /** * Bitmask that defines the changes that were applied to the descriptor. @@ -56,13 +31,13 @@ public class SchemaDescriptorChangeAction implements SchemaDescriptorChangeActio /** * Defines the data transformation that was applied to the descriptor. */ - protected SchemaDescriptorTransformationInfo descriptorTransformation = null; + protected SchemaDescriptorTransformation descriptorTransformation = null; /** * A list of change actions to data fields. * Populated only if ChangeTypes contains ALTER flag */ - protected ObjectArrayList fieldChangeActions = null; + protected ObjectArrayList fieldChangeActions = null; /** * Previous descriptor state. @@ -73,10 +48,10 @@ public class SchemaDescriptorChangeAction implements SchemaDescriptorChangeActio isNullable = true, dataType = SchemaDataType.OBJECT, nestedTypes = { - RecordClassDescriptor.class, EnumClassDescriptor.class} + TypeDescriptor.class, EnumDescriptor.class} ) - public ClassDescriptorInfo getPreviousState() { + public UniqueDescriptor getPreviousState() { return previousState; } @@ -84,7 +59,7 @@ public ClassDescriptorInfo getPreviousState() { * Previous descriptor state. * @param value - Previous State */ - public void setPreviousState(ClassDescriptorInfo value) { + public void setPreviousState(UniqueDescriptor value) { this.previousState = value; } @@ -112,10 +87,10 @@ public void nullifyPreviousState() { isNullable = true, dataType = SchemaDataType.OBJECT, nestedTypes = { - RecordClassDescriptor.class, EnumClassDescriptor.class} + TypeDescriptor.class, EnumDescriptor.class} ) - public ClassDescriptorInfo getNewState() { + public UniqueDescriptor getNewState() { return newState; } @@ -123,7 +98,7 @@ public ClassDescriptorInfo getNewState() { * New descriptor state. * @param value - New State */ - public void setNewState(ClassDescriptorInfo value) { + public void setNewState(UniqueDescriptor value) { this.newState = value; } @@ -189,7 +164,7 @@ public void nullifyChangeTypes() { SchemaDescriptorTransformation.class} ) - public SchemaDescriptorTransformationInfo getDescriptorTransformation() { + public SchemaDescriptorTransformation getDescriptorTransformation() { return descriptorTransformation; } @@ -197,7 +172,7 @@ public SchemaDescriptorTransformationInfo getDescriptorTransformation() { * Defines the data transformation that was applied to the descriptor. * @param value - Descriptor Transformation */ - public void setDescriptorTransformation(SchemaDescriptorTransformationInfo value) { + public void setDescriptorTransformation(SchemaDescriptorTransformation value) { this.descriptorTransformation = value; } @@ -229,7 +204,7 @@ public void nullifyDescriptorTransformation() { SchemaFieldChangeAction.class} ) - public ObjectArrayList getFieldChangeActions() { + public ObjectArrayList getFieldChangeActions() { return fieldChangeActions; } @@ -238,7 +213,7 @@ public ObjectArrayList getFieldChangeActions() { * Populated only if ChangeTypes contains ALTER flag * @param value - Field Change Actions */ - public void setFieldChangeActions(ObjectArrayList value) { + public void setFieldChangeActions(ObjectArrayList value) { this.fieldChangeActions = value; } @@ -306,8 +281,8 @@ public SchemaDescriptorChangeAction clone() { @Override public boolean equals(Object obj) { if (this == obj) return true; - if (!(obj instanceof SchemaDescriptorChangeActionInfo)) return false; - SchemaDescriptorChangeActionInfo other =(SchemaDescriptorChangeActionInfo)obj; + if (!(obj instanceof SchemaDescriptorChangeAction)) return false; + SchemaDescriptorChangeAction other =(SchemaDescriptorChangeAction)obj; if (hasPreviousState() != other.hasPreviousState()) return false; if (hasPreviousState() && !(getPreviousState().equals(other.getPreviousState()))) return false; if (hasNewState() != other.hasNewState()) return false; @@ -358,23 +333,15 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ public SchemaDescriptorChangeAction copyFrom(RecordInfo template) { - if (template instanceof SchemaDescriptorChangeActionInfo) { - SchemaDescriptorChangeActionInfo t = (SchemaDescriptorChangeActionInfo)template; + if (template instanceof SchemaDescriptorChangeAction) { + SchemaDescriptorChangeAction t = (SchemaDescriptorChangeAction)template; if (t.hasPreviousState()) { - if (hasPreviousState() && getPreviousState() instanceof RecordInterface) { - ((RecordInterface)getPreviousState()).copyFrom(t.getPreviousState()); - } else { - setPreviousState((ClassDescriptorInfo)t.getPreviousState().clone()); - } + t.setPreviousState((UniqueDescriptor) getPreviousState().clone()); } else { nullifyPreviousState(); } if (t.hasNewState()) { - if (hasNewState() && getNewState() instanceof RecordInterface) { - ((RecordInterface)getNewState()).copyFrom(t.getNewState()); - } else { - setNewState((ClassDescriptorInfo)t.getNewState().clone()); - } + t.setNewState((UniqueDescriptor) getNewState().clone()); } else { nullifyNewState(); } @@ -384,21 +351,17 @@ public SchemaDescriptorChangeAction copyFrom(RecordInfo template) { nullifyChangeTypes(); } if (t.hasDescriptorTransformation()) { - if (hasDescriptorTransformation() && getDescriptorTransformation() instanceof RecordInterface) { - ((RecordInterface)getDescriptorTransformation()).copyFrom(t.getDescriptorTransformation()); - } else { - setDescriptorTransformation((SchemaDescriptorTransformationInfo)t.getDescriptorTransformation().clone()); - } + t.setDescriptorTransformation((SchemaDescriptorTransformation) getDescriptorTransformation().clone()); } else { nullifyDescriptorTransformation(); } if (t.hasFieldChangeActions()) { if (!hasFieldChangeActions()) { - setFieldChangeActions(new ObjectArrayList(t.getFieldChangeActions().size())); + setFieldChangeActions(new ObjectArrayList(t.getFieldChangeActions().size())); } else { getFieldChangeActions().clear(); } - for (int i = 0; i < t.getFieldChangeActions().size(); ++i) ((ObjectArrayList)getFieldChangeActions()).add((SchemaFieldChangeActionInfo)t.getFieldChangeActions().get(i).clone()); + for (int i = 0; i < t.getFieldChangeActions().size(); ++i) ((ObjectArrayList)getFieldChangeActions()).add((SchemaFieldChangeAction)t.getFieldChangeActions().get(i).clone()); } else { nullifyFieldChangeActions(); } @@ -458,4 +421,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorChangeActionInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorChangeActionInfo.java deleted file mode 100644 index 813bc7075..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorChangeActionInfo.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.util.collections.generated.ObjectList; -import java.lang.Override; - -/** - * Class which defines a change to schema descriptor. - */ -public interface SchemaDescriptorChangeActionInfo extends RecordInfo { - /** - * Previous descriptor state. - * @return Previous State - */ - ClassDescriptorInfo getPreviousState(); - - /** - * Previous descriptor state. - * @return true if Previous State is not null - */ - boolean hasPreviousState(); - - /** - * New descriptor state. - * @return New State - */ - ClassDescriptorInfo getNewState(); - - /** - * New descriptor state. - * @return true if New State is not null - */ - boolean hasNewState(); - - /** - * Bitmask that defines the changes that were applied to the descriptor. - * @return Change Types - */ - SchemaDescriptorChangeType getChangeTypes(); - - /** - * Bitmask that defines the changes that were applied to the descriptor. - * @return true if Change Types is not null - */ - boolean hasChangeTypes(); - - /** - * Defines the data transformation that was applied to the descriptor. - * @return Descriptor Transformation - */ - SchemaDescriptorTransformationInfo getDescriptorTransformation(); - - /** - * Defines the data transformation that was applied to the descriptor. - * @return true if Descriptor Transformation is not null - */ - boolean hasDescriptorTransformation(); - - /** - * A list of change actions to data fields. - * Populated only if ChangeTypes contains ALTER flag - * @return Field Change Actions - */ - ObjectList getFieldChangeActions(); - - /** - * A list of change actions to data fields. - * Populated only if ChangeTypes contains ALTER flag - * @return true if Field Change Actions is not null - */ - boolean hasFieldChangeActions(); - - /** - * Method copies state to a given instance - */ - @Override - SchemaDescriptorChangeActionInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorChangeActionInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorChangeActionInterface.java deleted file mode 100644 index 4c14508e1..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorChangeActionInterface.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import com.epam.deltix.util.collections.generated.ObjectArrayList; -import java.lang.Override; - -/** - * Class which defines a change to schema descriptor. - */ -public interface SchemaDescriptorChangeActionInterface extends SchemaDescriptorChangeActionInfo, RecordInterface { - /** - * Previous descriptor state. - * @param value - Previous State - */ - void setPreviousState(ClassDescriptorInfo value); - - /** - * Previous descriptor state. - */ - void nullifyPreviousState(); - - /** - * New descriptor state. - * @param value - New State - */ - void setNewState(ClassDescriptorInfo value); - - /** - * New descriptor state. - */ - void nullifyNewState(); - - /** - * Bitmask that defines the changes that were applied to the descriptor. - * @param value - Change Types - */ - void setChangeTypes(SchemaDescriptorChangeType value); - - /** - * Bitmask that defines the changes that were applied to the descriptor. - */ - void nullifyChangeTypes(); - - /** - * Defines the data transformation that was applied to the descriptor. - * @param value - Descriptor Transformation - */ - void setDescriptorTransformation(SchemaDescriptorTransformationInfo value); - - /** - * Defines the data transformation that was applied to the descriptor. - */ - void nullifyDescriptorTransformation(); - - /** - * A list of change actions to data fields. - * Populated only if ChangeTypes contains ALTER flag - * @param value - Field Change Actions - */ - void setFieldChangeActions(ObjectArrayList value); - - /** - * A list of change actions to data fields. - * Populated only if ChangeTypes contains ALTER flag - */ - void nullifyFieldChangeActions(); - - /** - * Method nullifies all instance properties - */ - @Override - SchemaDescriptorChangeActionInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - SchemaDescriptorChangeActionInterface reset(); - - @Override - SchemaDescriptorChangeActionInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorChangeType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorChangeType.java index af9838542..7d898768f 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorChangeType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorChangeType.java @@ -1,28 +1,10 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.Bitmask; import com.epam.deltix.timebase.messages.SchemaElement; /** * Type of descriptor change. */ -@Bitmask @SchemaElement( name = "com.epam.deltix.timebase.messages.schema.SchemaDescriptorChangeType", title = "SchemaDescriptorChangeType" @@ -96,4 +78,4 @@ public static SchemaDescriptorChangeType strictValueOf(int number) { } return value; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorTransformation.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorTransformation.java index 20b13cbde..990d6169b 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorTransformation.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorTransformation.java @@ -1,28 +1,9 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.RecordInterface; import com.epam.deltix.timebase.messages.SchemaElement; import com.epam.deltix.timebase.messages.SchemaType; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; /** * Class which defines a transformation that is applied to the descriptor. @@ -31,7 +12,7 @@ name = "com.epam.deltix.timebase.messages.schema.SchemaDescriptorTransformation", title = "SchemaDescriptorTransformation" ) -public class SchemaDescriptorTransformation implements SchemaDescriptorTransformationInterface { +public class SchemaDescriptorTransformation implements RecordInterface { public static final String CLASS_NAME = SchemaDescriptorTransformation.class.getName(); /** @@ -113,8 +94,8 @@ public SchemaDescriptorTransformation clone() { @Override public boolean equals(Object obj) { if (this == obj) return true; - if (!(obj instanceof SchemaDescriptorTransformationInfo)) return false; - SchemaDescriptorTransformationInfo other =(SchemaDescriptorTransformationInfo)obj; + if (!(obj instanceof SchemaDescriptorTransformation)) return false; + SchemaDescriptorTransformation other =(SchemaDescriptorTransformation)obj; if (hasTransformationType() != other.hasTransformationType()) return false; if (hasTransformationType() && getTransformationType() != other.getTransformationType()) return false; return true; @@ -137,8 +118,8 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ public SchemaDescriptorTransformation copyFrom(RecordInfo template) { - if (template instanceof SchemaDescriptorTransformationInfo) { - SchemaDescriptorTransformationInfo t = (SchemaDescriptorTransformationInfo)template; + if (template instanceof SchemaDescriptorTransformation) { + SchemaDescriptorTransformation t = (SchemaDescriptorTransformation)template; if (t.hasTransformationType()) { setTransformationType(t.getTransformationType()); } else { @@ -169,4 +150,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorTransformationInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorTransformationInfo.java deleted file mode 100644 index 69276460b..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorTransformationInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.Override; - -/** - * Class which defines a transformation that is applied to the descriptor. - */ -public interface SchemaDescriptorTransformationInfo extends RecordInfo { - /** - * Defines the transformation type that was applied to the descriptor. - * @return Transformation Type - */ - SchemaDescriptorTransformationType getTransformationType(); - - /** - * Defines the transformation type that was applied to the descriptor. - * @return true if Transformation Type is not null - */ - boolean hasTransformationType(); - - /** - * Method copies state to a given instance - */ - @Override - SchemaDescriptorTransformationInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorTransformationInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorTransformationInterface.java deleted file mode 100644 index 8d7d9a06c..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorTransformationInterface.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import java.lang.Override; - -/** - * Class which defines a transformation that is applied to the descriptor. - */ -public interface SchemaDescriptorTransformationInterface extends SchemaDescriptorTransformationInfo, RecordInterface { - /** - * Defines the transformation type that was applied to the descriptor. - * @param value - Transformation Type - */ - void setTransformationType(SchemaDescriptorTransformationType value); - - /** - * Defines the transformation type that was applied to the descriptor. - */ - void nullifyTransformationType(); - - /** - * Method nullifies all instance properties - */ - @Override - SchemaDescriptorTransformationInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - SchemaDescriptorTransformationInterface reset(); - - @Override - SchemaDescriptorTransformationInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorTransformationType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorTransformationType.java index 5e6f4f64e..1e0d727e2 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorTransformationType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaDescriptorTransformationType.java @@ -1,19 +1,3 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; import com.epam.deltix.timebase.messages.SchemaElement; @@ -58,4 +42,4 @@ public static SchemaDescriptorTransformationType strictValueOf(int number) { } return value; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldChangeAction.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldChangeAction.java index 3e62a241f..514086761 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldChangeAction.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldChangeAction.java @@ -1,30 +1,6 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import com.epam.deltix.timebase.messages.SchemaDataType; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; +import com.epam.deltix.timebase.messages.*; /** * Class which defines a change to schema field. @@ -33,18 +9,18 @@ name = "com.epam.deltix.timebase.messages.schema.SchemaFieldChangeAction", title = "SchemaFieldChangeAction" ) -public class SchemaFieldChangeAction implements SchemaFieldChangeActionInterface { +public class SchemaFieldChangeAction implements RecordInterface { public static final String CLASS_NAME = SchemaFieldChangeAction.class.getName(); /** * Previous data field state. */ - protected DataFieldInfo previousState = null; + protected Field previousState = null; /** * New descriptor state. */ - protected DataFieldInfo newState = null; + protected Field newState = null; /** * Bitmask that defines the changes that were applied to the field. @@ -54,7 +30,7 @@ public class SchemaFieldChangeAction implements SchemaFieldChangeActionInterface /** * Defines the data transformation that was applied to the field. */ - protected SchemaFieldDataTransformationInfo dataTransformation = null; + protected SchemaFieldDataTransformation dataTransformation = null; /** * Previous data field state. @@ -65,10 +41,10 @@ public class SchemaFieldChangeAction implements SchemaFieldChangeActionInterface isNullable = true, dataType = SchemaDataType.OBJECT, nestedTypes = { - StaticDataField.class, NonStaticDataField.class} + StaticField.class, NonStaticField.class} ) - public DataFieldInfo getPreviousState() { + public Field getPreviousState() { return previousState; } @@ -76,7 +52,7 @@ public DataFieldInfo getPreviousState() { * Previous data field state. * @param value - Previous State */ - public void setPreviousState(DataFieldInfo value) { + public void setPreviousState(Field value) { this.previousState = value; } @@ -104,10 +80,10 @@ public void nullifyPreviousState() { isNullable = true, dataType = SchemaDataType.OBJECT, nestedTypes = { - StaticDataField.class, NonStaticDataField.class} + StaticField.class, NonStaticField.class} ) - public DataFieldInfo getNewState() { + public Field getNewState() { return newState; } @@ -115,7 +91,7 @@ public DataFieldInfo getNewState() { * New descriptor state. * @param value - New State */ - public void setNewState(DataFieldInfo value) { + public void setNewState(Field value) { this.newState = value; } @@ -181,7 +157,7 @@ public void nullifyChangeTypes() { SchemaFieldDataTransformation.class} ) - public SchemaFieldDataTransformationInfo getDataTransformation() { + public SchemaFieldDataTransformation getDataTransformation() { return dataTransformation; } @@ -189,7 +165,7 @@ public SchemaFieldDataTransformationInfo getDataTransformation() { * Defines the data transformation that was applied to the field. * @param value - Data Transformation */ - public void setDataTransformation(SchemaFieldDataTransformationInfo value) { + public void setDataTransformation(SchemaFieldDataTransformation value) { this.dataTransformation = value; } @@ -253,8 +229,8 @@ public SchemaFieldChangeAction clone() { @Override public boolean equals(Object obj) { if (this == obj) return true; - if (!(obj instanceof SchemaFieldChangeActionInfo)) return false; - SchemaFieldChangeActionInfo other =(SchemaFieldChangeActionInfo)obj; + if (!(obj instanceof SchemaFieldChangeAction)) return false; + SchemaFieldChangeAction other =(SchemaFieldChangeAction)obj; if (hasPreviousState() != other.hasPreviousState()) return false; if (hasPreviousState() && !(getPreviousState().equals(other.getPreviousState()))) return false; if (hasNewState() != other.hasNewState()) return false; @@ -292,23 +268,15 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ public SchemaFieldChangeAction copyFrom(RecordInfo template) { - if (template instanceof SchemaFieldChangeActionInfo) { - SchemaFieldChangeActionInfo t = (SchemaFieldChangeActionInfo)template; + if (template instanceof SchemaFieldChangeAction) { + SchemaFieldChangeAction t = (SchemaFieldChangeAction)template; if (t.hasPreviousState()) { - if (hasPreviousState() && getPreviousState() instanceof RecordInterface) { - ((RecordInterface)getPreviousState()).copyFrom(t.getPreviousState()); - } else { - setPreviousState((DataFieldInfo)t.getPreviousState().clone()); - } + t.setPreviousState((Field) getPreviousState().clone()); } else { nullifyPreviousState(); } if (t.hasNewState()) { - if (hasNewState() && getNewState() instanceof RecordInterface) { - ((RecordInterface)getNewState()).copyFrom(t.getNewState()); - } else { - setNewState((DataFieldInfo)t.getNewState().clone()); - } + t.setNewState((Field) getNewState().clone()); } else { nullifyNewState(); } @@ -318,11 +286,7 @@ public SchemaFieldChangeAction copyFrom(RecordInfo template) { nullifyChangeTypes(); } if (t.hasDataTransformation()) { - if (hasDataTransformation() && getDataTransformation() instanceof RecordInterface) { - ((RecordInterface)getDataTransformation()).copyFrom(t.getDataTransformation()); - } else { - setDataTransformation((SchemaFieldDataTransformationInfo)t.getDataTransformation().clone()); - } + t.setDataTransformation((SchemaFieldDataTransformation) getDataTransformation().clone()); } else { nullifyDataTransformation(); } @@ -363,4 +327,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldChangeActionInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldChangeActionInfo.java deleted file mode 100644 index 62e35e41c..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldChangeActionInfo.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.Override; - -/** - * Class which defines a change to schema field. - */ -public interface SchemaFieldChangeActionInfo extends RecordInfo { - /** - * Previous data field state. - * @return Previous State - */ - DataFieldInfo getPreviousState(); - - /** - * Previous data field state. - * @return true if Previous State is not null - */ - boolean hasPreviousState(); - - /** - * New descriptor state. - * @return New State - */ - DataFieldInfo getNewState(); - - /** - * New descriptor state. - * @return true if New State is not null - */ - boolean hasNewState(); - - /** - * Bitmask that defines the changes that were applied to the field. - * @return Change Types - */ - SchemaFieldChangeType getChangeTypes(); - - /** - * Bitmask that defines the changes that were applied to the field. - * @return true if Change Types is not null - */ - boolean hasChangeTypes(); - - /** - * Defines the data transformation that was applied to the field. - * @return Data Transformation - */ - SchemaFieldDataTransformationInfo getDataTransformation(); - - /** - * Defines the data transformation that was applied to the field. - * @return true if Data Transformation is not null - */ - boolean hasDataTransformation(); - - /** - * Method copies state to a given instance - */ - @Override - SchemaFieldChangeActionInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldChangeActionInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldChangeActionInterface.java deleted file mode 100644 index abd66de0a..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldChangeActionInterface.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import java.lang.Override; - -/** - * Class which defines a change to schema field. - */ -public interface SchemaFieldChangeActionInterface extends SchemaFieldChangeActionInfo, RecordInterface { - /** - * Previous data field state. - * @param value - Previous State - */ - void setPreviousState(DataFieldInfo value); - - /** - * Previous data field state. - */ - void nullifyPreviousState(); - - /** - * New descriptor state. - * @param value - New State - */ - void setNewState(DataFieldInfo value); - - /** - * New descriptor state. - */ - void nullifyNewState(); - - /** - * Bitmask that defines the changes that were applied to the field. - * @param value - Change Types - */ - void setChangeTypes(SchemaFieldChangeType value); - - /** - * Bitmask that defines the changes that were applied to the field. - */ - void nullifyChangeTypes(); - - /** - * Defines the data transformation that was applied to the field. - * @param value - Data Transformation - */ - void setDataTransformation(SchemaFieldDataTransformationInfo value); - - /** - * Defines the data transformation that was applied to the field. - */ - void nullifyDataTransformation(); - - /** - * Method nullifies all instance properties - */ - @Override - SchemaFieldChangeActionInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - SchemaFieldChangeActionInterface reset(); - - @Override - SchemaFieldChangeActionInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldChangeType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldChangeType.java index 24e0646ea..fa955e085 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldChangeType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldChangeType.java @@ -1,28 +1,10 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.Bitmask; import com.epam.deltix.timebase.messages.SchemaElement; /** * Type of field change. */ -@Bitmask @SchemaElement( name = "com.epam.deltix.timebase.messages.schema.SchemaFieldChangeType", title = "SchemaFieldChangeType" @@ -150,4 +132,4 @@ public static SchemaFieldChangeType strictValueOf(int number) { } return value; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldDataTransformation.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldDataTransformation.java index e619eaab3..b9b242f68 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldDataTransformation.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldDataTransformation.java @@ -1,32 +1,12 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import java.lang.CharSequence; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; import com.epam.deltix.containers.BinaryAsciiString; import com.epam.deltix.containers.CharSequenceUtils; import com.epam.deltix.containers.MutableString; +import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.RecordInterface; +import com.epam.deltix.timebase.messages.SchemaElement; +import com.epam.deltix.timebase.messages.SchemaType; /** * Class which defines a transformation that is applied to a data field. @@ -35,7 +15,7 @@ name = "com.epam.deltix.timebase.messages.schema.SchemaFieldDataTransformation", title = "SchemaFieldDataTransformation" ) -public class SchemaFieldDataTransformation implements SchemaFieldDataTransformationInterface { +public class SchemaFieldDataTransformation implements RecordInterface { public static final String CLASS_NAME = SchemaFieldDataTransformation.class.getName(); /** @@ -159,8 +139,8 @@ public SchemaFieldDataTransformation clone() { @Override public boolean equals(Object obj) { if (this == obj) return true; - if (!(obj instanceof SchemaFieldDataTransformationInfo)) return false; - SchemaFieldDataTransformationInfo other =(SchemaFieldDataTransformationInfo)obj; + if (!(obj instanceof SchemaFieldDataTransformation)) return false; + SchemaFieldDataTransformation other =(SchemaFieldDataTransformation)obj; if (hasTransformationType() != other.hasTransformationType()) return false; if (hasTransformationType() && getTransformationType() != other.getTransformationType()) return false; if (hasDefaultValue() != other.hasDefaultValue()) return false; @@ -198,8 +178,8 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ public SchemaFieldDataTransformation copyFrom(RecordInfo template) { - if (template instanceof SchemaFieldDataTransformationInfo) { - SchemaFieldDataTransformationInfo t = (SchemaFieldDataTransformationInfo)template; + if (template instanceof SchemaFieldDataTransformation) { + SchemaFieldDataTransformation t = (SchemaFieldDataTransformation)template; if (t.hasTransformationType()) { setTransformationType(t.getTransformationType()); } else { @@ -243,4 +223,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldDataTransformationInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldDataTransformationInfo.java deleted file mode 100644 index 25a1bbd45..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldDataTransformationInfo.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.CharSequence; -import java.lang.Override; - -/** - * Class which defines a transformation that is applied to a data field. - */ -public interface SchemaFieldDataTransformationInfo extends RecordInfo { - /** - * Defines the transformation that was applied to the field. - * @return Transformation Type - */ - SchemaFieldDataTransformationType getTransformationType(); - - /** - * Defines the transformation that was applied to the field. - * @return true if Transformation Type is not null - */ - boolean hasTransformationType(); - - /** - * Defines the default value if TransformationType equals SET_DEFAULT. - * @return Default Value - */ - CharSequence getDefaultValue(); - - /** - * Defines the default value if TransformationType equals SET_DEFAULT. - * @return true if Default Value is not null - */ - boolean hasDefaultValue(); - - /** - * Method copies state to a given instance - */ - @Override - SchemaFieldDataTransformationInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldDataTransformationInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldDataTransformationInterface.java deleted file mode 100644 index b3ce138f2..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldDataTransformationInterface.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import java.lang.CharSequence; -import java.lang.Override; - -/** - * Class which defines a transformation that is applied to a data field. - */ -public interface SchemaFieldDataTransformationInterface extends SchemaFieldDataTransformationInfo, RecordInterface { - /** - * Defines the transformation that was applied to the field. - * @param value - Transformation Type - */ - void setTransformationType(SchemaFieldDataTransformationType value); - - /** - * Defines the transformation that was applied to the field. - */ - void nullifyTransformationType(); - - /** - * Defines the default value if TransformationType equals SET_DEFAULT. - * @param value - Default Value - */ - void setDefaultValue(CharSequence value); - - /** - * Defines the default value if TransformationType equals SET_DEFAULT. - */ - void nullifyDefaultValue(); - - /** - * Method nullifies all instance properties - */ - @Override - SchemaFieldDataTransformationInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - SchemaFieldDataTransformationInterface reset(); - - @Override - SchemaFieldDataTransformationInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldDataTransformationType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldDataTransformationType.java index 6c14242a0..10b92c538 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldDataTransformationType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/SchemaFieldDataTransformationType.java @@ -1,19 +1,3 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; import com.epam.deltix.timebase.messages.SchemaElement; @@ -76,4 +60,4 @@ public static SchemaFieldDataTransformationType strictValueOf(int number) { } return value; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/StaticDataFieldInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/StaticDataFieldInfo.java deleted file mode 100644 index c2ff7997a..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/StaticDataFieldInfo.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import java.lang.CharSequence; -import java.lang.Override; - -/** - * Schema definition for static data field. - */ -public interface StaticDataFieldInfo extends DataFieldInfo { - /** - * Value constant for a field. - * @return Static Value - */ - CharSequence getStaticValue(); - - /** - * Value constant for a field. - * @return true if Static Value is not null - */ - boolean hasStaticValue(); - - /** - * Method copies state to a given instance - */ - @Override - StaticDataFieldInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/StaticDataFieldInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/StaticDataFieldInterface.java deleted file mode 100644 index faded7f1b..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/StaticDataFieldInterface.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.CharSequence; -import java.lang.Override; - -/** - * Schema definition for static data field. - */ -public interface StaticDataFieldInterface extends StaticDataFieldInfo, DataFieldInterface { - /** - * Value constant for a field. - * @param value - Static Value - */ - void setStaticValue(CharSequence value); - - /** - * Value constant for a field. - */ - void nullifyStaticValue(); - - /** - * Method nullifies all instance properties - */ - @Override - StaticDataFieldInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - StaticDataFieldInterface reset(); - - @Override - StaticDataFieldInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/StaticDataField.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/StaticField.java similarity index 70% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/StaticDataField.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/StaticField.java index 4a0497397..2a85988e6 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/StaticDataField.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/StaticField.java @@ -1,42 +1,22 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import java.lang.CharSequence; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; import com.epam.deltix.containers.BinaryAsciiString; import com.epam.deltix.containers.CharSequenceUtils; import com.epam.deltix.containers.MutableString; +import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.RecordInterface; +import com.epam.deltix.timebase.messages.SchemaElement; +import com.epam.deltix.timebase.messages.SchemaType; /** * Schema definition for static data field. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.StaticDataField", - title = "StaticDataField" + name = "com.epam.deltix.timebase.messages.schema.StaticField", + title = "StaticField" ) -public class StaticDataField extends DataField implements StaticDataFieldInterface { - public static final String CLASS_NAME = StaticDataField.class.getName(); +public class StaticField extends Field implements RecordInterface { + public static final String CLASS_NAME = StaticField.class.getName(); /** * Value constant for a field. @@ -83,15 +63,15 @@ public void nullifyStaticValue() { * @return new instance of this class. */ @Override - protected StaticDataField createInstance() { - return new StaticDataField(); + protected StaticField createInstance() { + return new StaticField(); } /** * Method nullifies all instance properties */ @Override - public StaticDataField nullify() { + public StaticField nullify() { super.nullify(); nullifyStaticValue(); return this; @@ -101,7 +81,7 @@ public StaticDataField nullify() { * Resets all instance properties to their default values */ @Override - public StaticDataField reset() { + public StaticField reset() { super.reset(); staticValue = null; return this; @@ -111,8 +91,8 @@ public StaticDataField reset() { * Method copies state to a given instance */ @Override - public StaticDataField clone() { - StaticDataField t = createInstance(); + public StaticField clone() { + StaticField t = createInstance(); t.copyFrom(this); return t; } @@ -125,8 +105,8 @@ public boolean equals(Object obj) { if (this == obj) return true; boolean superEquals = super.equals(obj); if (!superEquals) return false; - if (!(obj instanceof StaticDataFieldInfo)) return false; - StaticDataFieldInfo other =(StaticDataFieldInfo)obj; + if (!(obj instanceof StaticField)) return false; + StaticField other =(StaticField)obj; if (hasStaticValue() != other.hasStaticValue()) return false; if (hasStaticValue()) { if (getStaticValue().length() != other.getStaticValue().length()) return false; else { @@ -159,10 +139,10 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ @Override - public StaticDataField copyFrom(RecordInfo template) { + public StaticField copyFrom(RecordInfo template) { super.copyFrom(template); - if (template instanceof StaticDataFieldInfo) { - StaticDataFieldInfo t = (StaticDataFieldInfo)template; + if (template instanceof StaticField) { + StaticField t = (StaticField)template; if (t.hasStaticValue()) { if (hasStaticValue() && getStaticValue() instanceof StringBuilder) { ((StringBuilder)getStaticValue()).setLength(0); @@ -191,13 +171,13 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"StaticDataField\""); + str.append("{ \"$type\": \"StaticField\""); if (hasStaticValue()) { str.append(", \"staticValue\": \"").append(getStaticValue()).append("\""); } - if (hasDataType()) { - str.append(", \"dataType\": "); - getDataType().toString(str); + if (hasType()) { + str.append(", \"type\": "); + getType().toString(str); } if (hasName()) { str.append(", \"name\": \"").append(getName()).append("\""); @@ -211,4 +191,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/StreamMessage.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/StreamMessage.java new file mode 100644 index 000000000..fe02066b9 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/StreamMessage.java @@ -0,0 +1,501 @@ +package com.epam.deltix.timebase.messages.schema; + +import com.epam.deltix.containers.BinaryAsciiString; +import com.epam.deltix.containers.CharSequenceUtils; +import com.epam.deltix.containers.MutableString; +import com.epam.deltix.timebase.messages.*; +import com.epam.deltix.util.collections.generated.ObjectArrayList; + +/** + * Message that describes TimeBase stream + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.schema.StreamMessage", + title = "StreamMessage" +) +public class StreamMessage extends InstrumentMessage implements RecordInterface { + public static final String CLASS_NAME = StreamMessage.class.getName(); + + /** + * Stream key + */ + protected CharSequence key = null; + + /** + * Stream name + */ + protected CharSequence name = null; + + /** + * Stream description + */ + protected CharSequence description = null; + + /** + * Top types in stream schema + */ + protected ObjectArrayList topTypes = null; + + /** + * All types in stream schema + */ + protected ObjectArrayList allTypes = null; + + /** + * Stream key + * @return Key + */ + @SchemaElement + @SchemaType( + isNullable = false + ) + public CharSequence getKey() { + return key; + } + + /** + * Stream key + * @param value - Key + */ + public void setKey(CharSequence value) { + this.key = value; + } + + /** + * Stream key + * @return true if Key is not null + */ + public boolean hasKey() { + return key != null; + } + + /** + * Stream key + */ + public void nullifyKey() { + this.key = null; + } + + /** + * Stream name + * @return Name + */ + @SchemaElement + @SchemaType( + isNullable = true + ) + public CharSequence getName() { + return name; + } + + /** + * Stream name + * @param value - Name + */ + public void setName(CharSequence value) { + this.name = value; + } + + /** + * Stream name + * @return true if Name is not null + */ + public boolean hasName() { + return name != null; + } + + /** + * Stream name + */ + public void nullifyName() { + this.name = null; + } + + /** + * Stream description + * @return Description + */ + @SchemaElement + @SchemaType( + isNullable = true + ) + public CharSequence getDescription() { + return description; + } + + /** + * Stream description + * @param value - Description + */ + public void setDescription(CharSequence value) { + this.description = value; + } + + /** + * Stream description + * @return true if Description is not null + */ + public boolean hasDescription() { + return description != null; + } + + /** + * Stream description + */ + public void nullifyDescription() { + this.description = null; + } + + /** + * Top types in stream schema + * @return Top Types + */ + @SchemaElement + @SchemaArrayType( + isNullable = false, + isElementNullable = false, + elementTypes = { + TypeDescriptor.class} + + ) + public ObjectArrayList getTopTypes() { + return topTypes; + } + + /** + * Top types in stream schema + * @param value - Top Types + */ + public void setTopTypes(ObjectArrayList value) { + this.topTypes = value; + } + + /** + * Top types in stream schema + * @return true if Top Types is not null + */ + public boolean hasTopTypes() { + return topTypes != null; + } + + /** + * Top types in stream schema + */ + public void nullifyTopTypes() { + this.topTypes = null; + } + + /** + * All types in stream schema + * @return All Types + */ + @SchemaElement + @SchemaArrayType( + isNullable = false, + isElementNullable = false, + elementTypes = { + TypeDescriptor.class, EnumDescriptor.class} + + ) + public ObjectArrayList getAllTypes() { + return allTypes; + } + + /** + * All types in stream schema + * @param value - All Types + */ + public void setAllTypes(ObjectArrayList value) { + this.allTypes = value; + } + + /** + * All types in stream schema + * @return true if All Types is not null + */ + public boolean hasAllTypes() { + return allTypes != null; + } + + /** + * All types in stream schema + */ + public void nullifyAllTypes() { + this.allTypes = null; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + @Override + protected StreamMessage createInstance() { + return new StreamMessage(); + } + + /** + * Method nullifies all instance properties + */ + @Override + public StreamMessage nullify() { + super.nullify(); + nullifyKey(); + nullifyName(); + nullifyDescription(); + nullifyTopTypes(); + nullifyAllTypes(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + @Override + public StreamMessage reset() { + super.reset(); + key = null; + name = null; + description = null; + topTypes = null; + allTypes = null; + return this; + } + + /** + * Method copies state to a given instance + */ + @Override + public StreamMessage clone() { + StreamMessage t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + boolean superEquals = super.equals(obj); + if (!superEquals) return false; + if (!(obj instanceof StreamMessage)) return false; + StreamMessage other =(StreamMessage)obj; + if (hasKey() != other.hasKey()) return false; + if (hasKey()) { + if (getKey().length() != other.getKey().length()) return false; else { + CharSequence s1 = getKey(); + CharSequence s2 = other.getKey(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } + if (hasName() != other.hasName()) return false; + if (hasName()) { + if (getName().length() != other.getName().length()) return false; else { + CharSequence s1 = getName(); + CharSequence s2 = other.getName(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } + if (hasDescription() != other.hasDescription()) return false; + if (hasDescription()) { + if (getDescription().length() != other.getDescription().length()) return false; else { + CharSequence s1 = getDescription(); + CharSequence s2 = other.getDescription(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } + if (hasTopTypes() != other.hasTopTypes()) return false; + if (hasTopTypes()) { + if (getTopTypes().size() != other.getTopTypes().size()) return false; + else for (int j = 0; j < getTopTypes().size(); ++j) { + if ((getTopTypes().get(j) != null) != (other.getTopTypes().get(j) != null)) return false; + if (getTopTypes().get(j) != null && !getTopTypes().get(j).equals(other.getTopTypes().get(j))) return false; + } + } + if (hasAllTypes() != other.hasAllTypes()) return false; + if (hasAllTypes()) { + if (getAllTypes().size() != other.getAllTypes().size()) return false; + else for (int j = 0; j < getAllTypes().size(); ++j) { + if ((getAllTypes().get(j) != null) != (other.getAllTypes().get(j) != null)) return false; + if (getAllTypes().get(j) != null && !getAllTypes().get(j).equals(other.getAllTypes().get(j))) return false; + } + } + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = super.hashCode(); + if (hasKey()) { + hash = hash * 31 + getKey().hashCode(); + } + if (hasName()) { + hash = hash * 31 + getName().hashCode(); + } + if (hasDescription()) { + hash = hash * 31 + getDescription().hashCode(); + } + if (hasTopTypes()) { + for (int j = 0; j < getTopTypes().size(); ++j) { + hash ^= getTopTypes().get(j).hashCode(); + } + } + if (hasAllTypes()) { + for (int j = 0; j < getAllTypes().size(); ++j) { + hash ^= getAllTypes().get(j).hashCode(); + } + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + @Override + public StreamMessage copyFrom(RecordInfo template) { + super.copyFrom(template); + if (template instanceof StreamMessage) { + StreamMessage t = (StreamMessage)template; + if (t.hasKey()) { + if (hasKey() && getKey() instanceof StringBuilder) { + ((StringBuilder)getKey()).setLength(0); + } else { + setKey(new StringBuilder()); + } + ((StringBuilder)getKey()).append(t.getKey()); + } else { + nullifyKey(); + } + if (t.hasName()) { + if (hasName() && getName() instanceof StringBuilder) { + ((StringBuilder)getName()).setLength(0); + } else { + setName(new StringBuilder()); + } + ((StringBuilder)getName()).append(t.getName()); + } else { + nullifyName(); + } + if (t.hasDescription()) { + if (hasDescription() && getDescription() instanceof StringBuilder) { + ((StringBuilder)getDescription()).setLength(0); + } else { + setDescription(new StringBuilder()); + } + ((StringBuilder)getDescription()).append(t.getDescription()); + } else { + nullifyDescription(); + } + if (t.hasTopTypes()) { + if (!hasTopTypes()) { + setTopTypes(new ObjectArrayList(t.getTopTypes().size())); + } else { + getTopTypes().clear(); + } + for (int i = 0; i < t.getTopTypes().size(); ++i) ((ObjectArrayList)getTopTypes()).add((TypeDescriptor)t.getTopTypes().get(i).clone()); + } else { + nullifyTopTypes(); + } + if (t.hasAllTypes()) { + if (!hasAllTypes()) { + setAllTypes(new ObjectArrayList(t.getAllTypes().size())); + } else { + getAllTypes().clear(); + } + for (int i = 0; i < t.getAllTypes().size(); ++i) ((ObjectArrayList)getAllTypes()).add((UniqueDescriptor)t.getAllTypes().get(i).clone()); + } else { + nullifyAllTypes(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"StreamMessage\""); + if (hasKey()) { + str.append(", \"key\": \"").append(getKey()).append("\""); + } + if (hasName()) { + str.append(", \"name\": \"").append(getName()).append("\""); + } + if (hasDescription()) { + str.append(", \"description\": \"").append(getDescription()).append("\""); + } + if (hasTopTypes()) { + str.append(", \"topTypes\": ["); + if (getTopTypes().size() > 0) { + if (getTopTypes().get(0) == null) { + str.append("null"); + } else { + getTopTypes().get(0).toString(str); + } + } + for (int i = 1; i < getTopTypes().size(); ++i) { + str.append(", "); + if (getTopTypes().get(i) == null) { + str.append("null"); + } else { + getTopTypes().get(i).toString(str); + } + } + str.append("]"); + } + if (hasAllTypes()) { + str.append(", \"allTypes\": ["); + if (getAllTypes().size() > 0) { + if (getAllTypes().get(0) == null) { + str.append("null"); + } else { + getAllTypes().get(0).toString(str); + } + } + for (int i = 1; i < getAllTypes().size(); ++i) { + str.append(", "); + if (getAllTypes().get(i) == null) { + str.append("null"); + } else { + getAllTypes().get(i).toString(str); + } + } + str.append("]"); + } + if (hasTimeStampMs()) { + str.append(", \"timeStampMs\": \"").append(getTimeStampMs()).append("\""); + } + if (hasSymbol()) { + str.append(", \"symbol\": \"").append(getSymbol()).append("\""); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/TimeOfDayDataTypeInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/TimeOfDayDataTypeInfo.java deleted file mode 100644 index b7a3aa6f4..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/TimeOfDayDataTypeInfo.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import java.lang.Override; - -/** - * Schema definition of time-of-day data type. - */ -public interface TimeOfDayDataTypeInfo extends DataTypeInfo { - /** - * Method copies state to a given instance - */ - @Override - TimeOfDayDataTypeInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/TimeOfDayDataTypeInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/TimeOfDayDataTypeInterface.java deleted file mode 100644 index 9763031bd..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/TimeOfDayDataTypeInterface.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.Override; - -/** - * Schema definition of time-of-day data type. - */ -public interface TimeOfDayDataTypeInterface extends TimeOfDayDataTypeInfo, DataTypeInterface { - /** - * Method nullifies all instance properties - */ - @Override - TimeOfDayDataTypeInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - TimeOfDayDataTypeInterface reset(); - - @Override - TimeOfDayDataTypeInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/TimeOfDayDataType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/TimeOfDayFieldType.java similarity index 55% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/TimeOfDayDataType.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/TimeOfDayFieldType.java index 5f2054c95..1520cc250 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/TimeOfDayDataType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/TimeOfDayFieldType.java @@ -1,52 +1,69 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.RecordInterface; import com.epam.deltix.timebase.messages.SchemaElement; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; /** * Schema definition of time-of-day data type. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.TimeOfDayDataType", - title = "TimeOfDayDataType" + name = "com.epam.deltix.timebase.messages.schema.TimeOfDayFieldType", + title = "TimeOfDayFieldType" ) -public class TimeOfDayDataType extends DataType implements TimeOfDayDataTypeInterface { - public static final String CLASS_NAME = TimeOfDayDataType.class.getName(); +public class TimeOfDayFieldType extends FieldType implements RecordInterface { + public static final String CLASS_NAME = TimeOfDayFieldType.class.getName(); + + public TimeOfDayFieldType() { + super(); + baseName = "TIME_OF_DAY"; + } + + /** + * @return Base Name + */ + @Override + public CharSequence getBaseName() { + return baseName; + } + + /** + * @param value - Base Name + */ + @Override + public void setBaseName(CharSequence value) { + this.baseName = value; + } + + /** + * @return true if Base Name is not null + */ + @Override + public boolean hasBaseName() { + return baseName != null; + } + + /** + */ + @Override + public void nullifyBaseName() { + this.baseName = null; + } /** * Creates new instance of this class. * @return new instance of this class. */ @Override - protected TimeOfDayDataType createInstance() { - return new TimeOfDayDataType(); + protected TimeOfDayFieldType createInstance() { + return new TimeOfDayFieldType(); } /** * Method nullifies all instance properties */ @Override - public TimeOfDayDataType nullify() { + public TimeOfDayFieldType nullify() { super.nullify(); return this; } @@ -55,7 +72,7 @@ public TimeOfDayDataType nullify() { * Resets all instance properties to their default values */ @Override - public TimeOfDayDataType reset() { + public TimeOfDayFieldType reset() { super.reset(); return this; } @@ -64,8 +81,8 @@ public TimeOfDayDataType reset() { * Method copies state to a given instance */ @Override - public TimeOfDayDataType clone() { - TimeOfDayDataType t = createInstance(); + public TimeOfDayFieldType clone() { + TimeOfDayFieldType t = createInstance(); t.copyFrom(this); return t; } @@ -78,7 +95,8 @@ public boolean equals(Object obj) { if (this == obj) return true; boolean superEquals = super.equals(obj); if (!superEquals) return false; - if (!(obj instanceof TimeOfDayDataTypeInfo)) return false; + if (!(obj instanceof TimeOfDayFieldType)) return false; + TimeOfDayFieldType other =(TimeOfDayFieldType)obj; return true; } @@ -96,8 +114,11 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ @Override - public TimeOfDayDataType copyFrom(RecordInfo template) { + public TimeOfDayFieldType copyFrom(RecordInfo template) { super.copyFrom(template); + if (template instanceof TimeOfDayFieldType) { + TimeOfDayFieldType t = (TimeOfDayFieldType)template; + } return this; } @@ -115,14 +136,17 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"TimeOfDayDataType\""); + str.append("{ \"$type\": \"TimeOfDayFieldType\""); if (hasEncoding()) { str.append(", \"encoding\": \"").append(getEncoding()).append("\""); } if (hasIsNullable()) { str.append(", \"isNullable\": ").append(isNullable()); } + if (hasBaseName()) { + str.append(", \"baseName\": \"").append(getBaseName()).append("\""); + } str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/TypeDescriptor.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/TypeDescriptor.java new file mode 100644 index 000000000..5a53b4471 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/TypeDescriptor.java @@ -0,0 +1,376 @@ +package com.epam.deltix.timebase.messages.schema; + +import com.epam.deltix.timebase.messages.*; +import com.epam.deltix.util.collections.generated.ObjectArrayList; + +/** + * Schema definition for a class. + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.schema.TypeDescriptor", + title = "TypeDescriptor" +) +public class TypeDescriptor extends UniqueDescriptor implements RecordInterface { + public static final String CLASS_NAME = TypeDescriptor.class.getName(); + + /** + * Defines parent TypeDescriptor if exist. + */ + protected TypeDescriptor parent = null; + + /** + * Defines if current TypeDescriptor is abstract. + */ + protected byte isAbstract = TypeConstants.BOOLEAN_NULL; + + /** + * Defines if current TypeDescriptor is content class. + */ + protected byte isContentClass = TypeConstants.BOOLEAN_NULL; + + /** + * List of fields of a class. + */ + protected ObjectArrayList fields = null; + + /** + * Defines parent TypeDescriptor if exist. + * @return Parent + */ + @SchemaElement + @SchemaType( + isNullable = true, + dataType = SchemaDataType.OBJECT, + nestedTypes = { + TypeDescriptor.class} + + ) + public TypeDescriptor getParent() { + return parent; + } + + /** + * Defines parent TypeDescriptor if exist. + * @param value - Parent + */ + public void setParent(TypeDescriptor value) { + this.parent = value; + } + + /** + * Defines parent TypeDescriptor if exist. + * @return true if Parent is not null + */ + public boolean hasParent() { + return parent != null; + } + + /** + * Defines parent TypeDescriptor if exist. + */ + public void nullifyParent() { + this.parent = null; + } + + /** + * Defines if current TypeDescriptor is abstract. + * @return Is Abstract + */ + @SchemaElement + @SchemaType( + isNullable = false + ) + public boolean isAbstract() { + return isAbstract == 1; + } + + /** + * Defines if current TypeDescriptor is abstract. + * @param value - Is Abstract + */ + public void setIsAbstract(boolean value) { + this.isAbstract = (byte)(value ? 1 : 0); + } + + /** + * Defines if current TypeDescriptor is abstract. + * @return true if Is Abstract is not null + */ + public boolean hasIsAbstract() { + return isAbstract != TypeConstants.BOOLEAN_NULL; + } + + /** + * Defines if current TypeDescriptor is abstract. + */ + public void nullifyIsAbstract() { + this.isAbstract = TypeConstants.BOOLEAN_NULL; + } + + /** + * Defines if current TypeDescriptor is content class. + * @return Is Content Class + */ + @SchemaElement + @SchemaType( + isNullable = false + ) + public boolean isContentClass() { + return isContentClass == 1; + } + + /** + * Defines if current TypeDescriptor is content class. + * @param value - Is Content Class + */ + public void setIsContentClass(boolean value) { + this.isContentClass = (byte)(value ? 1 : 0); + } + + /** + * Defines if current TypeDescriptor is content class. + * @return true if Is Content Class is not null + */ + public boolean hasIsContentClass() { + return isContentClass != TypeConstants.BOOLEAN_NULL; + } + + /** + * Defines if current TypeDescriptor is content class. + */ + public void nullifyIsContentClass() { + this.isContentClass = TypeConstants.BOOLEAN_NULL; + } + + /** + * List of fields of a class. + * @return Fields + */ + @SchemaElement + @SchemaArrayType( + isNullable = false, + isElementNullable = false, + elementTypes = { + StaticField.class, NonStaticField.class} + + ) + public ObjectArrayList getFields() { + return fields; + } + + /** + * List of fields of a class. + * @param value - Fields + */ + public void setFields(ObjectArrayList value) { + this.fields = value; + } + + /** + * List of fields of a class. + * @return true if Fields is not null + */ + public boolean hasFields() { + return fields != null; + } + + /** + * List of fields of a class. + */ + public void nullifyFields() { + this.fields = null; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + @Override + protected TypeDescriptor createInstance() { + return new TypeDescriptor(); + } + + /** + * Method nullifies all instance properties + */ + @Override + public TypeDescriptor nullify() { + super.nullify(); + nullifyParent(); + nullifyIsAbstract(); + nullifyIsContentClass(); + nullifyFields(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + @Override + public TypeDescriptor reset() { + super.reset(); + parent = null; + isAbstract = TypeConstants.BOOLEAN_NULL; + isContentClass = TypeConstants.BOOLEAN_NULL; + fields = null; + return this; + } + + /** + * Method copies state to a given instance + */ + @Override + public TypeDescriptor clone() { + TypeDescriptor t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + boolean superEquals = super.equals(obj); + if (!superEquals) return false; + if (!(obj instanceof TypeDescriptor)) return false; + TypeDescriptor other =(TypeDescriptor)obj; + if (hasParent() != other.hasParent()) return false; + if (hasParent() && !(getParent().equals(other.getParent()))) return false; + if (hasIsAbstract() != other.hasIsAbstract()) return false; + if (hasIsAbstract() && isAbstract() != other.isAbstract()) return false; + if (hasIsContentClass() != other.hasIsContentClass()) return false; + if (hasIsContentClass() && isContentClass() != other.isContentClass()) return false; + if (hasFields() != other.hasFields()) return false; + if (hasFields()) { + if (getFields().size() != other.getFields().size()) return false; + else for (int j = 0; j < getFields().size(); ++j) { + if ((getFields().get(j) != null) != (other.getFields().get(j) != null)) return false; + if (getFields().get(j) != null && !getFields().get(j).equals(other.getFields().get(j))) return false; + } + } + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = super.hashCode(); + if (hasParent()) { + hash = hash * 31 + getParent().hashCode(); + } + if (hasIsAbstract()) { + hash = hash * 31 + (isAbstract() ? 1231 : 1237); + } + if (hasIsContentClass()) { + hash = hash * 31 + (isContentClass() ? 1231 : 1237); + } + if (hasFields()) { + for (int j = 0; j < getFields().size(); ++j) { + hash ^= getFields().get(j).hashCode(); + } + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + @Override + public TypeDescriptor copyFrom(RecordInfo template) { + super.copyFrom(template); + if (template instanceof TypeDescriptor) { + TypeDescriptor t = (TypeDescriptor)template; + if (t.hasParent()) { + t.setParent((TypeDescriptor) getParent().clone()); + } else { + nullifyParent(); + } + if (t.hasIsAbstract()) { + setIsAbstract(t.isAbstract()); + } else { + nullifyIsAbstract(); + } + if (t.hasIsContentClass()) { + setIsContentClass(t.isContentClass()); + } else { + nullifyIsContentClass(); + } + if (t.hasFields()) { + if (!hasFields()) { + setFields(new ObjectArrayList(t.getFields().size())); + } else { + getFields().clear(); + } + for (int i = 0; i < t.getFields().size(); ++i) ((ObjectArrayList)getFields()).add((Field)t.getFields().get(i).clone()); + } else { + nullifyFields(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"TypeDescriptor\""); + if (hasParent()) { + str.append(", \"parent\": "); + getParent().toString(str); + } + if (hasIsAbstract()) { + str.append(", \"isAbstract\": ").append(isAbstract()); + } + if (hasIsContentClass()) { + str.append(", \"isContentClass\": ").append(isContentClass()); + } + if (hasFields()) { + str.append(", \"fields\": ["); + if (getFields().size() > 0) { + if (getFields().get(0) == null) { + str.append("null"); + } else { + getFields().get(0).toString(str); + } + } + for (int i = 1; i < getFields().size(); ++i) { + str.append(", "); + if (getFields().get(i) == null) { + str.append("null"); + } else { + getFields().get(i).toString(str); + } + } + str.append("]"); + } + if (hasGuid()) { + str.append(", \"guid\": \"").append(getGuid()).append("\""); + } + if (hasName()) { + str.append(", \"name\": \"").append(getName()).append("\""); + } + if (hasTitle()) { + str.append(", \"title\": \"").append(getTitle()).append("\""); + } + if (hasDescription()) { + str.append(", \"description\": \"").append(getDescription()).append("\""); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptor.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/UniqueDescriptor.java similarity index 70% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptor.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/UniqueDescriptor.java index 40436dd2b..9709ac6e4 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/ClassDescriptor.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/UniqueDescriptor.java @@ -1,43 +1,22 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import java.lang.CharSequence; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; -import java.lang.UnsupportedOperationException; import com.epam.deltix.containers.BinaryAsciiString; import com.epam.deltix.containers.CharSequenceUtils; import com.epam.deltix.containers.MutableString; +import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.RecordInterface; +import com.epam.deltix.timebase.messages.SchemaElement; +import com.epam.deltix.timebase.messages.SchemaType; /** * Schema definition for a schema node. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.ClassDescriptor", - title = "ClassDescriptor" + name = "com.epam.deltix.timebase.messages.schema.UniqueDescriptor", + title = "UniqueDescriptor" ) -public abstract class ClassDescriptor extends NamedDescriptor implements ClassDescriptorInterface { - public static final String CLASS_NAME = ClassDescriptor.class.getName(); +public abstract class UniqueDescriptor extends Descriptor implements RecordInterface { + public static final String CLASS_NAME = UniqueDescriptor.class.getName(); /** * Optional GUID for this node. @@ -84,7 +63,7 @@ public void nullifyGuid() { * @return new instance of this class. */ @Override - protected ClassDescriptor createInstance() { + protected UniqueDescriptor createInstance() { throw new UnsupportedOperationException(); } @@ -92,7 +71,7 @@ protected ClassDescriptor createInstance() { * Method nullifies all instance properties */ @Override - public ClassDescriptor nullify() { + public UniqueDescriptor nullify() { super.nullify(); nullifyGuid(); return this; @@ -102,7 +81,7 @@ public ClassDescriptor nullify() { * Resets all instance properties to their default values */ @Override - public ClassDescriptor reset() { + public UniqueDescriptor reset() { super.reset(); guid = null; return this; @@ -112,8 +91,8 @@ public ClassDescriptor reset() { * Method copies state to a given instance */ @Override - public ClassDescriptor clone() { - ClassDescriptor t = createInstance(); + public UniqueDescriptor clone() { + UniqueDescriptor t = createInstance(); t.copyFrom(this); return t; } @@ -126,8 +105,8 @@ public boolean equals(Object obj) { if (this == obj) return true; boolean superEquals = super.equals(obj); if (!superEquals) return false; - if (!(obj instanceof ClassDescriptorInfo)) return false; - ClassDescriptorInfo other =(ClassDescriptorInfo)obj; + if (!(obj instanceof UniqueDescriptor)) return false; + UniqueDescriptor other =(UniqueDescriptor)obj; if (hasGuid() != other.hasGuid()) return false; if (hasGuid()) { if (getGuid().length() != other.getGuid().length()) return false; else { @@ -160,10 +139,10 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ @Override - public ClassDescriptor copyFrom(RecordInfo template) { + public UniqueDescriptor copyFrom(RecordInfo template) { super.copyFrom(template); - if (template instanceof ClassDescriptorInfo) { - ClassDescriptorInfo t = (ClassDescriptorInfo)template; + if (template instanceof UniqueDescriptor) { + UniqueDescriptor t = (UniqueDescriptor)template; if (t.hasGuid()) { if (hasGuid() && getGuid() instanceof StringBuilder) { ((StringBuilder)getGuid()).setLength(0); @@ -192,7 +171,7 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"ClassDescriptor\""); + str.append("{ \"$type\": \"UniqueDescriptor\""); if (hasGuid()) { str.append(", \"guid\": \"").append(getGuid()).append("\""); } @@ -208,4 +187,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/VarcharDataTypeInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/VarcharDataTypeInfo.java deleted file mode 100644 index 7266ec65d..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/VarcharDataTypeInfo.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import java.lang.Override; - -/** - * Schema definition of varchar data type. - */ -public interface VarcharDataTypeInfo extends DataTypeInfo { - /** - * True, if field allows line breaks. - * @return Is Multiline - */ - boolean isMultiline(); - - /** - * True, if field allows line breaks. - * @return true if Is Multiline is not null - */ - boolean hasIsMultiline(); - - /** - * Encoding type. - * @return Encoding Type - */ - int getEncodingType(); - - /** - * Encoding type. - * @return true if Encoding Type is not null - */ - boolean hasEncodingType(); - - /** - * Length. - * @return Length - */ - int getLength(); - - /** - * Length. - * @return true if Length is not null - */ - boolean hasLength(); - - /** - * Method copies state to a given instance - */ - @Override - VarcharDataTypeInfo clone(); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/VarcharDataTypeInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/VarcharDataTypeInterface.java deleted file mode 100644 index 51ba467a8..000000000 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/VarcharDataTypeInterface.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.epam.deltix.timebase.messages.schema; - -import com.epam.deltix.timebase.messages.RecordInfo; -import java.lang.Override; - -/** - * Schema definition of varchar data type. - */ -public interface VarcharDataTypeInterface extends VarcharDataTypeInfo, DataTypeInterface { - /** - * True, if field allows line breaks. - * @param value - Is Multiline - */ - void setIsMultiline(boolean value); - - /** - * True, if field allows line breaks. - */ - void nullifyIsMultiline(); - - /** - * Encoding type. - * @param value - Encoding Type - */ - void setEncodingType(int value); - - /** - * Encoding type. - */ - void nullifyEncodingType(); - - /** - * Length. - * @param value - Length - */ - void setLength(int value); - - /** - * Length. - */ - void nullifyLength(); - - /** - * Method nullifies all instance properties - */ - @Override - VarcharDataTypeInterface nullify(); - - /** - * Resets all instance properties to their default values - */ - @Override - VarcharDataTypeInterface reset(); - - @Override - VarcharDataTypeInterface copyFrom(RecordInfo template); -} \ No newline at end of file diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/VarcharDataType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/VarcharFieldType.java similarity index 66% rename from messages/src/main/java/com/epam/deltix/timebase/messages/schema/VarcharDataType.java rename to messages/src/main/java/com/epam/deltix/timebase/messages/schema/VarcharFieldType.java index eccd5bca1..a26ab8cc6 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/schema/VarcharDataType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/schema/VarcharFieldType.java @@ -1,39 +1,16 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.schema; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaType; -import com.epam.deltix.timebase.messages.TypeConstants; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; +import com.epam.deltix.timebase.messages.*; /** * Schema definition of varchar data type. */ @SchemaElement( - name = "com.epam.deltix.timebase.messages.schema.VarcharDataType", - title = "VarcharDataType" + name = "com.epam.deltix.timebase.messages.schema.VarcharFieldType", + title = "VarcharFieldType" ) -public class VarcharDataType extends DataType implements VarcharDataTypeInterface { - public static final String CLASS_NAME = VarcharDataType.class.getName(); +public class VarcharFieldType extends FieldType implements RecordInterface { + public static final String CLASS_NAME = VarcharFieldType.class.getName(); /** * True, if field allows line breaks. @@ -50,6 +27,11 @@ public class VarcharDataType extends DataType implements VarcharDataTypeInterfac */ protected int length = TypeConstants.INT32_NULL; + public VarcharFieldType() { + super(); + baseName = "VARCHAR"; + } + /** * True, if field allows line breaks. * @return Is Multiline @@ -75,14 +57,14 @@ public void setIsMultiline(boolean value) { * @return true if Is Multiline is not null */ public boolean hasIsMultiline() { - return isMultiline != com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; + return isMultiline != TypeConstants.BOOLEAN_NULL; } /** * True, if field allows line breaks. */ public void nullifyIsMultiline() { - this.isMultiline = com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; + this.isMultiline = TypeConstants.BOOLEAN_NULL; } /** @@ -110,14 +92,14 @@ public void setEncodingType(int value) { * @return true if Encoding Type is not null */ public boolean hasEncodingType() { - return encodingType != com.epam.deltix.timebase.messages.TypeConstants.INT32_NULL; + return encodingType != TypeConstants.INT32_NULL; } /** * Encoding type. */ public void nullifyEncodingType() { - this.encodingType = com.epam.deltix.timebase.messages.TypeConstants.INT32_NULL; + this.encodingType = TypeConstants.INT32_NULL; } /** @@ -145,14 +127,45 @@ public void setLength(int value) { * @return true if Length is not null */ public boolean hasLength() { - return length != com.epam.deltix.timebase.messages.TypeConstants.INT32_NULL; + return length != TypeConstants.INT32_NULL; } /** * Length. */ public void nullifyLength() { - this.length = com.epam.deltix.timebase.messages.TypeConstants.INT32_NULL; + this.length = TypeConstants.INT32_NULL; + } + + /** + * @return Base Name + */ + @Override + public CharSequence getBaseName() { + return baseName; + } + + /** + * @param value - Base Name + */ + @Override + public void setBaseName(CharSequence value) { + this.baseName = value; + } + + /** + * @return true if Base Name is not null + */ + @Override + public boolean hasBaseName() { + return baseName != null; + } + + /** + */ + @Override + public void nullifyBaseName() { + this.baseName = null; } /** @@ -160,15 +173,15 @@ public void nullifyLength() { * @return new instance of this class. */ @Override - protected VarcharDataType createInstance() { - return new VarcharDataType(); + protected VarcharFieldType createInstance() { + return new VarcharFieldType(); } /** * Method nullifies all instance properties */ @Override - public VarcharDataType nullify() { + public VarcharFieldType nullify() { super.nullify(); nullifyIsMultiline(); nullifyEncodingType(); @@ -180,11 +193,11 @@ public VarcharDataType nullify() { * Resets all instance properties to their default values */ @Override - public VarcharDataType reset() { + public VarcharFieldType reset() { super.reset(); - isMultiline = com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; - encodingType = com.epam.deltix.timebase.messages.TypeConstants.INT32_NULL; - length = com.epam.deltix.timebase.messages.TypeConstants.INT32_NULL; + isMultiline = TypeConstants.BOOLEAN_NULL; + encodingType = TypeConstants.INT32_NULL; + length = TypeConstants.INT32_NULL; return this; } @@ -192,8 +205,8 @@ public VarcharDataType reset() { * Method copies state to a given instance */ @Override - public VarcharDataType clone() { - VarcharDataType t = createInstance(); + public VarcharFieldType clone() { + VarcharFieldType t = createInstance(); t.copyFrom(this); return t; } @@ -206,8 +219,8 @@ public boolean equals(Object obj) { if (this == obj) return true; boolean superEquals = super.equals(obj); if (!superEquals) return false; - if (!(obj instanceof VarcharDataTypeInfo)) return false; - VarcharDataTypeInfo other =(VarcharDataTypeInfo)obj; + if (!(obj instanceof VarcharFieldType)) return false; + VarcharFieldType other =(VarcharFieldType)obj; if (hasIsMultiline() != other.hasIsMultiline()) return false; if (hasIsMultiline() && isMultiline() != other.isMultiline()) return false; if (hasEncodingType() != other.hasEncodingType()) return false; @@ -240,10 +253,10 @@ public int hashCode() { * @param template class instance that should be used as a copy source */ @Override - public VarcharDataType copyFrom(RecordInfo template) { + public VarcharFieldType copyFrom(RecordInfo template) { super.copyFrom(template); - if (template instanceof VarcharDataTypeInfo) { - VarcharDataTypeInfo t = (VarcharDataTypeInfo)template; + if (template instanceof VarcharFieldType) { + VarcharFieldType t = (VarcharFieldType)template; if (t.hasIsMultiline()) { setIsMultiline(t.isMultiline()); } else { @@ -277,7 +290,7 @@ public String toString() { */ @Override public StringBuilder toString(StringBuilder str) { - str.append("{ \"$type\": \"VarcharDataType\""); + str.append("{ \"$type\": \"VarcharFieldType\""); if (hasIsMultiline()) { str.append(", \"isMultiline\": ").append(isMultiline()); } @@ -293,7 +306,10 @@ public StringBuilder toString(StringBuilder str) { if (hasIsNullable()) { str.append(", \"isNullable\": ").append(isNullable()); } + if (hasBaseName()) { + str.append(", \"baseName\": \"").append(getBaseName()).append("\""); + } str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/service/BinaryMessage.java b/messages/src/main/java/com/epam/deltix/timebase/messages/service/BinaryMessage.java index e39ac45dc..015643cce 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/service/BinaryMessage.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/service/BinaryMessage.java @@ -1,36 +1,9 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.service; -import com.epam.deltix.timebase.messages.InstrumentMessage; -import com.epam.deltix.timebase.messages.OldElementName; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import com.epam.deltix.timebase.messages.SchemaDataType; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaGuid; -import com.epam.deltix.timebase.messages.SchemaType; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; import com.epam.deltix.containers.BinaryArray; import com.epam.deltix.containers.interfaces.BinaryArrayReadOnly; import com.epam.deltix.containers.interfaces.BinaryArrayReadWrite; +import com.epam.deltix.timebase.messages.*; /** */ @@ -209,4 +182,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/service/DataLossMessage.java b/messages/src/main/java/com/epam/deltix/timebase/messages/service/DataLossMessage.java index cd14c1463..5d0a35376 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/service/DataLossMessage.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/service/DataLossMessage.java @@ -1,31 +1,6 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.service; -import com.epam.deltix.timebase.messages.OldElementName; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaGuid; -import com.epam.deltix.timebase.messages.TypeConstants; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; +import com.epam.deltix.timebase.messages.*; /** * Message class, which describes data loss for 'lossy' Transient streams. See see "BufferOptions.Lossless". @@ -81,14 +56,14 @@ public void setBytes(long value) { * @return true if Bytes is not null */ public boolean hasBytes() { - return bytes != com.epam.deltix.timebase.messages.TypeConstants.INT64_NULL; + return bytes != TypeConstants.INT64_NULL; } /** * Number of the lost bytes. */ public void nullifyBytes() { - this.bytes = com.epam.deltix.timebase.messages.TypeConstants.INT64_NULL; + this.bytes = TypeConstants.INT64_NULL; } /** @@ -116,14 +91,14 @@ public void setFromTime(long value) { * @return true if From Time is not null */ public boolean hasFromTime() { - return fromTime != com.epam.deltix.timebase.messages.TypeConstants.TIMESTAMP_UNKNOWN; + return fromTime != TypeConstants.TIMESTAMP_UNKNOWN; } /** * The last reported message time before byte loss occurs. Precision - milliseconds. */ public void nullifyFromTime() { - this.fromTime = com.epam.deltix.timebase.messages.TypeConstants.TIMESTAMP_UNKNOWN; + this.fromTime = TypeConstants.TIMESTAMP_UNKNOWN; } /** @@ -152,8 +127,8 @@ public DataLossMessage nullify() { @Override public DataLossMessage reset() { super.reset(); - bytes = com.epam.deltix.timebase.messages.TypeConstants.INT64_NULL; - fromTime = com.epam.deltix.timebase.messages.TypeConstants.TIMESTAMP_UNKNOWN; + bytes = TypeConstants.INT64_NULL; + fromTime = TypeConstants.TIMESTAMP_UNKNOWN; return this; } @@ -252,4 +227,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/service/ErrorLevel.java b/messages/src/main/java/com/epam/deltix/timebase/messages/service/ErrorLevel.java index 548c25316..cc1d47fb5 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/service/ErrorLevel.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/service/ErrorLevel.java @@ -1,19 +1,3 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.service; import com.epam.deltix.timebase.messages.SchemaElement; @@ -97,4 +81,4 @@ public static ErrorLevel strictValueOf(int number) { } return value; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/service/ErrorMessage.java b/messages/src/main/java/com/epam/deltix/timebase/messages/service/ErrorMessage.java index c11a754bd..4532231cb 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/service/ErrorMessage.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/service/ErrorMessage.java @@ -1,35 +1,9 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.service; -import com.epam.deltix.timebase.messages.InstrumentMessage; -import com.epam.deltix.timebase.messages.OldElementName; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaGuid; -import java.lang.CharSequence; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; import com.epam.deltix.containers.BinaryAsciiString; import com.epam.deltix.containers.CharSequenceUtils; import com.epam.deltix.containers.MutableString; +import com.epam.deltix.timebase.messages.*; /** */ @@ -119,13 +93,13 @@ public void setSeqNum(long value) { * @return true if Sequence Number is not null */ public boolean hasSeqNum() { - return seqNum != com.epam.deltix.timebase.messages.TypeConstants.INT64_NULL; + return seqNum != TypeConstants.INT64_NULL; } /** */ public void nullifySeqNum() { - this.seqNum = com.epam.deltix.timebase.messages.TypeConstants.INT64_NULL; + this.seqNum = TypeConstants.INT64_NULL; } /** @@ -437,4 +411,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/service/EventMessage.java b/messages/src/main/java/com/epam/deltix/timebase/messages/service/EventMessage.java index 23e1bba10..34cbb5d7e 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/service/EventMessage.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/service/EventMessage.java @@ -1,30 +1,6 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.service; -import com.epam.deltix.timebase.messages.InstrumentMessage; -import com.epam.deltix.timebase.messages.OldElementName; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import com.epam.deltix.timebase.messages.SchemaElement; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; +import com.epam.deltix.timebase.messages.*; /** */ @@ -182,4 +158,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/service/EventMessageType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/service/EventMessageType.java index ebb562e92..398b02b2c 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/service/EventMessageType.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/service/EventMessageType.java @@ -1,19 +1,3 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.service; import com.epam.deltix.timebase.messages.OldElementName; @@ -98,4 +82,4 @@ public static EventMessageType strictValueOf(int number) { } return value; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/service/MetaDataChangeMessage.java b/messages/src/main/java/com/epam/deltix/timebase/messages/service/MetaDataChangeMessage.java index fb1d378d5..325a9601a 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/service/MetaDataChangeMessage.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/service/MetaDataChangeMessage.java @@ -1,30 +1,6 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.service; -import com.epam.deltix.timebase.messages.OldElementName; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.TypeConstants; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; +import com.epam.deltix.timebase.messages.*; /** * Special transient message that signals active stream consumers that their stream metadata has been changed @@ -73,14 +49,14 @@ public void setConverted(boolean value) { * @return true if Converted is not null */ public boolean hasConverted() { - return converted != com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; + return converted != TypeConstants.BOOLEAN_NULL; } /** * Indicates, that stream data was converted. */ public void nullifyConverted() { - this.converted = com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; + this.converted = TypeConstants.BOOLEAN_NULL; } /** @@ -105,13 +81,13 @@ public void setVersion(long value) { * @return true if Version is not null */ public boolean hasVersion() { - return version != com.epam.deltix.timebase.messages.TypeConstants.INT64_NULL; + return version != TypeConstants.INT64_NULL; } /** */ public void nullifyVersion() { - this.version = com.epam.deltix.timebase.messages.TypeConstants.INT64_NULL; + this.version = TypeConstants.INT64_NULL; } /** @@ -140,8 +116,8 @@ public MetaDataChangeMessage nullify() { @Override public MetaDataChangeMessage reset() { super.reset(); - converted = com.epam.deltix.timebase.messages.TypeConstants.BOOLEAN_NULL; - version = com.epam.deltix.timebase.messages.TypeConstants.INT64_NULL; + converted = TypeConstants.BOOLEAN_NULL; + version = TypeConstants.INT64_NULL; return this; } @@ -240,4 +216,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/service/RealTimeStartMessage.java b/messages/src/main/java/com/epam/deltix/timebase/messages/service/RealTimeStartMessage.java index faddfd61a..21a86898c 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/service/RealTimeStartMessage.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/service/RealTimeStartMessage.java @@ -1,30 +1,6 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.service; -import com.epam.deltix.timebase.messages.OldElementName; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.SchemaGuid; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; +import com.epam.deltix.timebase.messages.*; /** * Special transient message that is inserted into MessageSource to signal transition from historic to real-time data. @@ -136,4 +112,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/service/StreamTruncatedMessage.java b/messages/src/main/java/com/epam/deltix/timebase/messages/service/StreamTruncatedMessage.java index 9bc87778a..232bbbd7e 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/service/StreamTruncatedMessage.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/service/StreamTruncatedMessage.java @@ -1,34 +1,9 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.service; -import com.epam.deltix.timebase.messages.OldElementName; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import com.epam.deltix.timebase.messages.SchemaElement; -import com.epam.deltix.timebase.messages.TypeConstants; -import java.lang.CharSequence; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; import com.epam.deltix.containers.BinaryAsciiString; import com.epam.deltix.containers.CharSequenceUtils; import com.epam.deltix.containers.MutableString; +import com.epam.deltix.timebase.messages.*; /** * Special transient message that signals active stream consumers that their stream has been truncated @@ -112,14 +87,14 @@ public void setTruncateTime(long value) { * @return true if Truncated Time is not null */ public boolean hasTruncateTime() { - return truncateTime != com.epam.deltix.timebase.messages.TypeConstants.TIMESTAMP_UNKNOWN; + return truncateTime != TypeConstants.TIMESTAMP_UNKNOWN; } /** * Time of truncation in nanoseconds */ public void nullifyTruncateTime() { - this.truncateTime = com.epam.deltix.timebase.messages.TypeConstants.TIMESTAMP_UNKNOWN; + this.truncateTime = TypeConstants.TIMESTAMP_UNKNOWN; } /** @@ -144,13 +119,13 @@ public void setVersion(long value) { * @return true if Version is not null */ public boolean hasVersion() { - return version != com.epam.deltix.timebase.messages.TypeConstants.INT64_NULL; + return version != TypeConstants.INT64_NULL; } /** */ public void nullifyVersion() { - this.version = com.epam.deltix.timebase.messages.TypeConstants.INT64_NULL; + this.version = TypeConstants.INT64_NULL; } /** @@ -181,8 +156,8 @@ public StreamTruncatedMessage nullify() { public StreamTruncatedMessage reset() { super.reset(); instruments = null; - truncateTime = com.epam.deltix.timebase.messages.TypeConstants.TIMESTAMP_UNKNOWN; - version = com.epam.deltix.timebase.messages.TypeConstants.INT64_NULL; + truncateTime = TypeConstants.TIMESTAMP_UNKNOWN; + version = TypeConstants.INT64_NULL; return this; } @@ -309,4 +284,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/service/SystemMessage.java b/messages/src/main/java/com/epam/deltix/timebase/messages/service/SystemMessage.java index 027bb6024..69be86225 100644 --- a/messages/src/main/java/com/epam/deltix/timebase/messages/service/SystemMessage.java +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/service/SystemMessage.java @@ -1,30 +1,6 @@ -/* - * Copyright 2021 EPAM Systems, Inc - * - * See the NOTICE file distributed with this work for additional information - * regarding copyright ownership. Licensed under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ package com.epam.deltix.timebase.messages.service; -import com.epam.deltix.timebase.messages.InstrumentMessage; -import com.epam.deltix.timebase.messages.OldElementName; -import com.epam.deltix.timebase.messages.RecordInfo; -import com.epam.deltix.timebase.messages.RecordInterface; -import com.epam.deltix.timebase.messages.SchemaElement; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.lang.StringBuilder; +import com.epam.deltix.timebase.messages.*; /** * Base timebase system message. @@ -129,4 +105,4 @@ public StringBuilder toString(StringBuilder str) { str.append("}"); return str; } -} \ No newline at end of file +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/AggressorSide.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/AggressorSide.java new file mode 100644 index 000000000..0c2ceabbc --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/AggressorSide.java @@ -0,0 +1,54 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.SchemaElement; + +/** + * Side of quote or trade. Buy or Sell. + */ +@SchemaElement( + name = "deltix.timebase.api.messages.AggressorSide", + title = "Aggressor Side" +) +public enum AggressorSide { + /** + * Buy side. + */ + @SchemaElement( + name = "BUY" + ) + BUY(0), + + /** + * Sell side. + */ + @SchemaElement( + name = "SELL" + ) + SELL(1); + + private final int value; + + AggressorSide(int value) { + this.value = value; + } + + public int getNumber() { + return this.value; + } + + public static AggressorSide valueOf(int number) { + switch (number) { + case 0: return BUY; + case 1: return SELL; + default: return null; + } + } + + public static AggressorSide strictValueOf(int number) { + final AggressorSide value = valueOf(number); + if (value == null) { + throw new IllegalArgumentException("Enumeration 'AggressorSide' does not have value corresponding to '" + number + "'."); + } + return value; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BaseEntry.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BaseEntry.java new file mode 100644 index 000000000..8fd25d12d --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BaseEntry.java @@ -0,0 +1,278 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.*; + +/** + * Base class for market data entry to be included in package (PackageHeader). + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.universal.BaseEntry", + title = "Base Entry" +) +public class BaseEntry implements BaseEntryInterface { + public static final String CLASS_NAME = BaseEntry.class.getName(); + + /** + * Exchange code compressed to long using ALPHANUMERIC(10) encoding. + * see #getExchange() + */ + protected long exchangeId = TypeConstants.EXCHANGE_NULL; + + /** + * True, if quote (or trade) comes from an implied Order book. + */ + protected byte isImplied = TypeConstants.BOOLEAN_NULL; + + /** + * Special field designed to store multiple derivative instruments' updates + * into single package. Most of the time should be static null. + */ + protected long contractId = TypeConstants.INT64_NULL; + + /** + * Exchange code compressed to long using ALPHANUMERIC(10) encoding. + * see #getExchange() + * @return Exchange Code + */ + @SchemaElement( + title = "Exchange Code" + ) + @SchemaType( + encoding = "ALPHANUMERIC(10)", + dataType = SchemaDataType.VARCHAR + ) + public long getExchangeId() { + return exchangeId; + } + + /** + * Exchange code compressed to long using ALPHANUMERIC(10) encoding. + * see #getExchange() + * @param value - Exchange Code + */ + public void setExchangeId(long value) { + this.exchangeId = value; + } + + /** + * Exchange code compressed to long using ALPHANUMERIC(10) encoding. + * see #getExchange() + * @return true if Exchange Code is not null + */ + public boolean hasExchangeId() { + return exchangeId != TypeConstants.EXCHANGE_NULL; + } + + /** + * Exchange code compressed to long using ALPHANUMERIC(10) encoding. + * see #getExchange() + */ + public void nullifyExchangeId() { + this.exchangeId = TypeConstants.EXCHANGE_NULL; + } + + /** + * True, if quote (or trade) comes from an implied Order book. + * @return Is Implied + */ + @SchemaElement( + title = "Is Implied" + ) + @SchemaType( + dataType = SchemaDataType.BOOLEAN + ) + public boolean isImplied() { + return isImplied == 1; + } + + /** + * True, if quote (or trade) comes from an implied Order book. + * @param value - Is Implied + */ + public void setIsImplied(boolean value) { + this.isImplied = (byte)(value ? 1 : 0); + } + + /** + * True, if quote (or trade) comes from an implied Order book. + * @return true if Is Implied is not null + */ + public boolean hasIsImplied() { + return isImplied != TypeConstants.BOOLEAN_NULL; + } + + /** + * True, if quote (or trade) comes from an implied Order book. + */ + public void nullifyIsImplied() { + this.isImplied = TypeConstants.BOOLEAN_NULL; + } + + /** + * Special field designed to store multiple derivative instruments' updates + * into single package. Most of the time should be static null. + * @return Contract ID + */ + @SchemaElement( + title = "Contract ID" + ) + @SchemaType( + encoding = "ALPHANUMERIC(10)", + dataType = SchemaDataType.VARCHAR + ) + public long getContractId() { + return contractId; + } + + /** + * Special field designed to store multiple derivative instruments' updates + * into single package. Most of the time should be static null. + * @param value - Contract ID + */ + public void setContractId(long value) { + this.contractId = value; + } + + /** + * Special field designed to store multiple derivative instruments' updates + * into single package. Most of the time should be static null. + * @return true if Contract ID is not null + */ + public boolean hasContractId() { + return contractId != TypeConstants.INT64_NULL; + } + + /** + * Special field designed to store multiple derivative instruments' updates + * into single package. Most of the time should be static null. + */ + public void nullifyContractId() { + this.contractId = TypeConstants.INT64_NULL; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + protected BaseEntry createInstance() { + return new BaseEntry(); + } + + /** + * Method nullifies all instance properties + */ + public BaseEntry nullify() { + nullifyExchangeId(); + nullifyIsImplied(); + nullifyContractId(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + public BaseEntry reset() { + exchangeId = TypeConstants.EXCHANGE_NULL; + isImplied = TypeConstants.BOOLEAN_NULL; + contractId = TypeConstants.INT64_NULL; + return this; + } + + /** + * Method copies state to a given instance + */ + public BaseEntry clone() { + BaseEntry t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (!(obj instanceof BaseEntryInfo)) return false; + BaseEntryInfo other =(BaseEntryInfo)obj; + if (hasExchangeId() != other.hasExchangeId()) return false; + if (hasExchangeId() && getExchangeId() != other.getExchangeId()) return false; + if (hasIsImplied() != other.hasIsImplied()) return false; + if (hasIsImplied() && isImplied() != other.isImplied()) return false; + if (hasContractId() != other.hasContractId()) return false; + if (hasContractId() && getContractId() != other.getContractId()) return false; + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = 0; + if (hasExchangeId()) { + hash = hash * 31 + ((int)(getExchangeId() ^ (getExchangeId() >>> 32))); + } + if (hasIsImplied()) { + hash = hash * 31 + (isImplied() ? 1231 : 1237); + } + if (hasContractId()) { + hash = hash * 31 + ((int)(getContractId() ^ (getContractId() >>> 32))); + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + public BaseEntry copyFrom(RecordInfo template) { + if (template instanceof BaseEntryInfo) { + BaseEntryInfo t = (BaseEntryInfo)template; + if (t.hasExchangeId()) { + setExchangeId(t.getExchangeId()); + } else { + nullifyExchangeId(); + } + if (t.hasIsImplied()) { + setIsImplied(t.isImplied()); + } else { + nullifyIsImplied(); + } + if (t.hasContractId()) { + setContractId(t.getContractId()); + } else { + nullifyContractId(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"BaseEntry\""); + if (hasExchangeId()) { + str.append(", \"exchangeId\": ").append(getExchangeId()); + } + if (hasIsImplied()) { + str.append(", \"isImplied\": ").append(isImplied()); + } + if (hasContractId()) { + str.append(", \"contractId\": ").append(getContractId()); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BaseEntryInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BaseEntryInfo.java new file mode 100644 index 000000000..70493d675 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BaseEntryInfo.java @@ -0,0 +1,54 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.RecordInfo; + +/** + * Base class for market data entry to be included in package (PackageHeader). + */ +public interface BaseEntryInfo extends RecordInfo { + /** + * Exchange code compressed to long using ALPHANUMERIC(10) encoding. + * see #getExchange() + * @return Exchange Code + */ + long getExchangeId(); + + /** + * Exchange code compressed to long using ALPHANUMERIC(10) encoding. + * see #getExchange() + * @return true if Exchange Code is not null + */ + boolean hasExchangeId(); + + /** + * True, if quote (or trade) comes from an implied Order book. + * @return Is Implied + */ + boolean isImplied(); + + /** + * True, if quote (or trade) comes from an implied Order book. + * @return true if Is Implied is not null + */ + boolean hasIsImplied(); + + /** + * Special field designed to store multiple derivative instruments' updates + * into single package. Most of the time should be static null. + * @return Contract ID + */ + long getContractId(); + + /** + * Special field designed to store multiple derivative instruments' updates + * into single package. Most of the time should be static null. + * @return true if Contract ID is not null + */ + boolean hasContractId(); + + /** + * Method copies state to a given instance + */ + @Override + BaseEntryInfo clone(); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BaseEntryInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BaseEntryInterface.java new file mode 100644 index 000000000..aa32cd7ce --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BaseEntryInterface.java @@ -0,0 +1,61 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.RecordInterface; + +/** + * Base class for market data entry to be included in package (PackageHeader). + */ +public interface BaseEntryInterface extends BaseEntryInfo, RecordInterface { + /** + * Exchange code compressed to long using ALPHANUMERIC(10) encoding. + * see #getExchange() + * @param value - Exchange Code + */ + void setExchangeId(long value); + + /** + * Exchange code compressed to long using ALPHANUMERIC(10) encoding. + * see #getExchange() + */ + void nullifyExchangeId(); + + /** + * True, if quote (or trade) comes from an implied Order book. + * @param value - Is Implied + */ + void setIsImplied(boolean value); + + /** + * True, if quote (or trade) comes from an implied Order book. + */ + void nullifyIsImplied(); + + /** + * Special field designed to store multiple derivative instruments' updates + * into single package. Most of the time should be static null. + * @param value - Contract ID + */ + void setContractId(long value); + + /** + * Special field designed to store multiple derivative instruments' updates + * into single package. Most of the time should be static null. + */ + void nullifyContractId(); + + /** + * Method nullifies all instance properties + */ + @Override + BaseEntryInterface nullify(); + + /** + * Resets all instance properties to their default values + */ + @Override + BaseEntryInterface reset(); + + @Override + BaseEntryInterface copyFrom(RecordInfo template); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BasePriceEntry.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BasePriceEntry.java new file mode 100644 index 000000000..2a0bb0eb1 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BasePriceEntry.java @@ -0,0 +1,449 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.containers.BinaryAsciiString; +import com.epam.deltix.containers.CharSequenceUtils; +import com.epam.deltix.containers.MutableString; +import com.epam.deltix.dfp.Decimal; +import com.epam.deltix.dfp.Decimal64Utils; +import com.epam.deltix.timebase.messages.*; + +/** + * This is base class for price entry. + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.universal.BasePriceEntry", + title = "Base Price Entry" +) +public class BasePriceEntry extends BaseEntry implements BasePriceEntryInterface { + public static final String CLASS_NAME = BasePriceEntry.class.getName(); + + /** + * Ask, Bid or Trade price. + */ + @Decimal + protected long price = TypeConstants.DECIMAL_NULL; + + /** + * Ask, Bid or Trade quantity. + */ + protected long size = TypeConstants.DECIMAL_NULL; + + /** + * Numbers of orders. + */ + protected long numberOfOrders = TypeConstants.INT64_NULL; + + /** + * Quote ID. In Forex market, for example, quote ID can be referenced in + * TradeOrders (to identify market maker's quote/rate we want to deal with). + * Each market maker usually keeps this ID unique per session per day. This + * is a alpha-numeric text text field that can reach 64 characters or more, + * depending on market maker. + */ + protected CharSequence quoteId = null; + + /** + * Id of participant (or broker ID). + */ + protected CharSequence participantId = null; + + /** + * Ask, Bid or Trade price. + * @return Price + */ + @Decimal + @SchemaElement( + title = "Price" + ) + @SchemaType( + encoding = "DECIMAL64", + dataType = SchemaDataType.FLOAT + ) + public long getPrice() { + return price; + } + + /** + * Ask, Bid or Trade price. + * @param value - Price + */ + public void setPrice(@Decimal long value) { + this.price = value; + } + + /** + * Ask, Bid or Trade price. + * @return true if Price is not null + */ + public boolean hasPrice() { + return price != TypeConstants.DECIMAL_NULL; + } + + /** + * Ask, Bid or Trade price. + */ + public void nullifyPrice() { + this.price = TypeConstants.DECIMAL_NULL; + } + + /** + * Ask, Bid or Trade quantity. + * @return Size + */ + @SchemaElement( + title = "Size" + ) + @SchemaType( + encoding = "DECIMAL64", + dataType = SchemaDataType.FLOAT + ) + public long getSize() { + return size; + } + + /** + * Ask, Bid or Trade quantity. + * @param value - Size + */ + public void setSize(long value) { + this.size = value; + } + + /** + * Ask, Bid or Trade quantity. + * @return true if Size is not null + */ + public boolean hasSize() { + return size != TypeConstants.DECIMAL_NULL; + } + + /** + * Ask, Bid or Trade quantity. + */ + public void nullifySize() { + this.size = TypeConstants.DECIMAL_NULL; + } + + /** + * Numbers of orders. + * @return Number Of Orders + */ + @SchemaElement( + title = "Number Of Orders" + ) + public long getNumberOfOrders() { + return numberOfOrders; + } + + /** + * Numbers of orders. + * @param value - Number Of Orders + */ + public void setNumberOfOrders(long value) { + this.numberOfOrders = value; + } + + /** + * Numbers of orders. + * @return true if Number Of Orders is not null + */ + public boolean hasNumberOfOrders() { + return numberOfOrders != TypeConstants.INT64_NULL; + } + + /** + * Numbers of orders. + */ + public void nullifyNumberOfOrders() { + this.numberOfOrders = TypeConstants.INT64_NULL; + } + + /** + * Quote ID. In Forex market, for example, quote ID can be referenced in + * TradeOrders (to identify market maker's quote/rate we want to deal with). + * Each market maker usually keeps this ID unique per session per day. This + * is a alpha-numeric text text field that can reach 64 characters or more, + * depending on market maker. + * @return Quote ID + */ + @Identifier + @SchemaElement( + title = "Quote ID" + ) + public CharSequence getQuoteId() { + return quoteId; + } + + /** + * Quote ID. In Forex market, for example, quote ID can be referenced in + * TradeOrders (to identify market maker's quote/rate we want to deal with). + * Each market maker usually keeps this ID unique per session per day. This + * is a alpha-numeric text text field that can reach 64 characters or more, + * depending on market maker. + * @param value - Quote ID + */ + public void setQuoteId(CharSequence value) { + this.quoteId = value; + } + + /** + * Quote ID. In Forex market, for example, quote ID can be referenced in + * TradeOrders (to identify market maker's quote/rate we want to deal with). + * Each market maker usually keeps this ID unique per session per day. This + * is a alpha-numeric text text field that can reach 64 characters or more, + * depending on market maker. + * @return true if Quote ID is not null + */ + public boolean hasQuoteId() { + return quoteId != null; + } + + /** + * Quote ID. In Forex market, for example, quote ID can be referenced in + * TradeOrders (to identify market maker's quote/rate we want to deal with). + * Each market maker usually keeps this ID unique per session per day. This + * is a alpha-numeric text text field that can reach 64 characters or more, + * depending on market maker. + */ + public void nullifyQuoteId() { + this.quoteId = null; + } + + /** + * Id of participant (or broker ID). + * @return Participant + */ + @Identifier + @SchemaElement( + title = "Participant" + ) + public CharSequence getParticipantId() { + return participantId; + } + + /** + * Id of participant (or broker ID). + * @param value - Participant + */ + public void setParticipantId(CharSequence value) { + this.participantId = value; + } + + /** + * Id of participant (or broker ID). + * @return true if Participant is not null + */ + public boolean hasParticipantId() { + return participantId != null; + } + + /** + * Id of participant (or broker ID). + */ + public void nullifyParticipantId() { + this.participantId = null; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + @Override + protected BasePriceEntry createInstance() { + return new BasePriceEntry(); + } + + /** + * Method nullifies all instance properties + */ + @Override + public BasePriceEntry nullify() { + super.nullify(); + nullifyPrice(); + nullifySize(); + nullifyNumberOfOrders(); + nullifyQuoteId(); + nullifyParticipantId(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + @Override + public BasePriceEntry reset() { + super.reset(); + price = TypeConstants.DECIMAL_NULL; + size = TypeConstants.DECIMAL_NULL; + numberOfOrders = TypeConstants.INT64_NULL; + quoteId = null; + participantId = null; + return this; + } + + /** + * Method copies state to a given instance + */ + @Override + public BasePriceEntry clone() { + BasePriceEntry t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + boolean superEquals = super.equals(obj); + if (!superEquals) return false; + if (!(obj instanceof BasePriceEntryInfo)) return false; + BasePriceEntryInfo other =(BasePriceEntryInfo)obj; + if (hasPrice() != other.hasPrice()) return false; + if (hasPrice() && !Decimal64Utils.equals(getPrice(), other.getPrice())) return false; + if (hasSize() != other.hasSize()) return false; + if (hasSize() && !Decimal64Utils.equals(getSize(), other.getSize())) return false; + if (hasNumberOfOrders() != other.hasNumberOfOrders()) return false; + if (hasNumberOfOrders() && getNumberOfOrders() != other.getNumberOfOrders()) return false; + if (hasQuoteId() != other.hasQuoteId()) return false; + if (hasQuoteId()) { + if (getQuoteId().length() != other.getQuoteId().length()) return false; else { + CharSequence s1 = getQuoteId(); + CharSequence s2 = other.getQuoteId(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } + if (hasParticipantId() != other.hasParticipantId()) return false; + if (hasParticipantId()) { + if (getParticipantId().length() != other.getParticipantId().length()) return false; else { + CharSequence s1 = getParticipantId(); + CharSequence s2 = other.getParticipantId(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = super.hashCode(); + if (hasPrice()) { + hash = hash * 31 + ((int)(getPrice() ^ (getPrice() >>> 32))); + } + if (hasSize()) { + hash = hash * 31 + ((int)(getSize() ^ (getSize() >>> 32))); + } + if (hasNumberOfOrders()) { + hash = hash * 31 + ((int)(getNumberOfOrders() ^ (getNumberOfOrders() >>> 32))); + } + if (hasQuoteId()) { + hash = hash * 31 + getQuoteId().hashCode(); + } + if (hasParticipantId()) { + hash = hash * 31 + getParticipantId().hashCode(); + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + @Override + public BasePriceEntry copyFrom(RecordInfo template) { + super.copyFrom(template); + if (template instanceof BasePriceEntryInfo) { + BasePriceEntryInfo t = (BasePriceEntryInfo)template; + if (t.hasPrice()) { + setPrice(t.getPrice()); + } else { + nullifyPrice(); + } + if (t.hasSize()) { + setSize(t.getSize()); + } else { + nullifySize(); + } + if (t.hasNumberOfOrders()) { + setNumberOfOrders(t.getNumberOfOrders()); + } else { + nullifyNumberOfOrders(); + } + if (t.hasQuoteId()) { + if (!(hasQuoteId() && getQuoteId() instanceof BinaryAsciiString)) { + setQuoteId(new BinaryAsciiString()); + } + ((BinaryAsciiString)getQuoteId()).assign(t.getQuoteId()); + } else { + nullifyQuoteId(); + } + if (t.hasParticipantId()) { + if (!(hasParticipantId() && getParticipantId() instanceof BinaryAsciiString)) { + setParticipantId(new BinaryAsciiString()); + } + ((BinaryAsciiString)getParticipantId()).assign(t.getParticipantId()); + } else { + nullifyParticipantId(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"BasePriceEntry\""); + if (hasPrice()) { + str.append(", \"price\": "); + Decimal64Utils.appendTo(getPrice(), str); + } + if (hasSize()) { + str.append(", \"size\": "); + Decimal64Utils.appendTo(getSize(), str); + } + if (hasNumberOfOrders()) { + str.append(", \"numberOfOrders\": ").append(getNumberOfOrders()); + } + if (hasQuoteId()) { + str.append(", \"quoteId\": \"").append(getQuoteId()).append("\""); + } + if (hasParticipantId()) { + str.append(", \"participantId\": \"").append(getParticipantId()).append("\""); + } + if (hasExchangeId()) { + str.append(", \"exchangeId\": ").append(getExchangeId()); + } + if (hasIsImplied()) { + str.append(", \"isImplied\": ").append(isImplied()); + } + if (hasContractId()) { + str.append(", \"contractId\": ").append(getContractId()); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BasePriceEntryInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BasePriceEntryInfo.java new file mode 100644 index 000000000..4b422998c --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BasePriceEntryInfo.java @@ -0,0 +1,83 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.dfp.Decimal; + +/** + * This is base class for price entry. + */ +public interface BasePriceEntryInfo extends BaseEntryInfo { + /** + * Ask, Bid or Trade price. + * @return Price + */ + @Decimal + long getPrice(); + + /** + * Ask, Bid or Trade price. + * @return true if Price is not null + */ + boolean hasPrice(); + + /** + * Ask, Bid or Trade quantity. + * @return Size + */ + long getSize(); + + /** + * Ask, Bid or Trade quantity. + * @return true if Size is not null + */ + boolean hasSize(); + + /** + * Numbers of orders. + * @return Number Of Orders + */ + long getNumberOfOrders(); + + /** + * Numbers of orders. + * @return true if Number Of Orders is not null + */ + boolean hasNumberOfOrders(); + + /** + * Quote ID. In Forex market, for example, quote ID can be referenced in + * TradeOrders (to identify market maker's quote/rate we want to deal with). + * Each market maker usually keeps this ID unique per session per day. This + * is a alpha-numeric text text field that can reach 64 characters or more, + * depending on market maker. + * @return Quote ID + */ + CharSequence getQuoteId(); + + /** + * Quote ID. In Forex market, for example, quote ID can be referenced in + * TradeOrders (to identify market maker's quote/rate we want to deal with). + * Each market maker usually keeps this ID unique per session per day. This + * is a alpha-numeric text text field that can reach 64 characters or more, + * depending on market maker. + * @return true if Quote ID is not null + */ + boolean hasQuoteId(); + + /** + * Id of participant (or broker ID). + * @return Participant + */ + CharSequence getParticipantId(); + + /** + * Id of participant (or broker ID). + * @return true if Participant is not null + */ + boolean hasParticipantId(); + + /** + * Method copies state to a given instance + */ + @Override + BasePriceEntryInfo clone(); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BasePriceEntryInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BasePriceEntryInterface.java new file mode 100644 index 000000000..f37d4b6d6 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BasePriceEntryInterface.java @@ -0,0 +1,87 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.dfp.Decimal; +import com.epam.deltix.timebase.messages.RecordInfo; + +/** + * This is base class for price entry. + */ +public interface BasePriceEntryInterface extends BasePriceEntryInfo, BaseEntryInterface { + /** + * Ask, Bid or Trade price. + * @param value - Price + */ + void setPrice(@Decimal long value); + + /** + * Ask, Bid or Trade price. + */ + void nullifyPrice(); + + /** + * Ask, Bid or Trade quantity. + * @param value - Size + */ + void setSize(long value); + + /** + * Ask, Bid or Trade quantity. + */ + void nullifySize(); + + /** + * Numbers of orders. + * @param value - Number Of Orders + */ + void setNumberOfOrders(long value); + + /** + * Numbers of orders. + */ + void nullifyNumberOfOrders(); + + /** + * Quote ID. In Forex market, for example, quote ID can be referenced in + * TradeOrders (to identify market maker's quote/rate we want to deal with). + * Each market maker usually keeps this ID unique per session per day. This + * is a alpha-numeric text text field that can reach 64 characters or more, + * depending on market maker. + * @param value - Quote ID + */ + void setQuoteId(CharSequence value); + + /** + * Quote ID. In Forex market, for example, quote ID can be referenced in + * TradeOrders (to identify market maker's quote/rate we want to deal with). + * Each market maker usually keeps this ID unique per session per day. This + * is a alpha-numeric text text field that can reach 64 characters or more, + * depending on market maker. + */ + void nullifyQuoteId(); + + /** + * Id of participant (or broker ID). + * @param value - Participant + */ + void setParticipantId(CharSequence value); + + /** + * Id of participant (or broker ID). + */ + void nullifyParticipantId(); + + /** + * Method nullifies all instance properties + */ + @Override + BasePriceEntryInterface nullify(); + + /** + * Resets all instance properties to their default values + */ + @Override + BasePriceEntryInterface reset(); + + @Override + BasePriceEntryInterface copyFrom(RecordInfo template); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BookResetEntry.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BookResetEntry.java new file mode 100644 index 000000000..694114bfc --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BookResetEntry.java @@ -0,0 +1,247 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.SchemaElement; +import com.epam.deltix.timebase.messages.SchemaType; + +/** + * This entry used for empty snapshot indication. It is necessary because PackageHeader has no field exchangeId. + * You should use this entry only for empty snapshot (both sides are empty) case. + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.universal.BookResetEntry", + title = "Book Reset Entry" +) +public class BookResetEntry extends BaseEntry implements BookResetEntryInterface { + public static final String CLASS_NAME = BookResetEntry.class.getName(); + + /** + * Deprecated as of November 2019. No longer used. BookResetEntry now applies to both sides of Order Book and must be used only in snapshot package types. + * Previous meaning: Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + protected QuoteSide side = null; + + /** + * Data Model Type to identify what book we should reset. + */ + protected DataModelType modelType = null; + + /** + * Deprecated as of November 2019. No longer used. BookResetEntry now applies to both sides of Order Book and must be used only in snapshot package types. + * Previous meaning: Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return Side + */ + @Deprecated + @SchemaType( + isNullable = true + ) + @SchemaElement( + title = "Side" + ) + public QuoteSide getSide() { + return side; + } + + /** + * Deprecated as of November 2019. No longer used. BookResetEntry now applies to both sides of Order Book and must be used only in snapshot package types. + * Previous meaning: Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @param value - Side + */ + public void setSide(QuoteSide value) { + this.side = value; + } + + /** + * Deprecated as of November 2019. No longer used. BookResetEntry now applies to both sides of Order Book and must be used only in snapshot package types. + * Previous meaning: Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return true if Side is not null + */ + public boolean hasSide() { + return side != null; + } + + /** + * Deprecated as of November 2019. No longer used. BookResetEntry now applies to both sides of Order Book and must be used only in snapshot package types. + * Previous meaning: Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + public void nullifySide() { + this.side = null; + } + + /** + * Data Model Type to identify what book we should reset. + * @return Model Type + */ + @SchemaType( + isNullable = false + ) + @SchemaElement( + title = "Model Type" + ) + public DataModelType getModelType() { + return modelType; + } + + /** + * Data Model Type to identify what book we should reset. + * @param value - Model Type + */ + public void setModelType(DataModelType value) { + this.modelType = value; + } + + /** + * Data Model Type to identify what book we should reset. + * @return true if Model Type is not null + */ + public boolean hasModelType() { + return modelType != null; + } + + /** + * Data Model Type to identify what book we should reset. + */ + public void nullifyModelType() { + this.modelType = null; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + @Override + protected BookResetEntry createInstance() { + return new BookResetEntry(); + } + + /** + * Method nullifies all instance properties + */ + @Override + public BookResetEntry nullify() { + super.nullify(); + nullifySide(); + nullifyModelType(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + @Override + public BookResetEntry reset() { + super.reset(); + side = null; + modelType = null; + return this; + } + + /** + * Method copies state to a given instance + */ + @Override + public BookResetEntry clone() { + BookResetEntry t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + boolean superEquals = super.equals(obj); + if (!superEquals) return false; + if (!(obj instanceof BookResetEntryInfo)) return false; + BookResetEntryInfo other =(BookResetEntryInfo)obj; + if (hasSide() != other.hasSide()) return false; + if (hasSide() && getSide() != other.getSide()) return false; + if (hasModelType() != other.hasModelType()) return false; + if (hasModelType() && getModelType() != other.getModelType()) return false; + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = super.hashCode(); + if (hasSide()) { + hash = hash * 31 + getSide().getNumber(); + } + if (hasModelType()) { + hash = hash * 31 + getModelType().getNumber(); + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + @Override + public BookResetEntry copyFrom(RecordInfo template) { + super.copyFrom(template); + if (template instanceof BookResetEntryInfo) { + BookResetEntryInfo t = (BookResetEntryInfo)template; + if (t.hasSide()) { + setSide(t.getSide()); + } else { + nullifySide(); + } + if (t.hasModelType()) { + setModelType(t.getModelType()); + } else { + nullifyModelType(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"BookResetEntry\""); + if (hasSide()) { + str.append(", \"side\": \"").append(getSide()).append("\""); + } + if (hasModelType()) { + str.append(", \"modelType\": \"").append(getModelType()).append("\""); + } + if (hasExchangeId()) { + str.append(", \"exchangeId\": ").append(getExchangeId()); + } + if (hasIsImplied()) { + str.append(", \"isImplied\": ").append(isImplied()); + } + if (hasContractId()) { + str.append(", \"contractId\": ").append(getContractId()); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BookResetEntryInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BookResetEntryInfo.java new file mode 100644 index 000000000..3ca3f6ac9 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BookResetEntryInfo.java @@ -0,0 +1,43 @@ +package com.epam.deltix.timebase.messages.universal; + +/** + * This entry used for empty snapshot indication. It is necessary because PackageHeader has no field exchangeId. + * You should use this entry only for empty snapshot (both sides are empty) case. + */ +public interface BookResetEntryInfo extends BaseEntryInfo { + /** + * Deprecated as of November 2019. No longer used. BookResetEntry now applies to both sides of Order Book and must be used only in snapshot package types. + * Previous meaning: Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return Side + */ + QuoteSide getSide(); + + /** + * Deprecated as of November 2019. No longer used. BookResetEntry now applies to both sides of Order Book and must be used only in snapshot package types. + * Previous meaning: Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return true if Side is not null + */ + boolean hasSide(); + + /** + * Data Model Type to identify what book we should reset. + * @return Model Type + */ + DataModelType getModelType(); + + /** + * Data Model Type to identify what book we should reset. + * @return true if Model Type is not null + */ + boolean hasModelType(); + + /** + * Method copies state to a given instance + */ + @Override + BookResetEntryInfo clone(); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BookResetEntryInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BookResetEntryInterface.java new file mode 100644 index 000000000..5ed73d377 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BookResetEntryInterface.java @@ -0,0 +1,52 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.RecordInfo; + +/** + * This entry used for empty snapshot indication. It is necessary because PackageHeader has no field exchangeId. + * You should use this entry only for empty snapshot (both sides are empty) case. + */ +public interface BookResetEntryInterface extends BookResetEntryInfo, BaseEntryInterface { + /** + * Deprecated as of November 2019. No longer used. BookResetEntry now applies to both sides of Order Book and must be used only in snapshot package types. + * Previous meaning: Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @param value - Side + */ + void setSide(QuoteSide value); + + /** + * Deprecated as of November 2019. No longer used. BookResetEntry now applies to both sides of Order Book and must be used only in snapshot package types. + * Previous meaning: Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + void nullifySide(); + + /** + * Data Model Type to identify what book we should reset. + * @param value - Model Type + */ + void setModelType(DataModelType value); + + /** + * Data Model Type to identify what book we should reset. + */ + void nullifyModelType(); + + /** + * Method nullifies all instance properties + */ + @Override + BookResetEntryInterface nullify(); + + /** + * Resets all instance properties to their default values + */ + @Override + BookResetEntryInterface reset(); + + @Override + BookResetEntryInterface copyFrom(RecordInfo template); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BookUpdateAction.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BookUpdateAction.java new file mode 100644 index 000000000..a015dbdda --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/BookUpdateAction.java @@ -0,0 +1,67 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.SchemaElement; + +/** + * Directs how to update an Order Book for L2 format. + */ +@SchemaElement( + name = "deltix.timebase.api.messages.BookUpdateAction", + title = "Book Update Action" +) +public enum BookUpdateAction { + /** + * Quote is inserted (automatically shifts existing levels down). INSERT action is sent if there is a new price level. + * Client systems should then shift price levels down, and delete any price levels past the defined depth of the book. + */ + @SchemaElement( + name = "INSERT" + ) + INSERT(0), + + /** + * Update of an existing quote. The UPDATE action is sent to update characteristics of a price level without changing the price itself, + * or impacting any other prices on the book. The change data block is sent to update the order count and / or quantity for a price level. + * The UPDATE is not sent when the price changes at a given price level. + */ + @SchemaElement( + name = "UPDATE" + ) + UPDATE(1), + + /** + * Quote at given price level is deleted. Client systems should shift prices below the data block up to the price level vacated by the deleted price level. + * If available, an add data block will be sent to fill in the last price level. + */ + @SchemaElement( + name = "DELETE" + ) + DELETE(2); + + private final int value; + + BookUpdateAction(int value) { + this.value = value; + } + + public int getNumber() { + return this.value; + } + + public static BookUpdateAction valueOf(int number) { + switch (number) { + case 0: return INSERT; + case 1: return UPDATE; + case 2: return DELETE; + default: return null; + } + } + + public static BookUpdateAction strictValueOf(int number) { + final BookUpdateAction value = valueOf(number); + if (value == null) { + throw new IllegalArgumentException("Enumeration 'BookUpdateAction' does not have value corresponding to '" + number + "'."); + } + return value; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/DataModelType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/DataModelType.java new file mode 100644 index 000000000..f0c837de6 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/DataModelType.java @@ -0,0 +1,68 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.SchemaElement; + +/** + * Level of data model. + */ +public enum DataModelType { + /** + * Level One (best bid and best offer) + */ + @SchemaElement( + name = "LEVEL_ONE" + ) + LEVEL_ONE(0), + + /** + * Level Two. Market by level. More details than LEVEL_ONE. + */ + @SchemaElement( + name = "LEVEL_TWO" + ) + LEVEL_TWO(1), + + /** + * Level Three. Market by Order. The most detailed view of the market. + */ + @SchemaElement( + name = "LEVEL_THREE" + ) + LEVEL_THREE(2), + + /** + * Maximal level of details availabe in input market data. + */ + @SchemaElement( + name = "MAX" + ) + MAX(3); + + private final int value; + + DataModelType(int value) { + this.value = value; + } + + public int getNumber() { + return this.value; + } + + public static DataModelType valueOf(int number) { + switch (number) { + case 0: return LEVEL_ONE; + case 1: return LEVEL_TWO; + case 2: return LEVEL_THREE; + case 3: return MAX; + default: return null; + } + } + + public static DataModelType strictValueOf(int number) { + final DataModelType value = valueOf(number); + if (value == null) { + throw new IllegalArgumentException("Enumeration 'DataModelType' does not have value corresponding to '" + number + "'."); + } + return value; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/InsertType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/InsertType.java new file mode 100644 index 000000000..fce7a1e46 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/InsertType.java @@ -0,0 +1,63 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.SchemaElement; + +/** + * Insert type needs to distinguish between AddFront and AddBack. + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.universal.InsertType", + title = "Insert Type" +) +public enum InsertType { + /** + * Add back. + */ + @SchemaElement( + name = "ADD_BACK" + ) + ADD_BACK(0), + + /** + * Add front. + */ + @SchemaElement( + name = "ADD_FRONT" + ) + ADD_FRONT(1), + + /** + * Add by time. + */ + @SchemaElement( + name = "ADD_BEFORE" + ) + ADD_BEFORE(2); + + private final int value; + + InsertType(int value) { + this.value = value; + } + + public int getNumber() { + return this.value; + } + + public static InsertType valueOf(int number) { + switch (number) { + case 0: return ADD_BACK; + case 1: return ADD_FRONT; + case 2: return ADD_BEFORE; + default: return null; + } + } + + public static InsertType strictValueOf(int number) { + final InsertType value = valueOf(number); + if (value == null) { + throw new IllegalArgumentException("Enumeration 'InsertType' does not have value corresponding to '" + number + "'."); + } + return value; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L1Entry.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L1Entry.java new file mode 100644 index 000000000..be6d11bf1 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L1Entry.java @@ -0,0 +1,268 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.dfp.Decimal64Utils; +import com.epam.deltix.timebase.messages.*; + +/** + * This class may represent both exchange-local top of the book (BBO) as well as National Best Bid Offer (NBBO). + * You can use method {getIsNational()} to filter out NBBO messages. + * This is always a one side quote, unlike old BestBidOfferMessage which is two-side (with nullable properties). + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.universal.L1Entry", + title = "L1Entry" +) +public class L1Entry extends BasePriceEntry implements L1EntryInterface { + public static final String CLASS_NAME = L1Entry.class.getName(); + + /** + * return 1 if this BBO quote represents the national best, 0 if this BBO is regional + * and BooleanDataType.NULL if the property is undefined. In case of NBBO you can inspect {#getExchangeId()} + * to see what exchange/ECN has the national best price. + */ + protected byte isNational = TypeConstants.BOOLEAN_NULL; + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + protected QuoteSide side = null; + + /** + * return 1 if this BBO quote represents the national best, 0 if this BBO is regional + * and BooleanDataType.NULL if the property is undefined. In case of NBBO you can inspect {#getExchangeId()} + * to see what exchange/ECN has the national best price. + * @return Is National + */ + @SchemaElement( + title = "Is National" + ) + @SchemaType( + dataType = SchemaDataType.BOOLEAN + ) + public boolean isNational() { + return isNational == 1; + } + + /** + * return 1 if this BBO quote represents the national best, 0 if this BBO is regional + * and BooleanDataType.NULL if the property is undefined. In case of NBBO you can inspect {#getExchangeId()} + * to see what exchange/ECN has the national best price. + * @param value - Is National + */ + public void setIsNational(boolean value) { + this.isNational = (byte)(value ? 1 : 0); + } + + /** + * return 1 if this BBO quote represents the national best, 0 if this BBO is regional + * and BooleanDataType.NULL if the property is undefined. In case of NBBO you can inspect {#getExchangeId()} + * to see what exchange/ECN has the national best price. + * @return true if Is National is not null + */ + public boolean hasIsNational() { + return isNational != TypeConstants.BOOLEAN_NULL; + } + + /** + * return 1 if this BBO quote represents the national best, 0 if this BBO is regional + * and BooleanDataType.NULL if the property is undefined. In case of NBBO you can inspect {#getExchangeId()} + * to see what exchange/ECN has the national best price. + */ + public void nullifyIsNational() { + this.isNational = TypeConstants.BOOLEAN_NULL; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return Side + */ + @SchemaType( + isNullable = false + ) + @SchemaElement( + title = "Side" + ) + public QuoteSide getSide() { + return side; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @param value - Side + */ + public void setSide(QuoteSide value) { + this.side = value; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return true if Side is not null + */ + public boolean hasSide() { + return side != null; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + public void nullifySide() { + this.side = null; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + @Override + protected L1Entry createInstance() { + return new L1Entry(); + } + + /** + * Method nullifies all instance properties + */ + @Override + public L1Entry nullify() { + super.nullify(); + nullifyIsNational(); + nullifySide(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + @Override + public L1Entry reset() { + super.reset(); + isNational = TypeConstants.BOOLEAN_NULL; + side = null; + return this; + } + + /** + * Method copies state to a given instance + */ + @Override + public L1Entry clone() { + L1Entry t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + boolean superEquals = super.equals(obj); + if (!superEquals) return false; + if (!(obj instanceof L1EntryInfo)) return false; + L1EntryInfo other =(L1EntryInfo)obj; + if (hasIsNational() != other.hasIsNational()) return false; + if (hasIsNational() && isNational() != other.isNational()) return false; + if (hasSide() != other.hasSide()) return false; + if (hasSide() && getSide() != other.getSide()) return false; + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = super.hashCode(); + if (hasIsNational()) { + hash = hash * 31 + (isNational() ? 1231 : 1237); + } + if (hasSide()) { + hash = hash * 31 + getSide().getNumber(); + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + @Override + public L1Entry copyFrom(RecordInfo template) { + super.copyFrom(template); + if (template instanceof L1EntryInfo) { + L1EntryInfo t = (L1EntryInfo)template; + if (t.hasIsNational()) { + setIsNational(t.isNational()); + } else { + nullifyIsNational(); + } + if (t.hasSide()) { + setSide(t.getSide()); + } else { + nullifySide(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"L1Entry\""); + if (hasIsNational()) { + str.append(", \"isNational\": ").append(isNational()); + } + if (hasSide()) { + str.append(", \"side\": \"").append(getSide()).append("\""); + } + if (hasPrice()) { + str.append(", \"price\": "); + Decimal64Utils.appendTo(getPrice(), str); + } + if (hasSize()) { + str.append(", \"size\": "); + Decimal64Utils.appendTo(getSize(), str); + } + if (hasNumberOfOrders()) { + str.append(", \"numberOfOrders\": ").append(getNumberOfOrders()); + } + if (hasQuoteId()) { + str.append(", \"quoteId\": \"").append(getQuoteId()).append("\""); + } + if (hasParticipantId()) { + str.append(", \"participantId\": \"").append(getParticipantId()).append("\""); + } + if (hasExchangeId()) { + str.append(", \"exchangeId\": ").append(getExchangeId()); + } + if (hasIsImplied()) { + str.append(", \"isImplied\": ").append(isImplied()); + } + if (hasContractId()) { + str.append(", \"contractId\": ").append(getContractId()); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L1EntryInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L1EntryInfo.java new file mode 100644 index 000000000..dc9b354d4 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L1EntryInfo.java @@ -0,0 +1,46 @@ +package com.epam.deltix.timebase.messages.universal; + +/** + * This class may represent both exchange-local top of the book (BBO) as well as National Best Bid Offer (NBBO). + * You can use method {getIsNational()} to filter out NBBO messages. + * This is always a one side quote, unlike old BestBidOfferMessage which is two-side (with nullable properties). + */ +public interface L1EntryInfo extends BasePriceEntryInfo { + /** + * return 1 if this BBO quote represents the national best, 0 if this BBO is regional + * and BooleanDataType.NULL if the property is undefined. In case of NBBO you can inspect {#getExchangeId()} + * to see what exchange/ECN has the national best price. + * @return Is National + */ + boolean isNational(); + + /** + * return 1 if this BBO quote represents the national best, 0 if this BBO is regional + * and BooleanDataType.NULL if the property is undefined. In case of NBBO you can inspect {#getExchangeId()} + * to see what exchange/ECN has the national best price. + * @return true if Is National is not null + */ + boolean hasIsNational(); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return Side + */ + QuoteSide getSide(); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return true if Side is not null + */ + boolean hasSide(); + + /** + * Method copies state to a given instance + */ + @Override + L1EntryInfo clone(); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L1EntryInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L1EntryInterface.java new file mode 100644 index 000000000..31289355f --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L1EntryInterface.java @@ -0,0 +1,55 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.RecordInfo; + +/** + * This class may represent both exchange-local top of the book (BBO) as well as National Best Bid Offer (NBBO). + * You can use method {getIsNational()} to filter out NBBO messages. + * This is always a one side quote, unlike old BestBidOfferMessage which is two-side (with nullable properties). + */ +public interface L1EntryInterface extends L1EntryInfo, BasePriceEntryInterface { + /** + * return 1 if this BBO quote represents the national best, 0 if this BBO is regional + * and BooleanDataType.NULL if the property is undefined. In case of NBBO you can inspect {#getExchangeId()} + * to see what exchange/ECN has the national best price. + * @param value - Is National + */ + void setIsNational(boolean value); + + /** + * return 1 if this BBO quote represents the national best, 0 if this BBO is regional + * and BooleanDataType.NULL if the property is undefined. In case of NBBO you can inspect {#getExchangeId()} + * to see what exchange/ECN has the national best price. + */ + void nullifyIsNational(); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @param value - Side + */ + void setSide(QuoteSide value); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + void nullifySide(); + + /** + * Method nullifies all instance properties + */ + @Override + L1EntryInterface nullify(); + + /** + * Resets all instance properties to their default values + */ + @Override + L1EntryInterface reset(); + + @Override + L1EntryInterface copyFrom(RecordInfo template); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryNew.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryNew.java new file mode 100644 index 000000000..4d31e43ad --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryNew.java @@ -0,0 +1,267 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.dfp.Decimal64Utils; +import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.SchemaElement; +import com.epam.deltix.timebase.messages.SchemaType; +import com.epam.deltix.timebase.messages.TypeConstants; + +/** + * Reports incremental L2-updates: insert, delete or update of one line in Order Book either on ask or bid side. + * It also can encode L2-snapshot entry. Note L2 is level oriented depth-of-the-book format and should be used + * whenever price or integer index is used to locate book changes. It does support individual quotes book of + * arbitrary depth. But if incremental changes key is a quoteId L3Entry should be used instead. + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.universal.L2EntryNew", + title = "L2EntryNew" +) +public class L2EntryNew extends BasePriceEntry implements L2EntryNewInterface { + public static final String CLASS_NAME = L2EntryNew.class.getName(); + + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + */ + protected short level = TypeConstants.INT16_NULL; + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + protected QuoteSide side = null; + + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + * @return Level Index + */ + @SchemaType( + isNullable = false + ) + @SchemaElement( + title = "Level Index" + ) + public short getLevel() { + return level; + } + + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + * @param value - Level Index + */ + public void setLevel(short value) { + this.level = value; + } + + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + * @return true if Level Index is not null + */ + public boolean hasLevel() { + return level != TypeConstants.INT16_NULL; + } + + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + */ + public void nullifyLevel() { + this.level = TypeConstants.INT16_NULL; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return Side + */ + @SchemaType( + isNullable = false + ) + @SchemaElement( + title = "Side" + ) + public QuoteSide getSide() { + return side; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @param value - Side + */ + public void setSide(QuoteSide value) { + this.side = value; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return true if Side is not null + */ + public boolean hasSide() { + return side != null; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + public void nullifySide() { + this.side = null; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + @Override + protected L2EntryNew createInstance() { + return new L2EntryNew(); + } + + /** + * Method nullifies all instance properties + */ + @Override + public L2EntryNew nullify() { + super.nullify(); + nullifyLevel(); + nullifySide(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + @Override + public L2EntryNew reset() { + super.reset(); + level = TypeConstants.INT16_NULL; + side = null; + return this; + } + + /** + * Method copies state to a given instance + */ + @Override + public L2EntryNew clone() { + L2EntryNew t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + boolean superEquals = super.equals(obj); + if (!superEquals) return false; + if (!(obj instanceof L2EntryNewInfo)) return false; + L2EntryNewInfo other =(L2EntryNewInfo)obj; + if (hasLevel() != other.hasLevel()) return false; + if (hasLevel() && getLevel() != other.getLevel()) return false; + if (hasSide() != other.hasSide()) return false; + if (hasSide() && getSide() != other.getSide()) return false; + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = super.hashCode(); + if (hasLevel()) { + hash = hash * 31 + ((int)getLevel()); + } + if (hasSide()) { + hash = hash * 31 + getSide().getNumber(); + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + @Override + public L2EntryNew copyFrom(RecordInfo template) { + super.copyFrom(template); + if (template instanceof L2EntryNewInfo) { + L2EntryNewInfo t = (L2EntryNewInfo)template; + if (t.hasLevel()) { + setLevel(t.getLevel()); + } else { + nullifyLevel(); + } + if (t.hasSide()) { + setSide(t.getSide()); + } else { + nullifySide(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"L2EntryNew\""); + if (hasLevel()) { + str.append(", \"level\": ").append(getLevel()); + } + if (hasSide()) { + str.append(", \"side\": \"").append(getSide()).append("\""); + } + if (hasPrice()) { + str.append(", \"price\": "); + Decimal64Utils.appendTo(getPrice(), str); + } + if (hasSize()) { + str.append(", \"size\": "); + Decimal64Utils.appendTo(getSize(), str); + } + if (hasNumberOfOrders()) { + str.append(", \"numberOfOrders\": ").append(getNumberOfOrders()); + } + if (hasQuoteId()) { + str.append(", \"quoteId\": \"").append(getQuoteId()).append("\""); + } + if (hasParticipantId()) { + str.append(", \"participantId\": \"").append(getParticipantId()).append("\""); + } + if (hasExchangeId()) { + str.append(", \"exchangeId\": ").append(getExchangeId()); + } + if (hasIsImplied()) { + str.append(", \"isImplied\": ").append(isImplied()); + } + if (hasContractId()) { + str.append(", \"contractId\": ").append(getContractId()); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryNewInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryNewInfo.java new file mode 100644 index 000000000..f36c0d4d8 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryNewInfo.java @@ -0,0 +1,45 @@ +package com.epam.deltix.timebase.messages.universal; + +/** + * Reports incremental L2-updates: insert, delete or update of one line in Order Book either on ask or bid side. + * It also can encode L2-snapshot entry. Note L2 is level oriented depth-of-the-book format and should be used + * whenever price or integer index is used to locate book changes. It does support individual quotes book of + * arbitrary depth. But if incremental changes key is a quoteId L3Entry should be used instead. + */ +public interface L2EntryNewInfo extends BasePriceEntryInfo { + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + * @return Level Index + */ + short getLevel(); + + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + * @return true if Level Index is not null + */ + boolean hasLevel(); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return Side + */ + QuoteSide getSide(); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return true if Side is not null + */ + boolean hasSide(); + + /** + * Method copies state to a given instance + */ + @Override + L2EntryNewInfo clone(); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryNewInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryNewInterface.java new file mode 100644 index 000000000..3a4768646 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryNewInterface.java @@ -0,0 +1,54 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.RecordInfo; + +/** + * Reports incremental L2-updates: insert, delete or update of one line in Order Book either on ask or bid side. + * It also can encode L2-snapshot entry. Note L2 is level oriented depth-of-the-book format and should be used + * whenever price or integer index is used to locate book changes. It does support individual quotes book of + * arbitrary depth. But if incremental changes key is a quoteId L3Entry should be used instead. + */ +public interface L2EntryNewInterface extends L2EntryNewInfo, BasePriceEntryInterface { + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + * @param value - Level Index + */ + void setLevel(short value); + + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + */ + void nullifyLevel(); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @param value - Side + */ + void setSide(QuoteSide value); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + void nullifySide(); + + /** + * Method nullifies all instance properties + */ + @Override + L2EntryNewInterface nullify(); + + /** + * Resets all instance properties to their default values + */ + @Override + L2EntryNewInterface reset(); + + @Override + L2EntryNewInterface copyFrom(RecordInfo template); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryUpdate.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryUpdate.java new file mode 100644 index 000000000..f018c1855 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryUpdate.java @@ -0,0 +1,341 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.dfp.Decimal64Utils; +import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.SchemaElement; +import com.epam.deltix.timebase.messages.SchemaType; +import com.epam.deltix.timebase.messages.TypeConstants; + +/** + * Reports incremental L2-updates: insert, delete or update of one line in Order Book either on ask or bid side. + * It also can encode L2-snapshot entry. Note L2 is level oriented depth-of-the-book format and should be used + * whenever price or integer index is used to locate book changes. It does support individual quotes book of + * arbitrary depth. But if incremental changes key is a quoteId L3Entry should be used instead. + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.universal.L2EntryUpdate", + title = "L2EntryUpdate" +) +public class L2EntryUpdate extends BasePriceEntry implements L2EntryUpdateInterface { + public static final String CLASS_NAME = L2EntryUpdate.class.getName(); + + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + */ + protected short level = TypeConstants.INT16_NULL; + + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, marketMakerCode, depth fields constitute the composite key + * to identify the order book record. + *

. + */ + protected BookUpdateAction action = null; + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + protected QuoteSide side = null; + + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + * @return Level Index + */ + @SchemaType( + isNullable = false + ) + @SchemaElement( + title = "Level Index" + ) + public short getLevel() { + return level; + } + + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + * @param value - Level Index + */ + public void setLevel(short value) { + this.level = value; + } + + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + * @return true if Level Index is not null + */ + public boolean hasLevel() { + return level != TypeConstants.INT16_NULL; + } + + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + */ + public void nullifyLevel() { + this.level = TypeConstants.INT16_NULL; + } + + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, marketMakerCode, depth fields constitute the composite key + * to identify the order book record. + *

. + * @return Action + */ + @SchemaType( + isNullable = false + ) + @SchemaElement( + title = "Action" + ) + public BookUpdateAction getAction() { + return action; + } + + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, marketMakerCode, depth fields constitute the composite key + * to identify the order book record. + *

. + * @param value - Action + */ + public void setAction(BookUpdateAction value) { + this.action = value; + } + + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, marketMakerCode, depth fields constitute the composite key + * to identify the order book record. + *

. + * @return true if Action is not null + */ + public boolean hasAction() { + return action != null; + } + + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, marketMakerCode, depth fields constitute the composite key + * to identify the order book record. + *

. + */ + public void nullifyAction() { + this.action = null; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return Side + */ + @SchemaElement( + title = "Side" + ) + public QuoteSide getSide() { + return side; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @param value - Side + */ + public void setSide(QuoteSide value) { + this.side = value; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return true if Side is not null + */ + public boolean hasSide() { + return side != null; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + public void nullifySide() { + this.side = null; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + @Override + protected L2EntryUpdate createInstance() { + return new L2EntryUpdate(); + } + + /** + * Method nullifies all instance properties + */ + @Override + public L2EntryUpdate nullify() { + super.nullify(); + nullifyLevel(); + nullifyAction(); + nullifySide(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + @Override + public L2EntryUpdate reset() { + super.reset(); + level = TypeConstants.INT16_NULL; + action = null; + side = null; + return this; + } + + /** + * Method copies state to a given instance + */ + @Override + public L2EntryUpdate clone() { + L2EntryUpdate t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + boolean superEquals = super.equals(obj); + if (!superEquals) return false; + if (!(obj instanceof L2EntryUpdateInfo)) return false; + L2EntryUpdateInfo other =(L2EntryUpdateInfo)obj; + if (hasLevel() != other.hasLevel()) return false; + if (hasLevel() && getLevel() != other.getLevel()) return false; + if (hasAction() != other.hasAction()) return false; + if (hasAction() && getAction() != other.getAction()) return false; + if (hasSide() != other.hasSide()) return false; + if (hasSide() && getSide() != other.getSide()) return false; + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = super.hashCode(); + if (hasLevel()) { + hash = hash * 31 + ((int)getLevel()); + } + if (hasAction()) { + hash = hash * 31 + getAction().getNumber(); + } + if (hasSide()) { + hash = hash * 31 + getSide().getNumber(); + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + @Override + public L2EntryUpdate copyFrom(RecordInfo template) { + super.copyFrom(template); + if (template instanceof L2EntryUpdateInfo) { + L2EntryUpdateInfo t = (L2EntryUpdateInfo)template; + if (t.hasLevel()) { + setLevel(t.getLevel()); + } else { + nullifyLevel(); + } + if (t.hasAction()) { + setAction(t.getAction()); + } else { + nullifyAction(); + } + if (t.hasSide()) { + setSide(t.getSide()); + } else { + nullifySide(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"L2EntryUpdate\""); + if (hasLevel()) { + str.append(", \"level\": ").append(getLevel()); + } + if (hasAction()) { + str.append(", \"action\": \"").append(getAction()).append("\""); + } + if (hasSide()) { + str.append(", \"side\": \"").append(getSide()).append("\""); + } + if (hasPrice()) { + str.append(", \"price\": "); + Decimal64Utils.appendTo(getPrice(), str); + } + if (hasSize()) { + str.append(", \"size\": "); + Decimal64Utils.appendTo(getSize(), str); + } + if (hasNumberOfOrders()) { + str.append(", \"numberOfOrders\": ").append(getNumberOfOrders()); + } + if (hasQuoteId()) { + str.append(", \"quoteId\": \"").append(getQuoteId()).append("\""); + } + if (hasParticipantId()) { + str.append(", \"participantId\": \"").append(getParticipantId()).append("\""); + } + if (hasExchangeId()) { + str.append(", \"exchangeId\": ").append(getExchangeId()); + } + if (hasIsImplied()) { + str.append(", \"isImplied\": ").append(isImplied()); + } + if (hasContractId()) { + str.append(", \"contractId\": ").append(getContractId()); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryUpdateInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryUpdateInfo.java new file mode 100644 index 000000000..397a7f31f --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryUpdateInfo.java @@ -0,0 +1,65 @@ +package com.epam.deltix.timebase.messages.universal; + +/** + * Reports incremental L2-updates: insert, delete or update of one line in Order Book either on ask or bid side. + * It also can encode L2-snapshot entry. Note L2 is level oriented depth-of-the-book format and should be used + * whenever price or integer index is used to locate book changes. It does support individual quotes book of + * arbitrary depth. But if incremental changes key is a quoteId L3Entry should be used instead. + */ +public interface L2EntryUpdateInfo extends BasePriceEntryInfo { + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + * @return Level Index + */ + short getLevel(); + + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + * @return true if Level Index is not null + */ + boolean hasLevel(); + + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, marketMakerCode, depth fields constitute the composite key + * to identify the order book record. + *

. + * @return Action + */ + BookUpdateAction getAction(); + + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, marketMakerCode, depth fields constitute the composite key + * to identify the order book record. + *

. + * @return true if Action is not null + */ + boolean hasAction(); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return Side + */ + QuoteSide getSide(); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return true if Side is not null + */ + boolean hasSide(); + + /** + * Method copies state to a given instance + */ + @Override + L2EntryUpdateInfo clone(); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryUpdateInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryUpdateInterface.java new file mode 100644 index 000000000..082897a9a --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L2EntryUpdateInterface.java @@ -0,0 +1,73 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.RecordInfo; + +/** + * Reports incremental L2-updates: insert, delete or update of one line in Order Book either on ask or bid side. + * It also can encode L2-snapshot entry. Note L2 is level oriented depth-of-the-book format and should be used + * whenever price or integer index is used to locate book changes. It does support individual quotes book of + * arbitrary depth. But if incremental changes key is a quoteId L3Entry should be used instead. + */ +public interface L2EntryUpdateInterface extends L2EntryUpdateInfo, BasePriceEntryInterface { + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + * @param value - Level Index + */ + void setLevel(short value); + + /** + * Market Depth / Price Level. + * This value is zero-based (top of the book will have depth=0). + */ + void nullifyLevel(); + + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, marketMakerCode, depth fields constitute the composite key + * to identify the order book record. + *

. + * @param value - Action + */ + void setAction(BookUpdateAction value); + + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, marketMakerCode, depth fields constitute the composite key + * to identify the order book record. + *

. + */ + void nullifyAction(); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @param value - Side + */ + void setSide(QuoteSide value); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + void nullifySide(); + + /** + * Method nullifies all instance properties + */ + @Override + L2EntryUpdateInterface nullify(); + + /** + * Resets all instance properties to their default values + */ + @Override + L2EntryUpdateInterface reset(); + + @Override + L2EntryUpdateInterface copyFrom(RecordInfo template); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryNew.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryNew.java new file mode 100644 index 000000000..0478e4581 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryNew.java @@ -0,0 +1,328 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.containers.BinaryAsciiString; +import com.epam.deltix.containers.CharSequenceUtils; +import com.epam.deltix.containers.MutableString; +import com.epam.deltix.dfp.Decimal64Utils; +import com.epam.deltix.timebase.messages.Identifier; +import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.SchemaElement; +import com.epam.deltix.timebase.messages.SchemaType; + +/** + * Reports incremental L3-updates: new, cancel, modify and replace of one quote in Order Book either on ask or bid side. + * It also can encode L3-snapshot entry. Note L3 is quote oriented depth-of-the-book format and should be used + * whenever quoteId is used to locate book changes. + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.universal.L3EntryNew", + title = "L3EntryNew" +) +public class L3EntryNew extends BasePriceEntry implements L3EntryNewInterface { + public static final String CLASS_NAME = L3EntryNew.class.getName(); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + protected QuoteSide side = null; + + /** + * Insert type. Add front or Add back. + */ + protected InsertType insertType = null; + + /** + * In case of InsertType = ADD_BEFORE represents the id of the quote that should be after inserted. + */ + protected CharSequence insertBeforeQuoteId = null; + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return Side + */ + @SchemaType( + isNullable = false + ) + @SchemaElement( + title = "Side" + ) + public QuoteSide getSide() { + return side; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @param value - Side + */ + public void setSide(QuoteSide value) { + this.side = value; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return true if Side is not null + */ + public boolean hasSide() { + return side != null; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + public void nullifySide() { + this.side = null; + } + + /** + * Insert type. Add front or Add back. + * @return Insert Type + */ + @SchemaElement + public InsertType getInsertType() { + return insertType; + } + + /** + * Insert type. Add front or Add back. + * @param value - Insert Type + */ + public void setInsertType(InsertType value) { + this.insertType = value; + } + + /** + * Insert type. Add front or Add back. + * @return true if Insert Type is not null + */ + public boolean hasInsertType() { + return insertType != null; + } + + /** + * Insert type. Add front or Add back. + */ + public void nullifyInsertType() { + this.insertType = null; + } + + /** + * In case of InsertType = ADD_BEFORE represents the id of the quote that should be after inserted. + * @return Insert Before Quote Id + */ + @Identifier + @SchemaType( + isNullable = true + ) + @SchemaElement + public CharSequence getInsertBeforeQuoteId() { + return insertBeforeQuoteId; + } + + /** + * In case of InsertType = ADD_BEFORE represents the id of the quote that should be after inserted. + * @param value - Insert Before Quote Id + */ + public void setInsertBeforeQuoteId(CharSequence value) { + this.insertBeforeQuoteId = value; + } + + /** + * In case of InsertType = ADD_BEFORE represents the id of the quote that should be after inserted. + * @return true if Insert Before Quote Id is not null + */ + public boolean hasInsertBeforeQuoteId() { + return insertBeforeQuoteId != null; + } + + /** + * In case of InsertType = ADD_BEFORE represents the id of the quote that should be after inserted. + */ + public void nullifyInsertBeforeQuoteId() { + this.insertBeforeQuoteId = null; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + @Override + protected L3EntryNew createInstance() { + return new L3EntryNew(); + } + + /** + * Method nullifies all instance properties + */ + @Override + public L3EntryNew nullify() { + super.nullify(); + nullifySide(); + nullifyInsertType(); + nullifyInsertBeforeQuoteId(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + @Override + public L3EntryNew reset() { + super.reset(); + side = null; + insertType = null; + insertBeforeQuoteId = null; + return this; + } + + /** + * Method copies state to a given instance + */ + @Override + public L3EntryNew clone() { + L3EntryNew t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + boolean superEquals = super.equals(obj); + if (!superEquals) return false; + if (!(obj instanceof L3EntryNewInfo)) return false; + L3EntryNewInfo other =(L3EntryNewInfo)obj; + if (hasSide() != other.hasSide()) return false; + if (hasSide() && getSide() != other.getSide()) return false; + if (hasInsertType() != other.hasInsertType()) return false; + if (hasInsertType() && getInsertType() != other.getInsertType()) return false; + if (hasInsertBeforeQuoteId() != other.hasInsertBeforeQuoteId()) return false; + if (hasInsertBeforeQuoteId()) { + if (getInsertBeforeQuoteId().length() != other.getInsertBeforeQuoteId().length()) return false; else { + CharSequence s1 = getInsertBeforeQuoteId(); + CharSequence s2 = other.getInsertBeforeQuoteId(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = super.hashCode(); + if (hasSide()) { + hash = hash * 31 + getSide().getNumber(); + } + if (hasInsertType()) { + hash = hash * 31 + getInsertType().getNumber(); + } + if (hasInsertBeforeQuoteId()) { + hash = hash * 31 + getInsertBeforeQuoteId().hashCode(); + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + @Override + public L3EntryNew copyFrom(RecordInfo template) { + super.copyFrom(template); + if (template instanceof L3EntryNewInfo) { + L3EntryNewInfo t = (L3EntryNewInfo)template; + if (t.hasSide()) { + setSide(t.getSide()); + } else { + nullifySide(); + } + if (t.hasInsertType()) { + setInsertType(t.getInsertType()); + } else { + nullifyInsertType(); + } + if (t.hasInsertBeforeQuoteId()) { + if (!(hasInsertBeforeQuoteId() && getInsertBeforeQuoteId() instanceof BinaryAsciiString)) { + setInsertBeforeQuoteId(new BinaryAsciiString()); + } + ((BinaryAsciiString)getInsertBeforeQuoteId()).assign(t.getInsertBeforeQuoteId()); + } else { + nullifyInsertBeforeQuoteId(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"L3EntryNew\""); + if (hasSide()) { + str.append(", \"side\": \"").append(getSide()).append("\""); + } + if (hasInsertType()) { + str.append(", \"insertType\": \"").append(getInsertType()).append("\""); + } + if (hasInsertBeforeQuoteId()) { + str.append(", \"insertBeforeQuoteId\": \"").append(getInsertBeforeQuoteId()).append("\""); + } + if (hasPrice()) { + str.append(", \"price\": "); + Decimal64Utils.appendTo(getPrice(), str); + } + if (hasSize()) { + str.append(", \"size\": "); + Decimal64Utils.appendTo(getSize(), str); + } + if (hasNumberOfOrders()) { + str.append(", \"numberOfOrders\": ").append(getNumberOfOrders()); + } + if (hasQuoteId()) { + str.append(", \"quoteId\": \"").append(getQuoteId()).append("\""); + } + if (hasParticipantId()) { + str.append(", \"participantId\": \"").append(getParticipantId()).append("\""); + } + if (hasExchangeId()) { + str.append(", \"exchangeId\": ").append(getExchangeId()); + } + if (hasIsImplied()) { + str.append(", \"isImplied\": ").append(isImplied()); + } + if (hasContractId()) { + str.append(", \"contractId\": ").append(getContractId()); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryNewInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryNewInfo.java new file mode 100644 index 000000000..e1ff9ffbf --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryNewInfo.java @@ -0,0 +1,54 @@ +package com.epam.deltix.timebase.messages.universal; + +/** + * Reports incremental L3-updates: new, cancel, modify and replace of one quote in Order Book either on ask or bid side. + * It also can encode L3-snapshot entry. Note L3 is quote oriented depth-of-the-book format and should be used + * whenever quoteId is used to locate book changes. + */ +public interface L3EntryNewInfo extends BasePriceEntryInfo { + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return Side + */ + QuoteSide getSide(); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return true if Side is not null + */ + boolean hasSide(); + + /** + * Insert type. Add front or Add back. + * @return Insert Type + */ + InsertType getInsertType(); + + /** + * Insert type. Add front or Add back. + * @return true if Insert Type is not null + */ + boolean hasInsertType(); + + /** + * In case of InsertType = ADD_BEFORE represents the id of the quote that should be after inserted. + * @return Insert Before Quote Id + */ + CharSequence getInsertBeforeQuoteId(); + + /** + * In case of InsertType = ADD_BEFORE represents the id of the quote that should be after inserted. + * @return true if Insert Before Quote Id is not null + */ + boolean hasInsertBeforeQuoteId(); + + /** + * Method copies state to a given instance + */ + @Override + L3EntryNewInfo clone(); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryNewInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryNewInterface.java new file mode 100644 index 000000000..07e9a5e20 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryNewInterface.java @@ -0,0 +1,62 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.RecordInfo; + +/** + * Reports incremental L3-updates: new, cancel, modify and replace of one quote in Order Book either on ask or bid side. + * It also can encode L3-snapshot entry. Note L3 is quote oriented depth-of-the-book format and should be used + * whenever quoteId is used to locate book changes. + */ +public interface L3EntryNewInterface extends L3EntryNewInfo, BasePriceEntryInterface { + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @param value - Side + */ + void setSide(QuoteSide value); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + void nullifySide(); + + /** + * Insert type. Add front or Add back. + * @param value - Insert Type + */ + void setInsertType(InsertType value); + + /** + * Insert type. Add front or Add back. + */ + void nullifyInsertType(); + + /** + * In case of InsertType = ADD_BEFORE represents the id of the quote that should be after inserted. + * @param value - Insert Before Quote Id + */ + void setInsertBeforeQuoteId(CharSequence value); + + /** + * In case of InsertType = ADD_BEFORE represents the id of the quote that should be after inserted. + */ + void nullifyInsertBeforeQuoteId(); + + /** + * Method nullifies all instance properties + */ + @Override + L3EntryNewInterface nullify(); + + /** + * Resets all instance properties to their default values + */ + @Override + L3EntryNewInterface reset(); + + @Override + L3EntryNewInterface copyFrom(RecordInfo template); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryUpdate.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryUpdate.java new file mode 100644 index 000000000..c0c9a0301 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryUpdate.java @@ -0,0 +1,277 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.dfp.Decimal64Utils; +import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.timebase.messages.SchemaElement; +import com.epam.deltix.timebase.messages.SchemaType; + +/** + * Reports incremental L3-updates: new, cancel, modify and replace of one quote in Order Book either on ask or bid side. + * It also can encode L3-snapshot entry. Note L3 is quote oriented depth-of-the-book format and should be used + * whenever quoteId is used to locate book changes. + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.universal.L3EntryUpdate", + title = "L3 Entry Update" +) +public class L3EntryUpdate extends BasePriceEntry implements L3EntryUpdateInterface { + public static final String CLASS_NAME = L3EntryUpdate.class.getName(); + + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, quoteId fields constitute the composite key + * to identify the order book record. + *

. + */ + protected QuoteUpdateAction action = null; + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + protected QuoteSide side = null; + + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, quoteId fields constitute the composite key + * to identify the order book record. + *

. + * @return Action + */ + @SchemaType( + isNullable = false + ) + @SchemaElement( + title = "Action" + ) + public QuoteUpdateAction getAction() { + return action; + } + + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, quoteId fields constitute the composite key + * to identify the order book record. + *

. + * @param value - Action + */ + public void setAction(QuoteUpdateAction value) { + this.action = value; + } + + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, quoteId fields constitute the composite key + * to identify the order book record. + *

. + * @return true if Action is not null + */ + public boolean hasAction() { + return action != null; + } + + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, quoteId fields constitute the composite key + * to identify the order book record. + *

. + */ + public void nullifyAction() { + this.action = null; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return Side + */ + @SchemaElement( + title = "Side" + ) + public QuoteSide getSide() { + return side; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @param value - Side + */ + public void setSide(QuoteSide value) { + this.side = value; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return true if Side is not null + */ + public boolean hasSide() { + return side != null; + } + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + public void nullifySide() { + this.side = null; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + @Override + protected L3EntryUpdate createInstance() { + return new L3EntryUpdate(); + } + + /** + * Method nullifies all instance properties + */ + @Override + public L3EntryUpdate nullify() { + super.nullify(); + nullifyAction(); + nullifySide(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + @Override + public L3EntryUpdate reset() { + super.reset(); + action = null; + side = null; + return this; + } + + /** + * Method copies state to a given instance + */ + @Override + public L3EntryUpdate clone() { + L3EntryUpdate t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + boolean superEquals = super.equals(obj); + if (!superEquals) return false; + if (!(obj instanceof L3EntryUpdateInfo)) return false; + L3EntryUpdateInfo other =(L3EntryUpdateInfo)obj; + if (hasAction() != other.hasAction()) return false; + if (hasAction() && getAction() != other.getAction()) return false; + if (hasSide() != other.hasSide()) return false; + if (hasSide() && getSide() != other.getSide()) return false; + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = super.hashCode(); + if (hasAction()) { + hash = hash * 31 + getAction().getNumber(); + } + if (hasSide()) { + hash = hash * 31 + getSide().getNumber(); + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + @Override + public L3EntryUpdate copyFrom(RecordInfo template) { + super.copyFrom(template); + if (template instanceof L3EntryUpdateInfo) { + L3EntryUpdateInfo t = (L3EntryUpdateInfo)template; + if (t.hasAction()) { + setAction(t.getAction()); + } else { + nullifyAction(); + } + if (t.hasSide()) { + setSide(t.getSide()); + } else { + nullifySide(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"L3EntryUpdate\""); + if (hasAction()) { + str.append(", \"action\": \"").append(getAction()).append("\""); + } + if (hasSide()) { + str.append(", \"side\": \"").append(getSide()).append("\""); + } + if (hasPrice()) { + str.append(", \"price\": "); + Decimal64Utils.appendTo(getPrice(), str); + } + if (hasSize()) { + str.append(", \"size\": "); + Decimal64Utils.appendTo(getSize(), str); + } + if (hasNumberOfOrders()) { + str.append(", \"numberOfOrders\": ").append(getNumberOfOrders()); + } + if (hasQuoteId()) { + str.append(", \"quoteId\": \"").append(getQuoteId()).append("\""); + } + if (hasParticipantId()) { + str.append(", \"participantId\": \"").append(getParticipantId()).append("\""); + } + if (hasExchangeId()) { + str.append(", \"exchangeId\": ").append(getExchangeId()); + } + if (hasIsImplied()) { + str.append(", \"isImplied\": ").append(isImplied()); + } + if (hasContractId()) { + str.append(", \"contractId\": ").append(getContractId()); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryUpdateInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryUpdateInfo.java new file mode 100644 index 000000000..5f5e8a73d --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryUpdateInfo.java @@ -0,0 +1,50 @@ +package com.epam.deltix.timebase.messages.universal; + +/** + * Reports incremental L3-updates: new, cancel, modify and replace of one quote in Order Book either on ask or bid side. + * It also can encode L3-snapshot entry. Note L3 is quote oriented depth-of-the-book format and should be used + * whenever quoteId is used to locate book changes. + */ +public interface L3EntryUpdateInfo extends BasePriceEntryInfo { + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, quoteId fields constitute the composite key + * to identify the order book record. + *

. + * @return Action + */ + QuoteUpdateAction getAction(); + + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, quoteId fields constitute the composite key + * to identify the order book record. + *

. + * @return true if Action is not null + */ + boolean hasAction(); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return Side + */ + QuoteSide getSide(); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @return true if Side is not null + */ + boolean hasSide(); + + /** + * Method copies state to a given instance + */ + @Override + L3EntryUpdateInfo clone(); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryUpdateInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryUpdateInterface.java new file mode 100644 index 000000000..cfa7fd5a0 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/L3EntryUpdateInterface.java @@ -0,0 +1,59 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.RecordInfo; + +/** + * Reports incremental L3-updates: new, cancel, modify and replace of one quote in Order Book either on ask or bid side. + * It also can encode L3-snapshot entry. Note L3 is quote oriented depth-of-the-book format and should be used + * whenever quoteId is used to locate book changes. + */ +public interface L3EntryUpdateInterface extends L3EntryUpdateInfo, BasePriceEntryInterface { + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, quoteId fields constitute the composite key + * to identify the order book record. + *

. + * @param value - Action + */ + void setAction(QuoteUpdateAction value); + + /** + * Directs how to update an Order Book + *

+ * symbol, instrumentType, exchangeCode, quoteId fields constitute the composite key + * to identify the order book record. + *

. + */ + void nullifyAction(); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + * @param value - Side + */ + void setSide(QuoteSide value); + + /** + * Quote side. Bid or Ask. + * Ask = Sell limit order. + * Bid = Buy limit order. + */ + void nullifySide(); + + /** + * Method nullifies all instance properties + */ + @Override + L3EntryUpdateInterface nullify(); + + /** + * Resets all instance properties to their default values + */ + @Override + L3EntryUpdateInterface reset(); + + @Override + L3EntryUpdateInterface copyFrom(RecordInfo template); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/PackageHeader.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/PackageHeader.java new file mode 100644 index 000000000..4f9fcc056 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/PackageHeader.java @@ -0,0 +1,276 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.*; +import com.epam.deltix.util.collections.generated.ObjectArrayList; + +/** + * Represents market data package. + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.universal.PackageHeader", + title = "Package Header" +) +public class PackageHeader extends MarketMessage implements PackageHeaderInterface { + public static final String CLASS_NAME = PackageHeader.class.getName(); + + /** + * Message package content. Array of individual entries. + * Typical entries classes are L1Entry, L2Entry, L3Entry, TradeEntry. + */ + protected ObjectArrayList entries = null; + + /** + * Package type needs to distinguish between incremental changes and different types of snapshot. + */ + protected PackageType packageType = null; + + /** + * Message package content. Array of individual entries. + * Typical entries classes are L1Entry, L2Entry, L3Entry, TradeEntry. + * @return Entries + */ + @SchemaElement( + title = "Entries" + ) + @SchemaArrayType( + isNullable = false, + isElementNullable = false, + elementTypes = { + TradeEntry.class, L1Entry.class, L2EntryNew.class, L2EntryUpdate.class, L3EntryNew.class, L3EntryUpdate.class, BookResetEntry.class, StatisticsEntry.class} + + ) + public ObjectArrayList getEntries() { + return entries; + } + + /** + * Message package content. Array of individual entries. + * Typical entries classes are L1Entry, L2Entry, L3Entry, TradeEntry. + * @param value - Entries + */ + public void setEntries(ObjectArrayList value) { + this.entries = value; + } + + /** + * Message package content. Array of individual entries. + * Typical entries classes are L1Entry, L2Entry, L3Entry, TradeEntry. + * @return true if Entries is not null + */ + public boolean hasEntries() { + return entries != null; + } + + /** + * Message package content. Array of individual entries. + * Typical entries classes are L1Entry, L2Entry, L3Entry, TradeEntry. + */ + public void nullifyEntries() { + this.entries = null; + } + + /** + * Package type needs to distinguish between incremental changes and different types of snapshot. + * @return Package Type + */ + @SchemaType( + isNullable = false + ) + @SchemaElement( + title = "Package Type" + ) + public PackageType getPackageType() { + return packageType; + } + + /** + * Package type needs to distinguish between incremental changes and different types of snapshot. + * @param value - Package Type + */ + public void setPackageType(PackageType value) { + this.packageType = value; + } + + /** + * Package type needs to distinguish between incremental changes and different types of snapshot. + * @return true if Package Type is not null + */ + public boolean hasPackageType() { + return packageType != null; + } + + /** + * Package type needs to distinguish between incremental changes and different types of snapshot. + */ + public void nullifyPackageType() { + this.packageType = null; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + @Override + protected PackageHeader createInstance() { + return new PackageHeader(); + } + + /** + * Method nullifies all instance properties + */ + @Override + public PackageHeader nullify() { + super.nullify(); + nullifyEntries(); + nullifyPackageType(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + @Override + public PackageHeader reset() { + super.reset(); + entries = null; + packageType = null; + return this; + } + + /** + * Method copies state to a given instance + */ + @Override + public PackageHeader clone() { + PackageHeader t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + boolean superEquals = super.equals(obj); + if (!superEquals) return false; + if (!(obj instanceof PackageHeaderInfo)) return false; + PackageHeaderInfo other =(PackageHeaderInfo)obj; + if (hasEntries() != other.hasEntries()) return false; + if (hasEntries()) { + if (getEntries().size() != other.getEntries().size()) return false; + else for (int j = 0; j < getEntries().size(); ++j) { + if ((getEntries().get(j) != null) != (other.getEntries().get(j) != null)) return false; + if (getEntries().get(j) != null && !getEntries().get(j).equals(other.getEntries().get(j))) return false; + } + } + if (hasPackageType() != other.hasPackageType()) return false; + if (hasPackageType() && getPackageType() != other.getPackageType()) return false; + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = super.hashCode(); + if (hasEntries()) { + for (int j = 0; j < getEntries().size(); ++j) { + hash ^= getEntries().get(j).hashCode(); + } + } + if (hasPackageType()) { + hash = hash * 31 + getPackageType().getNumber(); + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + @Override + public PackageHeader copyFrom(RecordInfo template) { + super.copyFrom(template); + if (template instanceof PackageHeaderInfo) { + PackageHeaderInfo t = (PackageHeaderInfo)template; + if (t.hasEntries()) { + if (!hasEntries()) { + setEntries(new ObjectArrayList(t.getEntries().size())); + } else { + getEntries().clear(); + } + for (int i = 0; i < t.getEntries().size(); ++i) ((ObjectArrayList)getEntries()).add((BaseEntryInfo)t.getEntries().get(i).clone()); + } else { + nullifyEntries(); + } + if (t.hasPackageType()) { + setPackageType(t.getPackageType()); + } else { + nullifyPackageType(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"PackageHeader\""); + if (hasEntries()) { + str.append(", \"entries\": ["); + if (getEntries().size() > 0) { + if (getEntries().get(0) == null) { + str.append("null"); + } else { + getEntries().get(0).toString(str); + } + } + for (int i = 1; i < getEntries().size(); ++i) { + str.append(", "); + if (getEntries().get(i) == null) { + str.append("null"); + } else { + getEntries().get(i).toString(str); + } + } + str.append("]"); + } + if (hasPackageType()) { + str.append(", \"packageType\": \"").append(getPackageType()).append("\""); + } + if (hasOriginalTimestamp()) { + str.append(", \"originalTimestamp\": \"").append(getOriginalTimestamp()).append("\""); + } + if (hasCurrency()) { + str.append(", \"currency\": ").append(getCurrency()); + } + if (hasSequenceNumber()) { + str.append(", \"sequenceNumber\": ").append(getSequenceNumber()); + } + if (hasSourceId()) { + str.append(", \"sourceId\": ").append(getSourceId()); + } + if (hasTimeStampMs()) { + str.append(", \"timeStampMs\": \"").append(getTimeStampMs()).append("\""); + } + if (hasSymbol()) { + str.append(", \"symbol\": \"").append(getSymbol()).append("\""); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/PackageHeaderInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/PackageHeaderInfo.java new file mode 100644 index 000000000..3fcddc54c --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/PackageHeaderInfo.java @@ -0,0 +1,41 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.MarketMessageInfo; +import com.epam.deltix.util.collections.generated.ObjectList; + +/** + * Represents market data package. + */ +public interface PackageHeaderInfo extends MarketMessageInfo { + /** + * Message package content. Array of individual entries. + * Typical entries classes are L1Entry, L2Entry, L3Entry, TradeEntry. + * @return Entries + */ + ObjectList getEntries(); + + /** + * Message package content. Array of individual entries. + * Typical entries classes are L1Entry, L2Entry, L3Entry, TradeEntry. + * @return true if Entries is not null + */ + boolean hasEntries(); + + /** + * Package type needs to distinguish between incremental changes and different types of snapshot. + * @return Package Type + */ + PackageType getPackageType(); + + /** + * Package type needs to distinguish between incremental changes and different types of snapshot. + * @return true if Package Type is not null + */ + boolean hasPackageType(); + + /** + * Method copies state to a given instance + */ + @Override + PackageHeaderInfo clone(); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/PackageHeaderInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/PackageHeaderInterface.java new file mode 100644 index 000000000..a6c2b1607 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/PackageHeaderInterface.java @@ -0,0 +1,49 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.MarketMessageInterface; +import com.epam.deltix.timebase.messages.RecordInfo; +import com.epam.deltix.util.collections.generated.ObjectArrayList; + +/** + * Represents market data package. + */ +public interface PackageHeaderInterface extends PackageHeaderInfo, MarketMessageInterface { + /** + * Message package content. Array of individual entries. + * Typical entries classes are L1Entry, L2Entry, L3Entry, TradeEntry. + * @param value - Entries + */ + void setEntries(ObjectArrayList value); + + /** + * Message package content. Array of individual entries. + * Typical entries classes are L1Entry, L2Entry, L3Entry, TradeEntry. + */ + void nullifyEntries(); + + /** + * Package type needs to distinguish between incremental changes and different types of snapshot. + * @param value - Package Type + */ + void setPackageType(PackageType value); + + /** + * Package type needs to distinguish between incremental changes and different types of snapshot. + */ + void nullifyPackageType(); + + /** + * Method nullifies all instance properties + */ + @Override + PackageHeaderInterface nullify(); + + /** + * Resets all instance properties to their default values + */ + @Override + PackageHeaderInterface reset(); + + @Override + PackageHeaderInterface copyFrom(RecordInfo template); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/PackageType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/PackageType.java new file mode 100644 index 000000000..335ff6797 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/PackageType.java @@ -0,0 +1,63 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.SchemaElement; + +/** + * Package type needs to distinguish between incremental changes and different types of snapshot. + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.universal.PackageType", + title = "Package Type" +) +public enum PackageType { + /** + * Vendor snapshot. + */ + @SchemaElement( + name = "VENDOR_SNAPSHOT" + ) + VENDOR_SNAPSHOT(0), + + /** + * Periodical snapshot. + */ + @SchemaElement( + name = "PERIODICAL_SNAPSHOT" + ) + PERIODICAL_SNAPSHOT(1), + + /** + * Incremental update. + */ + @SchemaElement( + name = "INCREMENTAL_UPDATE" + ) + INCREMENTAL_UPDATE(2); + + private final int value; + + PackageType(int value) { + this.value = value; + } + + public int getNumber() { + return this.value; + } + + public static PackageType valueOf(int number) { + switch (number) { + case 0: return VENDOR_SNAPSHOT; + case 1: return PERIODICAL_SNAPSHOT; + case 2: return INCREMENTAL_UPDATE; + default: return null; + } + } + + public static PackageType strictValueOf(int number) { + final PackageType value = valueOf(number); + if (value == null) { + throw new IllegalArgumentException("Enumeration 'PackageType' does not have value corresponding to '" + number + "'."); + } + return value; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/QuoteSide.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/QuoteSide.java new file mode 100644 index 000000000..cea8e8dd2 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/QuoteSide.java @@ -0,0 +1,50 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.SchemaElement; + +/** + * Side of quote. Bid and Ask . + */ +public enum QuoteSide { + /** + * Bid for quote. + */ + @SchemaElement( + name = "BID" + ) + BID(0), + + /** + * Ask for quote. + */ + @SchemaElement( + name = "ASK" + ) + ASK(1); + + private final int value; + + QuoteSide(int value) { + this.value = value; + } + + public int getNumber() { + return this.value; + } + + public static QuoteSide valueOf(int number) { + switch (number) { + case 0: return BID; + case 1: return ASK; + default: return null; + } + } + + public static QuoteSide strictValueOf(int number) { + final QuoteSide value = valueOf(number); + if (value == null) { + throw new IllegalArgumentException("Enumeration 'QuoteSide' does not have value corresponding to '" + number + "'."); + } + return value; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/QuoteUpdateAction.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/QuoteUpdateAction.java new file mode 100644 index 000000000..9105cc90f --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/QuoteUpdateAction.java @@ -0,0 +1,59 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.SchemaElement; + +/** + * Directs how to update an Order Book for L3 format. + */ +public enum QuoteUpdateAction { + /** + * Delete quote (meaning trader cancel it). + */ + @SchemaElement( + name = "CANCEL" + ) + CANCEL(0), + + /** + * Modify quote content (meaning that quote safe its position in order). + */ + @SchemaElement( + name = "MODIFY" + ) + MODIFY(1), + + /** + * Modify quote content (meaning that quote lose its position in order). + */ + @SchemaElement( + name = "REPLACE" + ) + REPLACE(2); + + private final int value; + + QuoteUpdateAction(int value) { + this.value = value; + } + + public int getNumber() { + return this.value; + } + + public static QuoteUpdateAction valueOf(int number) { + switch (number) { + case 0: return CANCEL; + case 1: return MODIFY; + case 2: return REPLACE; + default: return null; + } + } + + public static QuoteUpdateAction strictValueOf(int number) { + final QuoteUpdateAction value = valueOf(number); + if (value == null) { + throw new IllegalArgumentException("Enumeration 'QuoteUpdateAction' does not have value corresponding to '" + number + "'."); + } + return value; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/StatisticsEntry.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/StatisticsEntry.java new file mode 100644 index 000000000..a7117a622 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/StatisticsEntry.java @@ -0,0 +1,306 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.containers.BinaryAsciiString; +import com.epam.deltix.containers.CharSequenceUtils; +import com.epam.deltix.containers.MutableString; +import com.epam.deltix.dfp.Decimal64Utils; +import com.epam.deltix.timebase.messages.*; + +/** + * Represents arbitrary exchange event. + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.universal.StatisticsEntry", + title = "StatisticsEntry" +) +public class StatisticsEntry extends BaseEntry implements StatisticsEntryInterface { + public static final String CLASS_NAME = StatisticsEntry.class.getName(); + + /** + * Type of the event and meaning of the value. + * Not nullable, use StatisticsType.Custom if unknown/non-mapped + */ + protected StatisticsType type = null; + + /** + * Generic field to store value. Meaning is depends on StatisticsType + */ + protected long value = TypeConstants.DECIMAL_NULL; + + /** + * Original event type, vendor specific. + */ + protected CharSequence originalType = null; + + /** + * Type of the event and meaning of the value. + * Not nullable, use StatisticsType.Custom if unknown/non-mapped + * @return Type + */ + @SchemaElement( + title = "Type" + ) + public StatisticsType getType() { + return type; + } + + /** + * Type of the event and meaning of the value. + * Not nullable, use StatisticsType.Custom if unknown/non-mapped + * @param value - Type + */ + public void setType(StatisticsType value) { + this.type = value; + } + + /** + * Type of the event and meaning of the value. + * Not nullable, use StatisticsType.Custom if unknown/non-mapped + * @return true if Type is not null + */ + public boolean hasType() { + return type != null; + } + + /** + * Type of the event and meaning of the value. + * Not nullable, use StatisticsType.Custom if unknown/non-mapped + */ + public void nullifyType() { + this.type = null; + } + + /** + * Generic field to store value. Meaning is depends on StatisticsType + * @return Value + */ + @SchemaElement( + title = "Value" + ) + @SchemaType( + encoding = "DECIMAL64", + isNullable = true, + dataType = SchemaDataType.FLOAT + ) + public long getValue() { + return value; + } + + /** + * Generic field to store value. Meaning is depends on StatisticsType + * @param value - Value + */ + public void setValue(long value) { + this.value = value; + } + + /** + * Generic field to store value. Meaning is depends on StatisticsType + * @return true if Value is not null + */ + public boolean hasValue() { + return value != TypeConstants.DECIMAL_NULL; + } + + /** + * Generic field to store value. Meaning is depends on StatisticsType + */ + public void nullifyValue() { + this.value = TypeConstants.DECIMAL_NULL; + } + + /** + * Original event type, vendor specific. + * @return OriginalType + */ + @SchemaElement( + title = "OriginalType" + ) + public CharSequence getOriginalType() { + return originalType; + } + + /** + * Original event type, vendor specific. + * @param value - OriginalType + */ + public void setOriginalType(CharSequence value) { + this.originalType = value; + } + + /** + * Original event type, vendor specific. + * @return true if OriginalType is not null + */ + public boolean hasOriginalType() { + return originalType != null; + } + + /** + * Original event type, vendor specific. + */ + public void nullifyOriginalType() { + this.originalType = null; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + @Override + protected StatisticsEntry createInstance() { + return new StatisticsEntry(); + } + + /** + * Method nullifies all instance properties + */ + @Override + public StatisticsEntry nullify() { + super.nullify(); + nullifyType(); + nullifyValue(); + nullifyOriginalType(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + @Override + public StatisticsEntry reset() { + super.reset(); + type = null; + value = TypeConstants.DECIMAL_NULL; + originalType = null; + return this; + } + + /** + * Method copies state to a given instance + */ + @Override + public StatisticsEntry clone() { + StatisticsEntry t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + boolean superEquals = super.equals(obj); + if (!superEquals) return false; + if (!(obj instanceof StatisticsEntryInfo)) return false; + StatisticsEntryInfo other =(StatisticsEntryInfo)obj; + if (hasType() != other.hasType()) return false; + if (hasType() && getType() != other.getType()) return false; + if (hasValue() != other.hasValue()) return false; + if (hasValue() && !Decimal64Utils.equals(getValue(), other.getValue())) return false; + if (hasOriginalType() != other.hasOriginalType()) return false; + if (hasOriginalType()) { + if (getOriginalType().length() != other.getOriginalType().length()) return false; else { + CharSequence s1 = getOriginalType(); + CharSequence s2 = other.getOriginalType(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = super.hashCode(); + if (hasType()) { + hash = hash * 31 + getType().getNumber(); + } + if (hasValue()) { + hash = hash * 31 + ((int)(getValue() ^ (getValue() >>> 32))); + } + if (hasOriginalType()) { + hash = hash * 31 + getOriginalType().hashCode(); + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + @Override + public StatisticsEntry copyFrom(RecordInfo template) { + super.copyFrom(template); + if (template instanceof StatisticsEntryInfo) { + StatisticsEntryInfo t = (StatisticsEntryInfo)template; + if (t.hasType()) { + setType(t.getType()); + } else { + nullifyType(); + } + if (t.hasValue()) { + setValue(t.getValue()); + } else { + nullifyValue(); + } + if (t.hasOriginalType()) { + if (hasOriginalType() && getOriginalType() instanceof StringBuilder) { + ((StringBuilder)getOriginalType()).setLength(0); + } else { + setOriginalType(new StringBuilder()); + } + ((StringBuilder)getOriginalType()).append(t.getOriginalType()); + } else { + nullifyOriginalType(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"StatisticsEntry\""); + if (hasType()) { + str.append(", \"type\": \"").append(getType()).append("\""); + } + if (hasValue()) { + str.append(", \"value\": "); + Decimal64Utils.appendTo(getValue(), str); + } + if (hasOriginalType()) { + str.append(", \"originalType\": \"").append(getOriginalType()).append("\""); + } + if (hasExchangeId()) { + str.append(", \"exchangeId\": ").append(getExchangeId()); + } + if (hasIsImplied()) { + str.append(", \"isImplied\": ").append(isImplied()); + } + if (hasContractId()) { + str.append(", \"contractId\": ").append(getContractId()); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/StatisticsEntryInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/StatisticsEntryInfo.java new file mode 100644 index 000000000..3cb806096 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/StatisticsEntryInfo.java @@ -0,0 +1,50 @@ +package com.epam.deltix.timebase.messages.universal; + +/** + * Represents arbitrary exchange event. + */ +public interface StatisticsEntryInfo extends BaseEntryInfo { + /** + * Type of the event and meaning of the value. + * Not nullable, use StatisticsType.Custom if unknown/non-mapped + * @return Type + */ + StatisticsType getType(); + + /** + * Type of the event and meaning of the value. + * Not nullable, use StatisticsType.Custom if unknown/non-mapped + * @return true if Type is not null + */ + boolean hasType(); + + /** + * Generic field to store value. Meaning is depends on StatisticsType + * @return Value + */ + long getValue(); + + /** + * Generic field to store value. Meaning is depends on StatisticsType + * @return true if Value is not null + */ + boolean hasValue(); + + /** + * Original event type, vendor specific. + * @return OriginalType + */ + CharSequence getOriginalType(); + + /** + * Original event type, vendor specific. + * @return true if OriginalType is not null + */ + boolean hasOriginalType(); + + /** + * Method copies state to a given instance + */ + @Override + StatisticsEntryInfo clone(); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/StatisticsEntryInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/StatisticsEntryInterface.java new file mode 100644 index 000000000..b73f17d75 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/StatisticsEntryInterface.java @@ -0,0 +1,58 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.RecordInfo; + +/** + * Represents arbitrary exchange event. + */ +public interface StatisticsEntryInterface extends StatisticsEntryInfo, BaseEntryInterface { + /** + * Type of the event and meaning of the value. + * Not nullable, use StatisticsType.Custom if unknown/non-mapped + * @param value - Type + */ + void setType(StatisticsType value); + + /** + * Type of the event and meaning of the value. + * Not nullable, use StatisticsType.Custom if unknown/non-mapped + */ + void nullifyType(); + + /** + * Generic field to store value. Meaning is depends on StatisticsType + * @param value - Value + */ + void setValue(long value); + + /** + * Generic field to store value. Meaning is depends on StatisticsType + */ + void nullifyValue(); + + /** + * Original event type, vendor specific. + * @param value - OriginalType + */ + void setOriginalType(CharSequence value); + + /** + * Original event type, vendor specific. + */ + void nullifyOriginalType(); + + /** + * Method nullifies all instance properties + */ + @Override + StatisticsEntryInterface nullify(); + + /** + * Resets all instance properties to their default values + */ + @Override + StatisticsEntryInterface reset(); + + @Override + StatisticsEntryInterface copyFrom(RecordInfo template); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/StatisticsType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/StatisticsType.java new file mode 100644 index 000000000..342dca4c2 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/StatisticsType.java @@ -0,0 +1,153 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.SchemaElement; + +/** + * Represents type of event and its value for StatisticsEntry. + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.universal.StatisticsType", + title = "Statistics Type" +) +public enum StatisticsType { + /** + * Custom. + */ + @SchemaElement( + name = "CUSTOM" + ) + CUSTOM(1), + + /** + * Opening price. + */ + @SchemaElement( + name = "OPENING_PRICE" + ) + OPENING_PRICE(2), + + /** + * Closing price. + */ + @SchemaElement( + name = "CLOSING_PRICE" + ) + CLOSING_PRICE(3), + + /** + * Settlement price. + */ + @SchemaElement( + name = "SETTLEMENT_PRICE" + ) + SETTLEMENT_PRICE(4), + + /** + * Trading session high price. + */ + @SchemaElement( + name = "TRADING_SESSION_HIGH_PRICE" + ) + TRADING_SESSION_HIGH_PRICE(5), + + /** + * Trading session low price. + */ + @SchemaElement( + name = "TRADING_SESSION_LOW_PRICE" + ) + TRADING_SESSION_LOW_PRICE(6), + + /** + * Trading session vwap price. + */ + @SchemaElement( + name = "TRADING_SESSION_VWAP_PRICE" + ) + TRADING_SESSION_VWAP_PRICE(7), + + /** + * Trade volume. + */ + @SchemaElement( + name = "TRADE_VOLUME" + ) + TRADE_VOLUME(8), + + /** + * Open interest. + */ + @SchemaElement( + name = "OPEN_INTEREST" + ) + OPEN_INTEREST(9), + + /** + * Session high bid. + */ + @SchemaElement( + name = "SESSION_HIGH_BID" + ) + SESSION_HIGH_BID(10), + + /** + * Session low offer. + */ + @SchemaElement( + name = "SESSION_LOW_OFFER" + ) + SESSION_LOW_OFFER(11), + + /** + * Auction clearing price. + */ + @SchemaElement( + name = "AUCTION_CLEARING_PRICE" + ) + AUCTION_CLEARING_PRICE(12), + + /** + * Fixing priceq. + */ + @SchemaElement( + name = "FIXING_PRICE" + ) + FIXING_PRICE(13); + + private final int value; + + StatisticsType(int value) { + this.value = value; + } + + public int getNumber() { + return this.value; + } + + public static StatisticsType valueOf(int number) { + switch (number) { + case 1: return CUSTOM; + case 2: return OPENING_PRICE; + case 3: return CLOSING_PRICE; + case 4: return SETTLEMENT_PRICE; + case 5: return TRADING_SESSION_HIGH_PRICE; + case 6: return TRADING_SESSION_LOW_PRICE; + case 7: return TRADING_SESSION_VWAP_PRICE; + case 8: return TRADE_VOLUME; + case 9: return OPEN_INTEREST; + case 10: return SESSION_HIGH_BID; + case 11: return SESSION_LOW_OFFER; + case 12: return AUCTION_CLEARING_PRICE; + case 13: return FIXING_PRICE; + default: return null; + } + } + + public static StatisticsType strictValueOf(int number) { + final StatisticsType value = valueOf(number); + if (value == null) { + throw new IllegalArgumentException("Enumeration 'StatisticsType' does not have value corresponding to '" + number + "'."); + } + return value; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/TradeEntry.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/TradeEntry.java new file mode 100644 index 000000000..48c450716 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/TradeEntry.java @@ -0,0 +1,874 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.containers.BinaryAsciiString; +import com.epam.deltix.containers.CharSequenceUtils; +import com.epam.deltix.containers.MutableString; +import com.epam.deltix.dfp.Decimal64Utils; +import com.epam.deltix.timebase.messages.*; + +/** + * Basic information about a market trade. + */ +@SchemaElement( + name = "com.epam.deltix.timebase.messages.universal.TradeEntry", + title = "Trade Entry" +) +public class TradeEntry extends BaseEntry implements TradeEntryInterface { + public static final String CLASS_NAME = TradeEntry.class.getName(); + + /** + * Ask, Bid or Trade price. + */ + protected long price = TypeConstants.DECIMAL_NULL; + + /** + * Ask, Bid or Trade quantity. + */ + protected long size = TypeConstants.DECIMAL_NULL; + + /** + * Market specific trade condition. + */ + protected CharSequence condition = null; + + /** + * Explains the meaning of the given price and/or size. + * The value is null for regular trades. + */ + protected TradeType tradeType = null; + + /** + * Seller number of orders involved in match. + */ + protected long sellerNumberOfOrders = TypeConstants.INT64_NULL; + + /** + * Buyer number of orders involved in match. + */ + protected long buyerNumberOfOrders = TypeConstants.INT64_NULL; + + /** + * ID of seller order. + */ + protected CharSequence sellerOrderId = null; + + /** + * ID of buyer order. + */ + protected CharSequence buyerOrderId = null; + + /** + * Seller participant ID (or broker ID) for trader that submit selling order. + */ + protected CharSequence sellerParticipantId = null; + + /** + * Buyer participant ID (or broker ID) for trader that submit buying order. + */ + protected CharSequence buyerParticipantId = null; + + /** + * Trade side. Sell or Buy. + * For Trade it's aggressor side, i.e. side from where market order has came. + */ + protected AggressorSide side = null; + + /** + * Id of particular execution event (ExecutionId, TradeId, MatchId) + */ + protected CharSequence matchId = null; + + /** + * Ask, Bid or Trade price. + * @return Price + */ + @SchemaElement( + title = "Price" + ) + @SchemaType( + encoding = "DECIMAL64", + dataType = SchemaDataType.FLOAT + ) + public long getPrice() { + return price; + } + + /** + * Ask, Bid or Trade price. + * @param value - Price + */ + public void setPrice(long value) { + this.price = value; + } + + /** + * Ask, Bid or Trade price. + * @return true if Price is not null + */ + public boolean hasPrice() { + return price != TypeConstants.DECIMAL_NULL; + } + + /** + * Ask, Bid or Trade price. + */ + public void nullifyPrice() { + this.price = TypeConstants.DECIMAL_NULL; + } + + /** + * Ask, Bid or Trade quantity. + * @return Size + */ + @SchemaElement( + title = "Size" + ) + @SchemaType( + encoding = "DECIMAL64", + dataType = SchemaDataType.FLOAT + ) + public long getSize() { + return size; + } + + /** + * Ask, Bid or Trade quantity. + * @param value - Size + */ + public void setSize(long value) { + this.size = value; + } + + /** + * Ask, Bid or Trade quantity. + * @return true if Size is not null + */ + public boolean hasSize() { + return size != TypeConstants.DECIMAL_NULL; + } + + /** + * Ask, Bid or Trade quantity. + */ + public void nullifySize() { + this.size = TypeConstants.DECIMAL_NULL; + } + + /** + * Market specific trade condition. + * @return Condition + */ + @SchemaElement( + title = "Condition" + ) + @SchemaType( + encoding = "UTF8" + ) + public CharSequence getCondition() { + return condition; + } + + /** + * Market specific trade condition. + * @param value - Condition + */ + public void setCondition(CharSequence value) { + this.condition = value; + } + + /** + * Market specific trade condition. + * @return true if Condition is not null + */ + public boolean hasCondition() { + return condition != null; + } + + /** + * Market specific trade condition. + */ + public void nullifyCondition() { + this.condition = null; + } + + /** + * Explains the meaning of the given price and/or size. + * The value is null for regular trades. + * @return Trade Type + */ + @SchemaElement( + title = "Trade Type" + ) + public TradeType getTradeType() { + return tradeType; + } + + /** + * Explains the meaning of the given price and/or size. + * The value is null for regular trades. + * @param value - Trade Type + */ + public void setTradeType(TradeType value) { + this.tradeType = value; + } + + /** + * Explains the meaning of the given price and/or size. + * The value is null for regular trades. + * @return true if Trade Type is not null + */ + public boolean hasTradeType() { + return tradeType != null; + } + + /** + * Explains the meaning of the given price and/or size. + * The value is null for regular trades. + */ + public void nullifyTradeType() { + this.tradeType = null; + } + + /** + * Seller number of orders involved in match. + * @return Seller Number Of Orders + */ + @SchemaElement( + title = "Seller Number Of Orders" + ) + public long getSellerNumberOfOrders() { + return sellerNumberOfOrders; + } + + /** + * Seller number of orders involved in match. + * @param value - Seller Number Of Orders + */ + public void setSellerNumberOfOrders(long value) { + this.sellerNumberOfOrders = value; + } + + /** + * Seller number of orders involved in match. + * @return true if Seller Number Of Orders is not null + */ + public boolean hasSellerNumberOfOrders() { + return sellerNumberOfOrders != TypeConstants.INT64_NULL; + } + + /** + * Seller number of orders involved in match. + */ + public void nullifySellerNumberOfOrders() { + this.sellerNumberOfOrders = TypeConstants.INT64_NULL; + } + + /** + * Buyer number of orders involved in match. + * @return Buyer Number Of Orders + */ + @SchemaElement( + title = "Buyer Number Of Orders" + ) + public long getBuyerNumberOfOrders() { + return buyerNumberOfOrders; + } + + /** + * Buyer number of orders involved in match. + * @param value - Buyer Number Of Orders + */ + public void setBuyerNumberOfOrders(long value) { + this.buyerNumberOfOrders = value; + } + + /** + * Buyer number of orders involved in match. + * @return true if Buyer Number Of Orders is not null + */ + public boolean hasBuyerNumberOfOrders() { + return buyerNumberOfOrders != TypeConstants.INT64_NULL; + } + + /** + * Buyer number of orders involved in match. + */ + public void nullifyBuyerNumberOfOrders() { + this.buyerNumberOfOrders = TypeConstants.INT64_NULL; + } + + /** + * ID of seller order. + * @return Seller Order ID + */ + @Identifier + @SchemaElement( + title = "Seller Order ID" + ) + public CharSequence getSellerOrderId() { + return sellerOrderId; + } + + /** + * ID of seller order. + * @param value - Seller Order ID + */ + public void setSellerOrderId(CharSequence value) { + this.sellerOrderId = value; + } + + /** + * ID of seller order. + * @return true if Seller Order ID is not null + */ + public boolean hasSellerOrderId() { + return sellerOrderId != null; + } + + /** + * ID of seller order. + */ + public void nullifySellerOrderId() { + this.sellerOrderId = null; + } + + /** + * ID of buyer order. + * @return Buyer Order ID + */ + @Identifier + @SchemaElement( + title = "Buyer Order ID" + ) + public CharSequence getBuyerOrderId() { + return buyerOrderId; + } + + /** + * ID of buyer order. + * @param value - Buyer Order ID + */ + public void setBuyerOrderId(CharSequence value) { + this.buyerOrderId = value; + } + + /** + * ID of buyer order. + * @return true if Buyer Order ID is not null + */ + public boolean hasBuyerOrderId() { + return buyerOrderId != null; + } + + /** + * ID of buyer order. + */ + public void nullifyBuyerOrderId() { + this.buyerOrderId = null; + } + + /** + * Seller participant ID (or broker ID) for trader that submit selling order. + * @return Seller Participant ID + */ + @Identifier + @SchemaElement( + title = "Seller Participant ID" + ) + public CharSequence getSellerParticipantId() { + return sellerParticipantId; + } + + /** + * Seller participant ID (or broker ID) for trader that submit selling order. + * @param value - Seller Participant ID + */ + public void setSellerParticipantId(CharSequence value) { + this.sellerParticipantId = value; + } + + /** + * Seller participant ID (or broker ID) for trader that submit selling order. + * @return true if Seller Participant ID is not null + */ + public boolean hasSellerParticipantId() { + return sellerParticipantId != null; + } + + /** + * Seller participant ID (or broker ID) for trader that submit selling order. + */ + public void nullifySellerParticipantId() { + this.sellerParticipantId = null; + } + + /** + * Buyer participant ID (or broker ID) for trader that submit buying order. + * @return Buyer Participant ID + */ + @Identifier + @SchemaElement( + title = "Buyer Participant ID" + ) + public CharSequence getBuyerParticipantId() { + return buyerParticipantId; + } + + /** + * Buyer participant ID (or broker ID) for trader that submit buying order. + * @param value - Buyer Participant ID + */ + public void setBuyerParticipantId(CharSequence value) { + this.buyerParticipantId = value; + } + + /** + * Buyer participant ID (or broker ID) for trader that submit buying order. + * @return true if Buyer Participant ID is not null + */ + public boolean hasBuyerParticipantId() { + return buyerParticipantId != null; + } + + /** + * Buyer participant ID (or broker ID) for trader that submit buying order. + */ + public void nullifyBuyerParticipantId() { + this.buyerParticipantId = null; + } + + /** + * Trade side. Sell or Buy. + * For Trade it's aggressor side, i.e. side from where market order has came. + * @return Side + */ + @SchemaElement( + title = "Side" + ) + public AggressorSide getSide() { + return side; + } + + /** + * Trade side. Sell or Buy. + * For Trade it's aggressor side, i.e. side from where market order has came. + * @param value - Side + */ + public void setSide(AggressorSide value) { + this.side = value; + } + + /** + * Trade side. Sell or Buy. + * For Trade it's aggressor side, i.e. side from where market order has came. + * @return true if Side is not null + */ + public boolean hasSide() { + return side != null; + } + + /** + * Trade side. Sell or Buy. + * For Trade it's aggressor side, i.e. side from where market order has came. + */ + public void nullifySide() { + this.side = null; + } + + /** + * Id of particular execution event (ExecutionId, TradeId, MatchId) + * @return Match ID + */ + @Identifier + @SchemaElement( + title = "Match ID" + ) + public CharSequence getMatchId() { + return matchId; + } + + /** + * Id of particular execution event (ExecutionId, TradeId, MatchId) + * @param value - Match ID + */ + public void setMatchId(CharSequence value) { + this.matchId = value; + } + + /** + * Id of particular execution event (ExecutionId, TradeId, MatchId) + * @return true if Match ID is not null + */ + public boolean hasMatchId() { + return matchId != null; + } + + /** + * Id of particular execution event (ExecutionId, TradeId, MatchId) + */ + public void nullifyMatchId() { + this.matchId = null; + } + + /** + * Creates new instance of this class. + * @return new instance of this class. + */ + @Override + protected TradeEntry createInstance() { + return new TradeEntry(); + } + + /** + * Method nullifies all instance properties + */ + @Override + public TradeEntry nullify() { + super.nullify(); + nullifyPrice(); + nullifySize(); + nullifyCondition(); + nullifyTradeType(); + nullifySellerNumberOfOrders(); + nullifyBuyerNumberOfOrders(); + nullifySellerOrderId(); + nullifyBuyerOrderId(); + nullifySellerParticipantId(); + nullifyBuyerParticipantId(); + nullifySide(); + nullifyMatchId(); + return this; + } + + /** + * Resets all instance properties to their default values + */ + @Override + public TradeEntry reset() { + super.reset(); + price = TypeConstants.DECIMAL_NULL; + size = TypeConstants.DECIMAL_NULL; + condition = null; + tradeType = null; + sellerNumberOfOrders = TypeConstants.INT64_NULL; + buyerNumberOfOrders = TypeConstants.INT64_NULL; + sellerOrderId = null; + buyerOrderId = null; + sellerParticipantId = null; + buyerParticipantId = null; + side = null; + matchId = null; + return this; + } + + /** + * Method copies state to a given instance + */ + @Override + public TradeEntry clone() { + TradeEntry t = createInstance(); + t.copyFrom(this); + return t; + } + + /** + * Indicates whether some other object is "equal to" this one. + */ + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + boolean superEquals = super.equals(obj); + if (!superEquals) return false; + if (!(obj instanceof TradeEntryInfo)) return false; + TradeEntryInfo other =(TradeEntryInfo)obj; + if (hasPrice() != other.hasPrice()) return false; + if (hasPrice() && !Decimal64Utils.equals(getPrice(), other.getPrice())) return false; + if (hasSize() != other.hasSize()) return false; + if (hasSize() && !Decimal64Utils.equals(getSize(), other.getSize())) return false; + if (hasCondition() != other.hasCondition()) return false; + if (hasCondition()) { + if (getCondition().length() != other.getCondition().length()) return false; else { + CharSequence s1 = getCondition(); + CharSequence s2 = other.getCondition(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } + if (hasTradeType() != other.hasTradeType()) return false; + if (hasTradeType() && getTradeType() != other.getTradeType()) return false; + if (hasSellerNumberOfOrders() != other.hasSellerNumberOfOrders()) return false; + if (hasSellerNumberOfOrders() && getSellerNumberOfOrders() != other.getSellerNumberOfOrders()) return false; + if (hasBuyerNumberOfOrders() != other.hasBuyerNumberOfOrders()) return false; + if (hasBuyerNumberOfOrders() && getBuyerNumberOfOrders() != other.getBuyerNumberOfOrders()) return false; + if (hasSellerOrderId() != other.hasSellerOrderId()) return false; + if (hasSellerOrderId()) { + if (getSellerOrderId().length() != other.getSellerOrderId().length()) return false; else { + CharSequence s1 = getSellerOrderId(); + CharSequence s2 = other.getSellerOrderId(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } + if (hasBuyerOrderId() != other.hasBuyerOrderId()) return false; + if (hasBuyerOrderId()) { + if (getBuyerOrderId().length() != other.getBuyerOrderId().length()) return false; else { + CharSequence s1 = getBuyerOrderId(); + CharSequence s2 = other.getBuyerOrderId(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } + if (hasSellerParticipantId() != other.hasSellerParticipantId()) return false; + if (hasSellerParticipantId()) { + if (getSellerParticipantId().length() != other.getSellerParticipantId().length()) return false; else { + CharSequence s1 = getSellerParticipantId(); + CharSequence s2 = other.getSellerParticipantId(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } + if (hasBuyerParticipantId() != other.hasBuyerParticipantId()) return false; + if (hasBuyerParticipantId()) { + if (getBuyerParticipantId().length() != other.getBuyerParticipantId().length()) return false; else { + CharSequence s1 = getBuyerParticipantId(); + CharSequence s2 = other.getBuyerParticipantId(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } + if (hasSide() != other.hasSide()) return false; + if (hasSide() && getSide() != other.getSide()) return false; + if (hasMatchId() != other.hasMatchId()) return false; + if (hasMatchId()) { + if (getMatchId().length() != other.getMatchId().length()) return false; else { + CharSequence s1 = getMatchId(); + CharSequence s2 = other.getMatchId(); + if ((s1 instanceof MutableString && s2 instanceof MutableString) || (s1 instanceof String && s2 instanceof String) || (s1 instanceof BinaryAsciiString && s2 instanceof BinaryAsciiString)) { + if (!s1.equals(s2)) return false; + } else { + if (!CharSequenceUtils.equals(s1, s2)) return false; + } + } + } + return true; + } + + /** + * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by. + */ + @Override + public int hashCode() { + int hash = super.hashCode(); + if (hasPrice()) { + hash = hash * 31 + ((int)(getPrice() ^ (getPrice() >>> 32))); + } + if (hasSize()) { + hash = hash * 31 + ((int)(getSize() ^ (getSize() >>> 32))); + } + if (hasCondition()) { + hash = hash * 31 + getCondition().hashCode(); + } + if (hasTradeType()) { + hash = hash * 31 + getTradeType().getNumber(); + } + if (hasSellerNumberOfOrders()) { + hash = hash * 31 + ((int)(getSellerNumberOfOrders() ^ (getSellerNumberOfOrders() >>> 32))); + } + if (hasBuyerNumberOfOrders()) { + hash = hash * 31 + ((int)(getBuyerNumberOfOrders() ^ (getBuyerNumberOfOrders() >>> 32))); + } + if (hasSellerOrderId()) { + hash = hash * 31 + getSellerOrderId().hashCode(); + } + if (hasBuyerOrderId()) { + hash = hash * 31 + getBuyerOrderId().hashCode(); + } + if (hasSellerParticipantId()) { + hash = hash * 31 + getSellerParticipantId().hashCode(); + } + if (hasBuyerParticipantId()) { + hash = hash * 31 + getBuyerParticipantId().hashCode(); + } + if (hasSide()) { + hash = hash * 31 + getSide().getNumber(); + } + if (hasMatchId()) { + hash = hash * 31 + getMatchId().hashCode(); + } + return hash; + } + + /** + * Method copies state to a given instance + * @param template class instance that should be used as a copy source + */ + @Override + public TradeEntry copyFrom(RecordInfo template) { + super.copyFrom(template); + if (template instanceof TradeEntryInfo) { + TradeEntryInfo t = (TradeEntryInfo)template; + if (t.hasPrice()) { + setPrice(t.getPrice()); + } else { + nullifyPrice(); + } + if (t.hasSize()) { + setSize(t.getSize()); + } else { + nullifySize(); + } + if (t.hasCondition()) { + if (hasCondition() && getCondition() instanceof StringBuilder) { + ((StringBuilder)getCondition()).setLength(0); + } else { + setCondition(new StringBuilder()); + } + ((StringBuilder)getCondition()).append(t.getCondition()); + } else { + nullifyCondition(); + } + if (t.hasTradeType()) { + setTradeType(t.getTradeType()); + } else { + nullifyTradeType(); + } + if (t.hasSellerNumberOfOrders()) { + setSellerNumberOfOrders(t.getSellerNumberOfOrders()); + } else { + nullifySellerNumberOfOrders(); + } + if (t.hasBuyerNumberOfOrders()) { + setBuyerNumberOfOrders(t.getBuyerNumberOfOrders()); + } else { + nullifyBuyerNumberOfOrders(); + } + if (t.hasSellerOrderId()) { + if (!(hasSellerOrderId() && getSellerOrderId() instanceof BinaryAsciiString)) { + setSellerOrderId(new BinaryAsciiString()); + } + ((BinaryAsciiString)getSellerOrderId()).assign(t.getSellerOrderId()); + } else { + nullifySellerOrderId(); + } + if (t.hasBuyerOrderId()) { + if (!(hasBuyerOrderId() && getBuyerOrderId() instanceof BinaryAsciiString)) { + setBuyerOrderId(new BinaryAsciiString()); + } + ((BinaryAsciiString)getBuyerOrderId()).assign(t.getBuyerOrderId()); + } else { + nullifyBuyerOrderId(); + } + if (t.hasSellerParticipantId()) { + if (!(hasSellerParticipantId() && getSellerParticipantId() instanceof BinaryAsciiString)) { + setSellerParticipantId(new BinaryAsciiString()); + } + ((BinaryAsciiString)getSellerParticipantId()).assign(t.getSellerParticipantId()); + } else { + nullifySellerParticipantId(); + } + if (t.hasBuyerParticipantId()) { + if (!(hasBuyerParticipantId() && getBuyerParticipantId() instanceof BinaryAsciiString)) { + setBuyerParticipantId(new BinaryAsciiString()); + } + ((BinaryAsciiString)getBuyerParticipantId()).assign(t.getBuyerParticipantId()); + } else { + nullifyBuyerParticipantId(); + } + if (t.hasSide()) { + setSide(t.getSide()); + } else { + nullifySide(); + } + if (t.hasMatchId()) { + if (!(hasMatchId() && getMatchId() instanceof BinaryAsciiString)) { + setMatchId(new BinaryAsciiString()); + } + ((BinaryAsciiString)getMatchId()).assign(t.getMatchId()); + } else { + nullifyMatchId(); + } + } + return this; + } + + /** + * @return a string representation of this class object. + */ + @Override + public String toString() { + StringBuilder str = new StringBuilder(); + return toString(str).toString(); + } + + /** + * @return a string representation of this class object. + */ + @Override + public StringBuilder toString(StringBuilder str) { + str.append("{ \"$type\": \"TradeEntry\""); + if (hasPrice()) { + str.append(", \"price\": "); + Decimal64Utils.appendTo(getPrice(), str); + } + if (hasSize()) { + str.append(", \"size\": "); + Decimal64Utils.appendTo(getSize(), str); + } + if (hasCondition()) { + str.append(", \"condition\": \"").append(getCondition()).append("\""); + } + if (hasTradeType()) { + str.append(", \"tradeType\": \"").append(getTradeType()).append("\""); + } + if (hasSellerNumberOfOrders()) { + str.append(", \"sellerNumberOfOrders\": ").append(getSellerNumberOfOrders()); + } + if (hasBuyerNumberOfOrders()) { + str.append(", \"buyerNumberOfOrders\": ").append(getBuyerNumberOfOrders()); + } + if (hasSellerOrderId()) { + str.append(", \"sellerOrderId\": \"").append(getSellerOrderId()).append("\""); + } + if (hasBuyerOrderId()) { + str.append(", \"buyerOrderId\": \"").append(getBuyerOrderId()).append("\""); + } + if (hasSellerParticipantId()) { + str.append(", \"sellerParticipantId\": \"").append(getSellerParticipantId()).append("\""); + } + if (hasBuyerParticipantId()) { + str.append(", \"buyerParticipantId\": \"").append(getBuyerParticipantId()).append("\""); + } + if (hasSide()) { + str.append(", \"side\": \"").append(getSide()).append("\""); + } + if (hasMatchId()) { + str.append(", \"matchId\": \"").append(getMatchId()).append("\""); + } + if (hasExchangeId()) { + str.append(", \"exchangeId\": ").append(getExchangeId()); + } + if (hasIsImplied()) { + str.append(", \"isImplied\": ").append(isImplied()); + } + if (hasContractId()) { + str.append(", \"contractId\": ").append(getContractId()); + } + str.append("}"); + return str; + } +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/TradeEntryInfo.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/TradeEntryInfo.java new file mode 100644 index 000000000..708f94175 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/TradeEntryInfo.java @@ -0,0 +1,160 @@ +package com.epam.deltix.timebase.messages.universal; + +/** + * Basic information about a market trade. + */ +public interface TradeEntryInfo extends BaseEntryInfo { + /** + * Ask, Bid or Trade price. + * @return Price + */ + long getPrice(); + + /** + * Ask, Bid or Trade price. + * @return true if Price is not null + */ + boolean hasPrice(); + + /** + * Ask, Bid or Trade quantity. + * @return Size + */ + long getSize(); + + /** + * Ask, Bid or Trade quantity. + * @return true if Size is not null + */ + boolean hasSize(); + + /** + * Market specific trade condition. + * @return Condition + */ + CharSequence getCondition(); + + /** + * Market specific trade condition. + * @return true if Condition is not null + */ + boolean hasCondition(); + + /** + * Explains the meaning of the given price and/or size. + * The value is null for regular trades. + * @return Trade Type + */ + TradeType getTradeType(); + + /** + * Explains the meaning of the given price and/or size. + * The value is null for regular trades. + * @return true if Trade Type is not null + */ + boolean hasTradeType(); + + /** + * Seller number of orders involved in match. + * @return Seller Number Of Orders + */ + long getSellerNumberOfOrders(); + + /** + * Seller number of orders involved in match. + * @return true if Seller Number Of Orders is not null + */ + boolean hasSellerNumberOfOrders(); + + /** + * Buyer number of orders involved in match. + * @return Buyer Number Of Orders + */ + long getBuyerNumberOfOrders(); + + /** + * Buyer number of orders involved in match. + * @return true if Buyer Number Of Orders is not null + */ + boolean hasBuyerNumberOfOrders(); + + /** + * ID of seller order. + * @return Seller Order ID + */ + CharSequence getSellerOrderId(); + + /** + * ID of seller order. + * @return true if Seller Order ID is not null + */ + boolean hasSellerOrderId(); + + /** + * ID of buyer order. + * @return Buyer Order ID + */ + CharSequence getBuyerOrderId(); + + /** + * ID of buyer order. + * @return true if Buyer Order ID is not null + */ + boolean hasBuyerOrderId(); + + /** + * Seller participant ID (or broker ID) for trader that submit selling order. + * @return Seller Participant ID + */ + CharSequence getSellerParticipantId(); + + /** + * Seller participant ID (or broker ID) for trader that submit selling order. + * @return true if Seller Participant ID is not null + */ + boolean hasSellerParticipantId(); + + /** + * Buyer participant ID (or broker ID) for trader that submit buying order. + * @return Buyer Participant ID + */ + CharSequence getBuyerParticipantId(); + + /** + * Buyer participant ID (or broker ID) for trader that submit buying order. + * @return true if Buyer Participant ID is not null + */ + boolean hasBuyerParticipantId(); + + /** + * Trade side. Sell or Buy. + * For Trade it's aggressor side, i.e. side from where market order has came. + * @return Side + */ + AggressorSide getSide(); + + /** + * Trade side. Sell or Buy. + * For Trade it's aggressor side, i.e. side from where market order has came. + * @return true if Side is not null + */ + boolean hasSide(); + + /** + * Id of particular execution event (ExecutionId, TradeId, MatchId) + * @return Match ID + */ + CharSequence getMatchId(); + + /** + * Id of particular execution event (ExecutionId, TradeId, MatchId) + * @return true if Match ID is not null + */ + boolean hasMatchId(); + + /** + * Method copies state to a given instance + */ + @Override + TradeEntryInfo clone(); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/TradeEntryInterface.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/TradeEntryInterface.java new file mode 100644 index 000000000..02a028911 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/TradeEntryInterface.java @@ -0,0 +1,159 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.RecordInfo; + +/** + * Basic information about a market trade. + */ +public interface TradeEntryInterface extends TradeEntryInfo, BaseEntryInterface { + /** + * Ask, Bid or Trade price. + * @param value - Price + */ + void setPrice(long value); + + /** + * Ask, Bid or Trade price. + */ + void nullifyPrice(); + + /** + * Ask, Bid or Trade quantity. + * @param value - Size + */ + void setSize(long value); + + /** + * Ask, Bid or Trade quantity. + */ + void nullifySize(); + + /** + * Market specific trade condition. + * @param value - Condition + */ + void setCondition(CharSequence value); + + /** + * Market specific trade condition. + */ + void nullifyCondition(); + + /** + * Explains the meaning of the given price and/or size. + * The value is null for regular trades. + * @param value - Trade Type + */ + void setTradeType(TradeType value); + + /** + * Explains the meaning of the given price and/or size. + * The value is null for regular trades. + */ + void nullifyTradeType(); + + /** + * Seller number of orders involved in match. + * @param value - Seller Number Of Orders + */ + void setSellerNumberOfOrders(long value); + + /** + * Seller number of orders involved in match. + */ + void nullifySellerNumberOfOrders(); + + /** + * Buyer number of orders involved in match. + * @param value - Buyer Number Of Orders + */ + void setBuyerNumberOfOrders(long value); + + /** + * Buyer number of orders involved in match. + */ + void nullifyBuyerNumberOfOrders(); + + /** + * ID of seller order. + * @param value - Seller Order ID + */ + void setSellerOrderId(CharSequence value); + + /** + * ID of seller order. + */ + void nullifySellerOrderId(); + + /** + * ID of buyer order. + * @param value - Buyer Order ID + */ + void setBuyerOrderId(CharSequence value); + + /** + * ID of buyer order. + */ + void nullifyBuyerOrderId(); + + /** + * Seller participant ID (or broker ID) for trader that submit selling order. + * @param value - Seller Participant ID + */ + void setSellerParticipantId(CharSequence value); + + /** + * Seller participant ID (or broker ID) for trader that submit selling order. + */ + void nullifySellerParticipantId(); + + /** + * Buyer participant ID (or broker ID) for trader that submit buying order. + * @param value - Buyer Participant ID + */ + void setBuyerParticipantId(CharSequence value); + + /** + * Buyer participant ID (or broker ID) for trader that submit buying order. + */ + void nullifyBuyerParticipantId(); + + /** + * Trade side. Sell or Buy. + * For Trade it's aggressor side, i.e. side from where market order has came. + * @param value - Side + */ + void setSide(AggressorSide value); + + /** + * Trade side. Sell or Buy. + * For Trade it's aggressor side, i.e. side from where market order has came. + */ + void nullifySide(); + + /** + * Id of particular execution event (ExecutionId, TradeId, MatchId) + * @param value - Match ID + */ + void setMatchId(CharSequence value); + + /** + * Id of particular execution event (ExecutionId, TradeId, MatchId) + */ + void nullifyMatchId(); + + /** + * Method nullifies all instance properties + */ + @Override + TradeEntryInterface nullify(); + + /** + * Resets all instance properties to their default values + */ + @Override + TradeEntryInterface reset(); + + @Override + TradeEntryInterface copyFrom(RecordInfo template); +} diff --git a/messages/src/main/java/com/epam/deltix/timebase/messages/universal/TradeType.java b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/TradeType.java new file mode 100644 index 000000000..9662502f4 --- /dev/null +++ b/messages/src/main/java/com/epam/deltix/timebase/messages/universal/TradeType.java @@ -0,0 +1,79 @@ +package com.epam.deltix.timebase.messages.universal; + +import com.epam.deltix.timebase.messages.OldElementName; +import com.epam.deltix.timebase.messages.SchemaElement; + +/** + * Explains the meaning of the given price and/or size. + */ +public enum TradeType { + /** + * Regular trade. + */ + @SchemaElement( + name = "REGULAR_TRADE" + ) + REGULAR_TRADE(0), + + /** + * Auction price. + */ + @SchemaElement( + name = "AUCTION_CLEARING_PRICE" + ) + AUCTION_CLEARING_PRICE(1), + + /** + * Trade correction. + */ + @SchemaElement( + name = "CORRECTION" + ) + CORRECTION(2), + + /** + * Trade cancellation. + */ + @OldElementName("CANCELATION") + @SchemaElement( + name = "CANCELLATION" + ) + CANCELLATION(3), + + /** + * Not regular trade of unknown type. + */ + @SchemaElement( + name = "UNKNOWN" + ) + UNKNOWN(20); + + private final int value; + + TradeType(int value) { + this.value = value; + } + + public int getNumber() { + return this.value; + } + + public static TradeType valueOf(int number) { + switch (number) { + case 0: return REGULAR_TRADE; + case 1: return AUCTION_CLEARING_PRICE; + case 2: return CORRECTION; + case 3: return CANCELLATION; + case 20: return UNKNOWN; + default: return null; + } + } + + public static TradeType strictValueOf(int number) { + final TradeType value = valueOf(number); + if (value == null) { + throw new IllegalArgumentException("Enumeration 'TradeType' does not have value corresponding to '" + number + "'."); + } + return value; + } +} diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/TypeConstantsPrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/TypeConstantsPrompts.properties new file mode 100644 index 000000000..d9f372fe2 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/TypeConstantsPrompts.properties @@ -0,0 +1,2 @@ +this Type Constants +this.doc UNDOCUMENTED diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/qql/ArgumentPrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/qql/ArgumentPrompts.properties new file mode 100644 index 000000000..225a53224 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/qql/ArgumentPrompts.properties @@ -0,0 +1,8 @@ +this Argument +this.doc Describes QQL function argument + +name Name +name.doc Argument name + +dataType Data Type +dataType.doc Data type diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/qql/InitArgumentPrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/qql/InitArgumentPrompts.properties new file mode 100644 index 000000000..60524c102 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/qql/InitArgumentPrompts.properties @@ -0,0 +1,5 @@ +this InitArgument +this.doc Describes QQL function init argument + +defaultValue Default Value +defaultValue.doc UNDOCUMENTED diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/qql/StatefulFunctionMessagePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/qql/StatefulFunctionMessagePrompts.properties new file mode 100644 index 000000000..36e1b5286 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/qql/StatefulFunctionMessagePrompts.properties @@ -0,0 +1,14 @@ +this StatefulFunctionMessage +this.doc Message that describes QQL stateful function + +id Id +id.doc Function identifier + +initArguments Init Arguments +initArguments.doc UNDOCUMENTED + +arguments Arguments +arguments.doc UNDOCUMENTED + +returnType Return Type +returnType.doc UNDOCUMENTED diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/qql/StatelessFunctionMessagePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/qql/StatelessFunctionMessagePrompts.properties new file mode 100644 index 000000000..b2d94e90f --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/qql/StatelessFunctionMessagePrompts.properties @@ -0,0 +1,11 @@ +this StatelessFunctionMessage +this.doc Message that describes QQL stateless function + +id Id +id.doc Function identifier + +arguments Arguments +arguments.doc UNDOCUMENTED + +returnType Return Type +returnType.doc UNDOCUMENTED diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/ArrayDataTypePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/ArrayDataTypePrompts.properties new file mode 100644 index 000000000..292f12ade --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/ArrayDataTypePrompts.properties @@ -0,0 +1,30 @@ +this ArrayDataType +this.doc Schema definition of array data type. + +elementType Element Type +elementType.doc \ +Array element data type. +
\n\ +
DEFAULT
\n\ +
UNDOCUMENTED
\n\ +
CHAR
\n\ +
UNDOCUMENTED
\n\ +
VARCHAR
\n\ +
UNDOCUMENTED
\n\ +
BINARY
\n\ +
UNDOCUMENTED
\n\ +
BOOLEAN
\n\ +
UNDOCUMENTED
\n\ +
INTEGER
\n\ +
UNDOCUMENTED
\n\ +
FLOAT
\n\ +
UNDOCUMENTED
\n\ +
TIMESTAMP
\n\ +
UNDOCUMENTED
\n\ +
TIME_OF_DAY
\n\ +
UNDOCUMENTED
\n\ +
OBJECT
\n\ +
UNDOCUMENTED
\n\ +
ENUM
\n\ +
UNDOCUMENTED
\n\ +
diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/BinaryDataTypePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/BinaryDataTypePrompts.properties new file mode 100644 index 000000000..d54253004 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/BinaryDataTypePrompts.properties @@ -0,0 +1,8 @@ +this BinaryDataType +this.doc Schema definition of binary data type. + +maxSize Max Size +maxSize.doc Maximum field length in bytes. + +compressionLevel Compression Level +compressionLevel.doc Compression level for binary data. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/BooleanDataTypePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/BooleanDataTypePrompts.properties new file mode 100644 index 000000000..4fc2fa72a --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/BooleanDataTypePrompts.properties @@ -0,0 +1,2 @@ +this BooleanDataType +this.doc Schema definition of boolean data type. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/CharDataTypePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/CharDataTypePrompts.properties new file mode 100644 index 000000000..9089756fe --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/CharDataTypePrompts.properties @@ -0,0 +1,2 @@ +this CharDataType +this.doc Schema definition of char data type. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/ClassDataTypePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/ClassDataTypePrompts.properties new file mode 100644 index 000000000..501cbdac0 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/ClassDataTypePrompts.properties @@ -0,0 +1,5 @@ +this ClassDataType +this.doc Schema definition of class data type. + +typeDescriptors Type Descriptors +typeDescriptors.doc Definitions for nested schema classes. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/ClassDescriptorRefPrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/ClassDescriptorRefPrompts.properties new file mode 100644 index 000000000..341b731a6 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/ClassDescriptorRefPrompts.properties @@ -0,0 +1,5 @@ +this ClassDescriptorRef +this.doc Schema definition for a reference to class descriptor. + +name Name +name.doc Node name. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/DateTimeDataTypePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/DateTimeDataTypePrompts.properties new file mode 100644 index 000000000..f78535f52 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/DateTimeDataTypePrompts.properties @@ -0,0 +1,2 @@ +this DateTimeDataType +this.doc Schema definition of date-time data type. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/EnumDataTypePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/EnumDataTypePrompts.properties new file mode 100644 index 000000000..9718f8ab6 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/EnumDataTypePrompts.properties @@ -0,0 +1,5 @@ +this EnumDataType +this.doc Schema definition of enum data type. + +typeDescriptor Type Descriptor +typeDescriptor.doc Definition for enumeration class. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/EnumValuePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/EnumValuePrompts.properties new file mode 100644 index 000000000..ed152c45b --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/EnumValuePrompts.properties @@ -0,0 +1,8 @@ +this EnumValue +this.doc Schema definition for a single enumeration value. + +symbol Symbol +symbol.doc Enumeration symbol. + +value Value +value.doc Enumeration value. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/FieldPrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/FieldPrompts.properties new file mode 100644 index 000000000..f8534d5f0 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/FieldPrompts.properties @@ -0,0 +1,5 @@ +this Schema Data Field +this.doc This is a base class for schema data field. + +dataType Data Type +dataType.doc Data type of a field. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/FieldTypePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/FieldTypePrompts.properties new file mode 100644 index 000000000..4789ee664 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/FieldTypePrompts.properties @@ -0,0 +1,8 @@ +this DataType +this.doc This is a base class for schema data types. + +encoding Encoding +encoding.doc Binary representation (encoding) of a field in database and protocol. + +isNullable Is Nullable +isNullable.doc True, if schema design allows the field to be nullable. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/FloatDataTypePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/FloatDataTypePrompts.properties new file mode 100644 index 000000000..08debef52 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/FloatDataTypePrompts.properties @@ -0,0 +1,5 @@ +this FloatDataType +this.doc Schema definition of float data type. + +scale Scale +scale.doc Scale. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/IntegerDataTypePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/IntegerDataTypePrompts.properties new file mode 100644 index 000000000..f3217ac51 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/IntegerDataTypePrompts.properties @@ -0,0 +1,2 @@ +this IntegerDataType +this.doc Schema definition of integer data type. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/IntegralDataTypePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/IntegralDataTypePrompts.properties new file mode 100644 index 000000000..f73594961 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/IntegralDataTypePrompts.properties @@ -0,0 +1,8 @@ +this IntegralDataType +this.doc This is a base class for numeric data types. + +minValue Min Value +minValue.doc String definition for minimum constraint. + +maxValue Max Value +maxValue.doc String definition for maximum constraint. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/NamedDescriptorPrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/NamedDescriptorPrompts.properties new file mode 100644 index 000000000..6a4f269e1 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/NamedDescriptorPrompts.properties @@ -0,0 +1,11 @@ +this NamedDescriptor +this.doc This is a base class for schema nodes. + +name Name +name.doc Node name. + +title Title +title.doc Node title. + +description Description +description.doc Node description. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/NonStaticFieldPrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/NonStaticFieldPrompts.properties new file mode 100644 index 000000000..924f1c217 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/NonStaticFieldPrompts.properties @@ -0,0 +1,10 @@ +this Schema Non-Static DataField +this.doc Schema definition for non-static data field. + +isPrimaryKey Is Primary Key +isPrimaryKey.doc \ +True, if field is defined as a primary key.\n\ +The propery is applicable for unique streams only. + +relativeTo Relative To +relativeTo.doc If specified, the field value will be encoded as a difference with a field defined in a RelativeTo property. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaChangeMessagePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaChangeMessagePrompts.properties new file mode 100644 index 000000000..e31bce8d7 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaChangeMessagePrompts.properties @@ -0,0 +1,14 @@ +this SchemaChangeMessage +this.doc Message tha defines a change in stream schema. + +previousState Previous State +previousState.doc Previous schema state. + +newState New State +newState.doc New schema state. + +descriptorChangeActions Descriptor Change Actions +descriptorChangeActions.doc New schema state. + +version Version +version.doc Message version diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaClassDescriptorPrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaClassDescriptorPrompts.properties new file mode 100644 index 000000000..26b21863d --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaClassDescriptorPrompts.properties @@ -0,0 +1,5 @@ +this ClassDescriptor +this.doc Schema definition for a schema node. + +guid Guid +guid.doc Optional GUID for this node. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaDescriptorChangeActionPrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaDescriptorChangeActionPrompts.properties new file mode 100644 index 000000000..9734efc0c --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaDescriptorChangeActionPrompts.properties @@ -0,0 +1,32 @@ +this SchemaDescriptorChangeAction +this.doc Class which defines a change to schema descriptor. + +previousState Previous State +previousState.doc Previous descriptor state. + +newState New State +newState.doc New descriptor state. + +changeTypes Change Types +changeTypes.doc \ +Bitmask that defines the changes that were applied to the descriptor. +
\n\ +
ADD
\n\ +
Add operation.
\n\ +
DELETE
\n\ +
Delete operation.
\n\ +
RENAME
\n\ +
Rename operation.
\n\ +
FIELDS_CHANGE
\n\ +
Fields change operation.
\n\ +
CONTENT_TYPE_CHANGE
\n\ +
Content type change operation.
\n\ +
+ +descriptorTransformation Descriptor Transformation +descriptorTransformation.doc Defines the data transformation that was applied to the descriptor. + +fieldChangeActions Field Change Actions +fieldChangeActions.doc \ +A list of change actions to data fields.\n\ +Populated only if ChangeTypes contains ALTER flag diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaDescriptorTransformationPrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaDescriptorTransformationPrompts.properties new file mode 100644 index 000000000..4dca21b1a --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaDescriptorTransformationPrompts.properties @@ -0,0 +1,10 @@ +this SchemaDescriptorTransformation +this.doc Class which defines a transformation that is applied to the descriptor. + +transformationType Transformation Type +transformationType.doc \ +Defines the transformation type that was applied to the descriptor. +
\n\ +
DROP_RECORD
\n\ +
Drop record operation.
\n\ +
diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaEnumDescriptorPrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaEnumDescriptorPrompts.properties new file mode 100644 index 000000000..a1b217b40 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaEnumDescriptorPrompts.properties @@ -0,0 +1,8 @@ +this Schema Enum Class Descriptor +this.doc Schema definition for enumeration class. + +values Values +values.doc List of values of enumeration. + +isBitmask Is Bitmask +isBitmask.doc True, if enumeration represents a bitmask. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaFieldChangeActionPrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaFieldChangeActionPrompts.properties new file mode 100644 index 000000000..ede513f0c --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaFieldChangeActionPrompts.properties @@ -0,0 +1,39 @@ +this SchemaFieldChangeAction +this.doc Class which defines a change to schema field. + +previousState Previous State +previousState.doc Previous data field state. + +newState New State +newState.doc New descriptor state. + +changeTypes Change Types +changeTypes.doc \ +Bitmask that defines the changes that were applied to the field. +
\n\ +
ADD
\n\ +
Add field or enumeration value operation.
\n\ +
DELETE
\n\ +
Delete field or enumeration value operation.
\n\ +
RENAME
\n\ +
Rename field or enumeration value operation.
\n\ +
TITLE_CHANGE
\n\ +
Change field title operation.
\n\ +
DESCRIPTION_CHANGE
\n\ +
Change field description operation.
\n\ +
DATA_TYPE_CHANGE
\n\ +
Change field data type operation.
\n\ +
ORDINAL_CHANGE
\n\ +
Change field ordinal operation.
\n\ +
MODIFIER_CHANGE
\n\ +
Change field modifier (static and non-static) operation.
\n\ +
STATIC_VALUE_CHANGE
\n\ +
Change field static value operation.
\n\ +
PRIMARY_KEY_CHANGE
\n\ +
Change fileld primary key attribute operation.
\n\ +
RELATION_CHANGE
\n\ +
Change field relation attribute operation.
\n\ +
+ +dataTransformation Data Transformation +dataTransformation.doc Defines the data transformation that was applied to the field. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaFieldDataTransformationPrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaFieldDataTransformationPrompts.properties new file mode 100644 index 000000000..b974d8020 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaFieldDataTransformationPrompts.properties @@ -0,0 +1,17 @@ +this SchemaFieldDataTransformation +this.doc Class which defines a transformation that is applied to a data field. + +transformationType Transformation Type +transformationType.doc \ +Defines the transformation that was applied to the field. +
\n\ +
CONVERT_DATA
\n\ +
Convert data operation.
\n\ +
SET_DEFAULT
\n\ +
Apply default value operation.
\n\ +
DROP_RECORD
\n\ +
Drop record operation.
\n\ +
+ +defaultValue Default Value +defaultValue.doc Defines the default value if TransformationType equals SET_DEFAULT. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaRecordDescriptorPrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaRecordDescriptorPrompts.properties new file mode 100644 index 000000000..be08e2fe9 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/SchemaRecordDescriptorPrompts.properties @@ -0,0 +1,14 @@ +this RecordClassDescriptor +this.doc Schema definition for a class. + +parent Parent +parent.doc Defines parent RecordClassDescriptor if exist. + +isAbstract Is Abstract +isAbstract.doc Defines if current RecordClassDescriptor is abstract. + +isContentClass Is Content Class +isContentClass.doc Defines if current RecordClassDescriptor is content class. + +dataFields Data Fields +dataFields.doc List of fields of a class. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/StaticFieldPrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/StaticFieldPrompts.properties new file mode 100644 index 000000000..a5c2744c7 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/StaticFieldPrompts.properties @@ -0,0 +1,5 @@ +this Static Data Field Definition +this.doc Schema definition for static data field. + +staticValue Static Value +staticValue.doc Value constant for a field. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/TimeOfDayDataTypePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/TimeOfDayDataTypePrompts.properties new file mode 100644 index 000000000..d06b51c9e --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/TimeOfDayDataTypePrompts.properties @@ -0,0 +1,2 @@ +this TimeOfDayDataType +this.doc Schema definition of time-of-day data type. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/VarcharDataTypePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/VarcharDataTypePrompts.properties new file mode 100644 index 000000000..c9f4ddfb0 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/schema/VarcharDataTypePrompts.properties @@ -0,0 +1,11 @@ +this VarcharDataType +this.doc Schema definition of varchar data type. + +isMultiline Is Multiline +isMultiline.doc True, if field allows line breaks. + +encodingType Encoding Type +encodingType.doc Encoding type. + +length Length +length.doc Length. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/service/BinaryMessagePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/service/BinaryMessagePrompts.properties new file mode 100644 index 000000000..5057a4dae --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/service/BinaryMessagePrompts.properties @@ -0,0 +1,5 @@ +this Binary Message +this.doc UNDOCUMENTED + +data Data buffer +data.doc UNDOCUMENTED diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/service/DataLossMessagePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/service/DataLossMessagePrompts.properties new file mode 100644 index 000000000..acb65224a --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/service/DataLossMessagePrompts.properties @@ -0,0 +1,12 @@ +this Data Loss Message +this.doc \ +Message class, which describes data loss for 'lossy' Transient streams. See see "BufferOptions.Lossless".\n\ +Such message can be received from see "ITickCursor", when message loss is occurred.\n\ +TickStream should have see "DataLossMessage" Class Descriptor defined in stream schema. See\n\ +see "Descriptor" . + +bytes Bytes +bytes.doc Number of the lost bytes. + +fromTime From Time +fromTime.doc The last reported message time before byte loss occurs. Precision - milliseconds. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/service/ErrorMessagePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/service/ErrorMessagePrompts.properties new file mode 100644 index 000000000..52c893efd --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/service/ErrorMessagePrompts.properties @@ -0,0 +1,33 @@ +this Error Message +this.doc UNDOCUMENTED + +errorType ErrorType +errorType.doc UNDOCUMENTED + +seqNum Sequence Number +seqNum.doc UNDOCUMENTED + +level Error Level +level.doc \ +UNDOCUMENTED +
\n\ +
DEBUG
\n\ +
UNDOCUMENTED
\n\ +
INFO
\n\ +
Maps to QuantOffice EventSeverity.Information
\n\ +
ALERT
\n\ +
Maps to QuantOffice EventSeverity.Warning
\n\ +
USER_ERROR
\n\ +
Application/User code error\n\ + Maps to QuantOffice EventSeverity.Error, will be visible as Trading Console alert
\n\ +
SYSTEM_ERROR
\n\ +
System error (Error in UHF/QuantOffice runtime)
\n\ +
HEARTBEAT
\n\ +
UNDOCUMENTED
\n\ +
+ +messageText Text +messageText.doc UNDOCUMENTED + +details Details +details.doc UNDOCUMENTED diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/service/EventMessagePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/service/EventMessagePrompts.properties new file mode 100644 index 000000000..2644e9e22 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/service/EventMessagePrompts.properties @@ -0,0 +1,20 @@ +this Event Message +this.doc UNDOCUMENTED + +eventType Event Type +eventType.doc \ +UNDOCUMENTED +
\n\ +
STREAM_DELETED
\n\ +
UNDOCUMENTED
\n\ +
STREAM_CREATED
\n\ +
UNDOCUMENTED
\n\ +
READ_LOCK_ACQUIRED
\n\ +
UNDOCUMENTED
\n\ +
READ_LOCK_RELEASED
\n\ +
UNDOCUMENTED
\n\ +
WRITE_LOCK_ACQUIRED
\n\ +
UNDOCUMENTED
\n\ +
WRITE_LOCK_RELEASED
\n\ +
UNDOCUMENTED
\n\ +
diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/service/MetaDataChangeMessagePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/service/MetaDataChangeMessagePrompts.properties new file mode 100644 index 000000000..56ca78970 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/service/MetaDataChangeMessagePrompts.properties @@ -0,0 +1,11 @@ +this Meta Data Change Message +this.doc \ +Special transient message that signals active stream consumers that their stream metadata has been changed\n\ +Used for advanced stream monitoring.\n\ +see also "SelectionOptions.VersionTracking" + +converted Converted +converted.doc Indicates, that stream data was converted. + +version Version +version.doc UNDOCUMENTED diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/service/RealTimeStartMessagePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/service/RealTimeStartMessagePrompts.properties new file mode 100644 index 000000000..f8b442b47 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/service/RealTimeStartMessagePrompts.properties @@ -0,0 +1,5 @@ +this Real Time Start Message +this.doc \ +Special transient message that is inserted into MessageSource to signal transition from historic to real-time data.\n\ +Message indicates that RealTimeMessageSource message source switched to read-time mode.\n\ +Can be received only when see "SelectionOptions.RealTimeNotification" = true. diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/service/StreamTruncatedMessagePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/service/StreamTruncatedMessagePrompts.properties new file mode 100644 index 000000000..88eb4227a --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/service/StreamTruncatedMessagePrompts.properties @@ -0,0 +1,14 @@ +this Stream Truncated Message +this.doc \ +Special transient message that signals active stream consumers that their stream has been truncated\n\ +Used for advanced stream monitoring.\n\ +see also "SelectionOptions.VersionTracking" + +instruments Instruments +instruments.doc UNDOCUMENTED + +truncateTime Truncated Time +truncateTime.doc Time of truncation in nanoseconds + +version Version +version.doc UNDOCUMENTED diff --git a/messages/src/main/resources/com/epam/deltix/timebase/messages/service/SystemMessagePrompts.properties b/messages/src/main/resources/com/epam/deltix/timebase/messages/service/SystemMessagePrompts.properties new file mode 100644 index 000000000..0b46ecdc2 --- /dev/null +++ b/messages/src/main/resources/com/epam/deltix/timebase/messages/service/SystemMessagePrompts.properties @@ -0,0 +1,2 @@ +this System Message +this.doc Base timebase system message. diff --git a/settings.gradle b/settings.gradle index c47b62265..a3e095d88 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,7 @@ //rootProject.name = 'commons' include ':lang', ':collections', ':util', ':messages' + project(':lang').name = 'timebase-lang' project(':util').name = 'timebase-util' project(':messages').name = 'timebase-messages' diff --git a/util/build.gradle b/util/build.gradle index d5ae1455c..430683759 100644 --- a/util/build.gradle +++ b/util/build.gradle @@ -1,19 +1,19 @@ description = 'Timebase general purpose utilities' dependencies { - implementation project(':timebase-lang') - implementation project(':timebase-collections') + api project(':timebase-lang') + api project(':timebase-collections') - implementation 'com.epam.deltix:gflog-api' - implementation 'com.epam.deltix:gflog-core' + implementation group: 'com.epam.deltix', name: 'gflog-api', version: gflogVersion + implementation group: 'com.epam.deltix', name: 'gflog-core', version: gflogVersion - implementation 'com.epam.deltix:dfp' - implementation 'com.epam.deltix:hd-date-time' + implementation group: 'com.epam.deltix', name: 'dfp', version: dfpVersion + implementation group: 'com.epam.deltix', name: 'hd-date-time', version: hdTimeVersion - implementation 'com.epam.deltix:thread-affinity' + implementation 'com.epam.deltix:thread-affinity:1.0.4' - implementation 'org.apache.commons:commons-lang3' - implementation 'org.apache.commons:commons-compress:1.7' + implementation 'org.apache.commons:commons-lang3:3.7' + implementation 'org.apache.commons:commons-compress:1.19' implementation 'javax.xml.bind:jaxb-api:2.2.8' implementation 'com.sun.xml.bind:jaxb-impl:2.3.0'