本文整理汇总了Java中org.apache.commons.lang3.ObjectUtils.allNotNull方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectUtils.allNotNull方法的具体用法?Java ObjectUtils.allNotNull怎么用?Java ObjectUtils.allNotNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.ObjectUtils
的用法示例。
在下文中一共展示了ObjectUtils.allNotNull方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNode
import org.apache.commons.lang3.ObjectUtils; //导入方法依赖的package包/类
/**
* 创建节点
*
* @param path
* @param data
* @param mode
* @return
*/
public boolean createNode(String path, String data, CreateMode mode) {
if (!ObjectUtils.allNotNull(zkClient, path)) {
return Boolean.FALSE;
}
try {
Stat stat = exists(path);
if (stat == null) {
mode = mode == null ? CreateMode.PERSISTENT : mode;
String opResult;
if (ObjectUtils.allNotNull(data)) {
opResult = zkClient.create().creatingParentContainersIfNeeded().withMode(mode).forPath(path, data.getBytes(Charsets.UTF_8));
} else {
opResult = zkClient.create().creatingParentContainersIfNeeded().withMode(mode).forPath(path);
}
return Objects.equal(opResult, path);
}
return Boolean.TRUE;
} catch (Exception e) {
log.error("create node fail! path: {}, error: {}", path, e);
}
return Boolean.FALSE;
}
示例2: deleteNode
import org.apache.commons.lang3.ObjectUtils; //导入方法依赖的package包/类
/**
* 删除节点 递归删除子节点
*
* @param path
* @param version
* @return
*/
public boolean deleteNode(String path, Integer version) {
if (!ObjectUtils.allNotNull(zkClient, path)) {
return Boolean.FALSE;
}
try {
Stat stat = exists(path);
if (stat != null) {
if (version == null) {
zkClient.delete().deletingChildrenIfNeeded().forPath(path);
} else {
zkClient.delete().deletingChildrenIfNeeded().withVersion(version).forPath(path);
}
}
return Boolean.TRUE;
} catch (Exception e) {
log.error("delete node fail! path: {}, error: {}", path, e);
}
return Boolean.FALSE;
}
示例3: setNodeData
import org.apache.commons.lang3.ObjectUtils; //导入方法依赖的package包/类
/**
* 设置节点数据
*
* @param path
* @param data
* @param version
* @return
*/
public boolean setNodeData(String path, byte[] data, Integer version) {
if (!ObjectUtils.allNotNull(zkClient, path)) {
return Boolean.FALSE;
}
try {
Stat stat = exists(path);
if (stat != null) {
if (version == null) {
zkClient.setData().forPath(path, data);
} else {
zkClient.setData().withVersion(version).forPath(path, data);
}
return Boolean.TRUE;
}
} catch (Exception e) {
log.error("set node data fail! path: {}, error: {}", path, e);
}
return Boolean.FALSE;
}
示例4: listenerPathChildrenCache
import org.apache.commons.lang3.ObjectUtils; //导入方法依赖的package包/类
/**
* 设置子节点更改监听
*
* @param path
* @throws Exception
*/
public boolean listenerPathChildrenCache(String path, BiConsumer<CuratorFramework, PathChildrenCacheEvent> biConsumer) {
if (!ObjectUtils.allNotNull(zkClient, path, biConsumer)) {
return Boolean.FALSE;
}
try {
Stat stat = exists(path);
if (stat != null) {
PathChildrenCache watcher = new PathChildrenCache(zkClient, path, true);
watcher.start(PathChildrenCache.StartMode.POST_INITIALIZED_EVENT);
//该模式下 watcher在重连的时候会自动 rebuild 否则需要重新rebuild
watcher.getListenable().addListener(biConsumer::accept, pool);
if (!pathChildrenCaches.contains(watcher)) {
pathChildrenCaches.add(watcher);
}
// else{
// watcher.rebuild();
// }
return Boolean.TRUE;
}
} catch (Exception e) {
log.error("listen path children cache fail! path:{} , error:{}", path, e);
}
return Boolean.FALSE;
}
示例5: readTargetChildsData
import org.apache.commons.lang3.ObjectUtils; //导入方法依赖的package包/类
/**
* 读取指定节点的子菜单的值
*
* @param path
* @return
*/
public Map<String, String> readTargetChildsData(String path) {
if (!ObjectUtils.allNotNull(zkClient, path)) {
return null;
}
Map<String, String> map = null;
try {
Stat stat = exists(path);
if (stat != null) {
List<String> childrens = zkClient.getChildren().forPath(path);
GetDataBuilder dataBuilder = zkClient.getData();
if (childrens != null) {
map = childrens.stream().collect(Collectors.toMap(Function.identity(), (child) -> {
try {
return new String(dataBuilder.forPath(ZKPaths.makePath(path, child)), Charsets.UTF_8);
} catch (Exception e1) {
return null;
}
}));
}
}
} catch (Exception e) {
log.error("get target childs data fail!, path:{} , error:{}", path, e);
}
return map;
}
示例6: getNodeData
import org.apache.commons.lang3.ObjectUtils; //导入方法依赖的package包/类
/**
* 获取指定节点的值
*
* @param path
* @return
*/
public byte[] getNodeData(String path) {
if (!ObjectUtils.allNotNull(zkClient, path)) {
return null;
}
try {
Stat stat = exists(path);
if (stat != null) {
return zkClient.getData().forPath(path);
}
} catch (Exception e) {
log.error("get node data fail! path: {}, error: {}", path, e);
}
return null;
}
示例7: exists
import org.apache.commons.lang3.ObjectUtils; //导入方法依赖的package包/类
/**
* 检查节点是否存在
*
* @param path
* @return
*/
public Stat exists(String path) {
if (!ObjectUtils.allNotNull(zkClient, path)) {
return null;
}
try {
return zkClient.checkExists().forPath(path);
} catch (Exception e) {
log.error("check node exists fail! path: {}, error: {}", path, e);
}
return null;
}
示例8: build
import org.apache.commons.lang3.ObjectUtils; //导入方法依赖的package包/类
public Baseline build() {
if (!ObjectUtils.allNotNull(padding)) {
throw new IllegalStateException("Missing required field.");
}
if (percent > 100) {
throw new IllegalStateException("percent cannot be greater than 100.");
}
if (padding < 1) {
throw new IllegalStateException("padding cannot be less than 1.");
}
return new Baseline(this);
}
示例9: setup
import org.apache.commons.lang3.ObjectUtils; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
final Profile profile = new ProfilePlistReader(new ProtocolFactory(Collections.singleton(new MantaProtocol()))).read(
new Local("../profiles/Joyent Triton Object Storage (us-east).cyberduckprofile"));
final String hostname;
final Local file;
if(ObjectUtils.allNotNull(System.getProperty("manta.key_path"), System.getProperty("manta.url"))) {
file = new Local(System.getProperty("manta.key_path"));
hostname = new URL(System.getProperty("manta.url")).getHost();
}
else {
final String key = "-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEAvlJTtsPpgDlSvoYwmWh9h6RMJBiVPQXUwqPgmdQIGjnY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pN0dGaV4ui7Kbt9Ist9adl39ZNKs83CQPs07rl+5zPTFeS\ni8MyRt6UAlrMVeiSYrhlI6hq6vC0/X30CR9tgCNLIHZvc3Ss8e90LeqzeJxnak7Y\n/bdU1lbuIFwSf4kDv6I4QQKBgF6OmWFls0N2fNCl/4txDm9qINrbBEl9Mlc9PlO9\npRmwDOpTgZgPzbfm2sgcbt0cP+rKfHO9lsoqCLgJS6pcovLmqPX6b2VILACK2c4M\nDVEfgA6uZ+ErDtpUm9nQiKKhQU+NRiszGqayUPbMnYQ8YuA4RzUN+whb474s3SAw\nZ18hAoGAXsOEFOFjaaGtbXGOZyyqdYoD5G22Qfi89tbEled5OeSsuFayix6vMt4T\nItr+gF82ED4fX42FIrg6igJ34z2pzsP4hIqH3yNRfc9rwv7GWBKYWzUDrBxEg5cx\nbt2CJUfZImSP9K1uahfc8MP7FFMdnnWPlkOpNc76G8FIpchIsNU=\n-----END RSA PRIVATE KEY----- ";
file = TemporaryFileServiceFactory.get().create(new AlphanumericRandomStringService().random());
LocalTouchFactory.get().touch(file);
IOUtils.write(key, file.getOutputStream(false), Charset.defaultCharset());
hostname = profile.getDefaultHostname();
}
final String user = System.getProperty("manta.user");
final Host host = new Host(profile, hostname, new Credentials(user).withIdentity(file));
session = new MantaSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager());
session.open(new DisabledHostKeyCallback(), new DisabledLoginCallback());
session.login(new DisabledPasswordStore(), new DisabledLoginCallback(), new DisabledCancelCallback());
final String testRoot = "cyberduck-test-" + new AlphanumericRandomStringService().random();
testPathPrefix = new Path(new MantaAccountHomeInfo(host.getCredentials().getUsername(), host.getDefaultPath()).getAccountPrivateRoot(), testRoot, EnumSet.of(Type.directory));
session.getClient().putDirectory(testPathPrefix.getAbsolute());
}
示例10: build
import org.apache.commons.lang3.ObjectUtils; //导入方法依赖的package包/类
public NavigationTimingRequest build() {
if (!ObjectUtils.allNotNull(serviceLevelAgreement, log)) {
throw new IllegalStateException("Missing required field.");
}
return new NavigationTimingRequest(this);
}
示例11: build
import org.apache.commons.lang3.ObjectUtils; //导入方法依赖的package包/类
public Log build() {
if (!ObjectUtils.allNotNull(team, browser, environmentTester, environmentTarget, testInfo)) {
throw new IllegalStateException("Missing required field.");
}
return new Log(this);
}