Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Java 'tag' variables for synching with a server.

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Java 'tag' variables for synching with a server.

    Hi all,

    I'm still in the stages of learning Java, and I'm constantly finding new challenges to improve my skills

    Anyway, I'm trying to achieve something of which I'm not quite sure if it can be done.
    It is for a simple online game, in which the player constantly sends it's position to the server.
    No problems there, everything works fine, however I was thinking of a system that would make my life easier, so I made a new class:

    public class OnlineObject {

    Each object that is in synch with the server extends this class.
    Now what I'm trying to do is create a system that automatically sends all the variables to the server that needs to be synched.
    However I have no idea how to find out what variables an object has, and how to make a system that only sends certain variables of that object.

    I really hope that somebody could point me in the right direction.
    If my problem isn't clear please ask, I found it really hard to put my thoughts on paper, so I understand if it comes accross as a bit 'blurry'.


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,494
    My Mood
    Mellow
    Thanks
    152
    Thanked 610 Times in 597 Posts

    Default Re: Java 'tag' variables for synching with a server.

    Look at the Observer/Observable and Callback design patterns to see if those suit your needs.

  3. #3
    Junior Member
    Join Date
    Jul 2013
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java 'tag' variables for synching with a server.

    Maybe this will help you.

Similar Threads

  1. Receive Server Sent Event Notifications in JAVA SERVER PAGE (JSP)
    By amritasenthilkumar in forum Web Frameworks
    Replies: 1
    Last Post: August 17th, 2012, 02:30 PM
  2. Differences between local variables and instance variables
    By rob17 in forum Java Theory & Questions
    Replies: 2
    Last Post: March 6th, 2012, 07:34 PM
  3. Instance Variables and local variables difference
    By dcwang3 in forum Java Theory & Questions
    Replies: 3
    Last Post: October 31st, 2011, 06:33 AM
  4. Java is resetting my variables to zero, and other mysterious things
    By schcrosby in forum What's Wrong With My Code?
    Replies: 3
    Last Post: January 12th, 2010, 08:50 PM