|
11 | 11 | }; |
12 | 12 | </script> |
13 | 13 | </head> |
14 | | -</html> |
15 | | - |
16 | | -The cufy framework is focused on to be more inheritable and more reflection friendly. Making it |
17 | | -less efficient (minor) but more fun and reliable in big complex projects. |
18 | | - |
19 | | -## Util |
20 | | -Utils and commons that supports reflection. |
21 | | - |
22 | | -- ### Groups |
23 | | - Collections are a base thing on programming. But it is hard to make a collection foreach |
24 | | - category a main collection. So it is easier to make the main collection dived it's content for |
25 | | - us to categories (or subgroups). Unmodifiable group is a group that can't be modified. It is a |
26 | | - good util to hold constant values. |
27 | | - |
28 | | - Simple Example: |
29 | | - |
30 | | - ```java |
31 | | - Group food = new UnmodifibleGroup(Arrays.asList("pizza", "potato", "apple", "orange")); |
32 | | - Group healthy = food.subgroup("healthy", f -> !f.equals("pizza")); |
33 | | - Group h = food.subgroup("healthy"); |
34 | | - |
35 | | - assert healthy == h; |
36 | | - ``` |
37 | | - |
38 | | -- ### Array Util |
39 | | - It has common array utils and nothing new. But the special thing is the reflection support. |
40 | | - It can accept 'object' as arrays. All the methods have '0' version of it. The '0' version accept |
41 | | - object as array parameter. |
42 | | - |
43 | | - Simple example: |
44 | | - |
45 | | - ```java |
46 | | - int[] array = {}; |
47 | | - Object object = array; |
48 | | - List<Integer> arrayAsList = Arrayu.asList(array); |
49 | | - List objectAsList = Arrayu.asList(object); |
50 | | - ``` |
51 | | - |
52 | | -- ### Collectionu: asList(Map) |
53 | | - You may need to treat a map as a list. Maybe you want to save storage. Or maybe you want to |
54 | | - store a list with other values with the same instance. Making a list from a map maybe the |
55 | | - solution. The method will return a list that it's elements are the values that have positive |
56 | | - integer keys on the passed map. Those keys is the indexes of the values associated to them. |
57 | | -
|
58 | | - ```java |
59 | | - List list = Collectionsu.asList(indexedMap); |
60 | | - ``` |
61 | | -
|
62 | | -## Util: Function |
63 | | -Functional interfaces. |
64 | | -
|
65 | | -- ### Throw Lambdas |
66 | | - There is always that position. When you want to pass a simple runnable or consumer to some |
67 | | - method. And that method will invoke it on the same thread. And you don't need to catch |
68 | | - exceptions. Since there is a try-catch covering the calling context. So Throw Lambdas will be |
69 | | - the saver. |
70 | | - |
71 | | - Simple example: |
72 | | - ```java |
73 | | - try { |
74 | | - Runnable runnable = (ThrowRunnable<Exception>) ()-> throwingMethod(); |
75 | | - } catch (Exception e) { |
76 | | - } |
77 | | - ``` |
78 | | - |
79 | | -## Lang |
80 | | -Base concepts with powerful features. |
81 | | - |
82 | | -## Meta |
83 | | -Support for runtime annotations that the program is depending on for it's computations. |
84 | | -
|
85 | | -## Convert |
86 | | -Converting objects to different types. |
87 | | -
|
88 | | -## Text |
89 | | -Abstracts for formatting, parsing and classifying text. |
90 | | -
|
91 | | -## Text: JSON |
92 | | -So advanced JSON formatter, parser and classifier. |
93 | | -- Uses readers and writers (buffered) |
94 | | -- Completely inheritable and easy to do (syntax and algorithm) |
95 | | -- Supports comments |
96 | | -- Supports recursion |
97 | | -- Can parse to an existing container (List or Map) and it deep override them |
98 | | -- Can specify the type of the input or output using Clazzes |
99 | | -
|
100 | | -- ### To parse a json-text: |
101 | | - |
102 | | - ```java |
103 | | - Object outputObject = JSNO.parse(inputString); |
104 | | - ``` |
105 | | - |
106 | | -- ### To format an object to a json-text: |
107 | | - |
108 | | - ```java |
109 | | - String outputString = JSON.format(inputObject); |
110 | | - ``` |
111 | | - |
112 | | -- ### To use more parsing specifications: |
113 | | - |
114 | | - ```java |
115 | | - JSON.global.parse(inputReader, outputObject, inputClazz, outputClazz); |
116 | | - ``` |
117 | | -- ### Or if you want auto-classify the input: |
118 | | - |
119 | | - ```java |
120 | | - JSON.global.cparse(inputReader, outputObject, outputClazz); |
121 | | - ``` |
122 | | - |
123 | | -- ### To use more formatting specifications: |
124 | | - |
125 | | - ```java |
126 | | - JSON.global.format(inputObject, outputObject, inputClazz, outputClazz); |
127 | | - ``` |
128 | | -
|
129 | | -## Beans |
130 | | -A bean is a map that it's fields is the properties of it. |
131 | | -- Compatible anywhere. Since it is a map. |
132 | | -- Any object can be a bean. Just with annotations. |
133 | | -- Interface based. Any class can implement. |
134 | | -- fields tris to convert the value before storing it. |
135 | | - |
136 | | -- ### A simple bean example: |
137 | | - |
138 | | - ```java |
139 | | - class ExBean extends Bean { |
140 | | - @Property |
141 | | - int ex_property; |
142 | | - } |
143 | | - ``` |
144 | | - |
145 | | -- ### A bean for a non-bean instance (fields should be annotated): |
146 | | - |
147 | | - ```java |
148 | | - Bean.forInstance(theInstance); |
149 | | - ``` |
150 | | - |
151 | | -- ### You can override the key (default is a string of field's name) and the type of the property. |
152 | | - |
153 | | - ```java |
154 | | - @Property(key = @MetaObject("newKey"), type = @MetaClazz(Integer.class)) |
155 | | - int ex_property; |
156 | | - ``` |
157 | | -
|
158 | | -## Concurrent |
159 | | -Utils to deal with concurrent actions and infinite loops. All utils depends on the logic rather |
160 | | -than the timing |
161 | | -
|
162 | | -## IO |
163 | | -Utils to deal with Input/Output ports. Like dealing with files or dealing with internet. |
164 | | -
|
165 | | -## IO: Loadable |
166 | | -Objects that can be loaded and saved. |
| 14 | +</html> |
0 commit comments