org.apache.commons.lang3.builder.ToStringStyle.MULTI_LINE_STYLE

Here are the examples of the java api org.apache.commons.lang3.builder.ToStringStyle.MULTI_LINE_STYLE taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

23 Examples 7

18 Source : UserYamlTesting.java
with Apache License 2.0
from xylo

public static void main(String[] args) {
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    try {
        User user = mapper.readValue(new File("test/src/yaml/user.yaml"), User.clreplaced);
        System.out.println(ReflectionToStringBuilder.toString(user, ToStringStyle.MULTI_LINE_STYLE));
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

18 Source : BaseObject.java
with Apache License 2.0
from wgzhao

@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}

18 Source : XkcdManager.java
with Apache License 2.0
from trixon

public static void main(String[] args) throws IOException {
    Xkcd x = new XkcdManager().parse();
    System.out.println(ToStringBuilder.reflectionToString(x, ToStringStyle.MULTI_LINE_STYLE));
}

18 Source : ApacheTest.java
with MIT License
from jparams

@Test
public void testToStringWithMultiLineStyle() {
    ToStringBuilder.setDefaultStyle(ToStringStyle.MULTI_LINE_STYLE);
    ToStringVerifier.forClreplaced(ApacheTest.clreplaced).withPreset(Presets.APACHE_TO_STRING_BUILDER_MULTI_LINE_STYLE).verify();
}

18 Source : AbstractResponse.java
with GNU General Public License v3.0
from iotaledger

/**
 * Builds a string representation of this object using multiple lines
 *
 * @return Returns a string representation of this object.
 */
@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}

18 Source : Transfer.java
with Apache License 2.0
from iotaledger

/**
 * Returns a Json Object that represents this object.
 *
 * @return Returns a string representation of this object.
 */
@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}

18 Source : Transaction.java
with Apache License 2.0
from iotaledger

/**
 * Returns a String that represents this object.
 *
 * @return Returns a string representation of this object.
 */
@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}

18 Source : AWSKafkaConfig.java
with BSD 2-Clause "Simplified" License
from datamachines

public static AWSKafkaConfig parseYaml(String file) {
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    AWSKafkaYaml cfg = null;
    boolean requiredParmsInYaml = true;
    try {
        cfg = mapper.readValue(new File(file), AWSKafkaYaml.clreplaced);
        System.out.println(ReflectionToStringBuilder.toString(cfg, ToStringStyle.MULTI_LINE_STYLE));
        Map<String, String> aws = cfg.getAwsParms();
        Map<String, String> kafka = cfg.getKafkaParms();
        Map<String, String> data = cfg.getDataProcessing();
        for (String parm : AWSRequireParms) {
            if (aws.get(parm) == null) {
                requiredParmsInYaml = false;
                ParamsErrorMessage(parm, "awsParms");
            }
        }
        for (String parm : KafkaRequireParms) {
            if (kafka.get(parm) == null) {
                requiredParmsInYaml = false;
                ParamsErrorMessage(parm, "kafkaParms");
            }
        }
        // check conflicting Parameters combinations
        int numEx = 0;
        StringBuilder partErr = new StringBuilder();
        for (String parm : ExclusiveParms) {
            String test = data.get(parm);
            if (test != null && test.equals("true")) {
                if (numEx > 0) {
                    partErr.append(", ");
                }
                partErr.append(parm);
                numEx++;
            }
        }
        if (numEx > 1) {
            requiredParmsInYaml = false;
            System.err.println(partErr.toString() + " are mutually exclusive.  Only one of them may be set to true");
        }
        // Check Optional Parameters combinations
        String xAES = data.get("AES");
        String xBinAes = data.get("binAES");
        if ((xAES != null && xAES.equals("true")) || (xBinAes != null && xBinAes.equals("true"))) {
            String xAesPw = data.get("AESPW");
            if (xAesPw == null) {
                requiredParmsInYaml = false;
                ParamsErrorMessage("AESPW", "AES or binAES");
            } else {
                String checkKeyRet = AESEncrypt.checkKey(xAesPw);
                if (checkKeyRet != null) {
                    requiredParmsInYaml = false;
                    System.err.println("Error with AES Key: " + checkKeyRet);
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (requiredParmsInYaml)
        return new AWSKafkaConfig(cfg);
    else
        return null;
}

18 Source : TestGetBean.java
with Apache License 2.0
from bjmashibing

public static void main(String[] args) {
    // Person p = new Person();
    // p.setAge(1);
    // 
    ClreplacedPathXmlApplicationContext ctx = new ClreplacedPathXmlApplicationContext("applicationContext.xml");
    // Person person = (Person)ctx.getBean("person");
    // Food food = ctx.getBean("food",Food.clreplaced);
    // 
    // food.setName("�㽶");
    // 
    // person.setName("zhangsan");
    // person.setAge(18);
    // person.setFood(food);
    Person person = (Person) ctx.getBean("person");
    System.out.println(ToStringBuilder.reflectionToString(person, ToStringStyle.MULTI_LINE_STYLE));
    ;
    System.out.println(ToStringBuilder.reflectionToString(ctx, ToStringStyle.MULTI_LINE_STYLE));
    ;
}

18 Source : Configuration.java
with MIT License
from Azure

public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}

18 Source : Inode.java
with Apache License 2.0
from alibaba

@Override
public String toString() {
    for (InodeEntry inodeEntry : inodeEntryList) {
        log.debug("{}", inodeEntry);
    }
    return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}

18 Source : BbsReplyEntity.java
with MIT License
from akageun

/**
 * 무한루프로 인해 override
 *
 * @return
 */
@Override
public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}

17 Source : WebTemplateFileParsingTestApp.java
with Apache License 2.0
from xylo

public static void main(String[] args) {
    try {
        WebTemplateFile[] entries = WebTemplateFileLoader.load(new File("test/src/yaml/webTemplateFiles.yaml"));
        for (WebTemplateFile entry : entries) {
            System.out.println(ReflectionToStringBuilder.toString(entry, ToStringStyle.MULTI_LINE_STYLE));
        }
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

17 Source : MBookmarkManager.java
with Apache License 2.0
from trixon

private void debugPrint() {
    System.out.println("debugPrint");
    for (MBookmark bookmark : gereplacedems()) {
        System.out.println(ToStringBuilder.reflectionToString(bookmark, ToStringStyle.MULTI_LINE_STYLE));
    }
}

17 Source : WxCpUserServiceImplTest.java
with Apache License 2.0
from LXiong

@Test
public void testListSimpleByDepartment() throws Exception {
    List<WxCpUser> users = this.wxCpService.getUserService().listSimpleByDepartment(1, true, 0);
    replacedertNotEquals(users.size(), 0);
    for (WxCpUser user : users) {
        System.out.println(ToStringBuilder.reflectionToString(user, ToStringStyle.MULTI_LINE_STYLE));
    }
}

17 Source : WxCpUserServiceImplTest.java
with Apache License 2.0
from LXiong

@Test
public void testListByDepartment() throws Exception {
    List<WxCpUser> users = this.wxCpService.getUserService().listByDepartment(1, true, 0);
    replacedertNotEquals(users.size(), 0);
    for (WxCpUser user : users) {
        System.out.println(ToStringBuilder.reflectionToString(user, ToStringStyle.MULTI_LINE_STYLE));
    }
}

17 Source : WxCpUserServiceImplTest.java
with Apache License 2.0
from chenpengliang0909

@Test
public void testListSimpleByDepartment() throws Exception {
    List<WxCpUser> users = this.wxCpService.getUserService().listSimpleByDepartment(1L, true, 0);
    replacedertNotEquals(users.size(), 0);
    for (WxCpUser user : users) {
        System.out.println(ToStringBuilder.reflectionToString(user, ToStringStyle.MULTI_LINE_STYLE));
    }
}

17 Source : WxCpUserServiceImplTest.java
with Apache License 2.0
from chenpengliang0909

@Test
public void testListByDepartment() throws Exception {
    List<WxCpUser> users = this.wxCpService.getUserService().listByDepartment(1L, true, 0);
    replacedertNotEquals(users.size(), 0);
    for (WxCpUser user : users) {
        System.out.println(ToStringBuilder.reflectionToString(user, ToStringStyle.MULTI_LINE_STYLE));
    }
}

16 Source : MyRealm.java
with Apache License 2.0
from v5java

/**
 * 验证当前登录的Subject
 * 经测试:本例中该方法的调用时机为LoginController.login()方法中执行Subject.login()的时候
 */
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) throws AuthenticationException {
    // 获取基于用户名和密码的令牌
    // 实际上这个authcToken是从LoginController里面currentUser.login(token)传过来的
    // 两个token的引用都是一样的,本例中是:org.apache.shiro.authc.UsernamePreplacedwordToken@33799a1e
    UsernamePreplacedwordToken token = (UsernamePreplacedwordToken) authcToken;
    System.out.print("验证当前Subject时获取到token:");
    System.out.println(ReflectionToStringBuilder.toString(token, ToStringStyle.MULTI_LINE_STYLE));
    // User user = userService.getByUsername(token.getUsername());
    // if(null != user){
    // String username = user.getUsername();
    // String preplacedword = user.getPreplacedword();
    // String nickname = user.getNickname();
    // AuthenticationInfo authcInfo = new SimpleAuthenticationInfo(username, preplacedword, nickname);
    // this.setSession("currentUser", user);
    // return authcInfo;
    // }else{
    // return null;
    // }
    // 此处无需比对,比对的逻辑Shiro会做,我们只需返回一个和令牌相关的正确的验证信息
    // 说白了就是第一个参数填登录用户名,第二个参数填合法的登录密码(可以是从数据库中取到的,本例中为了演示就硬编码了)
    // 这样一来,在随后的登录页面上就只有这里指定的用户和密码才能通过验证
    if ("jadyer".equals(token.getUsername())) {
        AuthenticationInfo authcInfo = new SimpleAuthenticationInfo("jadyer", "jadyer", this.getName());
        this.setAuthenticationSession("jadyer");
        return authcInfo;
    }
    if ("xuanyu".equals(token.getUsername())) {
        AuthenticationInfo authcInfo = new SimpleAuthenticationInfo("xuanyu", "xuanyu", this.getName());
        this.setAuthenticationSession("xuanyu");
        return authcInfo;
    }
    // 没有返回登录用户名对应的SimpleAuthenticationInfo对象时,就会在LoginController中抛出UnknownAccountException异常
    return null;
}

16 Source : UserController.java
with Apache License 2.0
from v5java

@RequestMapping(value = "/login", method = RequestMethod.POST)
public String login(String username, String preplacedword, HttpServletRequest request) {
    System.out.println("-------------------------------------------------------");
    String rand = (String) request.getSession().getAttribute("rand");
    String captcha = WebUtils.getCleanParam(request, "captcha");
    System.out.println("用户[" + username + "]登录时输入的验证码为[" + captcha + "],HttpSession中的验证码为[" + rand + "]");
    if (!StringUtils.equals(rand, captcha)) {
        request.setAttribute("message_login", "验证码不正确");
        return InternalResourceViewResolver.FORWARD_URL_PREFIX + "/";
    }
    UsernamePreplacedwordToken token = new UsernamePreplacedwordToken(username, preplacedword);
    token.setRememberMe(true);
    System.out.print("为验证登录用户而封装的Token:");
    System.out.println(ReflectionToStringBuilder.toString(token, ToStringStyle.MULTI_LINE_STYLE));
    // 获取当前的Subject
    Subject currentUser = SecurityUtils.getSubject();
    try {
        // 在调用了login方法后,SecurityManager会收到AuthenticationToken,并将其发送给已配置的Realm执行必须的认证检查
        // 每个Realm都能在必要时对提交的AuthenticationTokens作出反应
        // 所以这一步在调用login(token)方法时,它会走到MyRealm.doGetAuthenticationInfo()方法中,具体验证方式详见此方法
        System.out.println("对用户[" + username + "]进行登录验证...验证开始");
        currentUser.login(token);
        System.out.println("对用户[" + username + "]进行登录验证...验证通过");
    } catch (UnknownAccountException uae) {
        System.out.println("对用户[" + username + "]进行登录验证...验证未通过,未知账户");
        request.setAttribute("message_login", "未知账户");
    } catch (IncorrectCredentialsException ice) {
        System.out.println("对用户[" + username + "]进行登录验证...验证未通过,错误的凭证");
        request.setAttribute("message_login", "密码不正确");
    } catch (LockedAccountException lae) {
        System.out.println("对用户[" + username + "]进行登录验证...验证未通过,账户已锁定");
        request.setAttribute("message_login", "账户已锁定");
    } catch (ExcessiveAttemptsException eae) {
        System.out.println("对用户[" + username + "]进行登录验证...验证未通过,错误次数过多");
        request.setAttribute("message_login", "用户名或密码错误次数过多");
    } catch (AuthenticationException ae) {
        // 通过处理Shiro的运行时AuthenticationException就可以控制用户登录失败或密码错误时的情景
        System.out.println("对用户[" + username + "]进行登录验证...验证未通过,堆栈轨迹如下");
        ae.printStackTrace();
        request.setAttribute("message_login", "用户名或密码不正确");
    }
    // 验证是否登录成功
    if (currentUser.isAuthenticated()) {
        System.out.println("用户[" + username + "]登录认证通过(这里可进行一些认证通过后的系统参数初始化操作)");
        return "main";
    } else {
        token.clear();
        return InternalResourceViewResolver.FORWARD_URL_PREFIX + "/";
    }
}

16 Source : ObjectPropertyView.java
with Apache License 2.0
from trixon

@SuppressWarnings("unchecked")
private void refresh(Object o) {
    if (MSelectionLockManager.getInstance().isLocked()) {
        return;
    }
    Node centerObject = null;
    if (o == null) {
        centerObject = mPlaceholderLabel;
    } else if (o.getClreplaced().isInstance(mPropertySheet.gereplacedems())) {
        centerObject = mPropertySheet;
        loadList((ObservableList<PropertySheet.Item>) o);
    } else if (o.getClreplaced().isInstance(mDummyMap)) {
        centerObject = mPropertySheet;
        loadMap((Map<String, Object>) o);
    } else if (o instanceof Node) {
        centerObject = (Node) o;
    } else if (o instanceof String) {
        centerObject = mLogPanel;
        load(o.toString());
    } else {
        centerObject = mLogPanel;
        load(ToStringBuilder.reflectionToString(o, ToStringStyle.MULTI_LINE_STYLE));
    }
    setCenter(centerObject);
}

12 Source : JxMapViewerMapEngine.java
with Apache License 2.0
from trixon

@Override
public void fitToBounds(MLatLonBox latLonBox) {
    Set<GeoPosition> positions = new HashSet<>();
    positions.add(toGeoPosition(latLonBox.getNorthEast()));
    positions.add(toGeoPosition(latLonBox.getSouthWest()));
    mMap.zoomToBestFit(positions, 0.9);
    mMap.setCenterPosition(toGeoPosition(latLonBox.getCenter()));
    System.out.println(ToStringBuilder.reflectionToString(latLonBox, ToStringStyle.MULTI_LINE_STYLE));
    System.out.println(ToStringBuilder.reflectionToString(latLonBox.getCenter(), ToStringStyle.MULTI_LINE_STYLE));
}

10 Source : ZkJobRegistry.java
with Apache License 2.0
from warlock-china

@Override
public synchronized void register(JobConfig conf) {
    // 是否第一个启动节点
    boolean isFirstNode = false;
    Calendar now = Calendar.getInstance();
    long currentTimeMillis = now.getTimeInMillis();
    conf.setModifyTime(currentTimeMillis);
    if (groupPath == null) {
        groupPath = ROOT + conf.getGroupName();
    }
    if (nodeStateParentPath == null) {
        nodeStateParentPath = groupPath + "/nodes";
    }
    String path = getPath(conf);
    final String jobName = conf.getJobName();
    if (!zkClient.exists(nodeStateParentPath)) {
        isFirstNode = true;
        zkClient.createPersistent(nodeStateParentPath, true);
    } else {
        // 检查是否有节点
        if (!isFirstNode) {
            isFirstNode = zkClient.getChildren(nodeStateParentPath).size() == 0;
        }
    }
    if (!zkClient.exists(path)) {
        zkClient.createPersistent(path, true);
    }
    // 是否要更新ZK的conf配置
    boolean updateConfInZK = isFirstNode;
    if (!updateConfInZK) {
        JobConfig configFromZK = getConfigFromZK(path, null);
        if (configFromZK != null) {
            // 1.当前执行时间策略变化了
            // 2.下一次执行时间在当前时间之前
            // 3.配置文件修改是30分钟前
            if (!StringUtils.equals(configFromZK.getCronExpr(), conf.getCronExpr())) {
                updateConfInZK = true;
            } else if (configFromZK.getNextFireTime() != null && configFromZK.getNextFireTime().before(now.getTime())) {
                updateConfInZK = true;
            } else if (currentTimeMillis - configFromZK.getModifyTime() > TimeUnit.MINUTES.toMillis(30)) {
                updateConfInZK = true;
            }
        } else {
            // zookeeper 该job不存在?
            updateConfInZK = true;
        }
        // 拿ZK上的配置覆盖当前的
        if (!updateConfInZK) {
            conf = configFromZK;
        }
    }
    if (updateConfInZK) {
        conf.setCurrentNodeId(JobContext.getContext().getNodeId());
        zkClient.writeData(path, JsonUtils.toJson(conf));
    }
    schedulerConfgs.put(conf.getJobName(), conf);
    // 
    regAndSubscribeNodeEvent();
    // 订阅同步信息变化
    zkClient.subscribeDataChanges(path, new IZkDataListener() {

        @Override
        public void handleDataDeleted(String dataPath) throws Exception {
            schedulerConfgs.remove(jobName);
        }

        @Override
        public void handleDataChange(String dataPath, Object data) throws Exception {
            if (data == null)
                return;
            JobConfig _jobConfig = JsonUtils.toObject(data.toString(), JobConfig.clreplaced);
            schedulerConfgs.put(jobName, _jobConfig);
        }
    });
    // 清除之前遗留节点
    if (isFirstNode) {
        List<String> historyJobNames = zkClient.getChildren(groupPath);
        for (String name : historyJobNames) {
            if ("nodes".equals(name) || conf.getJobName().equals(name))
                continue;
            zkClient.delete(groupPath + "/" + name);
            logger.info("delete history job path:{}/{}", groupPath, name);
        }
    }
    logger.info("finish register schConfig:{}", ToStringBuilder.reflectionToString(conf, ToStringStyle.MULTI_LINE_STYLE));
}