Class PropertiesTransformer
- java.lang.Object
-
- org.apache.maven.plugins.shade.resource.properties.PropertiesTransformer
-
- All Implemented Interfaces:
ReproducibleResourceTransformer
,ResourceTransformer
- Direct Known Subclasses:
MicroprofileConfigTransformer
,OpenWebBeansPropertiesTransformer
public class PropertiesTransformer extends java.lang.Object implements ReproducibleResourceTransformer
Enables to merge a set of properties respecting priority between them.- Since:
- 3.2.2
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
alreadyMergedKey
private int
defaultOrdinal
private java.lang.String
ordinalKey
private java.util.List<java.util.Properties>
properties
private java.lang.String
resource
private boolean
reverseOrder
private long
time
-
Constructor Summary
Constructors Modifier Constructor Description PropertiesTransformer()
protected
PropertiesTransformer(java.lang.String resource, java.lang.String ordinalKey, int defaultOrdinal, boolean reversed)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canTransformResource(java.lang.String resource)
private int
getConfigurationOrdinal(java.util.Properties p)
boolean
hasTransformedResource()
private static java.util.Properties
mergeProperties(java.util.List<java.util.Properties> sortedProperties)
void
modifyOutputStream(java.util.jar.JarOutputStream os)
void
processResource(java.lang.String resource, java.io.InputStream is, java.util.List<Relocator> relocators)
Transform an individual resourcevoid
processResource(java.lang.String resource, java.io.InputStream is, java.util.List<Relocator> relocators, long time)
Transform an individual resourcevoid
setAlreadyMergedKey(java.lang.String alreadyMergedKey)
void
setDefaultOrdinal(int defaultOrdinal)
void
setOrdinalKey(java.lang.String ordinalKey)
void
setResource(java.lang.String resource)
void
setReverseOrder(boolean reverseOrder)
private java.util.List<java.util.Properties>
sortProperties()
-
-
-
Field Detail
-
resource
private java.lang.String resource
-
alreadyMergedKey
private java.lang.String alreadyMergedKey
-
ordinalKey
private java.lang.String ordinalKey
-
defaultOrdinal
private int defaultOrdinal
-
reverseOrder
private boolean reverseOrder
-
time
private long time
-
properties
private final java.util.List<java.util.Properties> properties
-
-
Method Detail
-
canTransformResource
public boolean canTransformResource(java.lang.String resource)
- Specified by:
canTransformResource
in interfaceResourceTransformer
-
processResource
public final void processResource(java.lang.String resource, java.io.InputStream is, java.util.List<Relocator> relocators) throws java.io.IOException
Description copied from interface:ResourceTransformer
Transform an individual resource- Specified by:
processResource
in interfaceResourceTransformer
- Parameters:
resource
- The resource nameis
- An input stream for the resource, the implementation should *not* close this streamrelocators
- A list of relocators- Throws:
java.io.IOException
- When the IO blows up
-
processResource
public void processResource(java.lang.String resource, java.io.InputStream is, java.util.List<Relocator> relocators, long time) throws java.io.IOException
Description copied from interface:ReproducibleResourceTransformer
Transform an individual resource- Specified by:
processResource
in interfaceReproducibleResourceTransformer
- Parameters:
resource
- The resource nameis
- An input stream for the resource, the implementation should *not* close this streamrelocators
- A list of relocatorstime
- the time of the resource to process- Throws:
java.io.IOException
- When the IO blows up
-
hasTransformedResource
public boolean hasTransformedResource()
- Specified by:
hasTransformedResource
in interfaceResourceTransformer
-
modifyOutputStream
public void modifyOutputStream(java.util.jar.JarOutputStream os) throws java.io.IOException
- Specified by:
modifyOutputStream
in interfaceResourceTransformer
- Throws:
java.io.IOException
-
setReverseOrder
public void setReverseOrder(boolean reverseOrder)
-
setResource
public void setResource(java.lang.String resource)
-
setOrdinalKey
public void setOrdinalKey(java.lang.String ordinalKey)
-
setDefaultOrdinal
public void setDefaultOrdinal(int defaultOrdinal)
-
setAlreadyMergedKey
public void setAlreadyMergedKey(java.lang.String alreadyMergedKey)
-
sortProperties
private java.util.List<java.util.Properties> sortProperties()
-
getConfigurationOrdinal
private int getConfigurationOrdinal(java.util.Properties p)
-
mergeProperties
private static java.util.Properties mergeProperties(java.util.List<java.util.Properties> sortedProperties)
-
-