Java Code Examples for jodd.util.StringUtil#isEmpty()

The following examples show how to use jodd.util.StringUtil#isEmpty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BrokeServer.java    From netty-pubsub with MIT License 5 votes vote down vote up
@Override
public void start() {
	ServerBootstrap serverBootstrap = new ServerBootstrap();
	serverBootstrap.group(boss, worker).channel(NioServerSocketChannel.class)
	.childHandler(new ChanelInitializerHandler())
	.childOption(ChannelOption.SO_KEEPALIVE, true);
	try {
		ChannelFuture channelFuture;
		if(!StringUtil.isEmpty(config.getConfig().getHost())){
			channelFuture=serverBootstrap.bind(config.getConfig().getHost(),Integer.parseInt(config.getConfig().getPort())).sync();
		}else{
			channelFuture = serverBootstrap.bind(Integer.parseInt(config.getConfig().getPort())).sync();
		} 
		channelFuture.addListener(new GenericFutureListener<Future<? super Void>>() {
			@Override
			public void operationComplete(Future<? super Void> future) throws Exception {   
				if(future.isSuccess()||future.isDone()){
					LOGGER.info("��broker��������ip->"+config.getConfig().getHost()+" port->"+config.getConfig().getPort());
				}else{
					LOGGER.info("��broker������ʧ��");
				}
			}
		});
		//�ж��Ƿ�����Ⱥ
		if(config.getConfig().getEnableCluster()){
			//��������Ⱥģʽ��������ע��zookeeper
			ServerConfig serverConfig = config.getConfig();
			ZkRegister.getInstance().register(serverConfig.getZkRootPath()+"/broker_",serverConfig.getHost()+":"+serverConfig.getPort());
		}
		 channelFuture.channel().closeFuture().sync();
	} catch (InterruptedException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}finally {
		stop();
	}
}
 
Example 2
Source File: TextUtils.java    From DAFramework with MIT License 5 votes vote down vote up
public static String[] rebuildArray(String[] arr) {
	if (arr != null) {
		List<String> list = new ArrayList<String>(Arrays.asList(arr));
		for (Iterator<String> iter = list.iterator(); iter.hasNext(); ) {
			String s = iter.next();
			if (StringUtil.isEmpty(s)) {
				iter.remove();
			}
		}
		String[] newArr = new String[list.size()];
		return list.toArray(newArr);
	}
	return new String[0];
}
 
Example 3
Source File: TextUtils.java    From wES with MIT License 5 votes vote down vote up
public static String[] rebuildArray(String[] arr) {
	if (arr != null) {
		List<String> list = new ArrayList<String>(Arrays.asList(arr));
		for (Iterator<String> iter = list.iterator(); iter.hasNext(); ) {
			String s = iter.next();
			if (StringUtil.isEmpty(s)) {
				iter.remove();
			}
		}
		String[] newArr = new String[list.size()];
		return list.toArray(newArr);
	}
	return new String[0];
}
 
Example 4
Source File: OAuth2Util.java    From jeewx with Apache License 2.0 5 votes vote down vote up
/**
 * 方法描述: 获取URL值
 * 作    者: Administrator
 * 日    期: 2015年1月13日-下午10:17:01
 * @param clazz
 * @param currentMethodName
 * @param paramsMap
 * @return 
 * 返回类型: String
 */
public static String obtainTargetUrl(Class clazz ,String currentMethodName,Map<String,String> paramsMap) {
	if(StringUtil.isEmpty(currentMethodName ) || clazz == null){
		return null;
	}
	StringBuffer targetURL =  new StringBuffer();
	String suffixStr = ".do?";
	targetURL.append(ResourceBundle.getBundle("sysConfig").getString("domain"));
	RequestMapping annotation = (RequestMapping)clazz.getAnnotation(RequestMapping.class);
	if(annotation != null){
		targetURL.append(annotation.value()[0]).append(suffixStr);
	}
	Method[] methodArray = clazz.getMethods();
	for (Method tempMethod : methodArray) {
		if(currentMethodName.equals(tempMethod.getName())){
			targetURL.append(tempMethod.getAnnotation(RequestMapping.class).params()[0]);
			break;
		}
	}
	if(paramsMap != null && paramsMap.size() > 0){
		Set<String> keys = paramsMap.keySet();
		for (String key : keys) {
			targetURL.append("&").append(key).append("=").append(paramsMap.get(key));
		}
	}
	return targetURL.toString();
}
 
Example 5
Source File: EventBus.java    From netty-pubsub with MIT License 4 votes vote down vote up
public static void setSubscribListener(String topic,SubscribListener subscribListener) {
	if(StringUtil.isEmpty(topic)&&subscribListener==null){
		throw new RuntimeException("topic and subscribListener not null");
	}
	EventBus.subscribListenerTable.put(topic, subscribListener);
}
 
Example 6
Source File: GeneratorDialog.java    From ueboot with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void onOK() {
    //保存当前设置
    writeDefaultSetting();
    com.ueboot.generator.CodeGenerator ac = new com.ueboot.generator.CodeGenerator();
    ac.initProperties();
    String clazzName = entityPackageName.getText();
    Class<?> clz = null;
    try {
        if (clazzName == null) {
            System.out.println("类名为空!");
            JOptionPane.showMessageDialog(null, " 类名不能为空 ", " 提示 ", JOptionPane.ERROR_MESSAGE);
            return;
        }
        String entityFilePath = ac.getProjectPah() + entityModuleName.getText() + separator + "target" + separator + "classes" + separator;
        URL[] urls = {new URL("file:" + entityFilePath)};
        System.out.println(urls[0].toURI().toString());
        URLClassLoader cl = new URLClassLoader(urls,this.getClass().getClassLoader());
        clz = Class.forName(clazzName, false, cl);
    } catch (Exception e) {
        e.printStackTrace();
        JOptionPane.showMessageDialog(null, " 未找到"+clazzName+"类文件,请先进行编译,防止class文件无法读取 ", " 提示 ", JOptionPane.ERROR_MESSAGE);
        return;
    }

    String classPath = clz.getClassLoader().getResource("").getPath();
    System.out.println("ClassPath:" + classPath);

    System.out.println("类名:" + clz.getSimpleName());
    if (StringUtil.isNotEmpty(repositoryPackageName.getText())) {
        if (StringUtil.isEmpty(repositoryModuleName.getText())) {
            JOptionPane.showMessageDialog(null, " repositoryModuleName不能为空 ", " 提示 ", JOptionPane.ERROR_MESSAGE);
            return;
        }
        ac.createRepository(clz, repositoryPackageName.getText(), repositoryModuleName.getText());
    }
    if (StringUtil.isNotEmpty(servicePackageName.getText())) {
        if (StringUtil.isEmpty(serviceModuleName.getText())) {
            JOptionPane.showMessageDialog(null, " serviceModuleName不能为空 ", " 提示 ", JOptionPane.ERROR_MESSAGE);
            return;
        }
        ac.createService(clz, servicePackageName.getText(), serviceModuleName.getText(), repositoryPackageName.getText());
    }
    if (StringUtil.isNotEmpty(controllerPackageName.getText())) {
        if (StringUtil.isEmpty(controllerModuleName.getText())) {
            JOptionPane.showMessageDialog(null, " controllerModuleName不能为空 ", " 提示 ", JOptionPane.ERROR_MESSAGE);
            return;
        }
        ac.createController(clz, controllerPackageName.getText(), servicePackageName.getText(), controllerModuleName.getText(),requestPath.getText());
    }
    if (StringUtil.isNotEmpty(vueFilePath.getText())) {
        if (StringUtil.isEmpty(vuePageModuleName.getText())) {
            JOptionPane.showMessageDialog(null, " vuePageModuleName不能为空 ", " 提示 ", JOptionPane.ERROR_MESSAGE);
            return;
        }
        ac.createPages(clz, vuePageModuleName.getText(), vueFilePath.getText(), requestPath.getText());
    }
    JOptionPane.showMessageDialog(null, "生成成功,如使用Git,请手工add文件! ", " 提示 ", JOptionPane.OK_OPTION);
}