Class ExtractClassDescriptor

    • Constructor Detail

      • ExtractClassDescriptor

        public ExtractClassDescriptor()
        Creates a new refactoring descriptor.
      • ExtractClassDescriptor

        public ExtractClassDescriptor​(String project,
                                      String description,
                                      String comment,
                                      Map<String,​String> arguments,
                                      int flags)
                               throws IllegalArgumentException
        Creates a new refactoring descriptor.
        Parameters:
        project - the non-empty name of the project associated with this refactoring, or null for a workspace refactoring
        description - a non-empty human-readable description of the particular refactoring instance
        comment - the human-readable comment of the particular refactoring instance, or null for no comment
        arguments - a map of arguments that will be persisted and describes all settings for this refactoring
        flags - the flags of the refactoring descriptor
        Throws:
        IllegalArgumentException - if the argument map contains invalid keys/values
    • Method Detail

      • getType

        public IType getType()
        Returns the type from which the fields are moved
        Returns:
        the type
      • setType

        public void setType​(IType type)
        Sets the type to extract class from
        Parameters:
        type - the type to extract class from
      • getPackage

        public String getPackage()
        Returns the package where the extracted class will be created in if {isCreateTopLevel() returns true. Can return null to indicate that the package will be the same as the type
        Returns:
        the package for the toplevel extracted class or null. If null the package will be the same as the type
      • setPackage

        public void setPackage​(String packageName)
        Sets the package in which the top level class will be created. Can be null to indicate that the package will be the same as the type
        Parameters:
        packageName - the package in which the top level class will be created. Can be null to indicate that the package will be the same as the type
      • getClassName

        public String getClassName()
        Returns the class name for the extracted class or null if the refactoring should choose a name
        Returns:
        the class name for the extracted class or null if the refactoring should choose a name
      • setClassName

        public void setClassName​(String className)
        Sets the class name for the extracted class or null if the refactoring should choose a name
        Parameters:
        className - the class name for the extracted class or null if the refactoring should choose a name
      • getFieldName

        public String getFieldName()
        Returns the field name for the generated field or null if the refactoring should choose a name
        Returns:
        the field name for the generated field or null if the refactoring should choose a name
      • setFieldName

        public void setFieldName​(String fieldName)
        Sets the field name for the generated field or null if the refactoring should choose a name
        Parameters:
        fieldName - the field name for the generated field or null if the refactoring should choose a name
      • isCreateTopLevel

        public boolean isCreateTopLevel()
        Returns whether the extracted class will be created as top level class or as nested class. If true the extracted class will be generated as top level class. The default is true
        Returns:
        if true the extracted class will be generated as top level class. The default is true
      • setCreateTopLevel

        public void setCreateTopLevel​(boolean createTopLevel)
        Sets whether the extracted class will be created as top level class or as nested class. If true the extracted class will be generated as top level class. Else the class will be created as nested class in the type. The default is true
        Parameters:
        createTopLevel - true to generated as top level class. The default is true
      • setCreateGetterSetter

        public void setCreateGetterSetter​(boolean createGetterSetter)
        Sets whether getters and setters will be created for all fields.
        Parameters:
        createGetterSetter - true to create getters and setters. Default is false.
      • isCreateGetterSetter

        public boolean isCreateGetterSetter()
        Returns true if getters and setters are generated for fields. Default is false.
        Returns:
        true if getters and setters are generated for fields. Default is false
      • validateDescriptor

        public RefactoringStatus validateDescriptor()
        Description copied from class: JavaRefactoringDescriptor
        Validates the refactoring descriptor with respect to the constraints imposed by the represented refactoring.

        Clients must call this method to verify that all arguments have been correctly set and that they satisfy the constraints imposed by specific refactorings. Returning a refactoring status of severity RefactoringStatus.FATAL indicates that the refactoring descriptor cannot be used to create a refactoring instance.

        Overrides:
        validateDescriptor in class JavaRefactoringDescriptor
        Returns:
        a refactoring status describing the outcome of the validation