最近,我一直在阅读有关序列化的内容,一切看起来都可以理解。带有import PerfectScrollbar from 'perfect-scrollbar';
class MyComponent extends Component {
componentDidMount() {
const parent = new PerfectScrollbar('.parent');
const sb1 = new PerfectScrollbar('.sb1');
const sb2 = new PerfectScrollbar('.sb2');
parent.update();
sb1.update();
sb2.update();
}
render() {
return(
<div className="parent">
<div className="sb1" ref="ref1">
Section 1
</div>
<div className="sb2" ref="ref2">
Section 2
</div>
</div>
);
}
}
export default MyComponent;
关键字的值被序列化,import PerfectScrollbar from 'react-perfect-scrollbar'
class MyComponent extends Component {
render() {
return(
<PerfectScrollbar>
<div className="sb1" ref="ref1">
Section 1
</div>
<div className="sb2" ref="ref2">
Section 2
</div>
</PerfectScrollbar>
);
}
}
export default MyComponent;
值不被序列化,在select cols.column_name
from user_tab_columns cols
where cols.table_name = 'table_name_here';
中,final
被忽略,依此类推。我已经阅读了几乎所有内容,但是我有一个问题,在Google或Stack Overflow中都找不到答案:
数据为static
时会发生什么?其中哪一个能胜过另一个?例如:
static transient
如果我在任何类中实现它,该接口的值将如何序列化?将其视为transient
还是static final
?
答案 0 :(得分:2)
静态final 变量将不会被序列化,因为就像 static 变量一样,它是独立于实例的类变量。 最终修饰符仅指出,一旦分配了变量,就无法再对其进行更改