Example usage for java.util List getClass

List of usage examples for java.util List getClass

Introduction

In this page you can find the example usage for java.util List getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:org.ebayopensource.turmeric.eclipse.mavenapi.test.internal.collections.TestListUtil.java

/**
 * Test method for {@link org.ebayopensource.turmeric.eclipse.mavenapi.internal.collections.ListUtil#vector(T[])}.
 *///from ww w . j  av  a2 s  .c om
@Test
public void testVectorTArray() {
    String[] data = { "3dfx", "Nvidia", "ATI" };
    List<String> list = ListUtil.vector(data);
    Assert.assertEquals(Vector.class.getName(), list.getClass().getName());
    Assert.assertArrayEquals("data not equals", data, list.toArray(new String[0]));

}

From source file:org.ebayopensource.turmeric.eclipse.mavenapi.test.internal.collections.TestListUtil.java

/**
 * Test method for {@link org.ebayopensource.turmeric.eclipse.mavenapi.internal.collections.ListUtil#vector(java.util.Collection)}.
 *//*from   w w  w .  ja  v  a2  s. c  o  m*/
@Test
public void testVectorCollectionOfT() {
    List<String> collection = new ArrayList<String>();
    collection.add("3dfx");
    collection.add("Nvidia");
    collection.add("ATI");
    List<String> list = ListUtil.vector(collection);
    Assert.assertEquals(Vector.class.getName(), list.getClass().getName());
    Assert.assertEquals("data not same", collection, list);
}

From source file:org.pentaho.metaverse.impl.model.kettle.json.TransMetaJsonDeserializer.java

protected void writeJsonFields(JsonNode fields, ObjectMapper mapper, ObjectId stepId) throws IOException {
    List<Map<String, Object>> fieldLists = new ArrayList<Map<String, Object>>();
    fieldLists = mapper.readValue(fields.toString(), fieldLists.getClass());
    int idx = 0;//from  w  w  w  . j av a  2  s. c  o  m
    for (Map<String, Object> fieldAttrs : fieldLists) {
        for (String s : fieldAttrs.keySet()) {
            Object val = fieldAttrs.get(s);
            try {
                if (val instanceof Integer) {
                    repository.saveStepAttribute(null, stepId, idx, s, (Integer) val);
                } else if (val instanceof Long) {
                    repository.saveStepAttribute(null, stepId, idx, s, (Long) val);
                } else if (val instanceof Double) {
                    repository.saveStepAttribute(null, stepId, idx, s, (Double) val);
                } else if (val instanceof Boolean) {
                    repository.saveStepAttribute(null, stepId, idx, s, (Boolean) val);
                } else {
                    repository.saveStepAttribute(null, stepId, idx, s, val == null ? null : (String) val);
                }
            } catch (KettleException e) {
                LOGGER.info(Messages.getString("INFO.Deserialization.Trans.SavingAttributes", s,
                        String.valueOf(idx)), e);
            }
        }
        idx++;
    }
}

From source file:nl.flotsam.calendar.web.UriListHttpMessageConverterTest.java

@Test
public void shouldParseCorrectly() throws IOException {
    UriListHttpMessageConverter converter = new UriListHttpMessageConverter();
    List<URI> list = new ArrayList<URI>();
    when(message.getHeaders()).thenReturn(headers);
    when(headers.getContentType()).thenReturn(MediaType.TEXT_PLAIN);
    when(message.getBody()).thenReturn(/*from w  w  w.  j  ava 2 s . c  o m*/
            new ReaderInputStream(new StringReader("http://localhost:8080\nhttp://localhost:7070")));
    list = converter.read((Class<? extends List<URI>>) list.getClass(), message);
    assertThat(list.size(), is(2));
}

From source file:org.flite.cach3.aop.CacheBaseTest.java

@Test
public void testIsList() {
    assertFalse(CacheBase.verifyTypeIsList(Object.class));
    assertFalse(CacheBase.verifyTypeIsList(String.class));

    assertTrue(CacheBase.verifyTypeIsList(ArrayList.class));

    final List<Long> full = new ArrayList<Long>();
    for (int ix = 0; ix < 10; ix++) {
        full.add(RandomUtils.nextLong());
    }/*from   w w  w.  j av  a 2  s .  c  om*/
    final List<Long> sub = full.subList(2, 7);
    assertTrue(CacheBase.verifyTypeIsList(sub.getClass()));
}

From source file:org.ebayopensource.turmeric.eclipse.utils.test.collections.TestListUtil.java

/**
 * Test method for {@link org.ebayopensource.turmeric.maveneclipseapi.internal.collections.ListUtil#linkedList()}.
 *//*from w  ww .  j  a  v  a 2 s .  co m*/
@Test
public void testLinkedList() {
    Collection<String> collection = new ArrayList<String>();
    collection.add("3dfx");
    collection.add("Nvidia");
    collection.add("ATI");
    List<String> list = ListUtil.linkedList(collection);
    Assert.assertEquals(LinkedList.class.getName(), list.getClass().getName());
    Assert.assertEquals("data not equals", collection, list);

    list = ListUtil.linkedList(collection.toArray(new String[0]));
    Assert.assertEquals(LinkedList.class.getName(), list.getClass().getName());
    Assert.assertEquals("data not equals", collection, list);
}

From source file:org.opendaylight.controller.flows.web.Flows.java

@SuppressWarnings("unchecked")
@RequestMapping(value = "/flow/deleteFlows", method = RequestMethod.POST)
@ResponseBody/*from  w ww  .j ava  2s. c om*/
public String removeSelectedFlows(@RequestParam(required = false) String body, HttpServletRequest request,
        @RequestParam(required = false) String container) {
    String containerName = (container == null) ? GlobalConstants.DEFAULT.toString() : container;

    // Authorization check
    String userName = request.getUserPrincipal().getName();
    if (DaylightWebUtil.getContainerPrivilege(userName, containerName, this) != Privilege.WRITE) {
        return "Operation not authorized";
    }
    IForwardingRulesManager frm = (IForwardingRulesManager) ServiceHelper
            .getInstance(IForwardingRulesManager.class, containerName, this);
    if (frm == null) {
        return "Forwarding Rules Manager is not available";
    }

    List<Map<String, String>> flowList = new ArrayList<Map<String, String>>();
    flowList = gson.fromJson(body, flowList.getClass());
    Status result = new Status(StatusCode.BADREQUEST, "Invalid request");
    String status = "";
    for (Map<String, String> flowEntry : flowList) {
        Node node = Node.fromString(flowEntry.get("node"));
        result = frm.removeStaticFlow(flowEntry.get("name"), node);
        if (result.isSuccess()) {
            DaylightWebUtil.auditlog("Flow Entry", userName, "removed", flowEntry.get("name") + " on Node "
                    + DaylightWebUtil.getNodeDesc(node, containerName, this), containerName);
        } else {
            status = flowEntry.get("name") + ", " + status;
        }
    }
    if (!status.equals("")) {
        return "Could not remove " + status.substring(0, status.length() - 2) + " Flow(s)";
    } else {
        return "Success";
    }
}

From source file:com.aw.core.cache.loader.MetaLoader.java

public MappableList<Row> getMap() {
    List<Row> list = getRows();
    if (list instanceof MappableList)
        return (MappableList<Row>) list;
    else/*from   ww w  . j  av a 2 s  .c o  m*/
        throw new AWBusinessException(
                "DataLoader id:" + dataLoader + " no retorna MappableList. List:" + list.getClass());
}

From source file:org.activiti5.engine.impl.bpmn.parser.factory.DefaultActivityBehaviorFactory.java

private void addExceptionMapAsFieldDeclaraion(List<FieldDeclaration> fieldDeclarations,
        List<MapExceptionEntry> mapExceptions) {
    FieldDeclaration exceptionMapsFieldDeclaration = new FieldDeclaration(EXCEPTION_MAP_FIELD,
            mapExceptions.getClass().toString(), mapExceptions);
    fieldDeclarations.add(exceptionMapsFieldDeclaration);

}

From source file:org.flowable.engine.impl.bpmn.parser.factory.DefaultActivityBehaviorFactory.java

private void addExceptionMapAsFieldDeclaration(List<FieldDeclaration> fieldDeclarations,
        List<MapExceptionEntry> mapExceptions) {
    FieldDeclaration exceptionMapsFieldDeclaration = new FieldDeclaration(EXCEPTION_MAP_FIELD,
            mapExceptions.getClass().toString(), mapExceptions);
    fieldDeclarations.add(exceptionMapsFieldDeclaration);

}