Skip to content

Commit fc2b9d1

Browse files
removing deprecateds
1 parent 69af2e6 commit fc2b9d1

File tree

6 files changed

+2
-439
lines changed

6 files changed

+2
-439
lines changed

SerialX-core/src/main/java/org/ugp/serialx/Serializer.java

Lines changed: 0 additions & 275 deletions
Original file line numberDiff line numberDiff line change
@@ -578,281 +578,6 @@ public <A extends Appendable> A SerializeAsSubscope(A source, char[] wrappingBra
578578
source = (A) SerializeTo(source.append('\n'), args).append('\n').append(multilpy('\t', tabs));
579579
return (A) source.append(wrappingBrackets[1]);
580580
}
581-
582-
/*
583-
* @param file | File with specific format content.
584-
* @param index | Index of value to get from lowest Scope.
585-
*
586-
* @return Value with index in lowest Scope. Similar to Serializer.LoadFrom(file).get(index) however this function is specifically designed to load only that 1 value witch saves alto of performance!
587-
* But target value can't be using any variables declared outside and also can't be variable invocation itself! Also there might be some problems with commented code! Also there can't be no variables in file!
588-
*
589-
* @since 1.2.5
590-
*
591-
@Deprecated
592-
public <T> T LoadFrom(File file, int index)
593-
{
594-
try
595-
{
596-
return LoadFrom(new FileReader(file), index);
597-
}
598-
catch (FileNotFoundException e)
599-
{
600-
e.printStackTrace();
601-
}
602-
return null;
603-
}
604-
605-
/**
606-
* @param str | Any {@link CharSequence} with specific format content.
607-
* @param index | Index of value to get from lowest Scope.
608-
*
609-
* @return Value with index in lowest Scope. Similar to Serializer.LoadFrom(str).get(index) however this function is specifically designed to load only that 1 value witch saves alto of performance!
610-
* But target value can't be using any variables declared outside and also can't be variable invocation itself! Also there might be some problems with commented code!
611-
*
612-
* @since 1.2.5
613-
*
614-
@Deprecated
615-
public <T> T LoadFrom(CharSequence str, int index)
616-
{
617-
return LoadFrom(new StringReader(str.toString()), index);
618-
}
619-
620-
/**
621-
* @param reader | Any {@link Reader} with specific format content.
622-
* @param index | Index of value to get from lowest Scope.
623-
*
624-
* @return Value with index in lowest Scope. Similar to Serializer.LoadFrom(reader).get(index) however this function is specifically designed to load only that 1 value witch saves alto of performance!
625-
* But target value can't be using any variables declared outside and also can't be variable invocation itself!
626-
*
627-
* @since 1.2.5
628-
*
629-
@Deprecated
630-
@SuppressWarnings("unchecked")
631-
public <T> T LoadFrom(Reader reader, int index)
632-
{
633-
StringBuilder sb = new StringBuilder();
634-
int semicolon = 0, brackets = 0, quote = 0, vars = 0, multLineCom = -1;
635-
636-
String line;
637-
try
638-
{
639-
BufferedReader lineReader = new BufferedReader(reader);
640-
while ((line = lineReader.readLine()) != null)
641-
{
642-
if (!contains(line = line.trim(), '=', ':') || !(brackets == 0 && quote % 2 == 0))
643-
for (int i = 0, com = -1, len = line.length(); i < len; i++)
644-
{
645-
char ch = line.charAt(i);
646-
647-
if (ch == '/' && i < len-1 && line.charAt(i+1) == '/')
648-
com++;
649-
else if (multLineCom <= -1 && ch == '"')
650-
quote++;
651-
652-
boolean notInObj = brackets == 0 && quote % 2 == 0;
653-
if (semicolon > index)
654-
{
655-
lineReader.close();
656-
return (T) DataParser.parseObj(DataParser.REGISTRY, sb.toString(), this);
657-
}
658-
659-
if (multLineCom > -1 || com > -1) //Is comment
660-
{
661-
if (multLineCom > 0 && ch == '*' && i < len-1 && line.charAt(++i) == '/')
662-
multLineCom = -1;
663-
}
664-
else if (ch == '/' && i < len-1)
665-
{
666-
char chNext = line.charAt(i+1);
667-
if (chNext == '*')
668-
i += multLineCom = 1;
669-
else
670-
sb.append(ch);
671-
}
672-
/*else if (notInObj && ch == '=')
673-
{
674-
vars++;
675-
}*
676-
else if (notInObj && isOneOf(ch, ';', ','))
677-
{
678-
if (vars > 0)
679-
{
680-
vars = 0;
681-
}
682-
else
683-
semicolon++;
684-
}
685-
else
686-
{
687-
if (ch | ' ') == '{' || ch == '[')
688-
brackets++;
689-
else if (ch == '}' || ch == ']')
690-
{
691-
if (brackets > 0)
692-
brackets--;
693-
else
694-
{
695-
lineReader.close();
696-
throw new IllegalArgumentException("Missing closing bracket in: " + line);
697-
}
698-
}
699-
700-
if (vars == 0 && semicolon == index)
701-
sb.append(ch);
702-
}
703-
}
704-
else
705-
{
706-
char lastCh = line.charAt(line.length()-1);
707-
if (isOneOf(lastCh, '{', '['))
708-
brackets++;
709-
if (isOneOf(lastCh, ';', ','))
710-
vars++;
711-
}
712-
713-
}
714-
}
715-
catch (IOException e)
716-
{
717-
e.printStackTrace();
718-
}
719-
720-
if (brackets > 0)
721-
throw new IllegalArgumentException("Unclosed brackets!");
722-
else if (quote % 2 != 0)
723-
throw new IllegalArgumentException("Unclosed or missing quotes!");
724-
else if (!(line = sb.toString()).isEmpty())
725-
return (T) DataParser.parseObj(DataParser.REGISTRY, line, this);
726-
LogProvider.instance.logErr("Value with index " + index + " is out of bounds!");
727-
return null;
728-
}
729-
730-
/**
731-
* @param file | File with specific format content.
732-
* @param varName | Name of variable to load!
733-
*
734-
* @return Value of variable with varName in lowest Scope. Similar to Serializer.LoadFrom(file).get(varName) however this function is specifically designed to load only that 1 variable witch saves alto of performance!
735-
* But target variable can't be using any variables declared outside! Also there might be some problems with commented code!
736-
*
737-
* @since 1.2.5
738-
*
739-
@Deprecated
740-
public <T> T LoadFrom(File file, String varName)
741-
{
742-
try
743-
{
744-
return LoadFrom(new FileReader(file), varName);
745-
}
746-
catch (FileNotFoundException e)
747-
{
748-
e.printStackTrace();
749-
}
750-
return null;
751-
}
752-
753-
/**
754-
* @param str | Any {@link CharSequence} with specific format content.
755-
* @param varName | Name of variable to load!
756-
*
757-
* @return Value of variable with varName in lowest Scope. Similar to Serializer.LoadFrom(str).get(varName) however this function is specifically designed to load only that 1 variable witch saves alto of performance!
758-
* But target variable can't be using any variables declared outside! Also there might be some problems with commented code!
759-
*
760-
* @since 1.2.5
761-
*
762-
@Deprecated
763-
public <T> T LoadFrom(CharSequence str, String varName)
764-
{
765-
return LoadFrom(new StringReader(str.toString()), varName);
766-
}
767-
768-
/**
769-
* @param reader | Any {@link Reader} with specific format content.
770-
* @param varName | Name of variable to load!
771-
*
772-
* @return Value of variable with varName in lowest Scope. Similar to Serializer.LoadFrom(reader).get(varName) however this function is specifically designed to load only that 1 variable witch saves alto of performance!
773-
* But target variable can't be using any variables declared outside! Also there might be some problems with commented code!
774-
*
775-
* @since 1.2.5
776-
*
777-
@Deprecated
778-
@SuppressWarnings("unchecked")
779-
public <T> T LoadFrom(Reader reader, String varName)
780-
{
781-
StringBuilder sb = new StringBuilder();
782-
int brackets = 0, quote = 0, multLineCom = -1, fromIndex = 0, fromIndexOrig = 0, findIndex = -1;
783-
784-
String line;
785-
try
786-
{
787-
BufferedReader lineReader = new BufferedReader(reader);
788-
while ((line = lineReader.readLine()) != null)
789-
{
790-
if (findIndex <= -1 && multLineCom <= -1 && line.length() > varName.length() && !(line.charAt(0) == '/' && isOneOf(line.charAt(1), '/', '*')) && (findIndex = line.indexOf(varName)) > -1)
791-
{
792-
fromIndexOrig = fromIndex = findIndex;
793-
findIndex+=sb.length();
794-
}
795-
796-
for (int com = -1, len = line.length(); fromIndex < len; fromIndex++)
797-
{
798-
char ch = line.charAt(fromIndex);
799-
800-
if (ch == '/' && fromIndex < len-1 && line.charAt(fromIndex+1) == '/')
801-
com++;
802-
else if (multLineCom <= -1 && ch == '"')
803-
quote++;
804-
805-
if (findIndex > -1 && quote % 2 == 0 && brackets == 0 && isOneOf(ch, ';', ','))
806-
{
807-
lineReader.close();
808-
int start = sb.indexOf("=", findIndex-fromIndexOrig);
809-
if (start <= -1)
810-
start = sb.indexOf(":", findIndex-fromIndexOrig);
811-
return (T) DataParser.parseObj(DataParser.REGISTRY, sb.substring(start+1), this);
812-
}
813-
814-
if (multLineCom > -1 || com > -1) //Is comment
815-
{
816-
if (multLineCom > 0 && ch == '*' && fromIndex < len-1 && line.charAt(++fromIndex) == '/')
817-
multLineCom = -1;
818-
}
819-
else if (ch == '/' && fromIndex < len-1)
820-
{
821-
char chNext = line.charAt(fromIndex+1);
822-
if (chNext == '*')
823-
fromIndex = multLineCom = 1;
824-
else
825-
sb.append(ch);
826-
}
827-
else
828-
{
829-
if (ch | ' ') == '{' || ch == '[')
830-
brackets++;
831-
else if (ch == '}' || ch == ']')
832-
{
833-
if (brackets > 0)
834-
brackets--;
835-
else
836-
{
837-
lineReader.close();
838-
throw new IllegalArgumentException("Missing closing bracket in: " + line);
839-
}
840-
}
841-
842-
sb.append(ch);
843-
}
844-
}
845-
fromIndex = 0;
846-
}
847-
}
848-
catch (IOException e)
849-
{
850-
e.printStackTrace();
851-
}
852-
853-
LogProvider.instance.logErr("Variable " + varName + " was not found!");
854-
return null;
855-
}*/
856581

857582
/**
858583
* @param indexWithStringValue | Index of independent value that should be string.

SerialX-core/src/main/java/org/ugp/serialx/converters/DataConverter.java

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -54,43 +54,6 @@ public static CharSequence objToString(Object obj, Object... args)
5454
return REGISTRY.toString(obj, args);
5555
}
5656

57-
/**
58-
* @deprecated Use {@link ParserRegistry#toString(Object, Object...)}!
59-
*
60-
* @param registry | Registry to use!
61-
* @param obj | Object to convert into string!
62-
* @param args | Additional arguments that will be obtained in {@link DataParser#toString(String, Object...)}!
63-
*
64-
* @return Object converted to string using {@link DataConverter} suitable converter picked from registry!
65-
* {@link DataConverter#toString(Object, Object...)} of all registered converters will be called however only suitable ones should return the result, others should return {@link DataParser#CONTINUE}!
66-
*
67-
* @since 1.3.0
68-
*/
69-
@Deprecated
70-
public static CharSequence objToString(Registry<DataParser> registry, Object obj, Object... args)
71-
{
72-
if (registry instanceof ParserRegistry)
73-
return ((ParserRegistry) registry).toString(obj, args);
74-
return objToString(new ParserRegistry(registry), obj, args);
75-
}
76-
77-
/**
78-
* @deprecated Use {@link ParserRegistry#getConverterFor(Object, Object...)}!
79-
*
80-
* @param registry | Registry to use!
81-
* @param obj | Object to find converter for!
82-
* @param args | Additional arguments that will be obtained in {@link DataParser#toString(String, Object...)}!
83-
*
84-
* @return Converter suitable for converting required obj to string, selected from registry!
85-
*/
86-
@Deprecated
87-
public static DataConverter getConverterFor(Registry<DataParser> registry, Object obj, Object... args)
88-
{
89-
if (registry instanceof ParserRegistry)
90-
return ((ParserRegistry) registry).getConverterFor(obj, args);
91-
return getConverterFor(new ParserRegistry(registry), obj, args);
92-
}
93-
9457
/**
9558
* @return <code>"Object of " + objToDescribe.getClass().getName() + ": \"" + objToDescribe + "\" converted by " + DataParser.class.getName()</code>
9659
*

0 commit comments

Comments
 (0)