T
- The type implementing this abstract class.public abstract class StringBasedErpType<T extends StringBasedErpType<T>> extends Object implements ErpType<T>, Comparable<T>, StringRepresentableKey
Modifier and Type | Class and Description |
---|---|
static class |
StringBasedErpType.CharCasing
The casing of the contained value to be used by a
StringBasedErpType . |
static class |
StringBasedErpType.FillCharStrategy
The strategy to be used to fill the String representation of a
StringBasedErpType to the length specified
by getMaxLength() . |
Constructor and Description |
---|
StringBasedErpType(String value)
Constructs a new string-based type.
|
StringBasedErpType(String value,
StringBasedErpType.CharCasing charCasing)
Constructs a new string-based type with a certain character casing and the english locale.
|
StringBasedErpType(String value,
StringBasedErpType.CharCasing charCasing,
Locale locale)
Constructs a new string-based type with a certain character casing and the given locale.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(T other) |
boolean |
equals(Object o) |
char |
getFillChar() |
abstract StringBasedErpType.FillCharStrategy |
getFillCharStrategy() |
String |
getKeyAsString()
Returns the String representation of this key.
|
abstract int |
getMaxLength() |
abstract Class<T> |
getType() |
String |
getValue() |
int |
hashCode() |
boolean |
isDefault() |
boolean |
isEmpty() |
String |
toString() |
String |
toString(StringBasedErpType.FillCharStrategy strategy,
char fillChar)
Returns this value, filled according to the given
FillCharStrategy with the give fillChar. |
static <T extends StringBasedErpType<T>> |
transformToString(ErpTypeConverter<T> converter)
Creates a function which transforms a given
StringBasedErpType to its String representation. |
static <T extends StringBasedErpType<T>> |
transformToType(ErpTypeConverter<T> converter)
Creates a function which transforms a given String to its
StringBasedErpType representation. |
getTypeConverter
public StringBasedErpType(String value) throws IllegalArgumentException
value
- The value of the type (not null
). The given string is trimmed. An empty or trimmed empty value
results in an empty instance of the string-based type.IllegalArgumentException
- If the given value cannot be converted to an instance of this type, or the given parameter is null.public StringBasedErpType(String value, StringBasedErpType.CharCasing charCasing) throws IllegalArgumentException
value
- The value of the type (not null
). The given string is trimmed. An empty or trimmed empty value
results in an empty instance of the string-based type.charCasing
- Defines the casing of characters within the string.IllegalArgumentException
- If the given value cannot be converted to an instance of this type, or any of the given parameter is
null
.public StringBasedErpType(String value, StringBasedErpType.CharCasing charCasing, Locale locale) throws IllegalArgumentException
value
- The value of the type (not null
). The given string is trimmed. An empty or trimmed empty value
results in an empty instance of the string-based type.charCasing
- Defines the casing of characters within the string.locale
- The locale to be used to change the casing of value
.IllegalArgumentException
- If the given value cannot be converted to an instance of this type, or any of the given parameter is
null
.public abstract int getMaxLength()
public abstract StringBasedErpType.FillCharStrategy getFillCharStrategy()
public char getFillChar()
public final boolean isEmpty()
true
if the contained string value is empty, false
otherwise.public final boolean isDefault()
true
if this instance represents the default SapClient.DEFAULT
, false
otherwise.public final String toString(StringBasedErpType.FillCharStrategy strategy, char fillChar)
FillCharStrategy
with the give fillChar.strategy
- The strategy to be used to fill this value.fillChar
- The character to be used to fill this value.public int compareTo(T other)
compareTo
in interface Comparable<T extends StringBasedErpType<T>>
public String getKeyAsString()
StringRepresentableKey
getKeyAsString
in interface StringRepresentableKey
public static <T extends StringBasedErpType<T>> com.google.common.base.Function<T,String> transformToString(ErpTypeConverter<T> converter)
StringBasedErpType
to its String representation. This
function handles null gracefully and returns null itself.T
- The type of the subclass to transform.converter
- The converter that should transform the concrete implementation of StringBasedErpType
to
String.StringBasedErpType
to String.public static <T extends StringBasedErpType<T>> com.google.common.base.Function<String,T> transformToType(ErpTypeConverter<T> converter)
StringBasedErpType
representation. This
function handles null gracefully and returns null itself.T
- The type of the subclass to create.converter
- The converter that should transform the String representation to the concrete
StringBasedErpType
implementation.StringBasedErpType
.public String getValue()
Copyright © 2018 SAP SE. All rights reserved.