All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.slugstack.rewritejavarecipes.EncapsulateData Maven / Gradle / Ivy

There is a newer version: 0.2.2
Show newest version
package io.slugstack.rewritejavarecipes;

import org.openrewrite.ExecutionContext;
import org.openrewrite.Recipe;
import org.openrewrite.TreeVisitor;

/**
 * Performs information hiding by transforming "public"-visibility fields to
 * "private", generating getField() and setField(..) methods on the declaring
 * class, and updating consumer references to these once-public fields to use
 * their accessor methods.
 * 

* If a field is declared "public static final", it is left untouched. *

* If a field is declared "public final", only the field's "getField()" method * is generated, not it's "setField(..)". */ public class EncapsulateData extends Recipe { @Override public String getDisplayName() { return "Encapsulate data"; } @Override public String getDescription() { return "Performs information hiding by transforming 'public'-visibility fields to 'private', generating getField() and setField(..) methods on the declaring class, and updating consumer references to these once-public fields to use their accessor methods."; } @Override protected TreeVisitor getVisitor() { return new EncapsulateDataVisitor<>(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy