java.lang.Object | +--PropDiff
PropDiff is a utility for comparing and combining property files that can find the union, intersection, and difference. See java.util.Properties for more information about property files.
Run this with no arguments to see the usage/help that looks like:
Usage: [flags] properties-file1 properties-file2 [-f filenameOrPathPrefixForResults] flags: -c property settings that are common to both p1 and p2, where p2 take precedence -u union p1 and p2 where p2 has higher precedence -1 properties settings that are only in p1 -2 properties settings that are only in p2 -d intersection of properties in p1 and p2 that have different values -e intersection of properties in p1 and p2 that have equal values The flags can either be combined or separate. When no flags are used, all 6 property file combinations are produced. Use: -f - to stream output to console (stdout) Usage Examples: dump all variants to console: p1.properties p2.properties -f - combine two property files where first is default: -u p1.properties p2.properties Input property files are not modified.
Copyright (C) 2001 Step.com Communications, Inc. Copyright (C) 2002 Paul E. Baclace Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Constructor Summary | |
PropDiff(java.util.Properties p1,
java.lang.String filenamep1,
java.util.Properties p2,
java.lang.String filenamep2,
boolean toStdout)
Create a PropDiff that will operate on the Properties objects p1 and p2. |
Method Summary | |
java.util.Properties |
commonProps()
Return properties that are common (same name). |
java.util.Properties |
intersect(boolean intersectValues)
Return properties that have the same name and equal or different values. |
static void |
main(java.lang.String[] args)
The main method with a commandline interface. |
java.util.Properties |
onlyIn(int which)
Return properties only in one of the Properties objects. |
java.util.Properties |
union()
Return union of properties. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PropDiff(java.util.Properties p1, java.lang.String filenamep1, java.util.Properties p2, java.lang.String filenamep2, boolean toStdout)
p1
- a default or lower precedence Properties object.p2
- a higher precedence Properties object than p1.filenamep1
- filename (with or without full path) corresponding
to p1.filenamep2
- filename (with or without full path) corresponding
to p2.toStdout
- if true, send results to System.out instead of creating
property files as output.Method Detail |
public static void main(java.lang.String[] args)
public java.util.Properties intersect(boolean intersectValues)
intersectValues
- if true, then return props that also have the
same value. Otherwise, return only properties that have different values.
public java.util.Properties commonProps()
public java.util.Properties union()
public java.util.Properties onlyIn(int which)
which
- either 1 or 2.