diff --git a/CHANGELOG.md b/CHANGELOG.md
index 77cd422c..2d2554f4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,222 @@
# OSGL Tool Change Log
+1.26.3
+* Lang.fieldsOf returned list is not threadsafe #245
+* Support loading UTF-8 encoded properties file before Java 9 #244
+
+1.26.2 - 01/Jan/2021
+* Improve XML to JSON convert logic #243
+
+1.26.1 - 26/Dec/2020
+* Drop `javax.xml.bind` dependency #242
+* OS util cannot detect `Mac OS X` #241
+
+1.26.0 - 21/Dec/2020
+* XML to JSON conversion - convert attributes #240
+
+1.25.2 - 18/Aug/2020
+* Update fastjson to 1.2.73
+
+1.25.1 - 12/Jul/2020
+* Img.resize(...).to() method can't be accessed #239
+
+1.25.0 - 27/Jun/2020
+* Support java9 and above #238
+* N.eq's bug #237
+* Add Lang.not(Map)
+* Improve LFUCache - decr/incr operations now increase access count by one; added unit tests
+* BigLines - Improve performance on sequential access #235
+
+1.24.0 - 02/Mar/2020
+* `UserAgent` - use LFU cache to replace hash map #234
+* Crypto - add RSA encrypt/decrypt method #233
+* Improve storage logic on handling resource not found and access denied exceptions #231
+* UserAgent - support Microsoft Edge #230
+* Add `isExists()` and `isAccessDenied()` methods to `ISObject` interface.
+* Add `org.osgl.exceptions.AccessDeniedException`
+* Add `org.osgl.exceptions.ResourceNotFoundException`
+* Add `S.acronym(CharSequence)` static method.
+
+1.23.0 - 02/Jan/2020
+* Add `S.pluralize(String)` and `S.singularize(String)` method #229
+* add pseudo type msa=application/x-ms-application - support IE
+* ResultSetDataConverter enhancement #227
+* XML to JSON converter - it failed on very big number #226
+* XML to JSON converter - handle `[CDATA` #225
+* Convert framework - convert from Date to javax.sql.Timestamp returns Date #224
+
+1.22.1 - 23/Nov/2019
+* BigLines - improve iterator performance #223
+
+1.22.0 - 23/Nov/2019
+* MimeType enhancements #221
+ - use String.intern() to set fileExtension and type
+ - add `createAlias` to support pseudo mimetype
+* Lang - allow `invokeMethod` to invoke on non public methods #222
+* Add ResultSet converters #220
+
+1.21.0 - 3/Nov/2019
+* Add peusdo mime type for qrcode and barcode
+* ISObject - add isBinary method #219
+* Add Lang.sleep(long) method #218
+* CacheService - add state() method #217
+* N.requireXxx - add overload methods to allow customized error message
+* S.requireXxx - add overload methods to allow customized error message
+* Lang.requireNull - add overload methods to allow customized error message
+* Update fastjson to 1.2.62
+* MimeType - add support to rfc7807 types #216
+* MimeType - add support to yaml type #215
+
+1.20.2
+* IO - read from InputStream return value check logic error #214
+
+1.20.1 - 15/Sep/2019
+* TypeReference - provide helper method to generate type for container and map #212
+* DataMapper - it shall copy reference for transient fields #211
+
+1.20.0 - 21/Jul/2019
+* Keyword - add acronym method #210
+* Lang.cloneOf(Cloneable) failed #209
+* DataMapping - filter failure with nested structure #208
+
+1.19.4 - 16/Jun/2019
+* Add `N.Comparator` enum #207
+* MimeType - trait test failed for `text/plain` against text trait #206
+* MimeType - add traits for `doc`, `docx`, `ppt` and `pptx` #205
+* Lang.bool - support eval Map typed instance #204
+
+1.19.3 20/May/2019
+* Make nested classes in `SObject` be public to avoid class loading issue in ActFramework
+
+1.19.2 19/Apr/2019
+* Data mapping - Error merge into AdaptiveRecord #181
+* Bean copy - missing map inner structure when filter applied #202
+* Add `ToBeImplemented` Exception #201
+* Generics - provide exception free `typeParamImplementations` method #199
+* Make `SObject` constructor be public to workaround https://github.com/actframework/actframework/issues/1082
+
+1.19.1 04/Feb/2019
+* `Generics.buildTypeParamImplLookup` - support nested type params #197
+* `Generics.buildTypeParamImplLookup` fails to on `ParameterizedTypeImpl` #196
+
+1.19.0 23/Dec/2018
+* Keyword improvement #195
+* Add `getReturnType(Method, Class)` method to `Generics` #194
+
+1.18.3 9/Dec/2018
+* Add `isCollectionType` to `Lang` #193
+* Add XML to JSONArray converter #192
+* XML document output - allow configure the root tag #190
+* Data mapper - use `JSONObject` in case target type is not determined. #191
+
+1.18.2 28/Nov/2018
+* Add `Keyword` into `immutable-classes.list` file #185
+
+1.18.1 19/Nov/2018
+* Add `S.padLeadingZero(number, digits)` and `N.powerOfTen(e)` methods #184
+* Generic type info lost when calling `hint(Object)` on `$.convert` #183
+
+1.18.0 30/Oct/2018
+* Add XML utilities #179
+* Add converter between XML Document and JSONObject #178
+* $.map failed to apply filter #177
+* Keyword - fix `HTTPProtocol` style parsing #175
+* Keyword - add support to digits #174
+* Data mapping framework - issue when there are head mapping used in list/array or nested structure #173
+* Provide a mechanism to allow osgl-tool extension libraries to register automatically #172
+* Add `csv` int MimeType.Trait enum #171
+* Add `toLines(int limit)` API to `ReadStage` #170
+* Add `Lang.subarray` methods #169
+* add `Lang.setStaticFieldValue` methods #168
+* `N.require` API completeness #167
+* `$.getProperty` issue with `Map` type object #166
+* `IO.read` stage - support ByteBuffer and byte[] #164
+* Add built-in TypeConverter between ByteBuffer and byte array #163
+* `IO` write API completeness #162
+* Provide `S.urlSafeRandom()` methods #161
+* Bean copy/mapping - it does not process `AdaptiveMap` typed source correctly #160
+* Add `$.Transformer asTransformer()` to `Keyword.Style` #159
+* Converter - support multiple expression for String to Integer/Long conversion #158
+* Add `$.hc()` method #157
+* StringUtils - add new drop functions #156
+* Bean copy - add flat copy semantic #155
+* Provide a mechanism to enable application plug in logic to extend the IO read process #154
+* Create new `MimeType` utility #153
+* `IO.write(CharSequence content, Writer writer)` shall not append line separator at the end of the content #152
+* Convert framework - path exploring issue #151
+* Error on `$.deepCopy` when there are BigDecimal fields #150
+* Bean maping - specific mapping rule shall overwrite keyTransformer setting #149
+* Add `C.Map.flipped()` method #148
+* Bean copy framework: special key mapping not working for Map to Map copy #147
+* New `TypeConverters` for `URL`, `URI` and `File` #146
+* Add `IO.checksum(byte[])` method #145
+* `Lang.newInstance(Class)` - support common interfaces #144
+* `OsglConfig` - allow set `SingletonChecker` #143
+* `$.cloneOf` take consideration of `Clonable` and `Singleton` #142
+* Add `N.randLong(long)` function #141
+* Add `S.F.LOWER_FIRST` function #140
+* Bean copying/mapping framework - transform keys #139
+* Support `AdaptiveMap` in Bean copying/mapping framework #138
+* Add `AdaptiveMap` interface #137
+* Add `BeanInfo` interface #136
+* Optimize $.concat(array) methods #135
+* TypeConverter - add direct long to string converter mapping #134
+* add `NOT_BLANK` to `S.F` namespace #132
+* Add `IO.loadProperties(URL)` method #131
+* Add random utilities to Img for random color generation #130
+* Img - default text vertical alignment issue #129
+* Create a method to pick up random elements in an existing list #128
+* Make `Img.ProcessorStage` support pipeline with a list of processors #127
+* Make `IO` and Conversion framework work with `BufferedImage` #126
+* Improve `Img.randomPixels` effect #125
+* Generalize `Img.WaterMarker` to `Img.TextWriter` #124
+* Add `Noiser` processor #123
+* Fields of `Img.ProcessorStage` shall be in protected scope #122
+
+1.17.0 21/Jun/2018
+* add `IO.write(char[])` method #121
+* add `char[] Crypto.generatePassword(char[])` method #120
+* Add secureRandom methods #119
+* Mapping framework - Special field mapping shall not keep original mapping #118
+
+1.16.0 19/Jun/2018
+* Deprecate `C.set()`, replace it with `C.Set()` #117
+* Add `E.asRuntimeException(Exception)` method #116
+* `$.cloneOf(array)` error #115
+* Add `StringTokenSet` utility #114
+
+1.15.1 14/Jun/2018
+* Add `_CollectStage`, `_MapStage` and `_FilterStage` to `C` #111
+* Add `asList()` method to `C.Sequence` #112
+* Remove `Map C.map(Map)` method #113 (broken change)
+
+1.15.0
+* NPE with `LazySeq` when array contains `null` value #110
+* Use `ThreadLocalRandom.current()` to replace `new Random()` in `N.randXxx()` method #109
+* Add constants for quotes and single quotes in `S` #108
+* Add `collect(String)` to `C.Traversable` #107
+* Bean copy to Map issue #106
+* Bean copy utility shall not create new target component instance if it exists #105
+
+1.14.0 23/May/2018
+* Add string comparison methods to `Keyword` #104
+* Make `S.Buffer` extends `java.io.Writer` #103
+
+1.13.2 20/May/2018
+* Make mapping framework support `C.Range` #92
+
+1.13.1 19/May/2018
+* Move `ISObject`, `IStorageService` and `SObject` file from osgl-storage project to the tool project as `IO` utility refers to these symbols
+
+1.13.0 19/May/2018
+* Add `Lang.resetArray(x)` utils #101
+* Mapping framework - Add MERGE_MAPPING semantic #100
+* Allow it to inject flexible logic to decide whether a class is immutable #99
+* Mapping framework - improve filter spec handling #98
+* Mapping framework: allow map between different names #97
+* Mapping framework: copy from a container to another container should always be allowed #94
+* Support internal cache #95
+
1.12.0 13/May/2018
* Allow it to change a mapping stage's semantic #91
* **compatible break change** Make `rootClass` specified in `Lang.fieldsOf()` be exclusive #90
diff --git a/VERSION_MATRIX.md b/VERSION_MATRIX.md
index 5efd2308..f0156aa1 100644
--- a/VERSION_MATRIX.md
+++ b/VERSION_MATRIX.md
@@ -1,13 +1,16 @@
# Version matrix
-| tool | 1.7.x | 1.8.1 | 1.9.0 | 1.10.0 | 1.12.0 |
-| ------------ | -----: | -----: | -----: | ------: | ------: |
-| aaa | 1.3.0 | 1.3.2 | 1.3.3 | 1.3.3 | 1.3.3 |
-| cache | 1.3.0 | 1.3.2 | 1.3.3 | 1.3.3 | 1.3.3 |
-| excel-reader | 1.3.0 | 1.3.2 | 1.3.3 | 1.3.3 | 1.3.3 |
-| genie | 1.6.1 | 1.6.3 | 1.6.4 | 1.7.0 | 1.7.2 |
-| http | 1.4.0 | 1.5.1 | 1.5.2 | 1.5.2 | 1.6.1 |
-| logging | 1.1.0 | 1.1.2 | 1.1.3 | 1.1.3 | 1.1.3 |
-| mvc | 1.5.x | 1.5.3 | 1.6.0 | 1.6.0 | 1.7.0 |
-| storage | 1.5.0 | 1.5.2 | 1.5.3 | 1.5.3 | 1.5.3 |
-| tool-ext | 1.1.0 | 1.1.2 | 1.1.3 | 1.1.3 | 1.1.3 |
+| tool | 1.19.0 | 1.19.1 | 1.19.4 | 1.21.0 | 1.22.1 | 1.23.0 | 1.23.0 | 1.25.0 |
+| ------------ | ------: | ------: | ------: | ------: | ------: | ------: | ------: | ------: |
+| aaa | 1.6.0 | 1.6.0 | 1.7.0 | 1.8.0 | 1.8.0 | 1.8.0 | 1.9.0 | 1.9.1 |
+| cache | 1.6.0 | 1.6.0 | 1.7.0 | 1.8.0 | 1.8.0 | 1.8.0 | 1.8.0 | 1.8.1 |
+| csv | 1.0.0 | 1.0.0 | 1.1.0 | 1.2.0 | 1.2.0 | 1.2.0 | 1.2.0 | 1.2.1 |
+| excel-reader | end | end | end | end | end | end | end | end |
+| excel | 1.5.0 | 1.5.0 | 1.6.0 | 1.8.0 | 1.8.0 | 1.9.0 | 1.10.1 | 1.10.2 |
+| excel-java7 | | | | | | | 1.10.1 | 1.10.2 |
+| genie | 1.9.3 | 1.9.4 | 1.10.0 | 1.12.0 | 1.12.0 | 1.13.0 | 1.13.1 | 1.13.2 |
+| http | 1.9.0 | 1.9.0 | 1.10.0 | 1.11.0 | 1.12.0 | 1.13.0 | 1.13.1 | 1.13.3 |
+| logging | 1.3.0 | 1.3.0 | 1.4.0 | 1.5.0 | 1.5.0 | 1.5.0 | 1.5.0 | 1.5.1 |
+| mvc | 1.9.0 | 1.9.0 | 1.10.0 | 1.11.0 | 1.11.0 | 1.13.0 | 1.13.1 | 1.13.2 |
+| storage | 1.8.0 | 1.8.0 | 1.9.0 | 1.10.0 | 1.10.0 | 1.10.0 | 1.11.0 | 1.11.1 |
+| tool-ext | 1.3.1 | 1.3.1 | 1.4.0 | 1.5.0 | 1.5.0 | 1.5.0 | 1.5.0 | 1.5.1 |
diff --git a/doc/BeanCopy.md b/doc/BeanCopy.md
new file mode 100644
index 00000000..8a4db9c5
--- /dev/null
+++ b/doc/BeanCopy.md
@@ -0,0 +1,238 @@
+# Copy/Map between two structures
+
+OSGL tool provides flexible support to allow developer copy/map between any two data structures.
+
+## 1. API at a glance
+
+```java
+// do shallow copy from `foo` to `bar`
+$.copy(foo).to(bar);
+
+// deep copy from `foo` to `bar
+$.deepCopy(foo).to(bar);
+
+// deep copy using loose name match
+$.deepCopy(foo).looseMatching().to(bar);
+
+// deep copy with filter
+$.deepCopy(foo).filter("-password,-address.streetNo").to(bar);
+
+// deep copy with special name mapping rule
+$.deepCopy(foo)
+ .map("id").to("no")
+ .map("subject").to("title")
+ .to(bar);
+
+// merge data from `foo` to `bar`
+$.merge(foo).to(bar);
+
+// map data from `foo` to `bar`
+$.map(foo).to(bar);
+
+// map data from `foo` to `bar` using strict name match
+$.map(foo).strictMatching().to(bar);
+
+// merge map data from `foo` to `bar`
+$.mergeMap(foo).to(bar);
+```
+
+## 2. Concept
+
+OSGL bean copy framework relies on Java reflection to get internal structure of the source and target bean. Unlike some other bean copy tools, OSGL bean copy framework use field instead of getter/setter methods.
+
+### 2.1 Semantic
+
+OSGL mapping framework support the following five different semantics:
+
+1. `SHALLOW_COPY`, copy the first level fields
+2. `DEEP_COPY`, copy recursively until immutable type reached
+3. `MERGE`, similar to DEEP_COPY, but append elements from source container to target container including array
+4. `MAP`, similar to `DEEP_COPY`, with value type conversion support
+5. `MERGE_MAP`, similar to `MERGE`, with value type conversion support
+
+#### 2.1.1 Immutable type
+
+Immutable type is an important concept. When OSGL detect a source bean property is immutable typed, it will stop dig further down the structure, and copy the reference to the target bean directly.
+
+The following types are considered to be immutable types:
+
+* primitive types
+* wrapper type of primitive types
+* String
+* Enum
+* Any type that has been regisered into `OsglConfig` via `registerImmutableClassNames` API
+* Any type that when applied to the predicate function in `OsglConfig` which is registered via `registerImmutableClassPredicate($.Predicate)` API, cause `true` returned.
+
+### 2.2 Name mapping
+
+OSGL mapping framework support the following three different name mapping rules:
+
+1. Strict matching, require source name be equal to target name
+2. Keyword matching or loose matching, match keyword of two names. For example, the following names are considered to be match to each other
+ * foo_bar
+ * foo-bar
+ * fooBar
+ * FooBar
+ * Foo-Bar
+ * Foo_Bar
+3. Special matching rules can be set for each mapping process to match completely two different names.
+
+Here is an example of using special mapping rules:
+
+```java
+$.deepCopy(foo)
+ .map("id").to("no")
+ .map("subject").to("title")
+ .to(bar);
+```
+
+The above call tells mapping framework to map `id` field in `foo` to `no` field in target `bar`, and map `subject` field in `foo` to `title` field in `bar`.
+
+### 2.3 Filter
+
+Filter can be used to skip copying/mapping certain fields. Filter is provided with a list of field names separated by `,`, if a field name is prefixed with `-` it means the field must not be copied/mapped. If the field were prefixed with `+` or without prefix, then it means the field shall be copied/mapped and the fields that are not mentioned shall NOT be copied/mapped. Examples:
+
+* `-email,-password` - do not copy/map email and password fields, all other fields shall be copied/mapped
+* `+email` - copy only email field, all other fields shall not be copied.
+* `-cc.cvv` - do not copy `cvv` field in the instance of `cc` field, all other fields shall be copied
+* `-cc,+cc.cvv` - copy `cvv` field in the instance of `cc` field, all other fields in the `cc` instance shall not be copied, all fields other than `cc` instance shall be copied.
+
+To apply filter use the following API:
+
+```java
+$.deepCopy(foo).filter("-password,-address.streetNo").to(bar);
+```
+
+**Note** filter matches the field names in the target object.
+
+### 2.4 root class
+
+OSGL copy/mapping tool applied on fields instead of Getter/Setter methods. The exploring of fields of a bean is a recursive procedure till it reaches the `Object.class`. However there are cases that it needs to stop the fields exploring journey at a certain parent class. For example, suppose we have defined the following Base class:
+
+```java
+public abstract class ModelBase {
+ public Date _created;
+}
+```
+
+Your other model classes extends from `ModelBase`, and your Dao use the `_created` field to check whether the instance is new (when _created is `null`) or an existing record.
+
+Now you want to copy an existing record int an new record to prepopulate that new record for updates, and in the end you will save the updated copy as an new record. Thus in this case you do not want to copy the `_created` field which is defined in `ModelBase`. Here is how to do it with `rootClass`:
+
+```java
+MyModel copy = $.copy(existing).rootClass(ModelBase.class).to(MyModel.class);
+```
+
+### 2.5 Target generic type
+
+If you want to map from a container to another container with different element type, you need to provide the `targetGenericType` parameter to make it work:
+
+```java
+List fooList = C.list(new Foo(), new Foo());
+List barList = C.newList();
+$.map(fooList).targetGenericType(new TypeReference>(){}).to(barList);
+```
+
+### 2.6 Type convert
+
+If you need to map from a type to a different type field in the target bean, OSGL allows you to specify a type converter, for example, suppose you have a source bean defined as:
+
+```java
+public class RawData {
+ Calendar date;
+ public RawData(long currentTimeMillis) {
+ date = Calendar.getInstance();
+ date.setTimeInMillis(currentTimeMillis);
+ }
+}
+```
+
+And your target type is:
+
+```java
+public static class ConvertedData {
+ DateTime date;
+}
+```
+
+If you want to map from `RawData` to `ConvertedData`, you need a type converter to help convert `Calendar date` in `RawData` to `DateTime date` in `ConvertedData`:
+
+```
+public static Lang.TypeConverter converter = new Lang.TypeConverter() {
+ @Override
+ public DateTime convert(Calendar calendar) {
+ return new DateTime(calendar.getTimeInMillis());
+ }
+};
+```
+
+Now you can use the following API to specify the converter defined:
+
+```
+@Test
+public void testWithTypeConverter() {
+ RawData src = new RawData($.ms());
+ ConvertedData tgt = $.map(src).withConverter(converter).to(ConvertedData.class);
+ eq(tgt.date.getMillis(), src.date.getTimeInMillis());
+}
+```
+
+**Note**
+
+1. you probably don't need to define too many type converters for common types as most of them has already been defined and registered in OSGL. See Converter document (TBD).
+
+2. type converter only applied on MAP and MERGE_MAP semantic. For SHALLOW_COPY, DEEP_COPY and MERGE, converter will not be used.
+
+#### 2.6.1 Convert hint
+
+There are some case that your type convert relies on certain configuration. For example you want to convert a String to a Date, you need to provide the date format string as a convert hint; Another case is you convert a string to int, you can provide a convert int as the radix.
+
+The source type:
+
+```java
+public static class RawDataV2 {
+ String date;
+ public RawDataV2(String date) {
+ this.date = date;
+ }
+}
+```
+
+The target type:
+
+```java
+public static class ConvertedDataV2 {
+ Date date;
+}
+```
+
+As shown above, we need to map String typed date in source to Date typed date in target, so in the following code we provide the date format string as the hint:
+
+```java
+RawDataV2 src = new RawDataV2("20180518");
+ConvertedDataV2 tgt = $.map(src).conversionHint(Date.class, "yyyyMMdd").to(ConvertedDataV2.class);
+```
+
+It's worth note that the hint `"yyyyMMdd"` is provided along with a type `Date.class`, this tells OSGL to use the hint when the convert target is of `Date.class` type.
+
+### 2.7 Instance Factory
+
+During the copy/mapping process it might need to create an new instance of a certain type, by default OSGL relies on `Lang.newInstance(Class)` call to create the new instance. In certain environment it might have the need to inject other instance create logic, for example when app running in ActFramework might want to delegate the instance creation to `Act.getInstance(Class)` call. OSGL allows it to
+
+1. replace global instance factory
+2. specify instance factory for one copy/mapping operation
+
+#### 2.7.1 Register a global instance factory
+
+Sample code of registering a global instance factory:
+
+```java
+OsglConfig.registerGlobalInstanceFactory(new $.Function() {
+ final App app = Act.app();
+ @Override
+ public Object apply(Class aClass) throws NotAppliedException, $.Break {
+ return app.getInstance(aClass);
+ }
+});
+```
+
diff --git a/doc/benchmark.xlsx b/doc/benchmark.xlsx
new file mode 100644
index 00000000..ae7bb39c
Binary files /dev/null and b/doc/benchmark.xlsx differ
diff --git a/pom.xml b/pom.xml
index 9397c25d..5373091c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
osgl-tool
jar
- 1.12.1-SNAPSHOT
+ 1.30.1-SNAPSHOT
Java Tool
A simple Java toolkit
@@ -30,15 +30,23 @@
org.osgl
parent
- 1.0.0-BETA-1
+ 1.0.0-BETA-11
git@github.com:osglworks/java-tool.git
+ 1
1.11
1.8.3
- 1.2.47
- 1.5.2
+ 1.0.4
+ 5.5.1
+ 1.5.2
+ 3.7
+ 1.1.0
+ 5.5.4
+ 1.2.83
+ 1.10.0
+ 1.0.0.Final
0.7.2
@@ -49,6 +57,39 @@
+
+ org.actframework
+ act
+ 1.8.19
+ test
+
+
+ org.rythmengine
+ rythm-engine
+
+
+ junit
+ junit
+
+
+
+
+ org.osgl
+ genie
+ ${genie.version}
+ test
+
+
+ junit
+ junit
+
+
+
+
+ javax.inject
+ javax.inject
+ ${inject.version}
+
commons-codec
commons-codec
@@ -62,15 +103,45 @@
test
- joda-time
- joda-time
- 2.9.9
+ com.baidu.unbiz
+ easy-mapper
+ ${easy-mapper.version}
test
- org.osgl
- osgl-ut
- 2.0.0-BETA-1
+ net.sf.dozer
+ dozer
+ ${dozer.version}
+ test
+
+
+ org.modelmapper
+ modelmapper
+ ${model-mapper.version}
+ test
+
+
+ cn.hutool
+ hutool-core
+ ${hutool.version}
+ test
+
+
+ ma.glasnost.orika
+ orika-core
+ ${orika.version}
+ test
+
+
+ org.apache.commons
+ commons-lang3
+ ${commons-lang3.version}
+ test
+
+
+ joda-time
+ joda-time
+ 2.9.9
test
@@ -85,16 +156,10 @@
${fastjson.version}
- org.osgl
- osgl-storage
- ${osgl-storage.version}
+ org.hibernate.javax.persistence
+ hibernate-jpa-2.1-api
+ ${jpa.version}
provided
-
-
- org.osgl
- osgl-tool
-
-
diff --git a/src/main/java/org/osgl/Lang.java b/src/main/java/org/osgl/Lang.java
index 1bd751c7..999962c0 100644
--- a/src/main/java/org/osgl/Lang.java
+++ b/src/main/java/org/osgl/Lang.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,27 +23,31 @@
import static org.osgl.util.DataMapper.MappingRule.KEYWORD_MATCHING;
import static org.osgl.util.DataMapper.MappingRule.STRICT_MATCHING;
import static org.osgl.util.DataMapper.Semantic.*;
+import static org.osgl.util.XML.HINT_PRETTY;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.*;
import org.osgl.cache.CacheService;
import org.osgl.concurrent.ContextLocal;
import org.osgl.exception.*;
import org.osgl.util.*;
-import org.osgl.util.converter.TypeConverterRegistry;
+import org.osgl.util.TypeReference;
+import org.osgl.util.converter.*;
+import org.w3c.dom.Document;
import osgl.version.Version;
+import java.awt.image.BufferedImage;
import java.io.*;
import java.lang.annotation.Annotation;
import java.lang.reflect.*;
import java.math.BigDecimal;
import java.math.BigInteger;
+import java.net.*;
+import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
+import java.security.SecureRandom;
+import java.sql.ResultSet;
+import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
@@ -144,7 +148,8 @@ public static abstract class FuncBase {
* })
*
*
- * @param payload the object passed through the Break
+ * @param payload
+ * the object passed through the Break
* @return a {@link Break} instance
*/
protected final Break breakOut(Object payload) {
@@ -156,7 +161,8 @@ protected final Break breakOut(Object payload) {
/**
* Define a function that apply to no parameter (strictly this is not a function)
*
- * @param the generic type of the return value, could be Void
+ * @param
+ * the generic type of the return value, could be Void
* @see Function
* @see Func2
* @see Func3
@@ -170,8 +176,10 @@ public interface Func0 {
* user application to implement main logic of applying the function
*
* @return the Result instance of type R after appplying the function
- * @throws NotAppliedException if the function doesn't apply to the current context
- * @throws Break to short cut collecting operations (fold/reduce) on an {@link org.osgl.util.C.Traversable container}
+ * @throws NotAppliedException
+ * if the function doesn't apply to the current context
+ * @throws Break
+ * to short cut collecting operations (fold/reduce) on an {@link org.osgl.util.C.Traversable container}
*/
R apply() throws NotAppliedException, Break;
}
@@ -189,7 +197,8 @@ public static abstract class F0 extends FuncBase implements Func0 {
* Applies fallback function where this partial function is not defined, i.e. any
* {@link java.lang.RuntimeException} is captured
*
- * @param fallback if {@link RuntimeException} captured then apply this fallback function
+ * @param fallback
+ * if {@link RuntimeException} captured then apply this fallback function
* @return the result of this function or the fallback function application
*/
public R applyOrElse(F0 extends R> fallback) {
@@ -206,17 +215,20 @@ public R applyOrElse(F0 extends R> fallback) {
* function throws an exception, it is relayed to the caller of the composed
* function.
*
- * @param after the function applies after this function is applied
- * @param the type of the output of the {@code before} function
+ * @param after
+ * the function applies after this function is applied
+ * @param
+ * the type of the output of the {@code before} function
* @return the composed function
- * @throws NullPointerException if {@code before} is null
+ * @throws NullPointerException
+ * if {@code before} is null
*/
- public F0 andThen(final Function super R, ? extends T> after) {
+ public Producer andThen(final Function super R, ? extends T> after) {
E.NPE(after);
final F0 me = this;
- return new F0() {
+ return new Producer() {
@Override
- public T apply() {
+ public T produce() {
return after.apply(me.apply());
}
};
@@ -230,7 +242,8 @@ public T apply() {
* When apply the composed function, the result of the last function
* is returned
*
- * @param fs a sequence of function to be applied after this function
+ * @param fs
+ * a sequence of function to be applied after this function
* @return a composed function
*/
public F0 andThen(final Func0 extends R>... fs) {
@@ -255,7 +268,8 @@ public R apply() {
* a {@link java.lang.RuntimeException} is captured apply to the fallback function specified. This
* method helps to implement partial function
*
- * @param fallback the function to applied if this function doesn't apply in the current situation
+ * @param fallback
+ * the function to applied if this function doesn't apply in the current situation
* @return the final result
*/
public F0 orElse(final Func0 extends R> fallback) {
@@ -296,7 +310,8 @@ public Option apply() {
/**
* The class adapt traditional Factory to Function
*
- * @param the type of the instance been created by the factory
+ * @param
+ * the type of the instance been created by the factory
*/
public static abstract class Factory extends F0 {
@@ -347,7 +362,8 @@ public Object apply() throws NotAppliedException, Break {
/**
* Return a dumb function for {@link Func0}. This is the type-safe version of {@link #F0}
*
- * @param a generic type that matches whatever type required by the context of applying the function
+ * @param
+ * a generic type that matches whatever type required by the context of applying the function
* @return A dumb function that always return {@code null}
* @since 0.2
*/
@@ -359,8 +375,10 @@ public static F0 f0() {
/**
* Convert a general {@link Func0} typed function to {@link F0} type
*
- * @param f0 a function of type {@link Func0} that returns type R value
- * @param the generic type of the return value when applying function f0
+ * @param f0
+ * a function of type {@link Func0} that returns type R value
+ * @param
+ * the generic type of the return value when applying function f0
* @return a {@link F0} type that is equaivlent to function f0
* @since 0.2
*/
@@ -382,8 +400,10 @@ public R apply() {
* Define a function structure that accept one parameter. This interface is created to make it
* easily migrate to Java 8 in the future
*
- * @param the type of input parameter
- * @param the type of the return value when this function applied to the parameter(s)
+ * @param
+ * the type of input parameter
+ * @param
+ * the type of the return value when this function applied to the parameter(s)
* @see Func0
* @see Function
* @see Func2
@@ -401,10 +421,13 @@ public interface Function {
* {@link NotAppliedException} if the function is not defined for
* the given parameter(s)
*
- * @param t the argument
+ * @param t
+ * the argument
* @return {@code U} type result
- * @throws NotAppliedException if the function doesn't apply to the parameter(s)
- * @throws Break to short cut collecting operations (fold/reduce) on an {@link org.osgl.util.C.Traversable container}
+ * @throws NotAppliedException
+ * if the function doesn't apply to the parameter(s)
+ * @throws Break
+ * to short cut collecting operations (fold/reduce) on an {@link org.osgl.util.C.Traversable container}
*/
U apply(T t) throws NotAppliedException, Break;
@@ -413,8 +436,10 @@ public interface Function {
/**
* Alias of {@link Function}
*
- * @param the argument type
- * @param the return value type
+ * @param
+ * the argument type
+ * @param
+ * the return value type
* @since 0.2
*/
public interface Func1 extends Function {
@@ -423,8 +448,10 @@ public interface Func1 extends Function {
/**
* A {@link Function} function that support {@link #times(int)} operation
*
- * @param the type of parameter the function applied to
- * @param the type of return value of the function
+ * @param
+ * the type of parameter the function applied to
+ * @param
+ * the type of return value of the function
*/
public interface MultiplicableFunction extends Function {
/**
@@ -432,7 +459,8 @@ public interface MultiplicableFunction extends Function {
* returned applied to a param, the effect is the same as apply this function
* {@code n} times to the same param
*
- * @param n specify the times factor
+ * @param n
+ * specify the times factor
* @return the new function
*/
MultiplicableFunction times(int n);
@@ -443,8 +471,10 @@ public interface MultiplicableFunction extends Function {
* {@code Bijection} (mapping from {@code X} to {@code Y} is a special {@link Function} that has an
* inverse function by itself also a {@code Bijection} mapping from {@code Y} to {@code X}
*
- * @param the type of parameter
- * @param the type of return value
+ * @param
+ * the type of parameter
+ * @param
+ * the type of return value
*/
public interface Bijection extends Function {
/**
@@ -492,8 +522,10 @@ public R apply(P1 p1) throws NotAppliedException, Break {
* Applies this partial function to the given argument when it is contained in the function domain.
* Applies fallback function where this partial function is not defined.
*
- * @param p1 the argument this function to be applied
- * @param fallback the function to be applied to the argument p1 when this function failed with any runtime exception
+ * @param p1
+ * the argument this function to be applied
+ * @param fallback
+ * the function to be applied to the argument p1 when this function failed with any runtime exception
* @return the result of this function or the fallback function application
*/
public R applyOrElse(P1 p1, F1 super P1, ? extends R> fallback) {
@@ -520,10 +552,13 @@ public R apply() {
* function throws an exception, it is relayed to the caller of the composed
* function.
*
- * @param the type of return value of the new composed function
- * @param after the function applies after this function is applied
+ * @param
+ * the type of return value of the new composed function
+ * @param after
+ * the function applies after this function is applied
* @return the composed function
- * @throws NullPointerException if @{code after} is null
+ * @throws NullPointerException
+ * if @{code after} is null
*/
public F1 andThen(final Function super R, ? extends T> after) {
E.NPE(after);
@@ -544,7 +579,8 @@ public T apply(P1 p1) {
* When apply the composed function, the result of the last function
* is returned
*
- * @param afters a sequence of function to be applied after this function
+ * @param afters
+ * a sequence of function to be applied after this function
* @return a composed function
*/
public F1 andThen(final Function super P1, ? extends R>... afters) {
@@ -569,7 +605,8 @@ public R apply(P1 p1) {
* a {@link NotAppliedException} is captured apply to the fallback function specified. This
* method helps to implement partial function
*
- * @param fallback the function to applied if this function doesn't apply to the parameter(s)
+ * @param fallback
+ * the function to applied if this function doesn't apply to the parameter(s)
* @return the composed function
*/
public F1 orElse(final Function super P1, ? extends R> fallback) {
@@ -590,7 +627,8 @@ public R apply(P1 p1) {
* Returns an {@code F0<R>>} function by composing the specified {@code Func0<P1>} function
* with this function applied last
*
- * @param before the function to be applied first when applying the return function
+ * @param before
+ * the function to be applied first when applying the return function
* @return an new function such that f() == apply(f0())
*/
public F0 compose(final Func0 extends P1> before) {
@@ -607,8 +645,10 @@ public R apply() {
* Returns an {@code F1<X1, R>>} function by composing the specified
* {@code Function<X1, P1>} function with this function applied last
*
- * @param before the function to be applied first when applying the return function
- * @param type of argument takes by the {@code before} function
+ * @param before
+ * the function to be applied first when applying the return function
+ * @param
+ * type of argument takes by the {@code before} function
* @return an new function such that f(a) == apply(f1(a))
*/
public F1
@@ -626,9 +666,12 @@ public R apply(X1 x1) {
* Returns an {@code F2<X1, X2, R>>} function by composing the specified
* {@code Func2<X1, X2, P1>} function with this function applied last
*
- * @param the type of first param the new function applied to
- * @param the type of second param the new function applied to
- * @param before the function to be applied first when applying the return function
+ * @param
+ * the type of first param the new function applied to
+ * @param
+ * the type of second param the new function applied to
+ * @param before
+ * the function to be applied first when applying the return function
* @return an new function such that f(x1, x2) == apply(f1(x1, x2))
*/
public F2
@@ -647,10 +690,14 @@ public R apply(X1 x1, X2 x2) {
* Returns an {@code F3<X1, X2, X3, R>>} function by composing the specified
* {@code Func3<X1, X2, X3, P1>} function with this function applied last
*
- * @param the type of first param the new function applied to
- * @param the type of second param the new function applied to
- * @param the type of third param the new function applied to
- * @param before the function to be applied first when applying the return function
+ * @param
+ * the type of first param the new function applied to
+ * @param
+ * the type of second param the new function applied to
+ * @param
+ * the type of third param the new function applied to
+ * @param before
+ * the function to be applied first when applying the return function
* @return an new function such that f(x1, x2, x3) == apply(f1(x1, x2, x3))
*/
public F3
@@ -668,11 +715,16 @@ public R apply(X1 x1, X2 x2, X3 x3) {
* Returns an {@code F3<X1, X2, X3, X4, R>>} function by composing the specified
* {@code Func3<X1, X2, X3, X4, P1>} function with this function applied last
*
- * @param the type of first param the new function applied to
- * @param the type of second param the new function applied to
- * @param the type of third param the new function applied to
- * @param the type of fourth param the new function applied to
- * @param before the function to be applied first when applying the return function
+ * @param
+ * the type of first param the new function applied to
+ * @param
+ * the type of second param the new function applied to
+ * @param
+ * the type of third param the new function applied to
+ * @param
+ * the type of fourth param the new function applied to
+ * @param before
+ * the function to be applied first when applying the return function
* @return an new function such that f(x1, x2, x3, x4) == apply(f1(x1, x2, x3, x4))
*/
public F4
@@ -690,12 +742,18 @@ public R apply(X1 x1, X2 x2, X3 x3, X4 x4) {
* Returns an {@code F3<X1, X2, X3, X4, X5, R>>} function by composing the specified
* {@code Func3<X1, X2, X3, X4, X5, P1>} function with this function applied last
*
- * @param the type of first param the new function applied to
- * @param the type of second param the new function applied to
- * @param the type of third param the new function applied to
- * @param the type of fourth param the new function applied to
- * @param the type of fifth param the new function applied to
- * @param before the function to be applied first when applying the return function
+ * @param
+ * the type of first param the new function applied to
+ * @param
+ * the type of second param the new function applied to
+ * @param
+ * the type of third param the new function applied to
+ * @param
+ * the type of fourth param the new function applied to
+ * @param
+ * the type of fifth param the new function applied to
+ * @param before
+ * the function to be applied first when applying the return function
* @return an new function such that f(x1, x2, x3, x4, x5) == apply(f1(x1, x2, x3, x4, x5))
*/
public F5
@@ -749,8 +807,10 @@ public Object apply(Object o) throws NotAppliedException, Break {
/**
* The type-safe version of {@link #F1}
*
- * @param the argument type
- * @param the return value type
+ * @param
+ * the argument type
+ * @param
+ * the return value type
* @return a dumb function {@link #F1}
* @since 0.2
*/
@@ -764,9 +824,12 @@ public static F1 f1() {
* Convert a general {@link Function} function into a {@link F1} typed
* function
*
- * @param f1 the function that consumes {@code P1} and produce {@code R}
- * @param the argument type
- * @param the return value type
+ * @param f1
+ * the function that consumes {@code P1} and produce {@code R}
+ * @param
+ * the argument type
+ * @param
+ * the return value type
* @return whatever of type {@code R}
* @since 0.2
*/
@@ -822,9 +885,12 @@ public MultiplicableFunction times(int n) {
/**
* Define a function structure that accept two parameter
*
- * @param the type of first parameter this function applied to
- * @param the type of second parameter this function applied to
- * @param the type of the return value when this function applied to the parameter(s)
+ * @param
+ * the type of first parameter this function applied to
+ * @param
+ * the type of second parameter this function applied to
+ * @param
+ * the type of the return value when this function applied to the parameter(s)
* @see Func0
* @see Function
* @see Func3
@@ -841,11 +907,15 @@ public interface Func2 {
* {@link NotAppliedException} if the function is not defined for
* the given parameter(s)
*
- * @param p1 the first argument of type P1
- * @param p2 the second argument of type P2
+ * @param p1
+ * the first argument of type P1
+ * @param p2
+ * the second argument of type P2
* @return the result of type R
- * @throws NotAppliedException if the function doesn't apply to the parameter(s)
- * @throws Break to short cut collecting operations (fold/reduce) on an {@link org.osgl.util.C.Traversable container}
+ * @throws NotAppliedException
+ * if the function doesn't apply to the parameter(s)
+ * @throws Break
+ * to short cut collecting operations (fold/reduce) on an {@link org.osgl.util.C.Traversable container}
*/
R apply(P1 p1, P2 p2) throws NotAppliedException, Break;
@@ -866,9 +936,12 @@ public static abstract class F2
* Applies this partial function to the given argument when it is contained in the function domain.
* Applies fallback function where this partial function is not defined.
*
- * @param p1 the first param with type P1
- * @param p2 the second param with type P2
- * @param fallback the function to be called when an {@link RuntimeException} caught
+ * @param p1
+ * the first param with type P1
+ * @param p2
+ * the second param with type P2
+ * @param fallback
+ * the function to be called when an {@link RuntimeException} caught
* @return the result of this function or the fallback function application
*/
public R applyOrElse(P1 p1, P2 p2, F2 super P1, ? super P2, ? extends R> fallback) {
@@ -905,11 +978,14 @@ public R apply(P1 p1) {
* first to given parameter and then the specified function is applied to the result of
* this function.
*
- * @param f the function takes the R type parameter and return T
- * type result
- * @param the return type of function {@code f}
+ * @param f
+ * the function takes the R type parameter and return T
+ * type result
+ * @param
+ * the return type of function {@code f}
* @return the composed function
- * @throws NullPointerException if f is null
+ * @throws NullPointerException
+ * if f is null
*/
public F2 andThen(final Function super R, ? extends T> f) {
E.NPE(f);
@@ -931,7 +1007,8 @@ public T apply(P1 p1, P2 p2) {
* When apply the composed function, the result of the last function
* is returned
*
- * @param fs a sequence of function to be applied after this function
+ * @param fs
+ * a sequence of function to be applied after this function
* @return a composed function
*/
public F2 andThen(final Func2 super P1, ? super P2, ? extends R>... fs) {
@@ -956,7 +1033,8 @@ public R apply(P1 p1, P2 p2) {
* a {@link NotAppliedException} is captured apply to the fallback function specified. This
* method helps to implement partial function
*
- * @param fallback the function to applied if this function doesn't apply to the parameter(s)
+ * @param fallback
+ * the function to applied if this function doesn't apply to the parameter(s)
* @return the composed function
*/
public F2 orElse(final Func2 super P1, ? super P2, ? extends R> fallback) {
@@ -1013,9 +1091,12 @@ public Object apply(Object o, Object o2) throws NotAppliedException, Break {
/**
* The type-safe version of {@link #F2}
*
- * @param the type of the first param the new function applied to
- * @param the type of the second param the new function applied to
- * @param the type of new function application result
+ * @param
+ * the type of the first param the new function applied to
+ * @param
+ * the type of the second param the new function applied to
+ * @param
+ * the type of new function application result
* @return the dumb function {@link #F2}
* @since 0.2
*/
@@ -1029,10 +1110,14 @@ public static F2 f2() {
* Convert a general {@link Func2} function into a {@link F2} typed
* function
*
- * @param f2 the function that takes two arguments and return type {@code R}
- * @param the type of the first param the new function applied to
- * @param the type of the second param the new function applied to
- * @param the type of new function application result
+ * @param f2
+ * the function that takes two arguments and return type {@code R}
+ * @param
+ * the type of the first param the new function applied to
+ * @param
+ * the type of the second param the new function applied to
+ * @param
+ * the type of new function application result
* @return a {@code F2} instance corresponding to the specified {@code Func2} instance
* @since 0.2
*/
@@ -1054,10 +1139,14 @@ public R apply(P1 p1, P2 p2) {
/**
* Define a function structure that accept three parameter
*
- * @param the type of first parameter this function applied to
- * @param the type of second parameter this function applied to
- * @param the type of thrid parameter this function applied to
- * @param the type of the return value when this function applied to the parameter(s)
+ * @param
+ * the type of first parameter this function applied to
+ * @param
+ * the type of second parameter this function applied to
+ * @param
+ * the type of thrid parameter this function applied to
+ * @param
+ * the type of the return value when this function applied to the parameter(s)
* @see Func0
* @see Function
* @see Func2
@@ -1072,12 +1161,17 @@ public interface Func3 {
* {@link NotAppliedException} if the function is not defined for
* the given parameter(s)
*
- * @param p1 argument 1
- * @param p2 argument 2
- * @param p3 argument 3
+ * @param p1
+ * argument 1
+ * @param p2
+ * argument 2
+ * @param p3
+ * argument 3
* @return the result of function applied
- * @throws NotAppliedException if the function doesn't apply to the parameter(s)
- * @throws Break to short cut collecting operations (fold/reduce) on an {@link org.osgl.util.C.Traversable container}
+ * @throws NotAppliedException
+ * if the function doesn't apply to the parameter(s)
+ * @throws Break
+ * to short cut collecting operations (fold/reduce) on an {@link org.osgl.util.C.Traversable container}
*/
R apply(P1 p1, P2 p2, P3 p3) throws NotAppliedException, Break;
}
@@ -1097,10 +1191,14 @@ public static abstract class F3
* Applies this partial function to the given argument when it is contained in the function domain.
* Applies fallback function where this partial function is not defined.
*
- * @param p1 the first argument
- * @param p2 the second argument
- * @param p3 the third argument
- * @param fallback the function to be called of application of this function failed with any runtime exception
+ * @param p1
+ * the first argument
+ * @param p2
+ * the second argument
+ * @param p3
+ * the third argument
+ * @param fallback
+ * the function to be called of application of this function failed with any runtime exception
* @return the result of this function or the fallback function application
*/
public R applyOrElse(P1 p1, P2 p2, P3 p3, F3 super P1, ? super P2, ? super P3, ? extends R> fallback) {
@@ -1147,11 +1245,14 @@ public R apply(P1 p1, P2 p2) {
* first to given parameter and then the specified function is applied to the result of
* this function.
*
- * @param f the function takes the R type parameter and return T
- * type result
- * @param the return type of function {@code f}
+ * @param f
+ * the function takes the R type parameter and return T
+ * type result
+ * @param
+ * the return type of function {@code f}
* @return the composed function
- * @throws NullPointerException if f is null
+ * @throws NullPointerException
+ * if f is null
*/
public Func3 andThen(final Function super R, ? extends T> f) {
E.NPE(f);
@@ -1173,7 +1274,8 @@ public T apply(P1 p1, P2 p2, P3 p3) {
* When apply the composed function, the result of the last function
* is returned
*
- * @param fs a sequence of function to be applied after this function
+ * @param fs
+ * a sequence of function to be applied after this function
* @return a composed function
*/
public Func3 andThen(
@@ -1201,7 +1303,8 @@ public R apply(P1 p1, P2 p2, P3 p3) {
* a {@link NotAppliedException} is captured apply to the fallback function specified. This
* method helps to implement partial function
*
- * @param fallback the function to applied if this function doesn't apply to the parameter(s)
+ * @param fallback
+ * the function to applied if this function doesn't apply to the parameter(s)
* @return the composed function
*/
public F3 orElse(final Func3 super P1, ? super P2, ? super P3, ? extends R> fallback) {
@@ -1259,10 +1362,14 @@ public Object apply(Object o, Object o2, Object o3) throws NotAppliedException,
/**
* The type-safe version of {@link #F3}
*
- * @param the type of first parameter this function applied to
- * @param the type of second parameter this function applied to
- * @param the type of thrid parameter this function applied to
- * @param the type of the return value when this function applied to the parameter(s)
+ * @param
+ * the type of first parameter this function applied to
+ * @param
+ * the type of second parameter this function applied to
+ * @param
+ * the type of thrid parameter this function applied to
+ * @param
+ * the type of the return value when this function applied to the parameter(s)
* @return the dumb function {@link #F3}
* @since 0.2
*/
@@ -1276,11 +1383,16 @@ public static F3 f3() {
* Convert a general {@link Func3} function into a {@link F3} typed
* function
*
- * @param f3 the general function with three params
- * @param type of argument 1
- * @param type of argument 2
- * @param type of argument 3
- * @param return type
+ * @param f3
+ * the general function with three params
+ * @param
+ * type of argument 1
+ * @param
+ * type of argument 2
+ * @param
+ * type of argument 3
+ * @param
+ * return type
* @return the {@link #F3} typed instance which is equivalent to f3
* @since 0.2
*/
@@ -1302,11 +1414,16 @@ public R apply(P1 p1, P2 p2, P3 p3) {
/**
* Define a function structure that accept four parameter
*
- * @param the type of first parameter this function applied to
- * @param the type of second parameter this function applied to
- * @param the type of thrid parameter this function applied to
- * @param the type of fourth parameter this function applied to
- * @param the type of the return value when this function applied to the parameter(s)
+ * @param
+ * the type of first parameter this function applied to
+ * @param
+ * the type of second parameter this function applied to
+ * @param
+ * the type of thrid parameter this function applied to
+ * @param
+ * the type of fourth parameter this function applied to
+ * @param
+ * the type of the return value when this function applied to the parameter(s)
* @see Func0
* @see Function
* @see Func2
@@ -1321,13 +1438,19 @@ public interface Func4 {
* {@link NotAppliedException} if the function is not defined for
* the given parameter(s)
*
- * @param p1 the first argument
- * @param p2 the second argument
- * @param p3 the third argument
- * @param p4 the fourth argument
+ * @param p1
+ * the first argument
+ * @param p2
+ * the second argument
+ * @param p3
+ * the third argument
+ * @param p4
+ * the fourth argument
* @return whatever value of type {@code R}
- * @throws NotAppliedException if the function doesn't apply to the parameter(s)
- * @throws Break to short cut collecting operations (fold/reduce) on an {@link org.osgl.util.C.Traversable container}
+ * @throws NotAppliedException
+ * if the function doesn't apply to the parameter(s)
+ * @throws Break
+ * to short cut collecting operations (fold/reduce) on an {@link org.osgl.util.C.Traversable container}
*/
R apply(P1 p1, P2 p2, P3 p3, P4 p4) throws NotAppliedException, Break;
@@ -1348,12 +1471,17 @@ public static abstract class F4
* Applies this partial function to the given argument when it is contained in the function domain.
* Applies fallback function where this partial function is not defined.
*
- * @param p1 the first argument
- * @param p2 the second argument
- * @param p3 the third argument
- * @param p4 the fourth argument
- * @param fallback the failover function to be called if application of this function failed with any
- * runtime exception
+ * @param p1
+ * the first argument
+ * @param p2
+ * the second argument
+ * @param p3
+ * the third argument
+ * @param p4
+ * the fourth argument
+ * @param fallback
+ * the failover function to be called if application of this function failed with any
+ * runtime exception
* @return a composite function that apply to this function first and if failed apply to the callback function
*/
public R applyOrElse(P1 p1, P2 p2, P3 p3, P4 p4,
@@ -1412,11 +1540,14 @@ public R apply(P1 p1, P2 p2, P3 p3) {
* first to given parameter and then the specified function is applied to the result of
* this function.
*
- * @param f the function takes the R type parameter and return T
- * type result
- * @param the return type of function {@code f}
+ * @param f
+ * the function takes the R type parameter and return T
+ * type result
+ * @param
+ * the return type of function {@code f}
* @return the composed function
- * @throws NullPointerException if f is null
+ * @throws NullPointerException
+ * if f is null
*/
public F4 andThen(final Function super R, ? extends T> f) {
E.NPE(f);
@@ -1438,7 +1569,8 @@ public T apply(P1 p1, P2 p2, P3 p3, P4 p4) {
* When apply the composed function, the result of the last function
* is returned
*
- * @param fs a sequence of function to be applied after this function
+ * @param fs
+ * a sequence of function to be applied after this function
* @return a composed function
*/
public F4 andThen(
@@ -1466,7 +1598,8 @@ public R apply(P1 p1, P2 p2, P3 p3, P4 p4) {
* a {@link NotAppliedException} is captured apply to the fallback function specified. This
* method helps to implement partial function
*
- * @param fallback the function to applied if this function doesn't apply to the parameter(s)
+ * @param fallback
+ * the function to applied if this function doesn't apply to the parameter(s)
* @return the composed function
*/
public F4 orElse(
@@ -1526,11 +1659,16 @@ public Object apply(Object o, Object o2, Object o3, Object o4) throws NotApplied
/**
* The type-safe version of {@link #F4}
*
- * @param type of first argument
- * @param type of second argument
- * @param type of third argument
- * @param type of fourth argument
- * @param type of return value
+ * @param
+ * type of first argument
+ * @param
+ * type of second argument
+ * @param
+ * type of third argument
+ * @param
+ * type of fourth argument
+ * @param
+ * type of return value
* @return the dumb {@link #F4} function
* @since 0.2
*/
@@ -1544,12 +1682,18 @@ public static F4 f4() {
* Convert a general {@link Func4} function into a {@link F4} typed
* function
*
- * @param f4 the function to be converted
- * @param type of first argument
- * @param type of second argument
- * @param type of third argument
- * @param type of fourth argument
- * @param type of return value
+ * @param f4
+ * the function to be converted
+ * @param
+ * type of first argument
+ * @param
+ * type of second argument
+ * @param
+ * type of third argument
+ * @param
+ * type of fourth argument
+ * @param
+ * type of return value
* @return the function of {@link F4} type that is equivalent to function {@code f4}
* @since 0.2
*/
@@ -1572,12 +1716,18 @@ public R apply(P1 p1, P2 p2, P3 p3, P4 p4) {
/**
* Define a function structure that accept five parameter
*
- * @param the type of first parameter this function applied to
- * @param the type of second parameter this function applied to
- * @param the type of thrid parameter this function applied to
- * @param the type of fourth parameter this function applied to
- * @param the type of fifth parameter this function applied to
- * @param the type of the return value when this function applied to the parameter(s)
+ * @param
+ * the type of first parameter this function applied to
+ * @param
+ * the type of second parameter this function applied to
+ * @param
+ * the type of thrid parameter this function applied to
+ * @param
+ * the type of fourth parameter this function applied to
+ * @param
+ * the type of fifth parameter this function applied to
+ * @param
+ * the type of the return value when this function applied to the parameter(s)
* @see Func0
* @see Function
* @see Func2
@@ -1592,14 +1742,21 @@ public interface Func5 {
* {@link NotAppliedException} if the function is not defined for
* the given parameter(s)
*
- * @param p1 first argument
- * @param p2 second argument
- * @param p3 third argument
- * @param p4 fourth argument
- * @param p5 fifth argument
+ * @param p1
+ * first argument
+ * @param p2
+ * second argument
+ * @param p3
+ * third argument
+ * @param p4
+ * fourth argument
+ * @param p5
+ * fifth argument
* @return whatever with type {@code R}
- * @throws NotAppliedException if the function doesn't apply to the parameter(s)
- * @throws Break to short cut collecting operations (fold/reduce) on an {@link org.osgl.util.C.Traversable container}
+ * @throws NotAppliedException
+ * if the function doesn't apply to the parameter(s)
+ * @throws Break
+ * to short cut collecting operations (fold/reduce) on an {@link org.osgl.util.C.Traversable container}
*/
R apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) throws NotAppliedException, Break;
}
@@ -1619,12 +1776,18 @@ public static abstract class F5
* Applies this partial function to the given argument when it is contained in the function domain.
* Applies fallback function where this partial function is not defined.
*
- * @param p1 the first argument
- * @param p2 the second argument
- * @param p3 the third argument
- * @param p4 the fourth argument
- * @param p5 the fifth argument
- * @param fallback the function to be called if application of this function failed with any runtime exception
+ * @param p1
+ * the first argument
+ * @param p2
+ * the second argument
+ * @param p3
+ * the third argument
+ * @param p4
+ * the fourth argument
+ * @param p5
+ * the fifth argument
+ * @param fallback
+ * the function to be called if application of this function failed with any runtime exception
* @return a composite function apply to this function and then the callback function if this function failed
*/
public R applyOrElse(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5,
@@ -1693,11 +1856,14 @@ public R apply(P1 p1, P2 p2, P3 p3, P4 p4) {
* first to given parameter and then the specified function is applied to the result of
* this function.
*
- * @param f the function takes the R type parameter and return T
- * type result
- * @param the return type of function {@code f}
+ * @param f
+ * the function takes the R type parameter and return T
+ * type result
+ * @param
+ * the return type of function {@code f}
* @return the composed function
- * @throws NullPointerException if f is null
+ * @throws NullPointerException
+ * if f is null
*/
public F5 andThen(final Function super R, ? extends T> f) {
E.NPE(f);
@@ -1719,7 +1885,8 @@ public T apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
* When apply the composed function, the result of the last function
* is returned
*
- * @param fs a sequence of function to be applied after this function
+ * @param fs
+ * a sequence of function to be applied after this function
* @return a composed function
*/
public F5 andThen(
@@ -1747,7 +1914,8 @@ public R apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
* a {@link NotAppliedException} is captured apply to the fallback function specified. This
* method helps to implement partial function
*
- * @param fallback the function to applied if this function doesn't apply to the parameter(s)
+ * @param fallback
+ * the function to applied if this function doesn't apply to the parameter(s)
* @return the composed function
*/
public F5 orElse(
@@ -1807,12 +1975,18 @@ public Object apply(Object o, Object o2, Object o3, Object o4, Object o5) throws
/**
* The type-safe version of {@link #F5}
*
- * @param type of first argument
- * @param type of second argument
- * @param type of third argument
- * @param type of fourth argument
- * @param type of fifth argument
- * @param type of return value
+ * @param
+ * type of first argument
+ * @param
+ * type of second argument
+ * @param
+ * type of third argument
+ * @param
+ * type of fourth argument
+ * @param
+ * type of fifth argument
+ * @param
+ * type of return value
* @return a dumb {@link #F5} function
* @since 0.2
*/
@@ -1826,13 +2000,20 @@ public static F5 f5() {
* Convert a general {@link Func5} function into a {@link F5} typed
* function
*
- * @param f5 the function to be converted
- * @param type of first argument
- * @param type of second argument
- * @param type of third argument
- * @param type of fourth argument
- * @param type of fifth argument
- * @param type of return value
+ * @param f5
+ * the function to be converted
+ * @param
+ * type of first argument
+ * @param
+ * type of second argument
+ * @param
+ * type of third argument
+ * @param
+ * type of fourth argument
+ * @param
+ * type of fifth argument
+ * @param
+ * type of return value
* @return the function of {@link F5} type that is equivalent to function {@code f5}
* @since 0.2
*/
@@ -1857,7 +2038,8 @@ public R apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
/**
* Adapt JDK Comparator (since 1.2) to Functional programming. The class provides several java8 Comparator methods
*
- * @param the type of the element to be compared
+ * @param
+ * the type of the element to be compared
* @since 0.2
*/
public static abstract class Comparator
@@ -1900,9 +2082,12 @@ public int compare(T o1, T o2) {
/**
* See Java 8 doc
*
- * @param keyExtractor The function to extract the key for comparison
- * @param keyComparator The function to compare the extracted key
- * @param the generic type of the key
+ * @param keyExtractor
+ * The function to extract the key for comparison
+ * @param keyComparator
+ * The function to compare the extracted key
+ * @param
+ * the generic type of the key
* @return a function that extract key of type {@code U} from element of type {@code T}
* and run {@code keyComparator} to compare the two keys
* @since 0.2
@@ -1917,8 +2102,10 @@ public > Comparator thenComparing(
/**
* See Java 8 doc
*
- * @param keyExtractor the function that extract key of type U from instance of type T
- * @param the key type
+ * @param keyExtractor
+ * the function that extract key of type U from instance of type T
+ * @param
+ * the key type
* @return a comparator that applied if the result of this comparator is even
*/
public > Comparator thenComparing(
@@ -2004,8 +2191,10 @@ public int hashCode() {
/**
* Adapt a general {@link Func2} function with (T, T, Integer) type into {@link Comparator}
*
- * @param f The function takes two params (the same type) and returns integer
- * @param the type of the parameter
+ * @param f
+ * The function takes two params (the same type) and returns integer
+ * @param
+ * the type of the parameter
* @return a {@link Comparator} instance backed by function {@code f}
*/
@SuppressWarnings("unchecked")
@@ -2025,8 +2214,10 @@ public int compare(T o1, T o2) {
/**
* Adapt a jdk {@link java.util.Comparator} into {@link Comparator osgl Comparator}
*
- * @param the element type the comparator compares
- * @param c the jdk compator
+ * @param
+ * the element type the comparator compares
+ * @param c
+ * the jdk compator
* @return a {@link Comparator} instance backed by comparator {@code c}
*/
@SuppressWarnings("unchecked")
@@ -2072,7 +2263,8 @@ public final Boolean apply(T t) {
/**
* Sub class to implement this method to test on the supplied elements
*
- * @param t the element to be test
+ * @param t
+ * the element to be test
* @return {@code true} or {@code false} depends on the implementation
*/
public abstract boolean test(T t);
@@ -2091,7 +2283,8 @@ public Predicate negate() {
* with AND operation. For any T t to be tested, if any specified predicates
* must returns false on it, the resulting predicate will return false.
*
- * @param predicates the predicate function array
+ * @param predicates
+ * the predicate function array
* @return a function that returns {@code true} only when all functions in {@code predicates} returns
* {@code true} on a given argument
* @since 0.2
@@ -2119,7 +2312,8 @@ public boolean test(T t) {
* with OR operation. For any T t to be tested, if any specified predicates
* must returns true on it, the resulting predicate will return true.
*
- * @param predicates the predicate functions
+ * @param predicates
+ * the predicate functions
* @return a function returns {@code true} if any one of the predicate functions returns
* {@code true} on a given argument
* @since 0.2
@@ -2174,8 +2368,10 @@ public boolean test(T t) {
* If the function specified is already a {@link Predicate}, then
* the function itself is returned
*
- * @param f the function to be converted
- * @param the argument type
+ * @param f
+ * the function to be converted
+ * @param
+ * the argument type
* @return a function of {@link Predicate} type that is equivalent to function {@code f}
* @since 0.2
*/
@@ -2201,8 +2397,10 @@ public boolean test(T t) {
* If the function specified is already a {@link Predicate}, then
* the function itself is returned
*
- * @param f the function
- * @param the argument type
+ * @param f
+ * the function
+ * @param
+ * the argument type
* @return the function of {@link Predicate} type that is equivalent to the function {@code f}
* @since 0.2
*/
@@ -2220,7 +2418,8 @@ public boolean test(T t) {
* Define a processor function which applied to one parameter and return the parameter instance after
* processing on the parameter
*
- * @param the paramete type
+ * @param