`
kanpiaoxue
  • 浏览: 1744845 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

Java Getter and Setter: Basics, Common Mistakes, and Best Practices

阅读更多

 

文章地址: https://dzone.com/articles/java-getter-and-setter-basics-common-mistakes-and

 

 

 

Getter and setter are widely used in Java. It is seemingly simple, but not every programmer understands and implements this kind of method properly. So in this article, I would like to deeply discuss getter and setter methods in Java — from the basics to common mistakes and best practices.

If you are already good with the basics, jump directly to section 4 where I talk about common mistakes and best practices.

You may also like: Why Should I Write Getters and Setters?

1. What Are Getter and Setter?

In Java, getter and setter are two conventional methods that are used for retrieving and updating the value of a variable.

The following code is an example of a simple class with a private variable and a couple of getter/setter methods:

 
 
 
 
1
public class SimpleGetterAndSetter {
2
    private int number;
3
4
    public int getNumber() {
5
        return this.number;
6
    }
7
8
    public void setNumber(int num) {
9
        this.number = num;
10
    }
11
}
 
 

 

The class declares a private variable, number. Since number is private, the code from the outside of this class cannot access the variable directly, as shown below:

 
 
 
 
1
SimpleGetterAndSetter obj = new SimpleGetterAndSetter();
2
obj.number = 10;    // compile error, since number is private
3
int num = obj.number; // same as above
 
 

 

Instead, the outside code has to invoke the getter,  getNumber(), and the setter,  setNumber(), in order to read or update the variable, for example:

 
 
 
 
1
SimpleGetterAndSetter obj = new SimpleGetterAndSetter();
2
3
obj.setNumber(10);  // OK
4
int num = obj.getNumber();  // fine
 
 

 

So, a setter is a method that updates the value of a variable. And a getter is a method that reads the value of a variable. Getter and setter are also known as accessor and mutator in Java.

2. Why Do We Need Getter and Setter?

By using getter and setter, the programmer can control how their important variables are accessed and updated in the proper manner, such as changing the value of a variable within a specified range. Consider the following code of a setter method:

 
 
 
 
1
public void setNumber(int num) {
2
    if (num < 10 || num > 100) {
3
        throw new IllegalArgumentException();
4
    }
5
    this.number = num;
6
}
 
 

 

This ensures that the value of the number is always set between 10 and 100. Suppose the variable number can be updated directly, the caller can set any arbitrary value to it:

 
 
 
 
1
obj.number = 3;
 
 

 

And that violates the constraint for values ranging from 10 to 100 for that variable. Of course, we don’t expect that to happen. Thus, hiding the variable number as private and then using a setter comes to the rescue.

On the other hand, a getter method is the only way for the outside world to read the variable’s value:

 
 
 
 
1
public int getNumber() {
2
    return this.number;
3
}
 
 

 

The following picture illustrates the situation:

Getter and setter visual

So far, the setter and getter methods protect a variable’s value from unexpected changes by the outside world — the caller code.

When a variable is hidden by the private modifier and can be accessed only through getter and setter, it is encapsulatedEncapsulation is one of the fundamental principles in object-oriented programming (OOP), thus implementing getter and setter is one of the ways to enforce encapsulation in the program’s code.

Some frameworks such as HibernateSpring, and Struts can inspect information or inject their utility code through getter and setter. So providing getter and setter is necessary when integrating your code with such frameworks.

3. Naming Convention for Getter and Setter

The naming scheme of setter and getter should follow the Java bean naming convention as  getXxx() and  setXxx(), where Xxx is the name of the variable. For example, with the following variable name:

 
 
 
 
1
private String name;
 
 

 

The appropriate setter and getter will be:

 
 
 
 
1
public void setName(String name) { }
2
3
public String getName() { }
 
 

 

If the variable is of the type boolean, then the getter’s name can be either isXXX() or  getXXX(), but the former naming is preferred. For example:

 
 
 
 
1
private boolean single;
2
3
public String isSingle() { }
 
 

 

The following table shows some examples of getters and setters which qualified for the naming convention:

Variable declaration

Getter method

Setter method

 

int quantity

 

 

 int getQuantity() 

 

 void setQuantity(int qty) 

 

string firstName

 

 

 String getFirstName() 

 

 void setFirstName(String fname) 

 

Date birthday

 

 

 Date getBirthday() 

 

 void setBirthday(Date bornDate) 

 

boolean rich

 

 

 boolean isRich() 

 boolean getRich() 

 

 void setRich(Boolean rich) 

 

4. Common Mistakes When Implementing Getter and Setter

People often make mistakes, and developers are no exception. This section describes the most common mistakes when implementing setters and getters in Java, as well as workarounds.

Mistake #1: You have setter and getter, but the variable is declared in a less restricted scope.

Consider the following code snippet:

 
 
 
 
1
public String firstName;
2
3
public void setFirstName(String fname) {
4
    this.firstName = fname;
5
}
6
7
public String getFirstName() {
8
    return this.firstName;
9
}
 
 

 

The variable firstName is declared as public, so it can be accessed using the dot (.) operator directly, making the setter and getter useless. A workaround for this case is using more restricted access modifier such as protected and private:

 
 
 
 
1
private String firstName;
 
 

 

In the book Effective Java, Joshua Bloch points out this problem in item 14:

"In public classes, use accessor methods, not public fields."

Mistake #2: Assign object reference directly in the setter

Considering the following setter method:

 
 
 
 
1
private int[] scores;
2
3
public void setScores(int[] scr) {
4
    this.scores = scr;
5
}
 
 

 

The following code demonstrates this problem:

 
 
 
 
1
int[] myScores = {5, 5, 4, 3, 2, 4};
2
3
setScores(myScores);
4
5
displayScores();   
6
7
myScores[1] = 1;
8
9
displayScores();
 
 

 

An array of integer numbers, myScores, is initialized with 6 values (line 1) and the array is passed to the setScores() method (line 2). The method displayScores() simply prints out all scores from the array:

 
 
 
 
1
public void displayScores() {
2
    for (int i = 0; i < this.scores.length; i++) {
3
        System.out.print(this.scores[i] + " ");
4
    }
5
    System.out.println();
6
}
 
 

 

Line 3 will produce the following output:

 
 
 
 
1
5 5 4 3 2 4
 
 

 

These are all the elements of the myScores array. Now, in line 4, we can modify the value of the 2nd element in the myScores array as follows:

 
 
 
 
1
myScores[1] = 1;
 
 

 

What will happen if we call the method  displayScores() again at line 5? Well, it will produce the following output:

 
 
 
 
1
5 1 4 3 2 4
 
 

 

You realize that the value of the 2nd element is changed from 5 to 1, as a result of the assignment in line 4. Why does it matter? Well, that means the data can be modified outside the scope of the setter method, which breaks the encapsulation purpose of the setter. And why does that happen? Let’s look at the setScores()  method again:

 
 
 
 
1
public void setScores(int[] scr) {
2
    this.scores = scr;
3
}
 
 

 

The member variable scores are assigned to the method’s parameter variable scr directly. That means both of the variables are referring to the same object in memory — the myScores array object. So changes made to either the scores or myScores variables are actually made on the same object.

A workaround for this situation is to copy elements from the scr array to the scores array, one by one. The modified version of the setter would look like this:

 
 
 
 
1
public void setScores(int[] scr) {
2
    this.scores = new int[scr.length];
3
    System.arraycopy(scr, 0, this.scores, 0, scr.length);
4
}
 
 

 

What’s the difference? Well, the member variable scores is no longer referring to the object referred by the scr variable. Instead, the array scores is initialized to a new one with size equals to the size of the array scr. Then, we copy all elements from the array scr to the array scores, using System.arraycopy() method.

Run the following example again, and it will give us the following output:

 
 
 
 
1
5 5 4 3 2 4
2
5 5 4 3 2 4
 
 

 

Now, the two invocations of displayScores() produce the same output. That means the array scores is independent and different than the array scr passed into the setter, thus we have the assignment:

 
 
 
 
1
myScores[1] = 1;
 
 

 

This does not affect the array scores.

So, the rule of thumb is: If you pass an object reference into a setter method, then don’t copy that reference into the internal variable directly. Instead, you should find some ways to copy values of the passed object into the internal object, like we have copied elements from one array to another using the System.arraycopy()  method.

Mistake #3: Return the object reference directly in getter

Consider the following getter method:

 
 
 
 
1
private int[] scores;
2
3
public int[] getScores() {
4
    return this.scores;
5
}
 
 

 

And then look at the following code snippet:

 
 
 
 
1
int[] myScores = {5, 5, 4, 3, 2, 4};
2
3
setScores(myScores);
4
5
displayScores();
6
7
int[] copyScores = getScores();
8
9
copyScores[1] = 1;
10
11
displayScores();
 
 

 

It will produce the following output:

 
 
 
 
1
5 5 4 3 2 4
2
5 1 4 3 2 4
 
 

 

As you notice, the 2nd element of the array scores is modified outside the setter, in line 5. Because the getter method returns the reference of the internal variable scores directly, the outside code can obtain this reference and make a change to the internal object.

A workaround for this case is that, instead of returning the reference directly in the getter, we should return a copy of the object. This is so that the outside code can obtain only a copy, not the internal object. Therefore, we modify the above getter as follows:

 
 
 
 
1
public int[] getScores() {
2
    int[] copy = new int[this.scores.length];
3
    System.arraycopy(this.scores, 0, copy, 0, copy.length);
4
    return copy;
5
}
 
 

 

So the rule of thumb is: Do not return a reference of the original object in the getter method. Instead, it should return a copy of the original object.

5. Implementing Getters and Setters for Primitive Types

With primitive types (intfloatdoublebooleanchar…), you can freely assign/return values directly in setter/getter because Java copies the value of one primitive to another instead of copying the object reference. So, mistakes #2 and #3 can easily be avoided.

For example, the following code is safe because the setter and getter are involved in a primitive type of float:

 
 
 
 
1
private float amount;
2
3
public void setAmount(float amount) {
4
    this.amount = amount;
5
}
6
7
public float getAmount() {
8
    return this.amount;
9
}
 
 

 

So, for primitive types, there is no special trick to correctly implement the getter and setter.

6. Implementing Getters and Setters for Common Object Types

Getters and Setters for String Objects:

String is an object type, but it is immutable, which means once a String object is created, its String literal cannot be changed. In other words, every change on that String object will result in a newly created String object. So, like primitive types, you can safely implement getter and setter for a String variable, like this:

 
 
 
 
1
private String address;
2
3
public void setAddress(String addr) {
4
    this.address = addr;
5
}
6
7
public String getAddress() {
8
    return this.address;
9
}
 
 

 

Getters and Setters for Date Objects:

The java.util.Date class implements the clone() method from the Object class. The method clone() returns a copy of the object, so we can use it for the getter and setter, as shown in the following example:

 
 
 
 
1
private Date birthDate;
2
3
public void setBirthDate(Date date) {
4
    this.birthDate = (Date) date.clone();
5
}
6
7
public Date getBirthDate() {
8
    return (Date) this.birthDate.clone();
9
}
 
 

 

The clone() method returns an Object, so we must cast it to the Date type.You can learn more about this in item 39 of Effective Java by Joshua Bloch:

"Make defensive copies when needed." 

7. Implementing Getters and Setters for Collection Types

As described in mistakes #2 and #3, it’s not good to have setter and getter methods like this:

 
 
 
 
1
private List<String> listTitles;
2
3
public void setListTitles(List<String> titles) {
4
    this.listTitles = titles;
5
}
6
7
public List<String> getListTitles() {
8
    return this.listTitles;
9
}
 
 

 

Consider the following program:

 
 
 
 
1
import java.util.*;
2
3
public class CollectionGetterSetter {
4
    private List<String> listTitles;
5
6
    public void setListTitles(List<String> titles) {
7
this.listTitles = titles;
8
    }
9
10
    public List<String> getListTitles() {
11
        return this.listTitles;
12
    }
13
14
    public static void main(String[] args) {
15
        CollectionGetterSetter app = new CollectionGetterSetter();
16
        List<String> titles1 = new ArrayList();
17
        titles1.add("Name");
18
        titles1.add("Address");
19
        titles1.add("Email");
20
        titles1.add("Job");
21
22
        app.setListTitles(titles1);
23
24
        System.out.println("Titles 1: " + titles1);
25
26
        titles1.set(2, "Habilitation");
27
28
        List<String> titles2 = app.getListTitles();
29
        System.out.println("Titles 2: " + titles2);
30
31
        titles2.set(0, "Full name");
32
33
        List<String> titles3 = app.getListTitles();
34
        System.out.println("Titles 3: " + titles3);
35
36
    }
37
38
}
 
 

 

According to the rules for implementing getter and setter, the three System.out.println() statements should produce the same result. However, when running the above program, it produces the following output:

 
 
 
 
1
Titles 1: [Name, Address, Email, Job]
2
Titles 2: [Name, Address, Habilitation, Job]
3
Titles 3: [Full name, Address, Habilitation, Job]
 
 

 

For a collection of Strings, one solution is to use the constructor that takes another collection as an argument. For example, we can change the code of the above getter and setter as follows:

 
 
 
 
1
public void setListTitles(List<String> titles) {
2
    this.listTitles = new ArrayList<String>(titles);
3
}
4
5
public List<String> getListTitles() {
6
    return new ArrayList<String>(this.listTitles);   
7
}
 
 

 

Re-compile and run the CollectionGetterSetter program; it will produce the desired output:

 
 
 
 
1
Titles 1: [Name, Address, Email, Job]
2
Titles 2: [Name, Address, Email, Job]
3
Titles 3: [Name, Address, Email, Job]
 
 

 

NOTE: The constructor approach above is only working with Collections of Strings, but it will not work for Collections objects. Consider the following example for a Collection of the Person object:

 
 
 
 
1
import java.util.*; 
2
3
public class CollectionGetterSetterObject { 
4
    private List<Person> listPeople; 
5
6
    public void setListPeople(List<Person> list) { 
7
        this.listPeople = new ArrayList<Person>(list); 
8
    } 
9
10
    public List<Person> getListPeople() { 
11
        return new ArrayList<Person>(this.listPeople); 
12
    } 
13
14
    public static void main(String[] args) { 
15
        CollectionGetterSetterObject app = new CollectionGetterSetterObject(); 
16
17
        List<Person> list1 = new ArrayList<Person>(); 
18
        list1.add(new Person("Peter")); 
19
        list1.add(new Person("Alice")); 
20
        list1.add(new Person("Mary")); 
21
22
        app.setListPeople(list1); 
23
24
        System.out.println("List 1: " + list1); 
25
26
        list1.get(2).setName("Maryland"); 
27
28
        List<Person> list2 = app.getListPeople(); 
29
        System.out.println("List 2: " + list2); 
30
31
        list1.get(0).setName("Peter Crouch"); 
32
33
        List<Person> list3 = app.getListPeople(); 
34
        System.out.println("List 3: " + list3); 
35
36
    } 
37
} 
38
39
class Person { 
40
    private String name; 
41
42
    public Person(String name) { 
43
        this.name = name; 
44
    } 
45
46
    public String getName() { 
47
        return this.name; 
48
    } 
49
50
    public void setName(String name) { 
51
        this.name = name; 
52
    } 
53
54
    public String toString() { 
55
        return this.name; 
56
    } 
57
}
 
 

 

It produces the following output when running:

 
 
 
 
1
List 1: [Peter, Alice, Mary]
2
List 2: [Peter, Alice, Maryland]
3
List 3: [Peter Crouch, Alice, Maryland]
 
 

 

Because unlike String, for which new objects will be created whenever a String object is copied, other Object types are not. Only references are copied, so that’s why two Collections are distinct but they contain the same objects. In other words, it is because we haven’t provided any means for copying objects.

Look at the Collection API; we found that ArrayListHashMapHashSet, etc. implement their own clone() methods. These methods return shallow copies, which do not copy elements from the source Collection to the destination. According to the Javadoc of the clone() method of the ArrayList class:

public Object clone()
Returns a shallow copy of this ArrayList instance.
(The elements themselves are not copied.)

Thus, we cannot use the clone() method of these Collection classes. The solution is to implement the clone() method for our own defined object — the Person class in the above example. We implement the clone() method in the Person class as shown below:

 
 
 
 
1
public Object clone() {
2
    Person aClone = new Person(this.name);
3
    return aClone;
4
}
 
 

 

The setter for listPeople is modified as follows:

 
 
 
 
1
public void setListPeople(List<Person> list) {
2
    for (Person aPerson : list) {
3
        this.listPeople.add((Person) aPerson.clone());
4
    }
5
}
 
 

 

The corresponding getter is modified, as shown below:

 
 
 
 
1
public List<Person> getListPeople() {
2
    List<Person> listReturn = new ArrayList<Person>();
3
    for (Person aPerson : this.listPeople) {
4
        listReturn.add((Person) aPerson.clone());
5
    }
6
7
    return listReturn;
8
}
 
 

 

That results in a new version of the class CollectionGetterSetterObject, shown below:

 
 
 
 
1
import java.util.*;
2
3
public class CollectionGetterSetterObject {
4
    private List<Person> listPeople = new ArrayList<Person>();
5
6
    public void setListPeople(List<Person> list) {
7
        for (Person aPerson : list) {
8
            this.listPeople.add((Person) aPerson.clone());
9
        }
10
    }
11
12
    public List<Person> getListPeople() {
13
        List<Person> listReturn = new ArrayList<Person>();
14
        for (Person aPerson : this.listPeople) {
15
            listReturn.add((Person) aPerson.clone());
16
        }
17
18
        return listReturn;
19
    }
20
21
    public static void main(String[] args) {
22
        CollectionGetterSetterObject app = new CollectionGetterSetterObject();
23
24
        List<Person> list1 = new ArrayList<Person>();
25
        list1.add(new Person("Peter"));
26
        list1.add(new Person("Alice"));
27
        list1.add(new Person("Mary"));
28
29
        app.setListPeople(list1);
30
31
        System.out.println("List 1: " + list1);
32
33
        list1.get(2).setName("Maryland");
34
35
        List<Person> list2 = app.getListPeople();
36
        System.out.println("List 2: " + list2);
37
38
        list1.get(0).setName("Peter Crouch");
39
40
        List<Person> list3 = app.getListPeople();
41
        System.out.println("List 3: " + list3);
42
43
    }
44
}
 
 

 

Compile and run the new version of CollectionGetterSetterObject; it will produce the desired output:

 
 
 
 
1
List 1: [Peter, Alice, Mary] 
2
List 2: [Peter, Alice, Mary] 
3
List 3: [Peter, Alice, Mary]
 
 

 

So, the key points for implementing getter and setter for a Collection type are:

  • For a Collection of String objects, it does not need any special tweak since String objects are immutable.
  • For a Collection of custom types of an object:
    • Implement the clone() method for the custom type.
    • For the setter, add cloned items from the source Collection to the destination one.
    • For the getter, create a new Collection, which is being returned. Add cloned items from the original Collection to the new one.

8. Implementing Getters and Setters for Your Own Type

If you define a custom type of object, you should implement the clone() method for your own type. For example:

 
 
 
 
1
class Person {
2
    private String name;
3
4
    public Person(String name) {
5
        this.name = name;
6
    }
7
8
    public String getName() {
9
        return this.name;
10
    }
11
12
    public void setName(String name) {
13
        this.name = name;
14
    }
15
16
    public String toString() {
17
        return this.name;
18
    }
19
20
    public Object clone() {
21
        Person aClone = new Person(this.name);
22
        return aClone;
23
    }
24
}
 
 

 

As we can see, the class Person implements its  clone() method to return a cloned version of itself. Then, the setter method should be implemented like below:

 
 
 
 
1
public void setFriend(Person person) {
2
    this.friend = (Person) person.clone();
3
}
 
 

 

And for the getter method:

 
 
 
 
1
public Person getFriend() {
2
    return (Person) this.friend.clone();
3
}
 
 

 

So, the rules for implementing getter and setter for a custom object type are:

  • Implement a clone() method for the custom type.
  • Return a cloned object from the getter.
  • Assign a cloned object in the setter.

Conclusion

Java getter and setter seems to be simple, yet it can be dangerous if implemented naively. It could even be a source of problems that cause your code to misbehave. Or worse, one could easily exploit your programs by insidiously manipulating the arguments to, and returned objects from, your getters and setters. So, be careful and consider implementing the best practices mentioned above.

Hope you enjoyed!

Further Reading

Why Should I Write Getters and Setters?

Getter/Setter: The Most Hated Practice in Java

Setters, Method Handles, and Java 11

分享到:
评论

相关推荐

    99-智慧园区数据平台方案.pptx

    99-智慧园区数据平台方案.pptx

    node-v12.11.1-x86.msi

    Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    基于Springboot+Vue华强北商城二手手机管理系统-毕业源码案例设计.zip

    网络技术和计算机技术发展至今,已经拥有了深厚的理论基础,并在现实中进行了充分运用,尤其是基于计算机运行的软件更是受到各界的关注。加上现在人们已经步入信息时代,所以对于信息的宣传和管理就很关键。系统化是必要的,设计网上系统不仅会节约人力和管理成本,还会安全保存庞大的数据量,对于信息的维护和检索也不需要花费很多时间,非常的便利。 网上系统是在MySQL中建立数据表保存信息,运用SpringBoot框架和Java语言编写。并按照软件设计开发流程进行设计实现。系统具备友好性且功能完善。 网上系统在让售信息规范化的同时,也能及时通过数据输入的有效性规则检测出错误数据,让数据的录入达到准确性的目的,进而提升数据的可靠性,让系统数据的错误率降至最低。 关键词:vue;MySQL;SpringBoot框架 【引流】 Java、Python、Node.js、Spring Boot、Django、Express、MySQL、PostgreSQL、MongoDB、React、Angular、Vue、Bootstrap、Material-UI、Redis、Docker、Kubernetes

    Excel模版:工资条模板

    Excel工资条模板是一种预先设计好的电子表格文件,主要用于生成和打印员工的工资单,让员工清楚了解自己的工资组成和扣款详情。模板通常包含了以下几个关键部分: 1. **员工信息区**: - 姓名 - 员工编号/工号 - 部门 - 职位 2. **工资构成区**: - 基本工资 - 岗位工资 - 绩效奖金 - 加班工资 - 其他补贴(如交通补贴、餐补、全勤奖等) - 各项津贴(如高温补贴、取暖费等) - 其他应发收入(如年终奖、提成、福利等) 3. **扣款项目区**: - 社保扣款(养老保险、医疗保险、失业保险、工伤保险、生育保险) - 住房公积金 - 个人所得税 - 其他扣款(如迟到、旷工、违规罚款等) - 预借还款(如有) 4. **工资结算区**: - 应发工资总额 - 扣款总额 - 实发工资 5. **备注栏**: - 用于标注本月工资的特殊情况说明,如请假、调休、加班等情况。 6. **签名栏**: - 供员工确认工资数额无误后签名,也可以

    29-【智慧城市与政府治理分会场】10亿大数据助推都市治理-30页.pdf

    29-【智慧城市与政府治理分会场】10亿大数据助推都市治理-30页.pdf

    基于Springboot+Vue的租房管理系统-毕业源码案例设计.zip

    网络技术和计算机技术发展至今,已经拥有了深厚的理论基础,并在现实中进行了充分运用,尤其是基于计算机运行的软件更是受到各界的关注。加上现在人们已经步入信息时代,所以对于信息的宣传和管理就很关键。系统化是必要的,设计网上系统不仅会节约人力和管理成本,还会安全保存庞大的数据量,对于信息的维护和检索也不需要花费很多时间,非常的便利。 网上系统是在MySQL中建立数据表保存信息,运用SpringBoot框架和Java语言编写。并按照软件设计开发流程进行设计实现。系统具备友好性且功能完善。 网上系统在让售信息规范化的同时,也能及时通过数据输入的有效性规则检测出错误数据,让数据的录入达到准确性的目的,进而提升数据的可靠性,让系统数据的错误率降至最低。 关键词:vue;MySQL;SpringBoot框架 【引流】 Java、Python、Node.js、Spring Boot、Django、Express、MySQL、PostgreSQL、MongoDB、React、Angular、Vue、Bootstrap、Material-UI、Redis、Docker、Kubernetes

    线路工区光缆中断抢险预案.docx

    5G通信行业、网络优化、通信工程建设资料。

    299-教育数据资产管理平台及配套解决方案.pptx

    299-教育数据资产管理平台及配套解决方案.pptx

    太戈编程第345题答案

    abababababababab

    基于STM32F103C8单片机设计-旋转编码器数码管显示程序KEIL工程源码.zip

    STM32学习软件编程资料,STM32F103C8单片机经典外设应用设计实例软件源代码,KEIL工程文件,可供学习参考。

    5GKPI指标定义.pptx

    5G通信行业、网络优化、通信工程建设资料。

    全业务端到端-L2题库.xlsx

    5G通信行业、网络优化、通信工程建设资料

    3M 轨道砂光机精英系列说明书

    3M 轨道砂光机精英系列说明书

    基于Springboot+Vue教师工作量管理系统-毕业源码案例设计.zip

    网络技术和计算机技术发展至今,已经拥有了深厚的理论基础,并在现实中进行了充分运用,尤其是基于计算机运行的软件更是受到各界的关注。加上现在人们已经步入信息时代,所以对于信息的宣传和管理就很关键。系统化是必要的,设计网上系统不仅会节约人力和管理成本,还会安全保存庞大的数据量,对于信息的维护和检索也不需要花费很多时间,非常的便利。 网上系统是在MySQL中建立数据表保存信息,运用SpringBoot框架和Java语言编写。并按照软件设计开发流程进行设计实现。系统具备友好性且功能完善。 网上系统在让售信息规范化的同时,也能及时通过数据输入的有效性规则检测出错误数据,让数据的录入达到准确性的目的,进而提升数据的可靠性,让系统数据的错误率降至最低。 关键词:vue;MySQL;SpringBoot框架 【引流】 Java、Python、Node.js、Spring Boot、Django、Express、MySQL、PostgreSQL、MongoDB、React、Angular、Vue、Bootstrap、Material-UI、Redis、Docker、Kubernetes

    2023年亚太杯A题附件一,苹果图像数据集

    2023年亚太杯A题附件一,苹果图像数据集

    移动代维发电系统考试L2.xlsx

    5G通信、网络优化与通信建设

    59-《煤矿测量规程(1989版)》150.pdf

    59-《煤矿测量规程(1989版)》150.pdf

    施工现场安全技术交底模板.doc

    5G通信行业、网络优化、通信工程建设资料。

    基于YOLOv7的植物虫害识别&防治系统

    由于当今全球气候变化异常,农作物病虫害频发,而且农作物病种类多,成因复杂,其预防和识别难度较大,且传统病虫害识别方法大多靠人目视手查,需要一定的专家经验,具有主观性强、识别准确率低等缺点.而信息技术作为解决农作物病虫害智能、快速识别的新技术、新方法,我们计划利用农业信息大数据智能决策分析系统,建立完善一体化的智能农业信息监测系统等.本文便是基于深度学习将计算机视觉、图像识别等技术运用于农作物病虫害检测中,开发智能病虫害检测系统,以提高病虫害检测准确率,减少病虫害对农业生产的危害

Global site tag (gtag.js) - Google Analytics