Package org.apache.maven.cli.props
Class MavenProperties
Deprecated.
Enhancement of the standard
Properties
managing the maintain of comments, etc.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
Deprecated.TODOstatic class
Deprecated.This class is used to read properties lines.static class
Deprecated.This class is used to write properties lines.Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionDeprecated.private static final String
Deprecated.Constant for the supported comment characters.(package private) static final String
Deprecated.Unless standard java props, use UTF-8Deprecated.Deprecated.private static final int
Deprecated.Constant for the radix of hex numbers.private final Map
<String, MavenProperties.Layout> Deprecated.private static final String
Deprecated.Constant for the platform specific line separator.private Path
Deprecated.private static final char[]
Deprecated.The list of possible key/value separatorsDeprecated.(package private) boolean
Deprecated.(package private) boolean
Deprecated.private static final int
Deprecated.Constant for the length of a unicode literal.private static final char[]
Deprecated.The white space characters used as key/value separators. -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.MavenProperties
(boolean substitute) Deprecated.MavenProperties
(Path location) Deprecated.MavenProperties
(Path location, boolean substitute) Deprecated.MavenProperties
(Path location, Function<String, String> callback) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionprivate int
checkHeaderComment
(List<String> commentLines) Deprecated.Checks if parts of the passed in comment can be used as header comment.void
clear()
Deprecated.static boolean
contains
(char[] array, char valueToFind) Deprecated.Checks if the value is in the given array.entrySet()
Deprecated.protected static String
escapeJava
(String str) Deprecated.Escapes the characters in aString
using Java String rules.private static String
Deprecated.Escape the separators in the key.getComments
(String key) Deprecated.Deprecated.Return the comment footer.Deprecated.Return the comment header.getProperty
(String key) Deprecated.Searches for the property with the specified key in this property list.getProperty
(String key, String defaultValue) Deprecated.Searches for the property with the specified key in this property list.Deprecated.protected static String
hex
(char ch) Deprecated.Returns an upper case hexadecimalString
for the given character.(package private) static boolean
isCommentLine
(String line) Deprecated.Tests whether a line is a comment, i.e.void
load
(InputStream is) Deprecated.void
Deprecated.void
Deprecated.void
Deprecated.protected void
loadLayout
(Reader in, boolean maybeTyped) Deprecated.Reads a properties file and stores its internal structure.Enumeration
<?> Deprecated.Returns an enumeration of all the keys in this property list, including distinct keys in the default property list if a key of the same name has not already been found from the main properties list.Deprecated.Deprecated.Deprecated.Deprecated.(package private) void
putAllSubstituted
(Map<? extends String, ? extends String> m) Deprecated.Deprecated.void
save()
Deprecated.void
save
(OutputStream os) Deprecated.void
Deprecated.void
Deprecated.protected void
saveLayout
(Writer out, boolean typed) Deprecated.Writes the properties file to the given writer, preserving as much of its structure as possible.void
Deprecated.Set the comment footer.void
Deprecated.Set the comment header.setProperty
(String key, String value) Deprecated.Calls the map method put.void
store
(OutputStream os, String comment) Deprecated.Store a properties into a output stream, preserving comments, special character, etc.void
Deprecated.void
substitute
(Function<String, String> callback) Deprecated.protected static String
unescapeJava
(String str) Deprecated.Unescapes any Java literals found in theString
to aWriter
.boolean
Deprecated.boolean
update
(MavenProperties properties) Deprecated.Methods inherited from class java.util.AbstractMap
clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, size, toString, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
COMMENT_CHARS
Deprecated.Constant for the supported comment characters.- See Also:
-
SEPARATORS
private static final char[] SEPARATORSDeprecated.The list of possible key/value separators -
WHITE_SPACE
private static final char[] WHITE_SPACEDeprecated.The white space characters used as key/value separators. -
DEFAULT_ENCODING
Deprecated.Unless standard java props, use UTF-8 -
LINE_SEPARATOR
Deprecated.Constant for the platform specific line separator. -
HEX_RADIX
private static final int HEX_RADIXDeprecated.Constant for the radix of hex numbers.- See Also:
-
UNICODE_LEN
private static final int UNICODE_LENDeprecated.Constant for the length of a unicode literal.- See Also:
-
storage
Deprecated. -
layout
Deprecated. -
header
Deprecated. -
location
Deprecated. -
callback
Deprecated. -
substitute
boolean substituteDeprecated. -
typed
boolean typedDeprecated.
-
-
Constructor Details
-
MavenProperties
public MavenProperties()Deprecated. -
MavenProperties
Deprecated.- Throws:
IOException
-
MavenProperties
Deprecated.- Throws:
IOException
-
MavenProperties
public MavenProperties(boolean substitute) Deprecated. -
MavenProperties
Deprecated.
-
-
Method Details
-
load
Deprecated.- Throws:
IOException
-
load
Deprecated.- Throws:
IOException
-
load
Deprecated.- Throws:
IOException
-
load
Deprecated.- Throws:
IOException
-
save
Deprecated.- Throws:
IOException
-
save
Deprecated.- Throws:
IOException
-
save
Deprecated.- Throws:
IOException
-
save
Deprecated.- Throws:
IOException
-
store
Deprecated.Store a properties into a output stream, preserving comments, special character, etc. This method is mainly to be compatible with the java.util.Properties class.- Parameters:
os
- an output stream.comment
- this parameter is ignored as this Properties- Throws:
IOException
- If storing fails
-
getProperty
Deprecated.Searches for the property with the specified key in this property list.- Parameters:
key
- the property key.- Returns:
- the value in this property list with the specified key value.
-
getProperty
Deprecated.Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns the default value argument if the property is not found.- Parameters:
key
- the property key.defaultValue
- a default value.- Returns:
- The property value of the default value
-
entrySet
Deprecated. -
propertyNames
Deprecated.Returns an enumeration of all the keys in this property list, including distinct keys in the default property list if a key of the same name has not already been found from the main properties list.- Returns:
- an enumeration of all the keys in this property list, including the keys in the default property list.
-
setProperty
Deprecated.Calls the map method put. Provided for parallelism with the getProperty method. Enforces use of strings for property keys and values. The value returned is the result of the map call to put.- Parameters:
key
- the key to be placed into this property list.value
- the value corresponding to the key.- Returns:
- the previous value of the specified key in this property list, or null if it did not have one.
-
put
Deprecated. -
putAllSubstituted
Deprecated. -
put
Deprecated. -
put
Deprecated. -
put
Deprecated. -
update
Deprecated. -
update
Deprecated. -
getRaw
Deprecated. -
getComments
Deprecated. -
remove
Deprecated. -
clear
public void clear()Deprecated. -
getHeader
Deprecated.Return the comment header.- Returns:
- the comment header
-
setHeader
Deprecated.Set the comment header.- Parameters:
header
- the header to use
-
loadLayout
Deprecated.Reads a properties file and stores its internal structure. The found properties will be added to the associated configuration object.- Parameters:
in
- the reader to the properties file- Throws:
IOException
- if an error occurs
-
substitute
public void substitute()Deprecated. -
substitute
Deprecated. -
saveLayout
Deprecated.Writes the properties file to the given writer, preserving as much of its structure as possible.- Parameters:
out
- the writer- Throws:
IOException
- if an error occurs
-
checkHeaderComment
Deprecated.Checks if parts of the passed in comment can be used as header comment. This method checks whether a header comment can be defined (i.e. whether this is the first comment in the loaded file). If this is the case, it is searched for the lates blank line. This line will mark the end of the header comment. The return value is the index of the first line in the passed in list, which does not belong to the header comment.- Parameters:
commentLines
- the comment lines- Returns:
- the index of the next line after the header comment
-
isCommentLine
Deprecated.Tests whether a line is a comment, i.e. whether it starts with a comment character.- Parameters:
line
- the line- Returns:
- a flag if this is a comment line
-
unescapeJava
Deprecated.Unescapes any Java literals found in the
This is a slightly modified version of the StringEscapeUtils.unescapeJava() function in commons-lang that doesn't drop escaped separators (i.e '\,').String
to aWriter
.- Parameters:
str
- theString
to unescape, may be null- Returns:
- the processed string
- Throws:
IllegalArgumentException
- if the Writer isnull
-
escapeJava
Deprecated.Escapes the characters in a
String
using Java String rules.Deals correctly with quotes and control-chars (tab, backslash, cr, ff, etc.)
So a tab becomes the characters
'\\'
and't'
.The only difference between Java strings and JavaScript strings is that in JavaScript, a single quote must be escaped.
Example:
input string: He didn't say, "Stop!" output string: He didn't say, \"Stop!\"
- Parameters:
str
- String to escape values in, may be null- Returns:
- String with escaped values,
null
if null string input
-
hex
Deprecated.Returns an upper case hexadecimal
String
for the given character.- Parameters:
ch
- The character to convert.- Returns:
- An upper case hexadecimal
String
-
contains
public static boolean contains(char[] array, char valueToFind) Deprecated.Checks if the value is in the given array.
The method returns
false
if anull
array is passed in.- Parameters:
array
- the array to search throughvalueToFind
- the value to find- Returns:
true
if the array contains the object
-
escapeKey
Deprecated.Escape the separators in the key.- Parameters:
key
- the key- Returns:
- the escaped key
-