1 package org.apache.maven.plugin.assembly.format;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.project.MavenProject;
23 import org.codehaus.plexus.util.StringUtils;
24 import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
25
26 import java.util.Properties;
27
28
29
30
31
32
33 @Deprecated
34 public class ReflectionProperties
35 extends Properties
36 {
37
38 private static final long serialVersionUID = 1L;
39
40 private final MavenProject project;
41
42 final boolean escapedBackslashesInFilePath;
43
44 public ReflectionProperties( final MavenProject aProject, final boolean escapedBackslashesInFilePath )
45 {
46 super();
47
48 project = aProject;
49
50 this.escapedBackslashesInFilePath = escapedBackslashesInFilePath;
51 }
52
53 @Override
54 public Object get( final Object key )
55 {
56 Object value = null;
57 try
58 {
59 value = ReflectionValueExtractor.evaluate( "" + key, project );
60
61 if ( escapedBackslashesInFilePath && value != null && "java.lang.String".equals(
62 value.getClass().getName() ) )
63 {
64 final String val = (String) value;
65
66
67 if ( val.indexOf( ":\\" ) == 1 )
68 {
69 value = StringUtils.replace( (String) value, "\\", "\\\\" );
70 value = StringUtils.replace( (String) value, ":", "\\:" );
71 }
72 }
73 }
74 catch ( final Exception e )
75 {
76
77 }
78 return value;
79 }
80 }