Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. # Using IntelliJ select the desired type (e.g., java.lang.Number) and open subtypes hierarchy.
  2. # Using the toolbar in the Hierarchy window click the button to export the hierarchy into a file.
  3. # The exported file (let's call it init.txt) should look like below:
  4. Number (java.lang)
  5. Float (java.lang)
  6. MutableInt (org.apache.commons.lang3.mutable)
  7. MutableInt (org.apache.commons.lang3.mutable)
  8. BigFraction (org.apache.commons.math3.fraction)
  9. BigFraction (org.apache.commons.math3.fraction)
  10. BigFraction (org.apache.commons.math3.fraction)
  11. Integer (java.lang)
  12. MyInteger in MyClass (org.some.package)
  13. # The first step is to treat inner classes which appear as type MyInteger in MyClass to look like MyClass$MyInteger
  14. sed 's/\([[:alnum:]]\+\)$\([[:alnum:]]\+\)/\2$\1/' init.txt > step1.txt
  15. # The second step is to remove whitespaces to have all classes at the same level
  16. sed 's/\s\+//g' step1.txt > step2.txt
  17. # The third step is to bring package name in front of class name and remove parentheses
  18. sed 's/\(.\+\)(\(.\+\))/\2.\1/' step2.txt > step3.txt
  19. # The previous can be done using piped sed expressions as follows
  20. sed 's/\([[:alnum:]]\+\)$\([[:alnum:]]\+\)/\2$\1/' init.txt | sed 's/\s\+//g' | sed 's/\(.\+\)(\(.\+\))/\2.\1/'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement