Java Cursor Rules
Learn about cursor rules specific to Java development.
Java-Specific Rules
Cursor rules in Java provide intelligent navigation and manipulation capabilities designed specifically for Java development. These rules help you work more efficiently with Java's object-oriented features and language constructs.
Code Navigation
- Navigate between class and method definitions
- Jump to interface implementations
- Move between package declarations
Smart Selection
- Select method blocks and annotations
- Expand selection to include class members
- Smart generic type selection
Code Manipulation
- Quick class and method insertion
- Automated annotation handling
- Package and import navigation
Best Practices
- Use class-aware navigation
- Leverage method-specific cursor movements
- Utilize annotation-aware selection
Examples
// Navigate between class and interface implementations
public interface Printable {
void print();
}
public class Document implements Printable {
private String content;
@Override
public void print() {
System.out.println(content);
}
}
// Smart selection of annotations and generics
@Service
public class DataHandler<T extends Comparable<T>> {
@Autowired
private Repository<T> repository;
public List<T> processData() {
return repository.findAll();
}
}
Configuration
Customize Java-specific cursor rules in your settings:
{
"java.cursorRules": {
"classNavigation": true,
"smartSelection": true,
"annotationHandling": true
}
}