Autor Thema: Value Objects mit Netbeans erzeugen  (Gelesen 2298 mal)

Offline Axel_Janssen

  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 769
Value Objects mit Netbeans erzeugen
« am: 04.08.03 - 17:03:54 »
Value Objects sind Klassen mit Instanzvariablen und für jede öffentliche Variable 1 Setter und 1 getter. Solche Klassen sind ziemlich häufig.

Sieht so aus.

Code
   private String nameParticipant;
   private int dateStart;
   private int monthStart;
   private int dateEnd;
   private int monthEnd;
   private int timeStart;
   private int timeEnd;
   private String location;
   
   
   
   
   /**
    * Returns the dateEnd.
    * @return int
    */
   public int getDateEnd() {
      return dateEnd;
   }

   /**
    * Returns the dateStart.
    * @return int
    */
   public int getDateStart() {
      return dateStart;
   }

   /**
    * Returns the location.
    * @return String
    */
   public String getLocation() {
      return location;
   }

   /**
    * Returns the monthEnd.
    * @return int
    */
   public int getMonthEnd() {
      return monthEnd;
   }

   /**
    * Returns the monthStart.
    * @return int
    */
   public int getMonthStart() {
      return monthStart;
   }

   /**
    * Returns the nameParticipant.
    * @return String
    */
   public String getNameParticipant() {
      return nameParticipant;
   }

   /**
    * Returns the timeEnd.
    * @return int
    */
   public int getTimeEnd() {
      return timeEnd;
   }

   /**
    * Returns the timeStart.
    * @return int
    */
   public int getTimeStart() {
      return timeStart;
   }

   /**
    * Sets the dateEnd.
    * @param dateEnd The dateEnd to set
    */
   public void setDateEnd(int dateEnd) {
      this.dateEnd = dateEnd;
   }

   /**
    * Sets the dateStart.
    * @param dateStart The dateStart to set
    */
   public void setDateStart(int dateStart) {
      this.dateStart = dateStart;
   }

   /**
    * Sets the location.
    * @param location The location to set
    */
   public void setLocation(String location) {
      this.location = location;
   }

   /**
    * Sets the monthEnd.
    * @param monthEnd The monthEnd to set
    */
   public void setMonthEnd(int monthEnd) {
      this.monthEnd = monthEnd;
   }

   /**
    * Sets the monthStart.
    * @param monthStart The monthStart to set
    */
   public void setMonthStart(int monthStart) {
      this.monthStart = monthStart;
   }

   /**
    * Sets the nameParticipant.
    * @param nameParticipant The nameParticipant to set
    */
   public void setNameParticipant(String nameParticipant) {
      this.nameParticipant = nameParticipant;
   }

   /**
    * Sets the timeEnd.
    * @param timeEnd The timeEnd to set
    */
   public void setTimeEnd(int timeEnd) {
      this.timeEnd = timeEnd;
   }

   /**
    * Sets the timeStart.
    * @param timeStart The timeStart to set
    */
   public void setTimeStart(int timeStart) {
      this.timeStart = timeStart;
   }

Das sieht nach einer Menge Tipparbeit aus. Wie entwickele ich das effizient mit Netbeans.

Ganz einfach.
1. Eclipse öffnen.
2. dort eine Klasse generieren.
3. das folgende Tippen:
Code
   private String nameParticipant;
   private int dateStart;
   private int monthStart;
   private int dateEnd;
   private int monthEnd;
   private int timeStart;
   private int timeEnd;
   private String location;
4. Die Instanzvariablen im rechten Fenster (outline) von Eclipse highlighten.
5. rechte Maustaste, generate getters and setters
6. Ok. drücken.
7. den code nach netbeans rüberkopieren.
... design patterns are abstract designs that help identify the structure and elements involved in a specific design solution. From this, a concrete implementation can be produced.
Kyle Brown

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz