Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Type Descriptions Into Classes #34

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<relativePath>../../../microservices/microservice-parent/pom.xml</relativePath>
</parent>
<artifactId>type-utils</artifactId>
<version>3.1.2-SNAPSHOT</version>
<version>3.1.3-SNAPSHOT</version>
<url>https://code.nsa.gov/datawave-type-utils</url>
<licenses>
<license>
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/datawave/data/type/AbstractGeometryType.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,23 @@

import datawave.data.normalizer.DiscreteIndexNormalizer;
import datawave.data.normalizer.Normalizer;
import datawave.data.normalizer.OneToManyNormalizer;
import datawave.data.type.util.AbstractGeometry;
import datawave.data.type.util.TypePrettyNameSupplier;

/**
* The base GeoWave geometry type, which provides an implementation for the discrete index type interface.
*
* @param <T>
* The underlying geometry type
*/
public abstract class AbstractGeometryType<T extends AbstractGeometry & Comparable<T>> extends BaseType<T> implements DiscreteIndexType<T> {
public abstract class AbstractGeometryType<T extends AbstractGeometry & Comparable<T>> extends BaseType<T>
implements DiscreteIndexType<T>, TypePrettyNameSupplier {

private static final long GEOMETRY_FACTORY_SIZE = 120;
private static final long ENVELOPE_SIZE = 45;
private static final long GEOMETRY_BASE_SIZE = ENVELOPE_SIZE + 20;
private static final long STATIC_SIZE = PrecomputedSizes.STRING_STATIC_REF + Sizer.REFERENCE + GEOMETRY_FACTORY_SIZE;
private static final String DATA_DICTIONARY_TYPE_NAME = "Abstract Geometry";

public AbstractGeometryType(Normalizer<T> normalizer) {
super(normalizer);
Expand Down Expand Up @@ -96,4 +98,9 @@ public long sizeInBytes() {
}
return size;
}

@Override
public String getDataDictionaryTypeValue() {
return DATA_DICTIONARY_TYPE_NAME;
}
}
9 changes: 8 additions & 1 deletion src/main/java/datawave/data/type/DateType.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import java.util.Date;

import datawave.data.normalizer.Normalizer;
import datawave.data.type.util.TypePrettyNameSupplier;

public class DateType extends BaseType<Date> {
public class DateType extends BaseType<Date> implements TypePrettyNameSupplier {

private static final long serialVersionUID = 936566410691643144L;
private static final long STATIC_SIZE = PrecomputedSizes.STRING_STATIC_REF + PrecomputedSizes.DATE_STATIC_REF + Sizer.REFERENCE;
private static final String DATA_DICTIONARY_TYPE_NAME = "Date";

public DateType() {
super(Normalizer.DATE_NORMALIZER);
Expand All @@ -33,4 +35,9 @@ public String getDelegateAsString() {
public long sizeInBytes() {
return STATIC_SIZE + (2 * normalizedValue.length());
}

@Override
public String getDataDictionaryTypeValue() {
return DATA_DICTIONARY_TYPE_NAME;
}
}
9 changes: 8 additions & 1 deletion src/main/java/datawave/data/type/GeoLatType.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package datawave.data.type;

import datawave.data.normalizer.Normalizer;
import datawave.data.type.util.TypePrettyNameSupplier;

public class GeoLatType extends BaseType<String> {
public class GeoLatType extends BaseType<String> implements TypePrettyNameSupplier {

private static final long serialVersionUID = -2775239290833908032L;
private static final long STATIC_SIZE = PrecomputedSizes.STRING_STATIC_REF * 2 + Sizer.REFERENCE;
private static final String DATA_DICTIONARY_TYPE_NAME = "Latitude";

public GeoLatType() {
super(Normalizer.GEO_LAT_NORMALIZER);
Expand All @@ -20,4 +22,9 @@ public GeoLatType() {
public long sizeInBytes() {
return STATIC_SIZE + (2 * normalizedValue.length()) + (2 * delegate.length());
}

@Override
public String getDataDictionaryTypeValue() {
return DATA_DICTIONARY_TYPE_NAME;
}
}
9 changes: 8 additions & 1 deletion src/main/java/datawave/data/type/GeoLonType.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package datawave.data.type;

import datawave.data.normalizer.Normalizer;
import datawave.data.type.util.TypePrettyNameSupplier;

public class GeoLonType extends BaseType<String> {
public class GeoLonType extends BaseType<String> implements TypePrettyNameSupplier {

private static final long serialVersionUID = 8912983433360105604L;
private static final long STATIC_SIZE = PrecomputedSizes.STRING_STATIC_REF * 2 + Sizer.REFERENCE;
private static final String DATA_DICTIONARY_TYPE_NAME = "Longitude";

public GeoLonType() {
super(Normalizer.GEO_LON_NORMALIZER);
Expand All @@ -20,4 +22,9 @@ public GeoLonType() {
public long sizeInBytes() {
return STATIC_SIZE + (2 * normalizedValue.length()) + (2 * delegate.length());
}

@Override
public String getDataDictionaryTypeValue() {
return DATA_DICTIONARY_TYPE_NAME;
}
}
9 changes: 8 additions & 1 deletion src/main/java/datawave/data/type/GeoType.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package datawave.data.type;

import datawave.data.normalizer.Normalizer;
import datawave.data.type.util.TypePrettyNameSupplier;

public class GeoType extends BaseType<String> {
public class GeoType extends BaseType<String> implements TypePrettyNameSupplier {

private static final long serialVersionUID = 8429780512238258642L;
private static final long STATIC_SIZE = PrecomputedSizes.STRING_STATIC_REF * 2 + Sizer.REFERENCE;
private static final String DATA_DICTIONARY_TYPE_NAME = "Geo";

public GeoType() {
super(Normalizer.GEO_NORMALIZER);
Expand All @@ -20,4 +22,9 @@ public GeoType() {
public long sizeInBytes() {
return STATIC_SIZE + (2 * normalizedValue.length()) + (2 * delegate.length());
}

@Override
public String getDataDictionaryTypeValue() {
return DATA_DICTIONARY_TYPE_NAME;
}
}
9 changes: 8 additions & 1 deletion src/main/java/datawave/data/type/GeometryType.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
import datawave.data.normalizer.Normalizer;
import datawave.data.normalizer.OneToManyNormalizer;
import datawave.data.type.util.Geometry;
import datawave.data.type.util.TypePrettyNameSupplier;

/**
* Provides inclusive support for all geometry types. OneToManyNormalizer support is needed as lines and polygons are likely to produce multiple normalized
* values during ingest.
*/
public class GeometryType extends AbstractGeometryType<Geometry> implements OneToManyNormalizerType<Geometry> {
public class GeometryType extends AbstractGeometryType<Geometry> implements OneToManyNormalizerType<Geometry>, TypePrettyNameSupplier {

protected List<String> normalizedValues;
private static final String DATA_DICTIONARY_TYPE_NAME = "Geometry";

public GeometryType() {
super(Normalizer.GEOMETRY_NORMALIZER);
Expand Down Expand Up @@ -40,4 +42,9 @@ public List<String> getNormalizedValues() {
public boolean expandAtQueryTime() {
return false;
}

@Override
public String getDataDictionaryTypeValue() {
return DATA_DICTIONARY_TYPE_NAME;
}
}
9 changes: 8 additions & 1 deletion src/main/java/datawave/data/type/HexStringType.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package datawave.data.type;

import datawave.data.normalizer.Normalizer;
import datawave.data.type.util.TypePrettyNameSupplier;

public class HexStringType extends BaseType<String> {
public class HexStringType extends BaseType<String> implements TypePrettyNameSupplier {

private static final long serialVersionUID = -3480716807342380164L;
private static final long STATIC_SIZE = PrecomputedSizes.STRING_STATIC_REF * 2 + Sizer.REFERENCE;
private static final String DATA_DICTIONARY_TYPE_NAME = "Hex String";

public HexStringType() {
super(Normalizer.HEX_STRING_NORMALIZER);
Expand All @@ -20,4 +22,9 @@ public HexStringType() {
public long sizeInBytes() {
return STATIC_SIZE + (2 * normalizedValue.length()) + (2 * delegate.length());
}

@Override
public String getDataDictionaryTypeValue() {
return DATA_DICTIONARY_TYPE_NAME;
}
}
9 changes: 8 additions & 1 deletion src/main/java/datawave/data/type/IpAddressType.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
import datawave.data.type.util.IpAddress;
import datawave.data.type.util.IpV4Address;
import datawave.data.type.util.IpV6Address;
import datawave.data.type.util.TypePrettyNameSupplier;

public class IpAddressType extends BaseType<IpAddress> {
public class IpAddressType extends BaseType<IpAddress> implements TypePrettyNameSupplier {

private static final long serialVersionUID = -6512690642978201801L;
private static final long STATIC_SIZE = PrecomputedSizes.STRING_STATIC_REF + Sizer.REFERENCE;
private static final String DATA_DICTIONARY_TYPE_NAME = "IP Address";

public IpAddressType() {
super(Normalizer.IP_ADDRESS_NORMALIZER);
Expand Down Expand Up @@ -42,4 +44,9 @@ public long sizeInBytes() {
}
return base + ipSize;
}

@Override
public String getDataDictionaryTypeValue() {
return DATA_DICTIONARY_TYPE_NAME;
}
}
9 changes: 8 additions & 1 deletion src/main/java/datawave/data/type/IpV4AddressType.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
import datawave.data.type.util.IpAddress;
import datawave.data.type.util.IpV4Address;
import datawave.data.type.util.IpV6Address;
import datawave.data.type.util.TypePrettyNameSupplier;

public class IpV4AddressType extends BaseType<IpAddress> {
public class IpV4AddressType extends BaseType<IpAddress> implements TypePrettyNameSupplier {

private static final long serialVersionUID = 7214683578627273557L;
private static final long STATIC_SIZE = PrecomputedSizes.STRING_STATIC_REF + Sizer.REFERENCE;
private static final String DATA_DICTIONARY_TYPE_NAME = "IPv4 Address";

public IpV4AddressType() {
super(Normalizer.IP_ADDRESS_NORMALIZER);
Expand All @@ -33,4 +35,9 @@ public long sizeInBytes() {
}
return base + ipSize;
}

@Override
public String getDataDictionaryTypeValue() {
return DATA_DICTIONARY_TYPE_NAME;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package datawave.data.type;

import datawave.data.normalizer.Normalizer;
import datawave.data.type.util.TypePrettyNameSupplier;

public class LcNoDiacriticsListType extends ListType {
public class LcNoDiacriticsListType extends ListType implements TypePrettyNameSupplier {

private static final String DATA_DICTIONARY_TYPE_NAME = "Text List";

public LcNoDiacriticsListType() {
super(Normalizer.LC_NO_DIACRITICS_NORMALIZER);
Expand All @@ -12,4 +15,8 @@ public LcNoDiacriticsListType(String delegateString) {
super(delegateString, Normalizer.LC_NO_DIACRITICS_NORMALIZER);
}

@Override
public String getDataDictionaryTypeValue() {
return DATA_DICTIONARY_TYPE_NAME;
}
}
9 changes: 8 additions & 1 deletion src/main/java/datawave/data/type/LcNoDiacriticsType.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package datawave.data.type;

import datawave.data.normalizer.Normalizer;
import datawave.data.type.util.TypePrettyNameSupplier;

public class LcNoDiacriticsType extends BaseType<String> {
public class LcNoDiacriticsType extends BaseType<String> implements TypePrettyNameSupplier {

private static final long serialVersionUID = -6219894926244790742L;
private static final long STATIC_SIZE = PrecomputedSizes.STRING_STATIC_REF * 2 + Sizer.REFERENCE;
private static final String DATA_DICTIONARY_TYPE_NAME = "Text";

public LcNoDiacriticsType() {
super(Normalizer.LC_NO_DIACRITICS_NORMALIZER);
Expand All @@ -24,4 +26,9 @@ public LcNoDiacriticsType(String delegateString) {
public long sizeInBytes() {
return STATIC_SIZE + (2 * normalizedValue.length()) + (2 * delegate.length());
}

@Override
public String getDataDictionaryTypeValue() {
return DATA_DICTIONARY_TYPE_NAME;
}
}
9 changes: 8 additions & 1 deletion src/main/java/datawave/data/type/LcType.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package datawave.data.type;

import datawave.data.normalizer.Normalizer;
import datawave.data.type.util.TypePrettyNameSupplier;

public class LcType extends BaseType<String> {
public class LcType extends BaseType<String> implements TypePrettyNameSupplier {

private static final long serialVersionUID = -5102714749195917406L;
private static final long STATIC_SIZE = PrecomputedSizes.STRING_STATIC_REF * 2 + Sizer.REFERENCE;
private static final String DATA_DICTIONARY_TYPE_NAME = "Lower Case Text";

public LcType() {
super(Normalizer.LC_NORMALIZER);
Expand All @@ -24,4 +26,9 @@ public LcType(String delegateString) {
public long sizeInBytes() {
return STATIC_SIZE + (2 * normalizedValue.length()) + (2 * delegate.length());
}

@Override
public String getDataDictionaryTypeValue() {
return DATA_DICTIONARY_TYPE_NAME;
}
}
10 changes: 9 additions & 1 deletion src/main/java/datawave/data/type/ListType.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
import java.util.List;

import datawave.data.normalizer.Normalizer;
import datawave.data.type.util.TypePrettyNameSupplier;
import datawave.util.StringUtils;

public abstract class ListType extends BaseType implements OneToManyNormalizerType {
public abstract class ListType extends BaseType implements OneToManyNormalizerType, TypePrettyNameSupplier {

protected static final String delimiter = ",|;";
List<String> normalizedValues;
private static final String DATA_DICTIONARY_TYPE_NAME = "List";

public ListType(Normalizer normalizer) {
super(normalizer);
Expand Down Expand Up @@ -48,4 +51,9 @@ public List<String> getNormalizedValues() {
public boolean expandAtQueryTime() {
return false;
}

@Override
public String getDataDictionaryTypeValue() {
return DATA_DICTIONARY_TYPE_NAME;
}
}
9 changes: 8 additions & 1 deletion src/main/java/datawave/data/type/MacAddressType.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package datawave.data.type;

import datawave.data.normalizer.Normalizer;
import datawave.data.type.util.TypePrettyNameSupplier;

public class MacAddressType extends BaseType<String> {
public class MacAddressType extends BaseType<String> implements TypePrettyNameSupplier {

private static final long serialVersionUID = -6743560287574389073L;
private static final long STATIC_SIZE = PrecomputedSizes.STRING_STATIC_REF * 2 + Sizer.REFERENCE;
private static final String DATA_DICTIONARY_TYPE_NAME = "MAC Address";

public MacAddressType() {
super(Normalizer.MAC_ADDRESS_NORMALIZER);
Expand All @@ -20,4 +22,9 @@ public MacAddressType() {
public long sizeInBytes() {
return STATIC_SIZE + (2 * normalizedValue.length()) + (2 * delegate.length());
}

@Override
public String getDataDictionaryTypeValue() {
return DATA_DICTIONARY_TYPE_NAME;
}
}
10 changes: 9 additions & 1 deletion src/main/java/datawave/data/type/NumberListType.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package datawave.data.type;

import datawave.data.normalizer.Normalizer;
import datawave.data.type.util.TypePrettyNameSupplier;

public class NumberListType extends ListType {
public class NumberListType extends ListType implements TypePrettyNameSupplier {

private static final String DATA_DICTIONARY_TYPE_NAME = "Number List";

public NumberListType() {
super(Normalizer.NUMBER_NORMALIZER);
Expand All @@ -12,4 +15,9 @@ public NumberListType() {
public boolean expandAtQueryTime() {
return true;
}

@Override
public String getDataDictionaryTypeValue() {
return DATA_DICTIONARY_TYPE_NAME;
}
}
Loading
Loading