Class ParametersParser


  • public abstract class ParametersParser
    extends java.lang.Object
    Parses Serialization objects into Parameters objects of a certain kind.

    This class should eventually be in Tinks public API -- however, it might still change before that.

    • Method Detail

      • parseParameters

        public abstract Parameters parseParameters​(ProtoParametersSerialization serialization)
                                            throws java.security.GeneralSecurityException
        Parses a serialization into a Parameters object.

        This function is usually called with a Serialization matching the result of getObjectIdentifier. However, implementations should check that this is the case.

        Throws:
        java.security.GeneralSecurityException
      • getTypeUrl

        public final java.lang.String getTypeUrl()
        Returns the getTypeUrl for this serialization.
      • create

        public static ParametersParser create​(ParametersParser.ParametersParsingFunction function,
                                              java.lang.String typeUrl)
        Creates a ParametersParser object.

        In order to create a ParametersParser object, one typically writes a function

        
         class MyClass {
           private static MyParameters parse(ProtoParametersSerialization parametersSerialization)
                     throws GeneralSecurityException {
             ...
           }
         }
         
        This function can then be used to create a ParametersParser:
        
         ParametersParser parser =
               ParametersParser.create(MyClass::parse, objectIdentifier);
         
        Parameters:
        function - The function used to parse a Parameters object.
        objectIdentifier - The identifier to be returned by #getObjectIdentifier