From fc7b732dea8c27f7d11cf4a931a0f7a4fa9199d1 Mon Sep 17 00:00:00 2001 From: jendave Date: Fri, 9 Sep 2011 16:07:55 +0000 Subject: [PATCH] checkstyle --- .../java/treeProperties/types/FileType.java | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/main/java/treeProperties/types/FileType.java b/src/main/java/treeProperties/types/FileType.java index e3d8525ca9a..cab4e719eb5 100644 --- a/src/main/java/treeProperties/types/FileType.java +++ b/src/main/java/treeProperties/types/FileType.java @@ -22,18 +22,18 @@ import java.util.regex.Pattern; * @version V0.0 19.08.2009 */ public class FileType implements PropertyType { - /** Constant suffix="file" */ - public static final String suffix = "file"; - /** Constant type */ - public static final Class type = File.class; + /** Constant suffix="file". */ + public static final String SUFFIX = "file"; + /** Constant type. */ + public static final Class TYPE = File.class; /** *

Getter for the field suffix.

* * @return a {@link java.lang.String} object. */ - public String getSuffix() { - return suffix; + public final String getSuffix() { + return SUFFIX; } /** @@ -41,17 +41,20 @@ public class FileType implements PropertyType { * * @return a {@link java.lang.Class} object. */ - public Class getType() { - return type; + public final Class getType() { + return TYPE; } /** {@inheritDoc} */ - public File toObject(TreeProperties p, String s) { + public final File toObject(final TreeProperties p, final String s) { String path = getPath(s); File f = new File(path); - if (f.isAbsolute()) return f; - else return new File(p.getPath(), path); + if (f.isAbsolute()) { + return f; + } else { + return new File(p.getPath(), path); + } } /** @@ -66,13 +69,19 @@ public class FileType implements PropertyType { * @return a {@link java.lang.String} object. */ public static String getPath(String s) { - if (s.startsWith("~/")) s = System.getProperty("user.home") + "/" + s.substring(2); - else if (s.startsWith("~\\")) s = System.getProperty("user.home") + "\\" + s.substring(2); + if (s.startsWith("~/")) { + s = System.getProperty("user.home") + "/" + s.substring(2); + } else if (s.startsWith("~\\")) { + s = System.getProperty("user.home") + "\\" + s.substring(2); + } Matcher m = Pattern.compile("\\$\\$|\\$\\{([^\\}]*)\\}").matcher(s); StringBuffer result = new StringBuffer(); while (m.find()) { - if (m.group().equals("$$")) m.appendReplacement(result, Matcher.quoteReplacement("$")); - else m.appendReplacement(result, Matcher.quoteReplacement(System.getProperty(m.group(1)))); + if (m.group().equals("$$")) { + m.appendReplacement(result, Matcher.quoteReplacement("$")); + } else { + m.appendReplacement(result, Matcher.quoteReplacement(System.getProperty(m.group(1)))); + } } m.appendTail(result); return result.toString();