Example usage for java.lang Boolean toString

List of usage examples for java.lang Boolean toString

Introduction

In this page you can find the example usage for java.lang Boolean toString.

Prototype

public String toString() 

Source Link

Document

Returns a String object representing this Boolean's value.

Usage

From source file:com.enonic.cms.core.user.field.UserFieldHelper.java

private String formatBoolean(Boolean value) {
    return value.toString();
}

From source file:com.jillesvangurp.urlbuilder.UrlBuilder.java

public UrlBuilder queryParam(String name, Boolean value) {
    if (value != null) {
        return queryParam(name, value.toString());
    } else {/*from w ww .j ava 2  s  . c  om*/
        return null;
    }
}

From source file:com.couchbase.sqoop.mapreduce.db.CouchbaseRecordReadSerializeTest.java

@Before
@Override//from  w  w  w  .  j a va  2  s  . c  o  m
public void setUp() throws Exception {
    super.setUp();

    tappedStuff = new HashMap<String, ResponseMessage>();

    URI uri = new URI(CouchbaseUtils.CONNECT_STRING);
    String user = CouchbaseUtils.COUCHBASE_USER_NAME;
    String pass = CouchbaseUtils.COUCHBASE_USER_PASS;

    try {
        cb = new CouchbaseClient(Arrays.asList(uri), user, pass);
    } catch (IOException e) {
        LOG.error("Couldn't connect to server" + e.getMessage());
        fail(e.toString());
    }
    this.client = new TapClient(Arrays.asList(uri), user, pass);

    cb.flush();
    Thread.sleep(500);

    // set up the items we're going to deserialize
    Integer anint = new Integer(Integer.MIN_VALUE);
    cb.set(anint.toString(), 0x300, anint).get();

    Long along = new Long(Long.MAX_VALUE);
    cb.set(along.toString(), 0, along).get();

    Float afloat = new Float(Float.MAX_VALUE);
    cb.set(afloat.toString(), 0, afloat).get();

    Double doubleBase = new Double(Double.NEGATIVE_INFINITY);
    cb.set(doubleBase.toString(), 0, doubleBase).get();

    Boolean booleanBase = true;
    cb.set(booleanBase.toString(), 0, booleanBase).get();

    rightnow = new Date(); // instance, needed later
    dateText = rightnow.toString().replaceAll(" ", "_");
    cb.set(dateText, 0, rightnow).get();

    Byte byteMeSix = new Byte("6");
    cb.set(byteMeSix.toString(), 0, byteMeSix).get();

    String ourString = "hi,there";
    cb.set(ourString.toString(), 0, ourString).get();

    client.tapDump("tester");
    while (client.hasMoreMessages()) {
        ResponseMessage m = client.getNextMessage();
        if (m == null) {
            continue;
        }
        tappedStuff.put(m.getKey(), m);
    }
}

From source file:org.jasig.cas.client.configuration.WebXmlConfigurationStrategyImplTests.java

@Test
public void filterConfigValueForBoolean() {
    final ConfigurationKey<Boolean> key = ConfigurationKeys.ACCEPT_ANY_PROXY;
    final Boolean value = Boolean.TRUE;
    this.filterConfig.addInitParameter(key.getName(), value.toString());
    assertEquals(value, this.impl.getBoolean(key));
}

From source file:no.dusken.barweb.view.XListView.java

private Element createPersonElement(BarPerson p, Document dom, Integer lowLimit) {
    Element personEle = dom.createElement("barPerson");
    Boolean enoughMoney = p.getMoney() >= lowLimit;
    personEle.setAttribute("enoughmoney", enoughMoney.toString());
    personEle.setTextContent(p.getName());
    return personEle;
}

From source file:com.ingby.socbox.bischeck.cli.CacheCli.java

private static void cli(Boolean supportNull) throws IOException, ConfigurationException {

    ExecuteJEP parser = new ExecuteJEP(); // Create a new parser 

    ConsoleReader console = null;/* w  w  w.j  ava2  s  .c o m*/
    FileHistory history = null;

    String historyFile = System.getProperty("user.home") + File.separator + HISTORY_FILE;

    try {

        console = new ConsoleReader();
        history = new FileHistory(new File(historyFile));
        console.println("Welcome to Bischeck cache-cli");
        console.println("-----------------------------");

        console.print("- Using bischeck configuration: ");
        console.println(ConfigFileManager.initConfigDir().getAbsolutePath());

        console.print("- Cmd history: ");
        console.println(history.getFile().getAbsolutePath());
        console.print("- Null support in arrays: ");
        console.println(supportNull.toString());

        console.setHistory(history);
        console.println("Execution time is divided in parse/calculate/total time (ms)");
        console.setPrompt(PROMPT);

        // Main loop reading cli commands
        boolean first = true;
        while (true) {
            String line = null;

            try {
                line = console.readLine();
            } catch (IllegalArgumentException ie) {
                console.println(ie.getMessage());
                continue;
            }

            if (line == null || QUIT.equalsIgnoreCase(line) || EXIT.equalsIgnoreCase(line)) {
                break;
            }

            if (line.matches("^list.*")) {
                String[] patternArray = line.split("^list");
                String pattern = "*";
                if (patternArray.length == 2 && !patternArray[1].trim().isEmpty()) {
                    pattern = patternArray[1];
                }

                Map<String, Long> lists = listKeys(pattern.trim());
                if (!lists.isEmpty()) {
                    for (String key : lists.keySet()) {
                        console.print(key);
                        console.print(" : ");
                        console.println(lists.get(key).toString());
                    }
                } else {
                    console.println(NOT_FOUND);
                }

                continue;
            }

            if (HELP.equalsIgnoreCase(line)) {
                showhelp(console);
                continue;
            }

            try {
                if (first) {
                    execute(parser, line);
                    console.println(execute(parser, line));
                    first = false;
                } else {
                    console.println(execute(parser, line));
                }
            } catch (ParseException e) {
                console.println(e.getMessage());
            }
        }
    } finally {
        try {
            TerminalFactory.get().restore();
        } catch (Exception e) {
            console.println("Could not restore " + e.getMessage());
        }
        if (history != null) {
            history.flush();
        }
    }
}

From source file:com.orange.ngsi.ConvertersConfiguration.java

@Bean
public MappingJackson2HttpMessageConverter jsonV1Converter(ObjectMapper objectMapper) {

    // Serialize numbers as strings
    objectMapper.configure(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS, true);

    // Serialize booleans as strings
    SimpleModule booleanAsString = new SimpleModule("BooleanAsString");
    booleanAsString.addSerializer(Boolean.class, new JsonSerializer<Boolean>() {
        @Override//w  w w .j  a  va  2 s .  com
        public void serialize(Boolean value, JsonGenerator jgen, SerializerProvider provider)
                throws IOException, JsonProcessingException {
            jgen.writeString(value.toString());

        }
    });
    objectMapper.registerModule(booleanAsString);

    objectMapper.addMixIn(ContextElement.class, EntityIdMixIn.class);
    objectMapper.addMixIn(AppendContextElementResponse.class, EntityIdMixIn.class);

    return new MappingJackson2HttpMessageConverter(objectMapper);
}

From source file:org.opencron.server.controller.RecordController.java

@RequestMapping("/kill")
public void kill(HttpServletResponse response, HttpSession session, Long recordId) {
    Record record = recordService.get(recordId);
    if (Opencron.RunStatus.RERUNNING.getStatus().equals(record.getStatus())) {
        //?/*from  w w  w  .  j  a v  a2  s. c  om*/
        record.setStatus(Opencron.RunStatus.STOPPING.getStatus());
        recordService.save(record);
        //???
        record = recordService.getReRunningSubJob(recordId);
    }
    if (!jobService.checkJobOwner(record.getUserId(), session))
        return;
    Boolean flag = executeService.killJob(record);
    WebUtils.writeHtml(response, flag.toString());
}

From source file:fr.norad.jmxzabbix.core.ZabbixClient.java

public ZabbixClient(ZabbixConfig config) {
    this.config = config;

    // zabbix does not understand boolean with value true without quotes which is default of jackson
    SimpleModule module = new SimpleModule("BooleanAsString", new Version(1, 0, 0, null, null, null));
    module.addSerializer(new NonTypedScalarSerializerBase<Boolean>(Boolean.class) {
        @Override/*w ww. ja v a2 s . co  m*/
        public void serialize(Boolean value, JsonGenerator jgen, SerializerProvider provider)
                throws IOException {
            jgen.writeString(value.toString());
        }
    });

    mapper.registerModule(module);
}

From source file:com.autentia.tnt.bean.reports.ReportParameterDefinition.java

public ReportParameterDefinition(String id, String type, String label, Boolean value) {
    this(id, type, label);
    this.value = value.toString();
}