In Eclipse it seems to be common practice to define interfaces and hide a concrete implementation in a package under *.internal.*. The actual hiding though is not result of the word „internal“ in the package name but must be specified in the MANIFEST.MF with the exported packages.
There are also further possibilities that can be engaged. For example you can define a package a friend to another package(es) so that only these can access the classes within.
Manifest.MF
Bundle-SymbolicName: example
Export-Package:
com.example.public, // Anyone can access com.example.public if imported
com.example.test;x-internal:=true, // This is marked as internal, but can be used
com.example.impl;x-friends:=com.example.other, // Only com.example.other should access it
This is not part of the OSGi Standard but the Equinox reference implementation.
For further reference see the Article at EclipseZone.
Kategorie: Java
Tipps und Tricks rund um die Programmiersprache Java
YAAT – Yet another AST tutorial
Although there are several articles and tutorials on and about on how to use Eclipse AST (Abstract Syntax Tree), none was able to tell me what I needed to know. Therefore I decided to write this tutorial with accompanying source code to fill in the gaps.
„YAAT – Yet another AST tutorial“ weiterlesen
Plugin gets stuck
While working on a new plugin I tried to reuse components, that already exist.
While testing the plugin froze. You could see it in the debug view by stepping to the reused component. There where no exceptions that tell you anything. Suddenly I had the idea that in the eclipse environment that I started to test the plugin might have something in the error log. Bingo: NoClassDefFoundException. But how could the plugin compile if the resource is not available? The answer is quite simple: I added the needed resource file to the buildpath instead to the plugin dependencies. Therefore at compile time the resource could be found but the plugin knew nothing of the needed resource. When building a plugin never add something needed to the buildpath, add it to the dependencies. Doing this the plugin worked as desired
Bildverarbeitung in Java
Java ist keine Programmiersprache in der sich Bilder einfach manipulieren lassen. Dass es trotzdem geht und was nötig ist, soll dieser Artikel aufzeigen. „Bildverarbeitung in Java“ weiterlesen
Überprüfen ESR Referenz-Nummer
Mir wurde die Aufgabe gestellt, eine Prüfroutine für die ESR-Referenz zu implementieren – in Java. Nach einem Fehlstart duch das Verwenden des falschen Algorithmus (Luhn Algorithmus zur Modulo 10 Prüfung) habe ich den Richtigen gefunden. Jedoch nur für C/C++, Visual Basic und PHP. Auf dieser Basis war es mir dann möglich eine Adaption für Java zu bilden „Überprüfen ESR Referenz-Nummer“ weiterlesen