org.jetbrains.kotlin.backend.common
Class DataClassMethodGenerator

java.lang.Object
  extended by org.jetbrains.kotlin.backend.common.DataClassMethodGenerator

public abstract class DataClassMethodGenerator
extends java.lang.Object

A platform-independent logic for generating data class synthetic methods. TODO: data class with zero components gets no toString/equals/hashCode methods. This is inconsistent and should be changed here with the platform backends adopted.


Constructor Summary
DataClassMethodGenerator(KtClassOrObject declaration, BindingContext bindingContext)
           
 
Method Summary
 void generate()
           
protected abstract  void generateComponentFunction(FunctionDescriptor function, ValueParameterDescriptor parameter)
           
protected abstract  void generateCopyFunction(FunctionDescriptor function, java.util.List<KtParameter> constructorParameters)
           
protected abstract  void generateEqualsMethod(FunctionDescriptor function, java.util.List<PropertyDescriptor> properties)
           
protected abstract  void generateHashCodeMethod(FunctionDescriptor function, java.util.List<PropertyDescriptor> properties)
           
protected abstract  void generateToStringMethod(FunctionDescriptor function, java.util.List<PropertyDescriptor> properties)
           
protected  ClassDescriptor getClassDescriptor()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataClassMethodGenerator

public DataClassMethodGenerator(KtClassOrObject declaration,
                                BindingContext bindingContext)
Method Detail

generate

public void generate()

generateComponentFunction

protected abstract void generateComponentFunction(@NotNull
                                                  FunctionDescriptor function,
                                                  @NotNull
                                                  ValueParameterDescriptor parameter)

generateCopyFunction

protected abstract void generateCopyFunction(@NotNull
                                             FunctionDescriptor function,
                                             @NotNull
                                             java.util.List<KtParameter> constructorParameters)

generateToStringMethod

protected abstract void generateToStringMethod(@NotNull
                                               FunctionDescriptor function,
                                               @NotNull
                                               java.util.List<PropertyDescriptor> properties)

generateHashCodeMethod

protected abstract void generateHashCodeMethod(@NotNull
                                               FunctionDescriptor function,
                                               @NotNull
                                               java.util.List<PropertyDescriptor> properties)

generateEqualsMethod

protected abstract void generateEqualsMethod(@NotNull
                                             FunctionDescriptor function,
                                             @NotNull
                                             java.util.List<PropertyDescriptor> properties)

getClassDescriptor

@NotNull
protected ClassDescriptor getClassDescriptor()