You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param type | Class of object to create (may or may not support other implementations of {@link Type}).
554
555
*
555
-
* @return Object of objClass constructed from this scopes independent values using protocol for objClass or null if there was no protocol found in {@link Serializer#PROTOCOL_REGISTRY}!
556
+
* @return Object of type constructed from this scopes independent values using protocol for given class or null if there was no protocol found in {@link Serializer#PROTOCOL_REGISTRY}!
556
557
*
557
558
* @throws Exception | Exception if Exception occurred in {@link SerializationProtocol#unserialize(Class, Object...)}!
558
559
*
559
560
* @since 1.2.5
560
561
*/
561
-
public <T> TtoObject(Class<T> objClass) throwsException
* @param objClass | Object of class to create using protocols.
568
+
* @param type | Class of object to create using protocols (may or may not support other implementations of {@link Type}).
568
569
* @param protocolsToUse | Registry of protocols to use.
569
570
*
570
-
* @return Object of objClass constructed from this scopes independent values using protocol for objClass or null if there was no protocol found in {@link Serializer#PROTOCOL_REGISTRY}!
571
+
* @return Object of class constructed from this scopes independent values using protocol for given class or null if there was no protocol found in protocolsToUse!
571
572
*
572
573
* @throws Exception | Exception if Exception occurred in {@link SerializationProtocol#unserialize(Class, Object...)}!
573
574
*
574
575
* @since 1.3.2
575
576
*/
576
-
public <T> TtoObject(Class<T> objClass, ProtocolRegistryprotocolsToUse) throwsException
577
+
@SuppressWarnings("unchecked")
578
+
public <T> TtoObject(Typetype, ProtocolRegistryprotocolsToUse) throwsException
@@ -588,7 +594,7 @@ public <T> T toObject(Class<T> objClass, ProtocolRegistry protocolsToUse) throws
588
594
/**
589
595
* @param predicate | Predicate object with filter condition in test method!
590
596
*
591
-
* @return Original scope after filtration using inserted predicate! If some object can't be casted to {@link Predicate#test(Object)} argument, it will be treated as invalid and will be filtered away! Sub-scopes are not included!
597
+
* @return Scope after filtration using inserted predicate! If some object can't be casted to {@link Predicate#test(Object)} argument, it will be treated as invalid and will be filtered away! Sub-scopes are not included!
592
598
*
593
599
* @since 1.2.5
594
600
*/
@@ -603,14 +609,14 @@ public GenericScope<KeyT, ValT> filter(Predicate<ValT> predicate)
603
609
* If sub-scope is empty after filtration it will not be included in result!
604
610
* Note: Remember that this will work only when this scope generically allows to store other scopes inside (when ValT is base class of {@link GenericScope})!
605
611
*
606
-
* @return Original scope after filtration using inserted predicate! If some object can't be casted to {@link Predicate#test(Object)} argument, it will be treated as invalid and will be filtered away!
612
+
* @return Scope after filtration using inserted predicate! If some object can't be casted to {@link Predicate#test(Object)} argument, it will be treated as invalid and will be filtered away!
* @param trans | Function to transform objects of this scope!
625
631
*
626
-
* @return Original scope after transformation using inserted function! If some object can't be casted to {@link Function#apply(Object)} argument, it will be treated as invalid and will be filtered away! Sub-scopes are not included!
632
+
* @return Scope after transformation using inserted function! If some object can't be casted to {@link Function#apply(Object)} argument, it will be treated as invalid and will be filtered away! Sub-scopes are not included!
* If sub-scope is empty after transformation it will not be included in result!
639
645
* Note: Remember that this will work only when this scope generically allows to store other scopes inside (when ValT is base class of {@link GenericScope})!
640
646
*
641
-
* @return Original scope after transformation using inserted function! If some object can't be casted to {@link Function#apply(Object)} argument, it will be treated as invalid and will be filtered away!
647
+
* @return Scope after transformation using inserted function! If some object can't be casted to {@link Function#apply(Object)} argument, it will be treated as invalid and will be filtered away!
* @param trans | Function to transform objects of this scope!
690
+
* @param trans | Function to transform independent objects of this scope!
686
691
*
687
692
* @return Original scope after transformation using inserted function! If some object can't be casted to {@link Function#apply(Object)} argument, it will be treated as invalid and will be filtered away!
688
693
*
@@ -694,7 +699,7 @@ public <V> List<V> map(Function<ValT, V> trans)
694
699
}
695
700
696
701
/**
697
-
* @param trans | Function to transform objects of this scope!
702
+
* @param trans | Function to transform independent objects of this scope!
698
703
* @param includeSubScopes | If true transformation will be also applied on sub-scopes, if false sub-scopes will be treated as other things (parsed in to {@link Function#apply(Object)}).
699
704
* If sub-scope is empty after transformation it will not be included in result!
700
705
* Note: Remember that this will work only when this scope generically allows to store other scopes inside (when ValT is base class of {@link GenericScope})!
@@ -706,23 +711,50 @@ public <V> List<V> map(Function<ValT, V> trans)
706
711
@SuppressWarnings("unchecked")
707
712
public <V> List<V> map(Function<ValT, V> trans, booleanincludeSubScopes)
708
713
{
709
-
List<V> fltVals = newArrayList<>();
710
-
for (Objectobj : this)
714
+
// List<V> mapped = new ArrayList<>(size());
715
+
// for (Object obj : this)
716
+
// try
717
+
// {
718
+
// if (obj instanceof GenericScope && includeSubScopes)
* @return The parent scope of this scope or null if this scope has no parent such as default one in file.
892
+
* @return The parent scope of this scope or null if this scope has no parent such as default one in file.<br>
893
+
* Note: This may or may not be always null based on the way this scope was instantiated...
861
894
*
862
895
* @since 1.2.0
863
896
*/
864
897
public <TextendsGenericScope<?, ?>> TgetParent()
865
898
{
866
-
returngetParent(1);
899
+
returngetParent(1);
867
900
}
868
901
869
902
/**
870
903
* @param depth | Positive number representing how many times will this method call itself... <br> For example 0 or less = this, 1 = parent, 2 = parentOfParent (parent.getParent()) and so on...
871
904
* If you want to get the root parent (the one that has no parent), simply put a big number as depth. 99 should be enough!
872
905
*
873
906
* @return The parent scope based on depth or null if this scope has no parent which means its already root (default one in file).
874
-
* If depth was bigger than 1, null will be never returned, last not null parent will be returned instead!<br>
907
+
* If depth was bigger than 1, null will not be returned, last not null parent will be returned instead!<br>
908
+
* Note: This may or may not be always null based on the way this scope was instantiated...
875
909
*
876
910
* @since 1.3.2
877
911
*/
@@ -888,7 +922,7 @@ public boolean isEmpty()
888
922
}
889
923
890
924
/**
891
-
* @return New {@link LinkedHashMap} with variables of this a in defined order! Key is a KeyT of variable and value is its value!<br>
925
+
* @return New {@link LinkedHashMap} with variables of this a in defined order! Key is a KeyT of variable and value is its value!<br>
892
926
* Modifying this map will not affect this GenericScope object!
893
927
*
894
928
* @since 1.2.0
@@ -900,7 +934,8 @@ public boolean isEmpty()
900
934
901
935
/**
902
936
* @return New {@link ArrayList} with independent values of this {@link GenericScope}. These values have nothing to do with values of variables, they are independent!
903
-
* Modifying this list will not affect this GenericScope object!
937
+
* Modifying this list will not affect this GenericScope object!<br>
938
+
* Note: Returning other {@link List} implementations than {@link ArrayList} (or other collection that stores elements in "array-like fashion") may result in serious performance implications! Queues or LinkedLists are the prime examples to avoid!
904
939
*
905
940
* @since 1.2.0
906
941
*/
@@ -1056,7 +1091,7 @@ public static <K, V, S extends GenericScope<K, V>> S intoBidirectional(S scopeTo
0 commit comments