Modifier静态属性

JAVA 反射机制中,Field的getModifiers()方法返回int类型值表示该字段的修饰符。

其中,该修饰符是java.lang.reflect.Modifier的静态属性。

对应表如下:

PUBLIC: 1
PRIVATE: 2
PROTECTED: 4
STATIC: 8
FINAL: 16
SYNCHRONIZED: 32
VOLATILE: 64
TRANSIENT: 128
NATIVE: 256
INTERFACE: 512
ABSTRACT: 1024
STRICT: 2048
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
xmodifier 是使用 XPATH 创建或者更 XML。XPATH 可以用来搜索 XML,但是有时候也可以用来编辑或者创建 XML: XPath Value Desc /ns:root/ns:element1 add <ns:element1/> /ns:root/ns:element2[@attr=1] add <ns:element2 attr="1"/> /ns:root/ns:element2/@attr 1 add <ns:element2 attr="1"/> /ns:root/ns:element1/ns:element11 add <ns:element11/> /ns:root/ns:element3 TEXT add <ns:element3>TEXT</ns:element3> /ns:root/ns:element1[ns:element12]/ns:element13 add <ns:element13/> //PersonList/Person[2]/Name NewName set the second Person node's Name Text //PersonList/Person[2]/Name/text() NewName set the second Person node's Name Text //PersonList/Person[1]/Name(:delete) delete this Name node //PersonList/Person(:add)/Name NewName alway add a new Person node //PersonList/Person(:insertBefore(Person[Name='Name2']))/Name NewName add a new Person node before Person named "Name2" 代码示例: 创建新的 XML Document document = createDocument(); //empty document     XModifier modifier = new XModifier(document);     modifier.setNamespace("ns", "http://localhost");     // create an empty element     modifier.addModify("/ns:root/ns:element1");     // create an element with attribute     modifier.addModify("/ns:root/ns:element2[@attr=1]");     // append an new element to existing element1     modifier.addModify("/ns:root/ns:element1/ns:element11");     // create an element with text     modifier.addModify("/ns:root/ns:element3", "TEXT");     modifier.modify(); XML: <root  XML: 原始 XML: <root  XML: <root  ns:element13 标签:xmodifier
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值