User: juhalindfors
  Date: 02/02/20 22:46:20

  Added:       src/main/test/implementation/modelmbean/support User.java
  Log:
  
  
  Revision  Changes    Path
  1.1                  jmx/src/main/test/implementation/modelmbean/support/User.java
  
  Index: User.java
  ===================================================================
  
  package test.implementation.modelmbean.support;
  
  public class User {
  
      private long id          = System.currentTimeMillis();
      private String name      = "";
      private String address   = "";
      private String password  = null;
      private String[] numbers = new String[3];
      
  
      // read-only attribute 'ID'
      public long getID() { 
          return id;
      }
  
  
      // application method, not exposed to management
      public void setID(long id) {
          this.id = id;
      }
      
  
      // read-write attribute 'Name'
      public String getName() {
          return name;
      }
      public void setName(String name) {
          
  //System.out.println("SetNAME");
  
          this.name = name;
      }
  
      
      // read-write attribute 'Address'
      public String getAddress() {
          return address;
      }
      public void setAddress(String address) {
          this.address = address;
      }
  
      
      // read-write array attribute 'PhoneNumbers'
      public String[] getPhoneNumbers() {
          return numbers;
      }
      public void setPhoneNumbers(String[] numbers) {
          this.numbers = numbers;
      }
  
      
      // write-only attribute 'Password'
      public void setPassword(String passwd) {
          this.password = passwd;
      }
  
      
      // management operations
      public String printInfo() {
          return 
            "User: " + getName() +"\n"+
            "Address: " + getAddress() +"\n"+
            "Phone #: " + getPhoneNumbers()[0] +"\n"+
            "Phone #: " + getPhoneNumbers()[1] +"\n"+
            "Phone #: " + getPhoneNumbers()[2] +"\n";
      }
      
      public void addPhoneNumber(String number) {
          for (int i = 0; i < numbers.length; ++i)
              if (numbers[i] == null) {
                  numbers[i] = number;
                  break;
              }
      }
  
      public void removePhoneNumber(int index) {
          if (index < 0 || index >= numbers.length)
              return;
              
          numbers[index] = null;
      }
  }
  
  
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to