Class ColumnPattern<T,U>
java.lang.Object
bayern.steinbrecher.dbConnector.scheme.ColumnPattern<T,U>
- Type Parameters:
T- The datatype of the values stored in the column.U- The type of objects the content of this column belongs to.
- Direct Known Subclasses:
RegexColumnPattern,SimpleColumnPattern
public abstract class ColumnPattern<T,U>
extends java.lang.Object
- Since:
- 0.1
-
Constructor Summary
Constructors Modifier Constructor Description protectedColumnPattern(@NotNull java.lang.String columnNamePattern, @NotNull ColumnParser<T> parser) -
Method Summary
Modifier and Type Method Description Ucombine(U toSet, @NotNull java.lang.String columnName, @Nullable java.lang.String value)Parses the given value and sets it to the object of typeColumnPattern.protected abstract UcombineImpl(U toSet, @NotNull java.lang.String columnName, T parsedValue)booleanequals(@Nullable java.lang.Object obj)Checks whether this pattern reflects the same column names as the given object.@NotNull java.util.regex.PatterngetColumnNamePattern()@NotNull ColumnParser<T>getParser()inthashCode()booleanmatches(@NotNull java.lang.String columnName)@NotNull java.lang.StringtoString()
-
Constructor Details
-
ColumnPattern
protected ColumnPattern(@NotNull @NotNull java.lang.String columnNamePattern, @NotNull @NotNull ColumnParser<T> parser)- Parameters:
columnNamePattern- The RegEx column names have to match.parser- The parser for converting values from and to their SQL representation.- Since:
- 0.1
-
-
Method Details
-
getColumnNamePattern
@NotNull public @NotNull java.util.regex.Pattern getColumnNamePattern()- Since:
- 0.1
-
matches
public boolean matches(@NotNull @NotNull java.lang.String columnName)- Since:
- 0.1
-
getParser
- Since:
- 0.1
-
combine
public final U combine(@NotNull U toSet, @NotNull @NotNull java.lang.String columnName, @Nullable @Nullable java.lang.String value)Parses the given value and sets it to the object of typeColumnPattern.- Parameters:
toSet- The object to set the parsed value to.columnName- The column name matching this pattern to extract the key from.value- The value to parse and to set.- Returns:
- The resulting object of type
ColumnPattern. - Since:
- 0.1
-
combineImpl
protected abstract U combineImpl(@NotNull U toSet, @NotNull @NotNull java.lang.String columnName, @Nullable T parsedValue)- Since:
- 0.1
- See Also:
combine(Object, String, String)
-
equals
public boolean equals(@Nullable @Nullable java.lang.Object obj)Checks whether this pattern reflects the same column names as the given object. NOTE It is only checked whether their regex are identical not whether they express the same column names.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- The object to compare this column pattern with.- Returns:
trueonly if this pattern reflects the same column names as the given object.- Since:
- 0.1
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object- Since:
- 0.1
-
toString
@NotNull public @NotNull java.lang.String toString()- Overrides:
toStringin classjava.lang.Object- Since:
- 0.1
-