| java.lang.Object spoon.reflect.cu.SourceCodeFragment
SourceCodeFragment | public class SourceCodeFragment (Code) | | This class defines textual source code fragments that can be attached to a
compilation unit in order to modify its source code by preserving its
original formatting. Source code fragements are ignored by default. A special
mode must be activated in order to take them into account (-f or --fragments
with command line). When this mode is activated, the programs model is not
used any more to generate the transformed code (unless a fragment uses it to
get its code).
|
Field Summary | |
public String | code The value of the code, which will be printed as is within the orginal
source code (at the specified position). | public int | position The position in the orginal source code where this fragment must be
inserted. | public int | replacementLength The length of the original source code that must be replaced by this
fragment (starting at the position). |
Constructor Summary | |
public | SourceCodeFragment() Creates a new source code fragment with default values. | public | SourceCodeFragment(int position, String code, int replacementLength) Creates a new source code fragment. |
code | public String code(Code) | | The value of the code, which will be printed as is within the orginal
source code (at the specified position).
|
position | public int position(Code) | | The position in the orginal source code where this fragment must be
inserted. Default value is 0;
|
replacementLength | public int replacementLength(Code) | | The length of the original source code that must be replaced by this
fragment (starting at the position). Default value is 0 (pure insertion).
Note that if replacementLength==code.length, then the fragment just
replaces the existing code.
|
SourceCodeFragment | public SourceCodeFragment()(Code) | | Creates a new source code fragment with default values.
|
SourceCodeFragment | public SourceCodeFragment(int position, String code, int replacementLength)(Code) | | Creates a new source code fragment.
Parameters: position - the position at which it must start in the original sourcecode Parameters: code - the code as a string (will be pasted as is) Parameters: replacementLength - the number of character of the original code that should bereplaced |
|
|