package com.example.data_structure.vo; import org.springframework.stereotype.Component; @Component public class Bar { private int value; private String color; public Bar(int value, String color) { this.value = value; this.color = color; } public Bar() { } //getter public int getValue() { return value; } public String getColor() { return color; } //setter public void setValue(int value) { this.value = value; } public void setColor(String color) { this.color = color; } //toString @Override public String toString() { return "Bar{" + "value=" + value + ", color='" + color + '\'' + '}'; } //copy public static Bar copyBar(Bar bar){ Bar copyBar=new Bar(bar.getValue(),bar.getColor()); return copyBar; } }