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