= LogicalType _(record)_
:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you 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.

A generalization of Java's class type to also hold a logical name, which can be supplied lazily.

Equality is driven by the corresponding class exclusively, meaning the logical name is ignored in order to not cause any side-effects on logical name memoization eg. it happening too early.

Meta-model validators will take care, that there is no logical name ambiguity: There cannot be any LogicalTypes sharing the same corresponding class while having different logical names.

== API

[source,java]
.LogicalType.java
----
record LogicalType {
  LogicalType(String logicalName, Class<?> correspondingClass)
  LogicalType eager(Class<?> correspondingClass, String logicalName)     // <.>
  LogicalType fqcn(Class<?> correspondingClass)     // <.>
  LogicalType infer(Class<?> correspondingClass)
  String className()     // <.>
  String logicalSimpleName()     // <.>
  String namespace()     // <.>
  String logicalNameFormatted(String root, String delimiter)     // <.>
  boolean equals(Object obj)
  boolean isEqualTo(LogicalType other)
  int hashCode()
  int compareTo(LogicalType other)
  Class<?> getCorrespondingClass()     // <.>
  String getLogicalTypeName()     // <.>
  String getClassName()     // <.>
  String getLogicalTypeSimpleName()     // <.>
  String getNamespace()     // <.>
  String getLogicalTypeNameFormatted(String root, String delimiter)     // <.>
}
----

<.> xref:#eager_Class_String[eager(Class, String)]
+
--
Returns a new TypeIdentifier based on the corresponding class and (ahead of time) known _logicalName_ .
--
<.> xref:#fqcn_Class[fqcn(Class)]
+
--
Use the corresponding class's fully qualified name for the _logicalName_ . Most likely used in testing scenarios.
--
<.> xref:#className_[className()]
+
--
Canonical name of the corresponding class.
--
<.> xref:#logicalSimpleName_[logicalSimpleName()]
+
--
The logical type name consists of 2 parts, the _namespace_ and the _logical simple name_ .
--
<.> xref:#namespace_[namespace()]
+
--
The logical type name consists of 2 parts, the _namespace_ and the _logical simple name_ .
--
<.> xref:#logicalNameFormatted_String_String[logicalNameFormatted(String, String)]
+
--
The logical type name consists of 2 parts, the _namespace_ and the _logical simple name_ . Returns a concatenation of _namespace_ , _delimiter_ and the _logical simple name_ , whereas in the absence of a _namespace_ returns a concatenation of _root_ and the _logical simple name_ .
--
<.> xref:#getCorrespondingClass_[getCorrespondingClass()]
+
--
[WARNING]
====
[red]#_deprecated:_#

use _#correspondingClass()_
====
--
<.> xref:#getLogicalTypeName_[getLogicalTypeName()]
+
--
[WARNING]
====
[red]#_deprecated:_#

use _#logicalName()_
====
--
<.> xref:#getClassName_[getClassName()]
+
--
[WARNING]
====
[red]#_deprecated:_#

use _#className()_
====
--
<.> xref:#getLogicalTypeSimpleName_[getLogicalTypeSimpleName()]
+
--
[WARNING]
====
[red]#_deprecated:_#

use _#logicalSimpleName()_
====
--
<.> xref:#getNamespace_[getNamespace()]
+
--
[WARNING]
====
[red]#_deprecated:_#

use _#namespace()_
====
--
<.> xref:#getLogicalTypeNameFormatted_String_String[getLogicalTypeNameFormatted(String, String)]
+
--
[WARNING]
====
[red]#_deprecated:_#

use _#logicalNameFormatted(String, String)_
====
--

== Members

[#eager_Class_String]
=== eager(Class, String)

Returns a new TypeIdentifier based on the corresponding class and (ahead of time) known _logicalName_ .

[#fqcn_Class]
=== fqcn(Class)

Use the corresponding class's fully qualified name for the _logicalName_ . Most likely used in testing scenarios.

[#className_]
=== className()

Canonical name of the corresponding class.

[#logicalSimpleName_]
=== logicalSimpleName()

The logical type name consists of 2 parts, the _namespace_ and the _logical simple name_ .

Returns the _logical simple name_ part.

[#namespace_]
=== namespace()

The logical type name consists of 2 parts, the _namespace_ and the _logical simple name_ .

Returns the _namespace_ part.

[#logicalNameFormatted_String_String]
=== logicalNameFormatted(String, String)

The logical type name consists of 2 parts, the _namespace_ and the _logical simple name_ . Returns a concatenation of _namespace_ , _delimiter_ and the _logical simple name_ , whereas in the absence of a _namespace_ returns a concatenation of _root_ and the _logical simple name_ .

[#getCorrespondingClass_]
=== getCorrespondingClass()

[WARNING]
====
[red]#_deprecated:_#

use _#correspondingClass()_
====

[#getLogicalTypeName_]
=== getLogicalTypeName()

[WARNING]
====
[red]#_deprecated:_#

use _#logicalName()_
====

[#getClassName_]
=== getClassName()

[WARNING]
====
[red]#_deprecated:_#

use _#className()_
====

[#getLogicalTypeSimpleName_]
=== getLogicalTypeSimpleName()

[WARNING]
====
[red]#_deprecated:_#

use _#logicalSimpleName()_
====

[#getNamespace_]
=== getNamespace()

[WARNING]
====
[red]#_deprecated:_#

use _#namespace()_
====

[#getLogicalTypeNameFormatted_String_String]
=== getLogicalTypeNameFormatted(String, String)

[WARNING]
====
[red]#_deprecated:_#

use _#logicalNameFormatted(String, String)_
====
