Hidding java class field and methods

Hi,
I'm developing an API and I want to know if there's any way to hide all private class, field and methods when exploring the JAR from eclipse or another IDE. In [this capture|http://i8.photobucket.com/albums/a32/darkskimmer/Sinttulo-1-2.jpg] I can see "extra-information" like return type of private methods, etc. I want to keep this in secret...
Cheers!
P.S: I have to improve my english skills, I know... :)

darkskimmer wrote:
I'm developing an API and I want to know if there's any way to hide all private class, field and methods when exploring the JAR from eclipse or another IDE. Since the JVM has to be able to see them to access/execute them and and anything it can do you can do then you can't hide them.

Similar Messages

  • Inherited fields and methods shown with the class own fields and methods

    In each subclass page, javadoc includes the fields and methods of the superclass as if they were declared in the subclass. However the methods inherited from Object are shown in a separate box.
    Is there a way to make javadoc group all inherited fields and mehods in separate boxes, one for each superclass?
    I'm using the javadoc tool from J2SE v 1.4.2_07 SDK with NetBeans 4.0 Bundle.
    Thanks.

    Yes, I know it does, but it seems that the superclass
    must be declared public.Sort of. Per default javadoc documents public and protected types and members. With this setting, where would you expect the documentation of public members of a package-private super class to be?
    If you specify -package or -private as an option for javadoc, package-private and/or private types and members are documented, too, so package-private super classes are documented as usual.

  • Customize class members and methods showed by IDE

    Is anyway to customize the output of the class members and methods show by IDE when you code a class?
    In detail:
    If you have a class A:
    A myClass = new A();
    and you tipe myClass.
    then the IDE show you a list of class members and methods in a Dialog Box....
    can you customize these????????
    I want to set another output for these....
    Thanks!

    That's not the meaning of the question.....
    When someone work with a Java IDE and are editing source, the IDE help you writing code showing you the members and methods of the object that you are working on, like these:
    a.------------------------
    | void setX(int x) |
    | void setY(int y) |
    These information is provided by the IDE. I think that it makes a special type of introspection on classes ..... but a really strong one, because it can access to private members and methods....
    I want to customize these behaviour....... and i want the IDE's show only the strings that i want....
    For exemple:
    a.------------------------
    | to establish X |
    | to establish Y |
    Thanks!

  • Track public classes, interfaces and methods by ID

    Hi All,
    I'm wondering whether there is a tool to assign a unique ID to classes, interfaces and methods (eg. within Javadoc) and track these IDs.
    The reason I'd need such a feature is that I'd like to do requirements tracking in an easy but complete way. I have a document containing functional specifications (with IDs) and on the other side there is the source code; where the javadoc of the public methods and classes is my software specification. What I now want to do is make a link between the IDs in the functional spec to the IDs in the sofware spec (ie. the source code).
    Does anybody know of such a tool (commercial or not)?
    Thanks,
    Daniel

    I'm a bit confused as to whether or not I understand you correctly. Please tell me if the following pseudocode is somewhat like the solution you are looking for:
    class MethodFunctionality {
       private Class methodClass;
       private String methodSignature;
       private List methodFunctions;
        *   Returns true if the method is used for the specified
        *   requirement, false otherwise.
       public boolean fulfills(int requirementId) {
          if methodFunctions.contains(requirementId)
             return true;
          else
             return false;
       public String getMethodSignature() {
          return this.methodSingature;
       public Class getMethodClass() {
          return this.methodClass;
        *   Returns an array with IDs of each functional
        *   requirement covered by the method.
       public int[] getCoverage() {
          return this.methodFunctions;
    class ClassFunctionality {
       private Map methodDetails;
       private List classFunctions;
       public MethodFunctionality getMethodDetails(String methodSignature) {
          return (MethodFunctionality) this.methodDetails.get(methodSignature);
        *   Returns true if the class is used for the specified
        *   requirement, false otherwise.
       public boolean fulfills(int requirementId) {
          if classFunctions.contains(requirementId)
             return true;
          else
             return false;
        *   Returns an array with IDs of each functional
        *   requirement covered by the class.
       public int[] getCoverage() {
          return this.classFunctions;
    }Mapping classes and methods to functionality like this would both allow you to query each class and method for all the functional requirements they claim to cover and would allow you to collect all classes and methods involved for a particular functional requirement.

  • How to learn technics in wrting class, objects and methods

    Hi ,
    I am new this oops methodology. I know java language but don't know the basics. I mean to say I have no idea how to write classes and methods. I can write one single class with all the methods and I can call that class from an another class but this is not the way... I knew it but I am kinda confuse how to write the well structured oops style classes and methods....
    Can anybody help me please........
    Thanks

    A short simple (overly simple) explanation is that objects are like little machines, which operate independantly from other objects (other little machines). You design an application as a collection of these little machine/objects, interacting with each other. Then you drill down another layer of detail, and design the machines themselves. You do this by defining the classes, which are like blueprints to make a little machine/object.
    In java, this is largely expressed by the interface definition at the higher level, and the class definition at the lower level. The interfaces say how various objects may talk to each other, and the class definitions say how any individual object may talk at all.
    This is a very basic description, and in fact isn't entirely accurate; if they want to lots of people on this forum could pick it apart. But hopefully it gets the idea across. (As my language design prof said, quoting somebody else, "teaching is just a series of lies.")
    There are resources on the web about object-oriented programming, object-oriented design, etc. mutmansky's right, a college course is best, but you can still learn a lot from docs on the web.

  • How to get class name and method name within a class method?

    Hi,
    In a java class, is it possible to get its class name and the class method?
    Please advise.
    Thank you.

    I mean whether there's any built-in command that will
    return the class name instead of code it ourself, for
    easier maintenance.
    Possible?
    this.getClass().getName();

  • Delete Class Objects and methods

    Hi, i have created a class file for a game. Now i have 3 to 4
    games in one Main File. So after playing one game user can choose
    another. Now can anybody tell me how to delete the first class
    Object or methods, which was used in First game. So that i can
    remove the garbage collections from Flash to make it with fast
    process?

    A short simple (overly simple) explanation is that objects are like little machines, which operate independantly from other objects (other little machines). You design an application as a collection of these little machine/objects, interacting with each other. Then you drill down another layer of detail, and design the machines themselves. You do this by defining the classes, which are like blueprints to make a little machine/object.
    In java, this is largely expressed by the interface definition at the higher level, and the class definition at the lower level. The interfaces say how various objects may talk to each other, and the class definitions say how any individual object may talk at all.
    This is a very basic description, and in fact isn't entirely accurate; if they want to lots of people on this forum could pick it apart. But hopefully it gets the idea across. (As my language design prof said, quoting somebody else, "teaching is just a series of lies.")
    There are resources on the web about object-oriented programming, object-oriented design, etc. mutmansky's right, a college course is best, but you can still learn a lot from docs on the web.

  • How to convert a String variable as class name and method name?

    i have two classes
    class Student
    public String insertStudent(String sname)
    { return("Student has been inserted ");     }
    class Teacher
    public String execute(String methodName, String className)
    {  //return statement of the method 'insertStudent' in the class 'Student'; }
    }Now, i have a class with the main method. Here, i would like to call the method *'insertStudent'* of class *'Student'*
    using the method *'execute'* of class *'Teacher',* passing the method-name and the class-name (viz. insertStudent, Student) as the
    String parameter.
    Can anyone please help me out. Thanks
    regards,
    chinglai

    You should have just added that as a comment on your [initial posting|http://forums.sun.com/thread.jspa?threadID=5334953] instead of starting a new thread.
    Now, i have a class with the main method. Here, i would like to call the method 'insertStudent' of class 'Student'using the method 'execute' of class 'Teacher', passing the method-name and the class-name (viz. insertStudent, Student) as the
    String parameter.
    Why oh why? What do you want to achieve?
    Let me tell you: there is a way to do what you try to do, but it's not recommended and should be used only very sparingly. Especially not in anything like your code, that resembles normal business logic (as opposed to an application framework such as Spring, for example).
    Can you explain what exactly you want to do with that? Why should a Teacher be able to call any random method ony any other class. And what good would that do?

  • Audit of Java Class, Resource, and Source

    We are currently at 10.1.0.5 on Win@K3 server, and are implementing DIACAP requirements. One of the finding states we need to add auditing of objects and they gave us the script to implement this:
    AUDIT ALL BY ACCESS;
    AUDIT ALL PRIVILEGES BY ACCESS;
    AUDIT ALTER JAVA CLASS BY ACCESS;
    AUDIT ALTER JAVA RESOURCE BY ACCESS;
    AUDIT ALTER JAVA SOURCE BY ACCESS;
    When we try to run this in sqlplus, it gives us an error on the Java lines (Ora-00969: Missing ON keyword). According to the documentation I found on line, which was limited, this is the correct syntax. Anyone know why this is failing?
    Thanks!

    We are currently at 10.1.0.5 on Win@K3 server, and are implementing DIACAP requirements. One of the finding states we need to add auditing of objects and they gave us the script to implement this:
    AUDIT ALL BY ACCESS;
    AUDIT ALL PRIVILEGES BY ACCESS;
    AUDIT ALTER JAVA CLASS BY ACCESS;
    AUDIT ALTER JAVA RESOURCE BY ACCESS;
    AUDIT ALTER JAVA SOURCE BY ACCESS;
    When we try to run this in sqlplus, it gives us an error on the Java lines (Ora-00969: Missing ON keyword). According to the documentation I found on line, which was limited, this is the correct syntax. Anyone know why this is failing?
    Thanks!

  • Is there a difference from the  class field and getClass()  ?

    To get the url of an image, I have developed the code below which works fine. In fact I, used a few examples that I got from this forum without understanding what I'm doing.
    public java.net.URL getURL(String name)
        String n = name.trim();
           if (n == null || n.equals(""))  return null;
        java.net.URL url=null;
        try
             return TestImage.class.getResource("/" + n);
       catch (Exception ex)
              System.out.println(ex.toString());
              return null;
    }However, now to really understand what all this means, I'd like to know what is the class field. For example when I'm writting :
          TestImage.class.getResource("/" + n);what "class" refers to ? Is it the same as
          TestImage.getClass().getResource("/" + n);I'm wondering what is the class field because by looking for the javadoc for Class, or Object, I haven't found any such field name. Where is it documented ? Instead could I have written :
           Class.getResource("/" + n);

    This expression is true :
    String.class.equals("A string".getClass())So basically it is the same, except that getClass() is not static.
    Hope this helps,
    --Marc (http://jnative.sf.net)                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Generic Populating the XML document using Java Class Generator and Reflection

    I am looking for a generic source code in order to convert the data parsed from any tabular text form ( tab delimited for example that maps certain XML Schema created form Database Schema for Oracle.
    I know it is possible to generate XML DTD or XSD from Oracle database table schema by XSU utility from XDK. And also it is possible to create Java source files from an XML DTD or XSD by using XML Clas Generator.
    I believe there must be some generic code that parses tabular text data and converts them to XML format using above mentioned generated Java source files and may be Java reflection mechanism.
    If anyone has any tool or knows any free ware that helps me, I would like to know about it, and I would really appreciate it.

    1. Read the XML file into a DMO object, walk the DOM to find the list, insert your new entry as a child, write the DOM back to a file.
    2. If the XML is not in a file, but in a string, then you can do the same with string input and output.

  • When we are using java.io.DataInputstream and method readInt()or read doubl

    Hi
    When we are using java.io.DataInputStream some garbage value is coming
    import java.io.*;
    class DataDemo
    public static void main(String ar[]) throws IOException
    DataInputStream dis=new DataInputStream(System.in);
    double d=dis.readDouble();
    System.out.print("ERRRRR"+d);
    when we input 234.66
    its printing 7.123096485547326E-67
    If anybody know why plz answer me
    Regards
    Rani

    DataInputStream(System.in);Why do you expect this to create a double? It doesn't, see the documentation for the method, you're misusing it.

  • Java class libraries and class paths

    I'm using NetBeans IDE 6
    I'm trying to make a class library (which is started from another application).
    This is supposed to connect to a SQL 2005 database by first registering the SQLServerDriver from the sqljdbc.jar library.
    I've tried it in an Application with a main class and it runs fine. But when I move the built classes to the folder I want them to run from, I get a ClassNotFound exception for the ServerDriver when run.
    I'm assuming it is a problem with the classpath after I make the move, is there anything special I need to do to keep the classpath intact so it can find the driver?
    Sorry if it's too vague, I can try to clarify things if needed.

    See this NetBeans tutorial:
    http://www.netbeans.org/kb/articles/javase-deploy.html
    These forums provide support for Java programming, not NetBeans (or any other IDE.)
    This question should have been posted to the NB site mailing list.

  • Calling Classes and Methods in Transformation Rules

    Hi,
    I have transformations from Level 1 to Level 2 ODS where based on the source fields Date of Sale(ZDSALE) I have to derive Period to Date and Year to Date from the class ZBI_UTILITY_METHODS and method ATTRIBUTES_GET.  How do i incorporate this in my start and transformation routines. Can someone please give me the code for this and also give some sample codes where classes and methods are called in the transformation rules.
    Thanks
    Priya.

    Hi Priya,
    I suggest you the way to call method in the class like this:
      DATA: o_model          TYPE REF TO ZBI_UTILITY_METHODS.
    " define v_return variables based on type the method give the value
      CREATE OBJECT: o_model.
      v_return = o_model->ATTRIBUTES_GET( transfer parameter ).
      free o_model.
    Hopefully it can help you a lot.
    Regards,
    Niel.

  • Berkeley DB Java Edition (JE) and JRuby Interoperability

    I finally got around to doing a quick test of calling Berkeley DB Java Edition (JE) from JRuby (JRuby is a 100% pure-Java implementation of Ruby).
    Before we get to JE and JRuby you probably want to know the answer to this question: "Why you would want to run Ruby on a JVM?" The answer is threefold:
    1. Ruby Performance. A large amount of effort has been put into tuning contemporary JVMs (e.g. Hotspot, Java 6, etc.) and Ruby programmers (through JRuby) can benefit from these tuning efforts. The JRuby guys have set a goal to make JRuby the fastest Ruby implementation available and Sun is certainly throwing their weight behind that effort.
    2. Portability. JRuby is a Ruby interpreter that runs anywhere a Java 5 JVM runs. You download it as a single tar.gz and it will run pretty much anywhere.
    3. Legacy Code. JRuby makes legacy Java apps and libraries available to Ruby programmers (did you ever think you'd see the word "legacy" next to the word "Java"?).
    JE interoperability with JRuby is important because it means that Ruby programmers now have a simple, embeddable, ACID storage engine (JE) available to them.
    To test this interoperability, I cobbled together a simple Ruby test program which does the following:
    * Opens an Environment, Database, and Transaction
    * Creates 10 records with keys 1..10 and marshaled Ruby Time instances as the corresponding data. This uses the Ruby Marshal package for the data binding and the JE Integer binding on the key side. There's no reason why you couldn't use different marshaling packages or methods for keys and data.
    * Commits the transaction,
    * Performs a Cursor scan to read those 10 records and prints out the Time instances, and
    * Searches for and reads the record with key 5 (an arbitrary key) and prints out the Time instance that is the corresponding data
    By the way, hats off to the JRuby developers: all of this code "just worked", out of the box, and most of my two hour investment was spent learning enough basic Ruby to make it all work. If you already know Ruby and JE, then demonstrating this interoperability would take you all of about 10 minutes.
    This was all done at the "base API" level of JE and no modifications to JE were required. I used Transactions in my code, but there's no reason that you need to. Mark and I have been talking about how to integrate JE's Direct Persistence Layer (DPL) with JRuby and we think it can be done with some remodularization of some of the DPL code. This is exciting because it would provide POJO ACID persistence to Ruby programmers.
    Linda and I have been talking about whether it makes sense to possibly use Ruby as a scripting platform for JE in the future. Given how easy it was to bring up JE and JRuby, this certainly warrants some further thought.
    The Ruby code and corresponding output is shown below. By the way, if you see something that I didn't do "The Ruby Way", feel free to let me know.
    I'd love to hear about your experiences with JE and JRuby. Feel free to email me a charles.lamb at <theobviousdomain dot com>.
    require 'java'
    module JESimple
      require 'date'
      # Include all the Java and JE classes that we need.
      include_class 'java.io.File'
      include_class 'com.sleepycat.je.Cursor'
      include_class 'com.sleepycat.je.Database'
      include_class 'com.sleepycat.je.DatabaseConfig'
      include_class 'com.sleepycat.je.DatabaseEntry'
      include_class 'com.sleepycat.je.Environment'
      include_class 'com.sleepycat.je.EnvironmentConfig'
      include_class 'com.sleepycat.je.OperationStatus'
      include_class 'com.sleepycat.je.Transaction'
      include_class 'com.sleepycat.bind.tuple.IntegerBinding'
      include_class 'com.sleepycat.bind.tuple.StringBinding'
      # Create a JE Environment and Database.  Make them transactional.
      envConf = EnvironmentConfig.new()
      envConf.setAllowCreate(true)
      envConf.setTransactional(true)
      f = File.new('/export/home/cwl/work-jruby/JE')
      env = Environment.new(f, envConf);
      dbConf = DatabaseConfig.new()
      dbConf.setAllowCreate(true)
      dbConf.setSortedDuplicates(true)
      dbConf.setTransactional(true)
      db = env.openDatabase(nil, "fooDB", dbConf)
      # Create JE DatabaseEntry's for the key and data.
      key = DatabaseEntry.new()
      data = DatabaseEntry.new()
      # Begin a transaction
      txn = env.beginTransaction(nil, nil)
      # Write some simple marshaled strings to the database.  Use Ruby
      # Time just to demonstrate marshaling a random instance into JE.
      for i in (1..10)
        # For demonstration purposes, use JE's Binding for the key and
        # Ruby's Marshal package for the data.  There's no reason you
        # couldn't use JE's bindings for key and data or visa versa or
        # some other completely different binding.
        IntegerBinding.intToEntry(i, key)
        StringBinding.stringToEntry(Marshal.dump(Time.at(i * 3600 * 24)),
                                    data)
        status = db.put(txn, key, data)
        if (status != OperationStatus::SUCCESS)
          puts "Funky status on put #{status}"
        end
      end
      txn.commit()
      # Read back all of the records with a cursor scan.
      puts "Cursor Scan"
      c = db.openCursor(nil, nil)
      while (true) do
        status = c.getNext(key, data, nil)
        if (status != OperationStatus::SUCCESS)
          break
        end
        retKey = IntegerBinding.entryToInt(key)
        retData = Marshal.load(StringBinding.entryToString(data))
        dow =
        puts "#{retKey} => #{retData.strftime('%a %b %d')}"
      end
      c.close()
      # Read back the record with key 5.
      puts "\nSingle Record Retrieval"
      IntegerBinding.intToEntry(5, key)
      status = db.get(nil, key, data, nil)
      if (status != OperationStatus::SUCCESS)
        puts "Funky status on get #{status}"
      end
      retData = Marshal.load(StringBinding.entryToString(data))
      puts "5 => #{retData.strftime('%a %b %d')}"
      db.close
      env.close
    end
    Cursor Scan
    1 => Fri Jan 02
    2 => Sat Jan 03
    3 => Sun Jan 04
    4 => Mon Jan 05
    5 => Tue Jan 06
    6 => Wed Jan 07
    7 => Thu Jan 08
    8 => Fri Jan 09
    9 => Sat Jan 10
    10 => Sun Jan 11
    Single Record Retrieval
    5 => Tue Jan 06

    In my previous post (Berkeley DB Java Edition in JRuby), I showed an example of calling JE's base API layer and mentioned that Mark and I had been thinking about how to use the DPL from JRuby. Our ideal is to be able to define classes in Ruby, annotate those class definitions with DPL-like annotations, and have the JE DPL store them. There are a number of technical hurdles to overcome before we can do this. For instance, Ruby classes defined in JRuby do not map directly to underlying Java classes; instead they all appear as generic RubyObjects to a Java method. Granted, it would be possible for the DPL to fish out all of the fields from these classes using reflection, but presently it's just not set up to do that (hence the modification to the DPL that I spoke about in my previous blog entry). Furthermore, unlike Java, Ruby allows classes to change on the fly (add/remote new fields and methods) causing more heartburn for the DPL unless we required that only frozen Ruby classes could be stored persistently.
    On thinking about this some more, we realized that there may be a way to use the DPL from JRuby, albeit with some compromises. The key to this is that in JRuby, if a Java instance is passed back to the "Ruby side" (e.g. through a return value or by calling the constructor for a Java class), it remains a Java instance, even when passed around in JRuby (and eventually passed back into the "Java side"). So what if we require all persistent classes to be defined (i.e. annotated) on the Java side? That buys us the standard DPL annotations (effectively the DDL), freezes the classes that the DPL sees, and still lets us benefit from the POJO persistence of the DPL. All of this can be done without modification to JE or the DPL using the currently available release. I cooked up a quick example that builds on the standard "Person" example in the DPL doc and included the code below.
    require 'java'
    module DPL
      require 'date'
      # Include all the Java and JE classes that we need.
      include_class 'java.io.File'
      include_class 'com.sleepycat.je.Environment'
      include_class 'com.sleepycat.je.EnvironmentConfig'
      include_class 'com.sleepycat.persist.EntityCursor'
      include_class 'com.sleepycat.persist.EntityIndex'
      include_class 'com.sleepycat.persist.EntityStore'
      include_class 'com.sleepycat.persist.PrimaryIndex'
      include_class 'com.sleepycat.persist.SecondaryIndex'
      include_class 'com.sleepycat.persist.StoreConfig'
      include_class 'com.sleepycat.persist.model.Entity'
      include_class 'com.sleepycat.persist.model.Persistent'
      include_class 'com.sleepycat.persist.model.PrimaryKey'
      include_class 'com.sleepycat.persist.model.SecondaryKey'
      include_class 'com.sleepycat.persist.model.DeleteAction'
      include_class 'persist.Person'
      include_class 'persist.PersonExample'
      # Create a JE Environment and Database.  Make them transactional.
      envConf = EnvironmentConfig.new()
      envConf.setAllowCreate(true)
      envConf.setTransactional(true)
      f = File.new('/export/home/cwl/work-jruby/JE')
      env = Environment.new(f, envConf);
      # Open a transactional entity store.
      storeConfig = StoreConfig.new();
      storeConfig.setAllowCreate(true);
      storeConfig.setTransactional(true);
      store = EntityStore.new(env, "PersonStore", storeConfig);
      class PersonAccessor
        attr_accessor :personBySsn, :personByParentSsn
        def init(store)
          stringClass = java.lang.Class.forName('java.lang.String')
          personClass = java.lang.Class.forName('persist.Person')
          @personBySsn = store.getPrimaryIndex(stringClass, personClass)
          @personByParentSsn =
            store.getSecondaryIndex(@personBySsn, stringClass, "parentSsn");
        end
      end
      dao = PersonAccessor.new(store)
      dao.init(store)
      personBySsn = dao.personBySsn
      person = Person.new('Bob Smith', '111-11-1111', nil)
      personBySsn.put(person);
      person = Person.new('Mary Smith', '333-33-3333', '111-11-1111')
      personBySsn.put(person);
      person = Person.new('Jack Smith', '222-22-2222', '111-11-1111')
      personBySsn.put(person);
      # Get Bob by primary key using the primary index.
      bob = personBySsn.get("111-11-1111")
      puts "Lookup of Bob => #{bob.name}, #{bob.ssn}"
      children = dao.personByParentSsn.subIndex(bob.ssn).entities()
      puts "\nRetrieving children of Bob"
      while (true) do
        child = children.next()
        break if child == nil
        puts "#{child.name}, #{child.ssn}"
      end
      children.close()
      store.close
      env.close
    end

Maybe you are looking for