esoe 2 years ago
parent
commit
42ebf4bb13
  1. 5
      java/samples/FileReaderAndWriter/Text.txt
  2. 73
      java/samples/FileReaderAndWriter/build.xml
  3. 0
      java/samples/FileReaderAndWriter/build/classes/.netbeans_automatic_build
  4. 0
      java/samples/FileReaderAndWriter/build/classes/.netbeans_update_resources
  5. BIN
      java/samples/FileReaderAndWriter/build/classes/filereaderandwriter/FileReaderAndWriter.class
  6. 3
      java/samples/FileReaderAndWriter/manifest.mf
  7. 1420
      java/samples/FileReaderAndWriter/nbproject/build-impl.xml
  8. 8
      java/samples/FileReaderAndWriter/nbproject/genfiles.properties
  9. 2
      java/samples/FileReaderAndWriter/nbproject/private/private.properties
  10. 74
      java/samples/FileReaderAndWriter/nbproject/project.properties
  11. 15
      java/samples/FileReaderAndWriter/nbproject/project.xml
  12. 60
      java/samples/FileReaderAndWriter/src/filereaderandwriter/FileReaderAndWriter.java
  13. 73
      java/samples/PropertiesExample/build.xml
  14. 0
      java/samples/PropertiesExample/build/classes/.netbeans_automatic_build
  15. 0
      java/samples/PropertiesExample/build/classes/.netbeans_update_resources
  16. BIN
      java/samples/PropertiesExample/build/classes/propertiesexample/PropertiesExample.class
  17. 3
      java/samples/PropertiesExample/manifest.mf
  18. 1420
      java/samples/PropertiesExample/nbproject/build-impl.xml
  19. 8
      java/samples/PropertiesExample/nbproject/genfiles.properties
  20. 2
      java/samples/PropertiesExample/nbproject/private/private.properties
  21. 74
      java/samples/PropertiesExample/nbproject/project.properties
  22. 15
      java/samples/PropertiesExample/nbproject/project.xml
  23. 3
      java/samples/PropertiesExample/prop.properties
  24. 57
      java/samples/PropertiesExample/src/propertiesexample/PropertiesExample.java
  25. 73
      java/samples/RulesPECS/build.xml
  26. 0
      java/samples/RulesPECS/build/classes/.netbeans_automatic_build
  27. 0
      java/samples/RulesPECS/build/classes/.netbeans_update_resources
  28. BIN
      java/samples/RulesPECS/build/classes/rulespecs/City.class
  29. BIN
      java/samples/RulesPECS/build/classes/rulespecs/Country.class
  30. BIN
      java/samples/RulesPECS/build/classes/rulespecs/District.class
  31. BIN
      java/samples/RulesPECS/build/classes/rulespecs/RulesPECS.class
  32. BIN
      java/samples/RulesPECS/build/classes/rulespecs/Street.class
  33. 3
      java/samples/RulesPECS/manifest.mf
  34. 1420
      java/samples/RulesPECS/nbproject/build-impl.xml
  35. 8
      java/samples/RulesPECS/nbproject/genfiles.properties
  36. 2
      java/samples/RulesPECS/nbproject/private/private.properties
  37. 74
      java/samples/RulesPECS/nbproject/project.properties
  38. 15
      java/samples/RulesPECS/nbproject/project.xml
  39. 14
      java/samples/RulesPECS/src/rulespecs/City.java
  40. 14
      java/samples/RulesPECS/src/rulespecs/Country.java
  41. 17
      java/samples/RulesPECS/src/rulespecs/District.java
  42. 62
      java/samples/RulesPECS/src/rulespecs/RulesPECS.java
  43. 14
      java/samples/RulesPECS/src/rulespecs/Street.java

5
java/samples/FileReaderAndWriter/Text.txt

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
Hello world!Hello world!
Hello world!
Hello world!
Hello world!
Hello world!

73
java/samples/FileReaderAndWriter/build.xml

@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="FileReaderAndWriter" default="default" basedir=".">
<description>Builds, tests, and runs the project FileReaderAndWriter.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="FileReaderAndWriter-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>

0
java/samples/FileReaderAndWriter/build/classes/.netbeans_automatic_build

0
java/samples/FileReaderAndWriter/build/classes/.netbeans_update_resources

BIN
java/samples/FileReaderAndWriter/build/classes/filereaderandwriter/FileReaderAndWriter.class

Binary file not shown.

3
java/samples/FileReaderAndWriter/manifest.mf

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

1420
java/samples/FileReaderAndWriter/nbproject/build-impl.xml

File diff suppressed because it is too large Load Diff

8
java/samples/FileReaderAndWriter/nbproject/genfiles.properties

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
build.xml.data.CRC32=64ca7b4c
build.xml.script.CRC32=2cd2026b
build.xml.stylesheet.CRC32=8064a381@1.80.1.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=64ca7b4c
nbproject/build-impl.xml.script.CRC32=38645af4
nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48

2
java/samples/FileReaderAndWriter/nbproject/private/private.properties

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
compile.on.save=true
user.properties.file=C:\\Users\\denis.LAPTOP-4LI8UQ4O\\AppData\\Roaming\\NetBeans\\8.2\\build.properties

74
java/samples/FileReaderAndWriter/nbproject/project.properties

@ -0,0 +1,74 @@ @@ -0,0 +1,74 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# \u0424\u0430\u0439\u043b\u044b \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 build.classes.dir, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0430\u0440\u0445\u0438\u0432\u0430 jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/FileReaderAndWriter.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
includes=**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=true
javac.processorpath=\
${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=filereaderandwriter.FileReaderAndWriter
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

15
java/samples/FileReaderAndWriter/nbproject/project.xml

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>FileReaderAndWriter</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>

60
java/samples/FileReaderAndWriter/src/filereaderandwriter/FileReaderAndWriter.java

@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package filereaderandwriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author denis
*/
public class FileReaderAndWriter {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
File file = new File("Text.txt");
if(!file.exists()) try {
file.createNewFile();
} catch (IOException ex) {
Logger.getLogger(FileReaderAndWriter.class.getName()).log(Level.SEVERE, null, ex);
}
if(file.canWrite()){
String line = "Hello world!";
try (FileWriter writer = new FileWriter(file, true)) {
writer.append("\n" + line);
} catch (IOException ex) {
Logger.getLogger(FileReaderAndWriter.class.getName()).log(Level.SEVERE, null, ex);
}
}
if(file.canRead()){
String line = "";
try(FileReader reader = new FileReader(file)){
char[]buf = new char[5];
int c =0;
while((c=reader.read(buf))!=-1){
line += new String(buf, 0, c);
}
}catch (IOException ex) {
Logger.getLogger(FileReaderAndWriter.class.getName()).log(Level.SEVERE, null, ex);
}
System.out.println(line);
}
}
}

73
java/samples/PropertiesExample/build.xml

@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="PropertiesExample" default="default" basedir=".">
<description>Builds, tests, and runs the project PropertiesExample.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="PropertiesExample-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>

0
java/samples/PropertiesExample/build/classes/.netbeans_automatic_build

0
java/samples/PropertiesExample/build/classes/.netbeans_update_resources

BIN
java/samples/PropertiesExample/build/classes/propertiesexample/PropertiesExample.class

Binary file not shown.

3
java/samples/PropertiesExample/manifest.mf

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

1420
java/samples/PropertiesExample/nbproject/build-impl.xml

File diff suppressed because it is too large Load Diff

8
java/samples/PropertiesExample/nbproject/genfiles.properties

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
build.xml.data.CRC32=114678dd
build.xml.script.CRC32=5efee7cf
build.xml.stylesheet.CRC32=8064a381@1.80.1.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=114678dd
nbproject/build-impl.xml.script.CRC32=6b3fab86
nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48

2
java/samples/PropertiesExample/nbproject/private/private.properties

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
compile.on.save=true
user.properties.file=C:\\Users\\denis.LAPTOP-4LI8UQ4O\\AppData\\Roaming\\NetBeans\\8.2\\build.properties

74
java/samples/PropertiesExample/nbproject/project.properties

@ -0,0 +1,74 @@ @@ -0,0 +1,74 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# \u0424\u0430\u0439\u043b\u044b \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 build.classes.dir, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0430\u0440\u0445\u0438\u0432\u0430 jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/PropertiesExample.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
includes=**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=true
javac.processorpath=\
${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=propertiesexample.PropertiesExample
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

15
java/samples/PropertiesExample/nbproject/project.xml

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>PropertiesExample</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>

3
java/samples/PropertiesExample/prop.properties

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
#Wed Nov 23 21:13:48 MSK 2022
nameK=Hello world
key=key value2

57
java/samples/PropertiesExample/src/propertiesexample/PropertiesExample.java

@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package propertiesexample;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author denis
*/
public class PropertiesExample {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
File fileProp = new File("prop.properties");
if(!fileProp.exists()) try {
fileProp.createNewFile();
} catch (IOException ex) {
Logger.getLogger(PropertiesExample.class.getName()).log(Level.SEVERE, null, ex);
}
Properties properties = new Properties();
try {
properties.load(new FileReader(fileProp));
} catch (FileNotFoundException ex) {
Logger.getLogger(PropertiesExample.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(PropertiesExample.class.getName()).log(Level.SEVERE, null, ex);
}
// properties.put("key", "key value");
// properties.put("key", "key value2");
// properties.put("key2", "key value2");
System.out.println(properties.getProperty("nameK", "Key is not exist"));
try {
properties.store(new FileWriter(fileProp), null);
} catch (IOException ex) {
Logger.getLogger(PropertiesExample.class.getName()).log(Level.SEVERE, null, ex);
}
}
}

73
java/samples/RulesPECS/build.xml

@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="RulesPECS" default="default" basedir=".">
<description>Builds, tests, and runs the project RulesPECS.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="RulesPECS-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>

0
java/samples/RulesPECS/build/classes/.netbeans_automatic_build

0
java/samples/RulesPECS/build/classes/.netbeans_update_resources

BIN
java/samples/RulesPECS/build/classes/rulespecs/City.class

Binary file not shown.

BIN
java/samples/RulesPECS/build/classes/rulespecs/Country.class

Binary file not shown.

BIN
java/samples/RulesPECS/build/classes/rulespecs/District.class

Binary file not shown.

BIN
java/samples/RulesPECS/build/classes/rulespecs/RulesPECS.class

Binary file not shown.

BIN
java/samples/RulesPECS/build/classes/rulespecs/Street.class

Binary file not shown.

3
java/samples/RulesPECS/manifest.mf

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

1420
java/samples/RulesPECS/nbproject/build-impl.xml

File diff suppressed because it is too large Load Diff

8
java/samples/RulesPECS/nbproject/genfiles.properties

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
build.xml.data.CRC32=f1c33432
build.xml.script.CRC32=9cbcce91
build.xml.stylesheet.CRC32=8064a381@1.80.1.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=f1c33432
nbproject/build-impl.xml.script.CRC32=01d0e4a4
nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48

2
java/samples/RulesPECS/nbproject/private/private.properties

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
compile.on.save=true
user.properties.file=C:\\Users\\denis.LAPTOP-4LI8UQ4O\\AppData\\Roaming\\NetBeans\\8.2\\build.properties

74
java/samples/RulesPECS/nbproject/project.properties

@ -0,0 +1,74 @@ @@ -0,0 +1,74 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# \u0424\u0430\u0439\u043b\u044b \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 build.classes.dir, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0430\u0440\u0445\u0438\u0432\u0430 jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/RulesPECS.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
includes=**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=true
javac.processorpath=\
${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=rulespecs.RulesPECS
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

15
java/samples/RulesPECS/nbproject/project.xml

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>RulesPECS</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>

14
java/samples/RulesPECS/src/rulespecs/City.java

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package rulespecs;
/**
*
* @author denis
*/
public class City extends Country{
}

14
java/samples/RulesPECS/src/rulespecs/Country.java

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package rulespecs;
/**
*
* @author denis
*/
public class Country {
}

17
java/samples/RulesPECS/src/rulespecs/District.java

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package rulespecs;
/**
*
* @author denis
*/
public class District extends City{
public void methods(){
}
}

62
java/samples/RulesPECS/src/rulespecs/RulesPECS.java

@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package rulespecs;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author denis
*/
public class RulesPECS {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
RulesPECS rules = new RulesPECS();
List<Country> countrys = new ArrayList<>();
countrys.add(new Country());
List<City> citys = new ArrayList<>();
citys.add(new City());
List<District> districts = new ArrayList<>();
districts.add(new District());
List<Street> streets = new ArrayList<>();
streets.add(new Street());
rules.producer(countrys);
rules.producer(citys);
rules.producer(districts);
rules.producer(streets);
rules.consumer(countrys);
rules.consumer(citys);
rules.consumer(districts);
rules.consumer(streets);
}
public void producer (List<? extends District> list){
list.add(new Country());
list.add(new City());
list.add(new District());
list.add(new Street());
}
public void consumer (List<? super District> list){
Object district = list.get(0);
if(district instanceof Country) System.out.println("Object is Country");
if(district instanceof City) System.out.println("Object is City");
if(district instanceof District) System.out.println("Object is District");
if(district instanceof Street) System.out.println("Object is Street");
list.add(new Country());
list.add(new City());
list.add(new District());
list.add(new Street());
}
}

14
java/samples/RulesPECS/src/rulespecs/Street.java

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package rulespecs;
/**
*
* @author denis
*/
public class Street extends District{
}
Loading…
Cancel
Save