Package org.ec4j.core.model
Class PropertyType<T>
java.lang.Object
org.ec4j.core.model.PropertyType<T>
- Type Parameters:
T- the type of the parsedPropertyvalue
- Direct Known Subclasses:
PropertyType.LowerCasingPropertyType
A type of a
Property. This class also contains the "widely
supported" property types of as constants.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAn enumeration of allowed end of line values.static enumAn enumeration of allowed indentation style values.static classBecause some values need to be lowercased, as required by "lowercase_values1" a "lowercase_values2" tests (v0.9.0 properties), thisPropertyTypesubclass applies the lower-casing inPropertyType.LowerCasingPropertyType.normalizeIfNeeded(String).static classThe result ofPropertyparsed parsing.static interfaceA facility able to parse string values into other types. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String[]static final PropertyType<String> private final Stringstatic final PropertyType<PropertyType.EndOfLineValue> static final PropertyType<Integer> Note thattabis a legal value ofindent_size- see https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#indent_size and https://github.com/editorconfig/editorconfig/issues/54static final PropertyType<PropertyType.IndentStyleValue> static final PropertyType<Boolean> static final PropertyType<Integer> Note thatoffis a legal value ofmax_line_length- see https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#max_line_lengthprivate final Stringprivate final PropertyType.PropertyValueParser<T> static final PropertyType<Boolean> private static final Set<PropertyType<?>> static final PropertyType<Integer> static final PropertyType<Boolean> static final String -
Constructor Summary
ConstructorsConstructorDescriptionPropertyType(String name, String description, PropertyType.PropertyValueParser<T> parser, String... possibleValues) PropertyType(String name, String description, PropertyType.PropertyValueParser<T> parser, Set<String> possibleValues) -
Method Summary
Modifier and TypeMethodDescriptiongetName()normalizeIfNeeded(String value) Editor config tests require that some values need to be processed in various ways before being used.Parses the givenparsedinto aPropertyType.PropertyValuestatic Set<PropertyType<?>> toString()
-
Field Details
-
BOOLEAN_POSSIBLE_VALUES
-
charset
-
end_of_line
-
indent_size
Note thattabis a legal value ofindent_size- see https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#indent_size and https://github.com/editorconfig/editorconfig/issues/54If
indent_sizePropertyis constructed out oftab, the resulting instance'sProperty.getValueAs()returnsnull. -
indent_style
-
insert_final_newline
-
max_line_length
Note thatoffis a legal value ofmax_line_length- see https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#max_line_lengthIf
max_line_lengthPropertyis constructed usingoffvalue, the resulting instance'sProperty.getValueAs()returnsnull.- Since:
- 0.0.2
-
root
-
STANDARD_TYPES
-
tab_width
-
trim_trailing_whitespace
-
unset
- See Also:
-
description
-
name
-
parser
-
possibleValues
-
-
Constructor Details
-
PropertyType
-
PropertyType
public PropertyType(String name, String description, PropertyType.PropertyValueParser<T> parser, String... possibleValues)
-
-
Method Details
-
standardTypes
- Returns:
- a
Setof the "widely supported" property types - see http://editorconfig.org/
-
toSet
-
getDescription
- Returns:
- a short description of this
PropertyType
-
getName
- Returns:
- the name of this
PropertyType
-
getPossibleValues
- Returns:
- a
Setof values that are valid for thisPropertyType
-
normalizeIfNeeded
Editor config tests require that some values need to be processed in various ways before being used. This method is supposed to perform such transformations. This particular implementation performs no transformation. See alsoPropertyType.LowerCasingPropertyType.- Parameters:
value- the value to normalize- Returns:
- the normalized parsed or the passed-in
parsedif no transformation is necessary
-
parse
Parses the givenparsedinto aPropertyType.PropertyValue- Parameters:
value- the value to parse- Returns:
- the
PropertyType.PropertyValue
-
toString
-