Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{
%(key_boxed_type_name)s key = key_i.next();
%(value_boxed_type_name)s value = get( key );
to_hash_map.put( key, %(value_object_serialize_call)s );
}
return to_hash_map;
}
""" % locals()
def getParentTypeNames( self ):
key_boxed_type_name = self.getKeyType().getBoxedTypeName()
value_boxed_type_name = self.getValueType().getBoxedTypeName()
return ( "HashMap<%(key_boxed_type_name)s, %(value_boxed_type_name)s>" % locals(), )
class JavaModule(Module, JavaPackage):
def __init__( self, *args, **kwds ):
Module.__init__( self, *args, **kwds )
JavaPackage.__init__( self )
def generate( self ):
Module.generate( self )
if len( self.getConstants() ) > 0:
writeGeneratedFile( os.path.join( self.getPackageDirPath(), "Constants.java" ), """\
package %s;
public interface Constants
{
%s
};
def __repr__( self ):
if self.getValue() is not None:
return self.getIdentifier() + "( " + str( self.getValue() ) + " )"
else:
return self.getIdentifier()
class JavaExceptionType(ExceptionType):
def generate( self ):
JavaStructType( self.getScope(), self.getQualifiedName(), self.getTag(), ( "Exception", ), self.getMembers() ).generate()
class JavaInclude(Include): pass
class JavaInterface(Interface, JavaPackage):
def __init__( self, *args, **kwds ):
Interface.__init__( self, *args, **kwds )
JavaPackage.__init__( self )
class JavaMapType(MapType, JavaType):
def generate( self ):
class_header = self.getClassHeader()
name = self.getName()
key_boxed_type_name = self.getKeyType().getBoxedTypeName()
key_toString_call = self.getKeyType().getToStringCall( "key" )
value_boxed_type_name = self.getValueType().getBoxedTypeName()
value_toString_call = self.getValueType().getToStringCall( "value" )
serialize_methods = self.getSerializeMethods()
deserialize_methods = self.getDeserializeMethods()
other_methods = self.getOtherMethods()