Reference to primitive types?

I want to write a GUI that is able to set parameters to classes without knowing the exact nature of parameters. The parameter types are restricted to int and String. Something like this:
...in GUI class:
ClassToConfigure c = getFromSomewhere();
for (int i=0; i<c.getPropertyCount(); i++) {
  addToGUI(c.getDescription(), c.getType(), c.getKeyName())
then later after the value is set in the GUI:
c.setProperty(keyName, newValue);the setProperty method would have implementations for each type of newValue, and the GUI would have editing capabilities for each type too.
My problem is that I do not know how to implement this in the ClassToConfigure (CTC). My thoughts were: CTC enumerates all field it wants to be configurable in its constructor, something like:
addProperty(actual_field, "int", "Some description", "UniqueName");the CTC class would have a list of all properties with the "references" to the actual field to be able to update them.
but then I don't know how to update the fields when CTC.setProperty() is called. Is there a way to keep a reference to a field, even if the field has a primitive type? Another way to do it would be using function pointers, passing the getter and setter to CTC.addProperty, but this isn't possible in java.
Is there any straightforward way of implementing such behavior in java without tricky use of reflection?
Thanks in advance,
-Lev
P.S. I hope I made my point understandable, if not please let me know and I'll try to rephrase my concern.

I did not understand what you meant. But you can have the OO equivalents to function pointers, and that is method references. (But that is part of the the java.lang.reflect package)
Kaj

Similar Messages

  • After serialize a object what will be the value of reference and primitive

    After serialize a particular object what will the value its object references and primitives ???
    please go through the following scenario
    import java.io.*;
    class Dog implements Serializable{
         String dogString = "haiHai";
         int dogSize = 555;
         public String toString(){
              return "This is Object Man";
    class MyTestSerial
         Dog d = new Dog();
         MyTestSerial(){
                   try{
                        System.out.println("Before Serialization Dog object is : " +d);
                        System.out.println("Before Serialization d.dogSize : " +d.dogSize);
                        FileOutputStream fis = new FileOutputStream("MyTest.ser");
                        ObjectOutputStream obs = new ObjectOutputStream(fis);
                        obs.writeObject(d);
    obs.writeInt(d.dogSize);
    obs.writeObject(d.dogString);
                        System.out.println("After Serialization Dog object is : " +d);
                        System.out.println("Before Serialization d.dogSize : " +d.dogSize);
                   }catch(Exception e){
                   System.out.println(e);
         public static void main(String[] args) { MyTestSerial t = new MyTestSerial();     }
    In the above MyTestSerial class am serializing Dog object. After executing this obs.writeObject(d); the dog object will serialize without any problem.
    Now, once i try to print the dog object and dogString it should print the null value right ??
    and its primitive dogSize in the Dog class also print the value zero right??
    But am not getting those results. What mistake am doing here???
    Generally What will happen when we serialize a object or primitive value. After this what is the value of these types??
    Can any one a give the solution???
    Regards
    Dhinesh Kumar R

    Serializing merely copies the object data to the stream, the content is unaffected.

  • Axis webservice, wsdl and primitif type

    Environnement :
    JDK1.6, axis2-1.3, tomcat-6
    i have a POJO service called ProjectService wich return a ProjectVO value object, this object contains an item "themeId" of type Long (object not primitif type), because this item can be null.
    I use the eclipse wizard (bottom-up methode) to generate the Webservice, i ended with "server side" code, and "client side" code (stub.....) the stub obtained is called ProjectServiceStub wich contains an inner class ProjectVO, but this time
    the getThemeId() return a long primitif type and not a Long object.
    in the other side the eclipse-axis wizard generate a wsdl, the piece of information regarding themeId, is as follwoing
    <xs:element minOccurs="0" name="themeId" nillable="true" type="xs:long"/>
    ...the probleme is, when the POJO service return a NULL for the themeId item, the Webservice return a negatif big number, because int the ProjectServiceStub.ProjectVO object, the themeId is long and not Long.
    how can i fixe this probleme
    thanks for your help

    That wasnt really the question.
    Obviously Ive read the tutorial.
    Built my own DII client and webservice.
    Now im asking questions not covered by the tutorial.
    The question was how to reference complex java types.
    What are all the different types that can be included in a WSDL document. So far ive used String, Boolean. what else. Surely there must be a document that points these out!
    The answer to the other part of the question was quite simple.
    In the WSDL document, if a method takes multiple input paramters, the WSDL lists them by number.
    ie string 1, string 2 ect. as shown in previous listing.
    call.addParameter("String_1", QNAME_TYPE_STRING,
    ParameterMode.IN);
    So here you just add the additional parameters changing string 1 for the required parameter.

  • Mandatory fields With reference to Material types

    Dear Gurus,
    I need to make few fields as mandatory with reference to material types while creation of the material master data.
    For example:
    For Semi finished and Finished Schedule margin key is required(mandatory)
    For Raw Materials Schedule margin key is optional.
    Regards,
    Siddharth

    Hi
    find  following step to make field mandatory for material type
    Follow the stpes for making field as optional, required entry
    1 click the tab ,(Which is u want to be Required entry )and get the field name by pressing F1 key and then
    2.Go to T.Code: OMSR and enter that field name and get Selection Group
    once you get selection group and field name
    3 Use t.Code: OMS2 and click your material type and in next screen check Field reference ( you have assigned for material type; example :;For ROH material type the Field reference is ROH
    3. Use T.code:OMS9,, Double Click your Field Reference and select field selection Group , & select round box of Required Entry or optional and save
    check following link you will get clear idea [How to configure the fields required for each Material type ?;
    Regards
    Kailas ugale

  • Reference to generic type Set E should be parmeterized

    I have the following code in a class:
    1:Event theEvent = (Event) session.load(Event.class, eventId);
                2:Set<Event> eventSet;
                3:eventSet = user.getFavouriteEvents();
                4:eventSet.add(theEvent);At line 3, I get the following warning message:
    Type safety: The expresson of raw type Set is converted to Set<Event>. References to generic type Set<E> should be parameterized.
    What does this mean? What do I need to do to get past this warning.
    Thanks
    Sharma

    Found the problem. I forgot to parameterize the Set in the getFavouriteEvents() method.
    Thanks
    Sharma

  • Need suggestion for variable size array of primitive type.

    Hi all,
    I am working on a problem in which I need to keep an array of primitive (type int) sorted. Also I insert new elements while keeping it sorted, and at times I merge two similar arrays with unique elements.
    I would welcome suggestions on the implementation aspects as to which type/class to use. My primary consideration is performance. Here are my observations:
    1. type int
    Efficient operation, but arrays are fixed size so it makes clumsy code and overhead when the array is expanded or merged with another.
    Methods in class Arrays can be used, incl. binary search and sort.
    2. Vector, ArrayList, List, LinkedList
    Accept objects only. I can use Integer instead of int, but it will involve overhead, and I'll need to write my own sort and search routines (already done).
    For now, I choose option 2 using Vectors. Is there a better choice, or are there other options, given the conditions and consideration enumerated at the beginning?
    Appreciate any input or comments.

    mathmate wrote:
    I have not had the occasion to use them in parallel to recognize the difference. It pays to talk to people!A small benchmark is easily constructed:
    import bak.pcj.list.IntArrayList;
    import java.util.Random;
    import java.util.ArrayList;
    public class CollectionTest {
        static void testObjectsList(ArrayList<Integer> list, int n, long seed) {
            long start = System.currentTimeMillis();
            Random rand = new Random(seed);
            for(int i = 0; i < n; i++)
                list.add(new Integer(rand.nextInt()));
            for(int i = 0; i < n/2; i++)
                list.remove(rand.nextInt(list.size()));
            long end = System.currentTimeMillis();
            System.out.println("objectsList -> "+(end-start)+" ms.");
        static void testPrimitiveList(IntArrayList list, int n, long seed) {
            long start = System.currentTimeMillis();
            Random rand = new Random(seed);
            for(int i = 0; i < n; i++)
                list.add(rand.nextInt());
            for(int i = 0; i < n/2; i++)
                list.remove(rand.nextInt(list.size()));
            long end = System.currentTimeMillis();
            System.out.println("primitiveList -> "+(end-start)+" ms.");
        public static void main(String[] args) {
            long seed = System.currentTimeMillis();
            int numTests = 100000;
            testObjectsList(new ArrayList<Integer>(), numTests, seed);
            testPrimitiveList(new IntArrayList(), numTests, seed);
    }In the test above, Java's ArrayList is about 5 times faster. But when commenting out the remove(...) methods, the primitive 3rd party IntArrayList is about 4 to 5 times faster.
    Give it a spin.
    Again: just try to do it with the standard classes: if performance lacks, look at something else.

  • Access of possibly undefined property number through a reference with static type...

    Hello everyone !
    I run into this problem today ... take a look on the code :
    import com.trick7.effects.TeraFire;
    for (var j:uint=0; j<10; j++) {
        var fire:TeraFire = new TeraFire();
        fire.x = j * 40 + 20;
        fire.y = 100;
        fire.number = j; //This line is causeing the problem
        addChild(fire);
        fire.buttonMode = true;
    TeraFire class creates fire particles. The compiler error is :
    Scene 1, Layer 'Layer 1', Frame 1, Line 7
    1119: Access of possibly undefined property number through a reference with static type com.trick7.effects:TeraFire.
    Anyone can help me to find a solution to this problem.
    I can do that ".number" with a movieclip but not in this case. What can I do ?

    I borrowed that class from the internet.
    I made the changes you suggested: imported flash.Display.MovieClip and also made the class extend MovieClip.
    The error is still throwing in compiler errors. I am not really good enough to edit this class because there are some functions I don't still understand very good. This is the class below:
    package com.trick7.effects{
        import flash.display.BitmapData;
        import flash.display.GradientType;
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.filters.DisplacementMapFilter;
        import flash.filters.DisplacementMapFilterMode;
        import flash.geom.Matrix;
        import flash.geom.Point;
        import flash.geom.Rectangle;
        public class TeraFire extends MovieClip{
            public var phaseRateX:Number;
            public var phaseRateY:Number;
            private var offsets:Array= [new Point(),new Point()];
            private var seed:Number = Math.random();
            private var fireW:Number;
            private var fireH:Number;
            //火の色
            //private var fireColorIn:uint;
            //private var fireColorOut:uint;
            private var ball:Sprite;
            private var gradientImage:BitmapData;
            private var displaceImage:BitmapData;
            private var focalPointRatio:Number = 0.6;
            private const margin:int = 10;
            private var rdm:Number;
            public function TeraFire(xPos:Number=0, yPos:Number=0, fireWidth:Number=30, fireHeight:Number=90, fireColorIn:uint = 0xFFCC00,fireColorOut:uint = 0xE22D09){
                fireW = fireWidth;
                fireH = fireHeight;
                phaseRateX = 0;
                phaseRateY = 5;
                var matrix:Matrix = new Matrix();
                matrix.createGradientBox(fireW,fireH,Math.PI/2,-fireW/2,-fireH*(focalPointRatio+1)/2);
                var colors:Array = [fireColorIn, fireColorOut, fireColorOut];
                var alphas:Array = [1,1,0];
                var ratios:Array = [30, 100, 220];
                var home:Sprite = new Sprite();
                ball = new Sprite();
                ball.graphics.beginGradientFill(GradientType.RADIAL,colors, alphas, ratios, matrix,"pad","rgb",focalPointRatio);
                ball.graphics.drawEllipse(-fireW/2,-fireH*(focalPointRatio+1)/2,fireW,fireH);
                ball.graphics.endFill();
                //余白確保用透明矩形
                ball.graphics.beginFill(0x000000,0);
                ball.graphics.drawRect(-fireW/2,0,fireW+margin,1);
                ball.graphics.endFill();
                addChild(home);
                home.addChild(ball);
                this.x = xPos;
                this.y = yPos;
                addEventListener(Event.ENTER_FRAME,loop);
                displaceImage = new BitmapData(fireW+margin,fireH,false,0xFFFFFFFF);
                var matrix2:Matrix = new Matrix();
                matrix2.createGradientBox(fireW+margin,fireH,Math.PI/2,0,0);
                var gradient_mc:Sprite = new Sprite;
                gradient_mc.graphics.beginGradientFill(GradientType.LINEAR,[0x666666,0x666666], [0,1], [120,220], matrix2);
                gradient_mc.graphics.drawRect(0,0,fireW+margin,fireH);//drawのターゲットなので生成位置にこだわる必要はない。
                gradient_mc.graphics.endFill();
                gradientImage = new BitmapData(fireW+margin,fireH,true,0x00FFFFFF);
                gradientImage.draw(gradient_mc);//gradient_mcを消す必要は?
                rdm = Math.floor(Math.random()*10);
            private function loop(e:Event):void{
                for(var i:int = 0; i < 2; ++i){
                    offsets[i].x += phaseRateX;
                    offsets[i].y += phaseRateY;
                displaceImage.perlinNoise(30+rdm, 60+rdm, 2, seed, false, false, 7, true, offsets);
                displaceImage.copyPixels(gradientImage,gradientImage.rect,new Point(),null, null, true);
                var dMap:DisplacementMapFilter = new DisplacementMapFilter(displaceImage, new Point(), 1, 1, 20, 10, DisplacementMapFilterMode.CLAMP);
                ball.filters = [dMap];
    I you can clarify a little bit further I would appreciate it a lot because I wasted some good time on this.

  • Data is not updating in calss & Convert vi reference to strictly type reference vi

    Hi,
    In the attached project file there is a Class called 'ClassSample.lvclass' having 3 different data types Boolean, Numeric and Variant(not really sure, Variant can be use for strict data type reference). From this three we careated the 'VIs for data member access' you can see them in project file
    My questions are,(Please refer attached screenshot)
    1. Though member of same class, why value is not updating at probe 16 ?
    2. How to convert vi reference to strictly type reference vi ?
    Thank you.
    Attachments:
    Capture.JPG ‏426 KB
    ClassSample Project.zip ‏116 KB

    It depends a bit on your final intention. Bascially you have a shared state that you want to access asynchronously from different places. If you know that the actual object is only created once (terminilogie here is a bit shaky as every wire split would create a copy of the LVOOP object but I hope you know what I mean), you could use a global or Action Engine to store the state. Using a DVR for this state and adding the DVR to your object class data is however a more scalable approach as it will allow you to instantiate more than one object of that class and each one will contain its own DVR that will reference the same value for the specific object instance even if you split the object wire, creating actually two copies of that object (but for the purpose of this discussion they would be still the same object instance).
    Queues could work if you create a single element queue but you would always need to use Preview Queue rather than Dequeue in order to maintain the value in there.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Call to a possibly undefined method getClipboardContents through a reference with static type flashx.textLayout.edit:ISelectionManager.

    Hi Guys,
    As i am using the nigtly build of TLF 4.0.0.11073.
    I want to copy some text from the TLF, by copy operation. I am getting this type of Error.
    - Call to a possibly undefined method getClipboardContents through a reference with static type flashx.textLayout.edit:ISelectionManager.
    In the previous build, i dont use to get this type of error, but in this nightly builds i am getting this type of error.
    Can anyone help me to fix the same or any workaound.
    Thanks in advance.
    Krishna

    This functionality is still available, but it has moved. It's now in a TextClipboard class, in the same flashx.textLayout.edit package. So you should replace calls to getClipboardFormat() with TextClipboard.getContents().
    Hope this helps,
    - robin

  • Array Of Primitive Type (kodo3.4)

    Hello,
    I want to map an array of primitive type (double[] or double[][] or...) to
    a blob, so I specified the mapping this way:
    <extension vendor-name="kodo" key="jdbc-field-map-name" value="blob">
    <extension vendor-name="kodo" key="column" value="DATA"/>
    </extension>
    As I use MySQL and not to have an exception, I have added:
    kodo.jdbc.DBDictionary: DriverDeserializesBlobs=false
    But when I tried to refresh using kodo.jdbc.meta.MappingTool, I get:
    [refresh] Exception in thread "main" kodo.util.FatalInternalException:
    Cannot map "fr.ifp.reservoir.model.business.geostat.Lithotype.facies".
    Check the class and make sure you are using only supported types.
    [refresh] at
    kodo.jdbc.meta.DynamicMappingProvider.createFieldMapping(DynamicMappingProvider.java:336)
    [refresh] at
    kodo.jdbc.meta.DynamicMappingProvider.getFieldMapping(DynamicMappingProvider.java:118)
    [refresh] at
    kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.java:470)
    [refresh] at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:993)
    [refresh] at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:973)
    [refresh] at
    kodo.jdbc.meta.AbstractClassMapping.getMappings(AbstractClassMapping.java:939)
    [refresh] at
    kodo.jdbc.meta.AbstractClassMapping.getDeclaredFieldMappings(AbstractClassMapping.java:659)
    [refresh] at
    kodo.jdbc.meta.AbstractClassMapping.resolve(AbstractClassMapping.java:801)
    [refresh] at
    kodo.jdbc.meta.BaseClassMapping.resolve(BaseClassMapping.java:341)
    [refresh] at
    kodo.jdbc.meta.MappingRepository.resolve(MappingRepository.java:431)
    [refresh] at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:349)
    [refresh] at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:177)
    [refresh] at kodo.jdbc.meta.MappingTool.refresh(MappingTool.java:591)
    [refresh] at kodo.jdbc.meta.MappingTool.run(MappingTool.java:941)
    [refresh] at kodo.jdbc.meta.MappingTool.run(MappingTool.java:879)
    [refresh] at kodo.jdbc.meta.MappingTool.main(MappingTool.java:802)
    Thanks for your help.
    nicolas

    Hi,
    No more succes with persistence-modifier="persistent"...
    My class:
    public class ArrayWrapper {
    private String name;
    private double[] array;
    public ArrayWrapper(String name, double[] array) {
    this.name = name;
    this.array = array;
    public double[] getValues() {
    return array;
    public String getName() {
    return name;
    My metadata file:
    <jdo>
    <package name="model">
    <class name="ArrayWrapper">
    <field name="array" persistence-modifier="persistent">
    <extension vendor-name="kodo" key="jdbc-field-map-name" value="blob">
    <extension vendor-name="kodo" key="column" value="DATA"/>
    </extension>
    </field>
    </class>
    </package>
    </jdo>
    My StackTrace:
    refresh-mapping:
    [java] Exception in thread "main" kodo.util.FatalInternalException:
    Cannot map "model.ArrayWrapper.array". Check the class and make sure you
    are using only supported types.
    [java] at
    kodo.jdbc.meta.DynamicMappingProvider.createFieldMapping(DynamicMappingProvider.java:336)
    [java] at
    kodo.jdbc.meta.DynamicMappingProvider.getFieldMapping(DynamicMappingProvider.java:118)
    [java] at
    kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.java:470)
    [java] at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:993)
    [java] at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:973)
    [java] at
    kodo.jdbc.meta.AbstractClassMapping.getMappings(AbstractClassMapping.java:939)
    [java] at
    kodo.jdbc.meta.AbstractClassMapping.getDeclaredFieldMappings(AbstractClassMapping.java:659)
    [java] at
    kodo.jdbc.meta.AbstractClassMapping.resolve(AbstractClassMapping.java:801)
    [java] at
    kodo.jdbc.meta.BaseClassMapping.resolve(BaseClassMapping.java:341)
    [java] at
    kodo.jdbc.meta.MappingRepository.resolve(MappingRepository.java:431)
    [java] at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:349)
    [java] at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:177)
    [java] at kodo.jdbc.meta.MappingTool.refresh(MappingTool.java:591)
    [java] at kodo.jdbc.meta.MappingTool.run(MappingTool.java:941)
    [java] at kodo.jdbc.meta.MappingTool.run(MappingTool.java:879)
    [java] at kodo.jdbc.meta.MappingTool.main(MappingTool.java:802)

  • Passing a reference to a type definition to a SubVI

    I have created a type definition that I would like to use across my application. This particular type definition is also the front panel control to my top level VI. I wanted to pass a reference to this control to my SubVi's so that they could dereference as needed and in very rare cases update the values on the front panel. However, as I built the application I noticed that I was breaking the control reference as I updated the type definition. This implies that they type of the reference changes as I change the type definition.
    How do I go about building the reference I need or is there some other way to do this that works just as well. Even if I can't make a reference to the control that is tied to the type definition, I'm willing to pass in a variant who can house the reference as long as I can build the data type (the reference) inside my SubVis.
    Solved!
    Go to Solution.

    Okay, so I tried all three approaches in a SubVI, here's what happened.
    My approach was simply to create a Type Def control, right-click and create a Reference. Then create a control from that reference by right-clicking the output of the reference and selecting the Create Control option. I then pasted this 'cluster' reference into my SubVi, made it an input and then wired up the reference in the parent to the control in the SubVi.
    Result: This breaks when you update the Type Definition.
    Next, Ben's approach (or my best effort at doing what he suggested). I created a control from reference to the type def. I cut it from the parent VI and pasted it into a new type def. I then put the type def in the SubVI and set it as an input.
    Result: This breaks when you update the Type Definition (but it actually takes a bit longer for the error to propogate).
    Finally, Christian's solution (or my best effort). I took the type def reference and put it through a To More Generic Class guy, casting it to a Control Refnum. I put a Control Refnum on the front panel of my SubVI and wired it to a To More Specific Class guy. I created a control of the type def in the subvi, hid it, and created a reference. I wired the reference to the more specific guy and verified I was getting the right data.
    Result: It works!
    It's possible I just didn't understand how to make the reference type def you were referring to Ben. I would prefer a method with less verbage. I pass this refnum into a class which holds it. Since I can't replicate the type exactly prior to run time (i.e. create a control that is exactly a reference to the type definition of my front panel), I have to save the reference as a Control Refnum and cast it every time I need it (i.e. create a control from the typedef, create a reference frome the type def, etc). More verbage than optimal, but still good!
    Thanks for the help.

  • Reference to a type

    Hi,
    I have created a subvi which I now use in my main VI, however, I now want to use the values from the subvi WITHOUT having to have a control in my main VI.  I can't seem to find a tool to convert a reference to a type.
    Anyhelp would be much appreciated.
    Thanks,
    Paul.

    Hi Ben,
    I have included a simple VI of what I would like to achieve.  Any questions just ask.
    Please keep in mind that this is a simple model of what I would like to do.
    Thanks again,
    Paul.
    Message Edited by bigdave on 11-08-2005 12:13 PM
    Attachments:
    subvi.zip ‏17 KB

  • Conversion error with non-primitive types

    I'm wondering if anyone else is seeing this problem or has a potential solution.
    The problem, in a nutshell:
    I have beans that use non-primitive types (Float instead of float) in the getters and setters. However I keep getting conversion error problems. If I switch to primitive types, I don't get conversion errors. The built-in FloatConverter says (in the documentation at least) that it supports both primitives and boxed types. This was all working in EA4, though. I am discovering this problem as I migrate from EA4 to 1.0.
    The code is pretty straightforward:
    public class Bean implements Serializable {
    public float getProp() {...}
    public void setProp(float) {...}
    public Float getPropOld() {...}
    public void setPropOld(Float) {...}
    <!-- works -->
    <h:inputText id="floatinput" value="#{BeanInstance.prop}"/>
    <!-- doesn't work -->
    <h:inputText id="floatinputold" value="#{BeanInstance.propOld}"/>
    Any ideas? I have tried explicitly calling the FloatConverter but that gave the same problems.

    Okay, I figured out my problem.
    The JSF spec implies that f:convertNumber may be used inside an h:inputText tag. The early versions of Core JSF go further and show f:convertNumber being used inside an h:inputText tag in one of the examples. (Chapter 7, conversions).
    However, this has been the source of my problem. When using f:convertNumber, the converter would automatically determine the data type without regard to the data type in the backing bean. Hence, it would try to pass Longs or Doubles to the bean instead of Floats.
    I believe this may be an issue in the 1.0 FR release.

  • Primitive type Changing???

    One of my friends sent me this e-mail. Can anyone help??
    ok wood, here's one for you:
    the software i'm writing get's data from one of two processors on a
    satelite. these processors use different #'s of bytes for their
    primitive types.
    bool - 1 byte
    short - 2 bytes
    int - 2 bytes
    long - 4 bytes
    float - 4 bytes.
    so..as you know the jvm uses 4 bytes for an int, 8 for a long. I
    want to be able to have people who are developing sims ontop of my
    framework be able to use a primitiave type, such as an int, and have
    it only be 2 bytes...now i'm pretty sure this isn't possible. You
    can't overload a primitive type in java right? I have some ideas
    here on what to do (create whole new objects, holding byte arrays and
    use java.nio to manaage them), but it just seems like such a hastel.
    i guess i was wondering if you have ever seen this kindof thing
    before and if you had any advice. thanks man.

    In C, primitive types can vary in size, based on the platform being used. In Java, the size of primitives is static. If he wants 16-bit storage, short is the way to go. Well, a char is a couple of bytes, too, but it's unsigned, intended for Unicode characters, and probably not what he's looking for anyway...
    :o)

  • Configure array of primitive type for POF

    My impression is that Coherence's POF implementation can handle Java primitive and String by default thus we don't need to provide a customized POF configuration file if the object been put into the cache is Java primitive type.
    How about arrary of primitive type? For example, byte[]. Can Coherence's POF implementation handle byte[] as well?

    Just asking since we plan to move from using Externalizable to POF and not sure if we need special handling for byte[] type.
    Thanks for the reply.
    Regards,
    Chen

Maybe you are looking for