Example usage for java.lang Long valueOf

List of usage examples for java.lang Long valueOf

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public static Long valueOf(long l) 

Source Link

Document

Returns a Long instance representing the specified long value.

Usage

From source file:com.devnexus.ting.web.converter.StringToRoom.java

@Override
public Room convert(String source) {

    if (StringUtils.isEmpty(source) || !StringUtils.isNumeric(source)) {
        return null;
    } else {//  w ww  . ja v a  2s.  co  m
        return new Room(Long.valueOf(source));
    }

}

From source file:org.jspringbot.keyword.db.SetDBLongParameter.java

@Override
public Object execute(Object[] params) {
    helper.setLongParameter(String.valueOf(params[0]), Long.valueOf(String.valueOf(params[1])));

    return null;
}

From source file:com.alibaba.stonelab.toolkit.cs4p.communication.cmd.PlayerFire.java

@Override
public Cmd parser(String cmd) {
    String[] token = cmd.split(" ");
    if (token.length != 3) {
        return null;
    }/*from  w  w  w. java 2 s.c o  m*/
    if (!CMD.equals(token[0])) {
        return null;
    }
    if (!(StringUtils.isNumeric(token[1]) && StringUtils.isNumeric(token[2]))) {
        return null;
    }
    this.setX(Long.valueOf(token[1]));
    this.setY(Long.valueOf(token[2]));
    return this;
}

From source file:com.metawiring.load.generators.RandomStringRangeGenerator.java

public RandomStringRangeGenerator(String min, String max) {
    this(Long.valueOf(min), Long.valueOf(max));
}

From source file:com.devnexus.ting.web.converter.StringToSpeaker.java

@Override
public Speaker convert(String source) {

    if (StringUtils.isEmpty(source) || !StringUtils.isNumeric(source)) {
        return null;
    } else {/*from   ww  w.j a v a 2  s  .  c om*/
        return new Speaker(Long.valueOf(source));
    }

}

From source file:jp.co.opentone.bsol.linkbinder.scrapbook.CopyPropertiesTest.java

@Test
public void testPropertyUtilsCopyProperties() throws Exception {

    Map<String, Object> values = new HashMap<String, Object>();
    values.put("id", Long.valueOf(10));
    values.put("name", "test");
    List<CorresponGroup> groups = new ArrayList<CorresponGroup>();
    CorresponGroup g = new CorresponGroup();
    g.setId(1L);/* w  w w  .  ja v  a  2 s.  co m*/
    g.setName("g1");
    groups.add(g);

    g = new CorresponGroup();
    g.setId(2L);
    g.setName("g2");
    groups.add(g);

    values.put("groups", groups);

    Dto dto = new Dto();

    PropertyUtils.copyProperties(dto, values);

    assertEquals(Long.valueOf(10L), dto.getId());
    assertEquals("test", dto.getName());

    List<CorresponGroup> actual = dto.getGroups();
    assertNotNull(actual);
    assertEquals(groups.size(), actual.size());
    assertEquals(groups.get(0).getId(), actual.get(0).getId());
    assertEquals(groups.get(0).getName(), actual.get(0).getName());

}

From source file:nl.conspect.legacy.repository.impl.HibernateUserRepositoryImpl.java

public User find(long id) {
    return (User) getHibernateTemplate().get(User.class, Long.valueOf(id));
}

From source file:com.bukanir.android.utils.Utils.java

public static boolean isFreeSpaceAvailable(Context context, Movie m) {
    long freeSpace = Environment.getExternalStorageDirectory().getUsableSpace();

    if (freeSpace > Long.valueOf(m.size)) {
        return true;
    }//from w  ww .  ja  va  2  s  .  c o m
    return false;
}

From source file:org.dswarm.graph.json.Node.java

public Node(final long idArg, final NodeType typeArg) {

    id = Long.valueOf(idArg);
    type = typeArg;
}

From source file:net.ceos.project.poi.annotated.bean.cascade.CascadeObjectBuilder.java

/**
 * Create a CascadeObject for tests./* ww w . ja v  a 2s.c  om*/
 * 
 * @return the {@link CascadeObject}
 */
public static CascadeObject buildCascadeObject(int multiplier) {
    CascadeObject toValidate = new CascadeObject();

    toValidate.setDateAttribute(new Date());
    toValidate.setStringAttribute("some string");
    toValidate.setIntegerAttribute(46 * multiplier);
    toValidate.setDoubleAttribute(Double.valueOf("25.3") * multiplier);
    toValidate.setLongAttribute(Long.valueOf("1234567890") * multiplier);
    toValidate.setBooleanAttribute(Boolean.FALSE);
    /* create sub object Job */
    Job job = new Job();
    job.setJobCode(0005);
    job.setJobFamily("Family Job Name");
    job.setJobName("Job Name");
    toValidate.setJob(job);

    BasicObject bo = BasicObjectBuilder.buildBasicObject();
    List<BasicObject> boList = new ArrayList<>();
    boList.add(bo);
    boList.add(bo);
    boList.add(bo);
    boList.add(bo);
    boList.add(bo);

    toValidate.setBasicObjectList(boList);

    ObjectConfigurable oc = ObjectConfigurableBuilder.buildObjectConfigurable();
    ArrayList<ObjectConfigurable> ocList = new ArrayList<>();
    ocList.add(oc);
    ocList.add(oc);
    ocList.add(oc);

    toValidate.setObjectConfList(ocList);

    CascadeL1 l1 = CascadeL1Builder.buildCascadeL1();
    ArrayList<CascadeL1> objectsList = new ArrayList<>();
    objectsList.add(l1);
    objectsList.add(l1);

    toValidate.setObjectsList(objectsList);
    /*ArrayList<CascadeObject> ownList = new ArrayList<>();
    ownList.add(toValidate);
    ownList.add(toValidate);
            
    toValidate.setObjectsList(ownList);*/
    // TODO add new fields below

    return toValidate;
}