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
34 @Deprecated
35 public class ReflectionProperties
36 extends Properties
37 {
38
39 private static final long serialVersionUID = 1L;
40
41 private final MavenProject project;
42
43 boolean escapedBackslashesInFilePath;
44
45 public ReflectionProperties( final MavenProject aProject, final boolean escapedBackslashesInFilePath )
46 {
47 super();
48
49 project = aProject;
50
51 this.escapedBackslashesInFilePath = escapedBackslashesInFilePath;
52 }
53
54 @Override
55 public Object get( final Object key )
56 {
57 Object value = null;
58 try
59 {
60 value = ReflectionValueExtractor.evaluate( "" + key, project );
61
62 if ( escapedBackslashesInFilePath && value != null && "java.lang.String".equals( value.getClass()
63 .getName() ) )
64 {
65 final String val = (String) value;
66
67
68 if ( val.indexOf( ":\\" ) == 1 )
69 {
70 value = StringUtils.replace( (String) value, "\\", "\\\\" );
71 value = StringUtils.replace( (String) value, ":", "\\:" );
72 }
73 }
74 }
75 catch ( final Exception e )
76 {
77
78 }
79 return value;
80 }
81 }