Package rsb.util
Class OutputObjectComparer
java.lang.Object
rsb.util.OutputObjectComparer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheckForMatching
(HashMap<String, Object> compareTo) Creates a hashmap of strings and object outputs to then compares to another hashmap of strings and object outputs to determine the differences and returns a list of the strings and objects that differ between the twocheckForMatchingMethodOutputsEx
(HashMap<String, Object> compareTo, Parameters... param) Creates a hashmap of strings and object outputs to then compares to another hashmap of strings and object outputs to determine the differences and returns a hashmap of the strings and objects that differ between the twoboolean
checkForTypeAndNoMatch
(Object firstObject, Object secondObject) Checks the first objects type and then compares it to the second object which should also be the same typestatic String
convertToStringArrayStyle
(ArrayList<?> stringToConvert) Converts the given ArrayList containing strings to a string with the style of a String[] eg String output = "{"item1", "item2", "item3", "item4"}"static String
convertToStringArrayStyle
(List<?> stringToConvert) Converts the given ArrayList containing strings to a string with the style of a String[] eg String output = "{"item1", "item2", "item3", "item4"}"static String
convertToStringArrayStyleEx
(HashMap<String, Object> stringObjectHashMap, Parameters... param) Returns everything in the hashmap as a String[] styled stringgetFieldOutputEx
(Parameters... param) Returns a string of as much field values as the parameters passed for each objectgetFieldOutputEx
(Parameters[] param, Method... method) Returns a string of as much field values as the parameters passed for each object as well as allowing the passing of conditional methods to further sort the resultsgetListOfFieldOutputsEx
(Parameters[] param, Method... conditionals) Gets the output list based on this objects variables and parameters allowing one to add extra information to the key.Returns a hashmap of names and objects of any method with no parameters and respective to the parameters suppliedgetListOfMethodOutputs
(Object objectToInvoke, Class<?> classToCheck, Integer[] modifiersToInclude, String[] returnTypesToInclude, String[] returnTypesToIgnore, String[] namesToIgnore, Integer[] parameterConstraints) Returns a hashmap of names and objects of any method with no parameters and respective to the parameters suppliedgetListOfMethodOutputsEx
(Object objectToInvoke, Integer[] modifiersToInclude, String[] returnTypesToInclude, String[] returnTypesToIgnore, String[] namesToIgnore, Integer[] parameterConstraints, Parameters... param) Returns a hashmap of given parameters for the keys and objects of any method for the values and also respective to the parameters suppliedgetListOfMethodOutputsEx
(Parameters[] param, Method... conditionals) Gets the output list based on this objects variables and parameters allowing one to add extra information to the key.getMethodOuputsEx
(Parameters... param) Returns a string of as much method outputs as the parameters passed for each objectgetMethodOuputsEx
(Parameters[] param, Method... methods) Returns a string of as much method outputs as the parameters passed for each object as well as allowing the passing of conditional methods to further sort the resultsInteger[]
Gets the names of the methods into a readable stringGets the outputs of the methods into a readable stringInteger[]
String[]
String[]
String[]
void
setModifiersToInclude
(Integer[] modifiersToInclude) void
void
setParameterConstraints
(Integer[] parameterConstraints) void
setStringsToIgnoreInName
(String[] stringsToIgnoreInName) void
setTypesToIgnore
(String[] typesToIgnore) void
setTypesToInclude
(String[] typesToInclude) static Object[]
Returns the object as an arrayexample usage: String[] names = new String[]{"rb", "xz", "ux", "pt", "ye"}; for (String name : names) { try { Method method = player.getClass().getMethod(name); Object[] output = OutputObjectComparer.unpack(method.invoke(player)); log.debug("Name: " + name); for (int i = 0; i (less than) output.length; i++) { log.debug("Output:" + (int) output[i]); } log.debug("\n\n"); } catch (Exception e) { } }
-
Constructor Details
-
OutputObjectComparer
public OutputObjectComparer(Object object, Integer[] modifiersToInclude, String[] returnTypesToInclude, String[] returnTypesToIgnore, String[] stringsToIgnoreInName, Integer[] parameterConstraints) Creates an outputobjectcomparer with the given parameters- Parameters:
object
- the object to compare methods ofparameterConstraints
- the numbers of parameters to look for (usually going to just hold zero)modifiersToInclude
- the modifiers of the methods to include when checking the methodsreturnTypesToInclude
- the return types of the methods to include when checking the methodsreturnTypesToIgnore
- the return types of the methods to ignore when checking the methodsstringsToIgnoreInName
- the strings in the names of methods to ignore when checking the methods
-
-
Method Details
-
getListOfMethodOutputsEx
Gets the output list based on this objects variables and parameters allowing one to add extra information to the key. Additionally one may pass a method that performs a conditional statement to allow further sorting of the array.IE one should make a method in the class they are calling this from then use reflection and get the method from that class like so: exampleClass.class.getMethod("conditional1", int.class)
- Parameters:
param
- parameter array to decide what to values to return in the keyconditionals
- the conditional values to use to impact the output- Returns:
- the list of keys and outputs of the object's methods respective to the parameters
-
getListOfFieldOutputsEx
Gets the output list based on this objects variables and parameters allowing one to add extra information to the key. Additionally one may pass a method that performs a conditional statement to allow further sorting of the array.IE one should make a method in the class they are calling this from then use reflection and get the method from that class like so: exampleClass.class.getMethod("conditional1", int.class)
- Parameters:
param
- parameter array to decide what to values to return in the keyconditionals
- the conditional values to use to impact the output- Returns:
- the list of keys and outputs of the object's methods respective to the parameters
-
getListOfMethodOutputsEx
public static HashMap<String,Object> getListOfMethodOutputsEx(Object objectToInvoke, Integer[] modifiersToInclude, String[] returnTypesToInclude, String[] returnTypesToIgnore, String[] namesToIgnore, Integer[] parameterConstraints, Parameters... param) Returns a hashmap of given parameters for the keys and objects of any method for the values and also respective to the parameters supplied- Parameters:
objectToInvoke
- the object to checkparameterConstraints
- an array of parameter counts to allowmodifiersToInclude
- the modifiers of the method to include IE public static final ectreturnTypesToInclude
- the return types to includereturnTypesToIgnore
- the return types to ignorenamesToIgnore
- the names/strings in the names to ignoreparam
- parameter array to decide what to values to return in the key- Returns:
- the list of names and outputs of the object's methods respective to the parameters
-
getListOfMethodOutputs
Returns a hashmap of names and objects of any method with no parameters and respective to the parameters supplied- Returns:
- the list of names and outputs of the object's methods respective to the parameters
-
getListOfMethodOutputs
public static HashMap<String,Object> getListOfMethodOutputs(Object objectToInvoke, Class<?> classToCheck, Integer[] modifiersToInclude, String[] returnTypesToInclude, String[] returnTypesToIgnore, String[] namesToIgnore, Integer[] parameterConstraints) Returns a hashmap of names and objects of any method with no parameters and respective to the parameters supplied- Parameters:
objectToInvoke
- the object to checkclassToCheck
- the class of the object to invoke methods onparameterConstraints
- an array of parameter counts to allowmodifiersToInclude
- the modifiers of the method to include IE public static final ectreturnTypesToInclude
- the return types to includereturnTypesToIgnore
- the return types to ignorenamesToIgnore
- the names/strings in the names to ignore- Returns:
- the list of names and outputs of the object's methods respective to the parameters
-
checkForMatching
Creates a hashmap of strings and object outputs to then compares to another hashmap of strings and object outputs to determine the differences and returns a list of the strings and objects that differ between the two- Parameters:
compareTo
- The second hashmap to compare against for collisions- Returns:
- the names of the outputs that did not match
-
checkForTypeAndNoMatch
Checks the first objects type and then compares it to the second object which should also be the same type- Parameters:
firstObject
- the first object to checksecondObject
- the object to compare to- Returns:
- false unless they match
-
checkForMatchingMethodOutputsEx
public HashMap<String,Object> checkForMatchingMethodOutputsEx(HashMap<String, Object> compareTo, Parameters... param) Creates a hashmap of strings and object outputs to then compares to another hashmap of strings and object outputs to determine the differences and returns a hashmap of the strings and objects that differ between the two- Parameters:
compareTo
- The second hashmap to compare against for collisionsparam
- The parameters to use as a filter on the second hashmap- Returns:
- the names of the outputs that did not match
-
convertToStringArrayStyle
Converts the given ArrayList containing strings to a string with the style of a String[] eg String output = "{"item1", "item2", "item3", "item4"}"- Parameters:
stringToConvert
- ArrayList to convert to a string- Returns:
- A string comprised of the contents of the ArrayList
-
convertToStringArrayStyle
Converts the given ArrayList containing strings to a string with the style of a String[] eg String output = "{"item1", "item2", "item3", "item4"}"- Parameters:
stringToConvert
- List to convert to a string- Returns:
- A string comprised of the contents of the List
-
convertToStringArrayStyleEx
public static String convertToStringArrayStyleEx(HashMap<String, Object> stringObjectHashMap, Parameters... param) Returns everything in the hashmap as a String[] styled string- Parameters:
stringObjectHashMap
- the hashmap to convertparam
- The parameters to use as a filter on the second hashmap- Returns:
- the string containing all the data in the hashmap as a string
-
getMethodOuputsEx
Returns a string of as much method outputs as the parameters passed for each object as well as allowing the passing of conditional methods to further sort the results- Parameters:
param
- the parameter array to decide what to values to return in the keymethods
- the methods to allow further filtering of the method outputs- Returns:
- all the designated output based on the passed parameters for all objects
-
getMethodOuputsEx
Returns a string of as much method outputs as the parameters passed for each object- Parameters:
param
- the parameter array to decide what to values to return in the key- Returns:
- all the designated output based on the passed parameters for all objects
-
getFieldOutputEx
Returns a string of as much field values as the parameters passed for each object- Parameters:
param
- the parameter array to decide what to values to return in the key- Returns:
- all the designated output based on the passed parameters for all objects
-
getFieldOutputEx
Returns a string of as much field values as the parameters passed for each object as well as allowing the passing of conditional methods to further sort the results- Parameters:
param
- the parameter array to decide what to values to return in the keymethod
- the methods to allow further filtering of the method outputs- Returns:
- all the designated output based on the passed parameters for all objects
-
getNamesOfMethods
Gets the names of the methods into a readable string- Returns:
- the names of the objects methods
-
getObjectsOfMethods
Gets the outputs of the methods into a readable string- Returns:
- the outputs of the objects methods
-
unpack
Returns the object as an arrayexample usage: String[] names = new String[]{"rb", "xz", "ux", "pt", "ye"}; for (String name : names) { try { Method method = player.getClass().getMethod(name); Object[] output = OutputObjectComparer.unpack(method.invoke(player)); log.debug("Name: " + name); for (int i = 0; i (less than) output.length; i++) { log.debug("Output:" + (int) output[i]); } log.debug("\n\n"); } catch (Exception e) { } }
- Parameters:
object
- the object to convert- Returns:
- the object as an array
-
getStringsToIgnoreInName
-
setStringsToIgnoreInName
-
getTypesToIgnore
-
setTypesToIgnore
-
getModifiersToInclude
-
setModifiersToInclude
-
getObject
-
setObject
-
getTypesToInclude
-
setTypesToInclude
-
getParameterConstraints
-
setParameterConstraints
-