Use this class to implement basic encryption to text values (connection and password encryption). The class supports the following encryption types:
This cryptographic algorithm is a hash function, that was designed to be undecryptable. It is most frequently used to store passwords, as safe encryption is ensured. To check the password, the password entered by the user must be encrypted. If two encrypted passwords match, the password provided by the user can be accepted.
As a result of the encryption, a text value is returned, containing the encrypted value in hexadecimal format.
This is a decryptable algorithm. The encrypted text can be used for communication or to store data later to be decrypted to retrieve the original values. To use this algorithm, you need a 128-bit secure key ad a 128-bit init vector. If either one of them is unknown or the value does not match the one provided for encryption, the decryption will fail.
As a result of the encryption, a text value will be returned, containing the encrypted value in hexadecimal format. Such values can be decrypted if the key and the vector are available.
As a result of decryption, the “ExampleText” value will be returned.
Base64 is not an encryption but a way of encoding. You do not need any sort of key, only the use of the algorithm. If a value is encoded using Base64, you may decode it using any other algorithm containing Base64. Base64 is most frequently used to display an image on the screen. Browsers support displaying images as Base64-encoded information.
This class supports HTML content handling. Its first basic functionality is to generate HTML code for a component. Use it to insert a component into an HTML-based email. The second important functionality encoding a text to be displayed in HTML. Use it if you want to display a text which contains characters that are reserved in HTML (e.g. ">" and "<").
By using this class, we can convert any POJO object into a JSON string. The resulting string can be used as a JSON object.
After running the above code, the following JSON object will be generated as a JSON String:
Using this class you can easily perform complex string operations, such as cutting out a section from a text value following a pattern or using delimiters to separate texts.
Suppose we have an XML content that is available in text form. We want to extract the value of a tag from this content. All you have to do is call the subString method with the appropriate RegEx expression.
When running the example above, the value of the myTagValue variable will be equal to "value", since this text was included in the xmlData variable between the myTag tags.
Consider another common case where we have a list in text format from which we want to extract a specified item. This can also be easily done using the getToken method.
When running the above code, the variable secondElement takes the value "2" as it is the second item in our list. In the example, we used "," as a separator character, but in reality, it could be any character or text.
By using the class, you can easily perform common operations on Criteria objects. Such operations may include generating the Criteria class from text data (for example, a condition saved in a database), or negating a condition or concatenating one or more conditions.
After running the above code, the criteria variable will contain a Criteria object that matches the condition built in the following code snippet:
that is, a condition that satisfies any record in which the value of the column named valid is 'Y'.
After the code is executed, the value of the negated C riteria will be the negated form of the original condition, so any record in which the value column value is not "Y" will match the negated C riteria .
After running the above code, the combined criteria will contain both conditions concatenated with an AND logical relationship. If any parameter of the getCombinedCriteria method receives a null value, the returned condition returned will contain only the non-null condition. If both parameters are null, then the return value will be zero.