#NEWLINE# def Upgrade( self , aff4_class ) : #NEWLINE# #INDENT# 'Upgrades this object to the type specified.\n\n    AFF4 Objects can be upgraded on the fly to other type - As long as the new\n    type is derived from the current type. This feature allows creation of\n    placeholder objects which can later be upgraded to the fully featured\n    object.\n\n    Note: It is not allowed to downgrade an object if that would result in a\n    loss of information (since the new object has a smaller schema). This method\n    tries to store the new object with its new attributes and will fail if any\n    attributes can not be mapped.\n\n    Args:\n       aff4_class: A string representing the new class.\n\n    Returns:\n       an instance of the new class with all the same attributes as this current\n       object.\n\n    Raises:\n       RuntimeError: When the object to upgrade is locked.\n       AttributeError: When the new object can not accept some of the old\n       attributes.\n       InstantiationError: When we cannot instantiate the object type class.\n    ' #NEWLINE# if ( self . __class__ . __name__ == cls ) : #NEWLINE# #INDENT# return self #NEWLINE# #UNINDENT# cls = self . classes . get ( str ( aff4_class ) ) #NEWLINE# if ( cls is None ) : #NEWLINE# #INDENT# raise InstantiationError ( ( 'Could not instantiate %s' % aff4_class ) ) #NEWLINE# #UNINDENT# if isinstance ( self , cls ) : #NEWLINE# #INDENT# return self #NEWLINE# #UNINDENT# result = cls ( self . urn , mode = self . mode , clone = self , parent = self . parent , token = self . token , age = self . age_policy , object_exists = self . object_exists , follow_symlinks = self . follow_symlinks , aff4_type = self . aff4_type , mutation_pool = self . mutation_pool , transaction = self . transaction ) #NEWLINE# result . symlink_urn = self . urn #NEWLINE# result . Initialize ( ) #NEWLINE# return result