Example usage for java.lang Character valueOf

List of usage examples for java.lang Character valueOf

Introduction

In this page you can find the example usage for java.lang Character valueOf.

Prototype

@HotSpotIntrinsicCandidate
public static Character valueOf(char c) 

Source Link

Document

Returns a Character instance representing the specified char value.

Usage

From source file:org.culturegraph.mf.stream.converter.SimpleJsonEncoder.java

@Override
public void startRecord(final String id) {
    builder.append('{');
    bracketStack.push(Character.valueOf('}'));
}

From source file:com.link_intersystems.lang.reflect.MethodInvokingTransformerTest.java

@Test(expected = IllegalArgumentException.class)
public void transformWrongType() {
    Transformer transformer = new MethodInvokingTransformer(charAtMethod, argumentResolver);
    Character valueOf = Character.valueOf('c');
    transformer.transform(valueOf);/*from w  w  w  .ja  v  a2s  .  c  o  m*/
}

From source file:com.acc.setup.BncwebservicesDataSetup.java

@SystemSetup(process = Process.ALL, type = Type.ESSENTIAL)
public void createEssentialData(final SystemSetupContext context) {
    importService.importData(new StreamBasedImpExResource(
            BncwebservicesDataSetup.class.getResourceAsStream("/import/yCommerceWebServicesEssentialData.csv"),
            CSVConstants.HYBRIS_ENCODING, Character.valueOf(';')));
}

From source file:org.codehaus.groovy.grails.plugins.codecs.HTML4Encoder.java

@Override
protected String escapeCharacter(char ch, char previousChar) {
    Character key = Character.valueOf(ch);
    String replacement = replacements.get(key);
    if (replacement == null) {
        replacement = StreamingHTMLEncoderHelper.convertToReference(ch);
        replacements.put(key, replacement != null ? replacement : NULL_MARKER);
    }//from w w w.  jav a  2 s .c  o  m
    return replacement != NULL_MARKER ? replacement : null;
}

From source file:io.pivotal.spring.xd.jdbcgpfdist.support.ReadableTableFactoryBean.java

@Override
public ReadableTable getObject() throws Exception {
    ReadableTable w = new ReadableTable();
    w.setLocations(locations);/*from   w w w  .  j  av a2  s.  com*/
    w.setColumns(columns);
    w.setLike(like);
    w.setLogErrorsInto(logErrorsInto);
    w.setSegmentRejectLimit(segmentRejectLimit);
    w.setSegmentRejectType(segmentRejectType);
    w.setFormatHeader(header);

    if (format == Format.TEXT) {
        Character delim = delimiter != null ? delimiter : Character.valueOf('\t');
        w.setTextFormat(delim, nullString, escape);
    } else if (format == Format.CSV) {
        Character delim = delimiter != null ? delimiter : Character.valueOf(',');
        w.setCsvFormat(quote, delim, nullString, forceQuote, escape);
    }

    return w;
}

From source file:edu.ku.brc.af.ui.forms.validation.FormattedDateValidator.java

protected char discoverSeparator() {
    // Here we need to discover what the Date format's separator character is
    // I could figure out a call in java to get it.
    String formatStr = scrDateFormat.getSimpleDateFormat().toPattern();
    int i = 0;//from  w  w  w  .  ja v  a  2  s .c om
    while (i < formatStr.length()) {
        if (!Character.isLetter(formatStr.charAt(i))) {
            return formatStr.charAt(i);
        }
        i++;
    }
    return Character.valueOf('/');
}

From source file:org.culturegraph.mf.stream.converter.SimpleJsonEncoder.java

@Override
public void startEntity(final String name) {

    if (commaNeeded) {
        builder.append(", ");
    }//from   w  ww  . j  av  a2s .c om
    commaNeeded = true;

    if (name.endsWith(ARRAY_MARKER)) {
        builder.append("\"" + escape(name.substring(0, name.length() - ARRAY_MARKER.length())) + "\": [ ");
        bracketStack.push(Character.valueOf(']'));
    } else {
        if (inArray()) {
            builder.append(" { ");
        } else {
            builder.append("\"" + escape(name) + "\": { ");
        }

        bracketStack.push(Character.valueOf('}'));
    }
    commaStack.push(Boolean.valueOf(commaNeeded));
    commaNeeded = false;
}

From source file:com.workday.autoparse.xml.demo.XmlParserTest.java

@Test
public void testParse() throws UnknownElementException, ParseException, UnexpectedChildException {

    XmlStreamParser parser = XmlStreamParserFactory.newXmlStreamParser();

    InputStream in = getInputStreamOf("input.xml");
    DemoModel model = (DemoModel) parser.parseStream(in);

    assertTrue(model.myBoxedBoolean);//from  www  . j  a v a  2s  . co  m
    assertTrue(model.myPrimitiveBoolean);
    assertEquals(new BigDecimal(0.5), model.myBigDecimal);
    assertEquals(BigInteger.ONE, model.myBigInteger);
    assertEquals(2, model.myPrimitiveByte);
    assertEquals(Byte.valueOf((byte) 4), model.myBoxedByte);
    assertEquals('a', model.myPrimitiveChar);
    assertEquals(Character.valueOf('b'), model.myBoxedChar);
    assertEquals(5.5, model.myPrimitiveDouble, DOUBLE_E);
    assertEquals(Double.valueOf(6.5), model.myBoxedDouble);
    assertEquals(7.5f, model.myPrimitiveFloat, FLOAT_E);
    assertEquals(Float.valueOf(8.5f), model.myBoxedFloat);
    assertEquals(9, model.myPrimitiveInt);
    assertEquals(Integer.valueOf(10), model.myBoxedInt);
    assertEquals(11, model.myPrimitiveLong);
    assertEquals(Long.valueOf(12), model.myBoxedLong);
    assertEquals(13, model.myPrimitiveShort);
    assertEquals(Short.valueOf((short) 15), model.myBoxedShort);
    assertEquals("Bob", model.myString);
    assertTrue(model.myChildModel != null);

    assertEquals("My_String_Value", model.myChildModel.myString);
    assertEquals(5, model.myChildModel.myInt);

    assertEquals(3, model.repeatedChildModels.size());

    assertEquals("a", model.repeatedChildModels.get(0).value);
    assertEquals("I am some text.", model.repeatedChildModels.get(0).textContent);

    assertEquals("b", model.repeatedChildModels.get(1).value);
    assertNull(model.repeatedChildModels.get(1).textContent);

    assertEquals("c", model.repeatedChildModels.get(2).value);
}

From source file:org.openmrs.module.htmlwidgets.web.handler.StringHandler.java

/** 
 * @see WidgetHandler#parse(String, Class<?>)
 *///from   ww w.j a  va2s .c  om
@Override
public Object parse(String input, Class<?> type) {
    if (StringUtils.isNotBlank(input)) {
        if (Character.class.isAssignableFrom(type)) {
            if (input.length() > 1) {
                throw new IllegalArgumentException("Unable to parse '" + input + "' into a Character");
            }
            return (input.length() == 0 ? null : Character.valueOf(input.charAt(0)));
        }
        return input;
    }
    return null;
}

From source file:org.apache.openjpa.jdbc.meta.DiscriminatorMappingInfo.java

/**
 * Return the discriminator value as an object of the right type.
 */// w w w  .  j a va  2  s .  co m
public Object getValue(Discriminator discrim, boolean adapt) {
    if (discrim.getValue() != null)
        return discrim.getValue();
    if (StringUtils.isEmpty(_value)) {
        return discrim.getMappingRepository().getMappingDefaults().getDiscriminatorValue(discrim, adapt);
    }

    switch (discrim.getJavaType()) {
    case JavaTypes.INT:
        return Integer.valueOf(_value);
    case JavaTypes.CHAR:
        return Character.valueOf(_value.charAt(_value.indexOf('\'') + 1));
    case JavaTypes.STRING:
    default:
        return _value;
    }
}