Examples of canConvert()


Examples of net.buffalo.protocal.converters.collection.CollectionConverter.canConvert()

    context = new DefaultMarshallingContext(new DefaultConverterLookup(), streamWriter);
  }
 
  public void testCanApplyList() throws Exception {
    CollectionConverter s = new CollectionConverter();
    assertTrue(s.canConvert(ArrayList.class));
    assertTrue(s.canConvert(LinkedList.class));   
    assertFalse(s.canConvert(String.class));   
  }

  public void testStringList() throws Exception {
View Full Code Here

Examples of net.buffalo.protocal.converters.map.MapConverter.canConvert()

    mashallingContext = new DefaultMarshallingContext(converterLookup, streamWriter);
  }
 
  public void testShouldSerializeMap() throws Exception {
    MapConverter ms = new MapConverter();
    assertTrue(ms.canConvert(HashMap.class));
    assertFalse(ms.canConvert(null));
   
    Map m = new HashMap();
    m.put("string", "value");
    ms.marshal(m, mashallingContext, streamWriter);
View Full Code Here

Examples of net.buffalo.protocal.converters.map.ObjectConverter.canConvert()

 
  public void testShouldSerializeParentClass() throws Exception {
    ObjectConverter os = new ObjectConverter();
    BirthdayPeople people = new BirthdayPeople();
    people.setBirthday(new Date());
    assertTrue(os.canConvert(BirthdayPeople.class));
    os.marshal(people, context, streamWriter);
    String output = stringWriter.getBuffer().toString();
    assertTrue(output.indexOf("date")>-1);
    assertTrue(output.indexOf("name") > -1);
    assertEquals(1, context.getObjects().size());
View Full Code Here

Examples of no.hal.jex.jdt.JdtTestAnnotationsToModelConverter.canConvert()

    }
    URI testsResourceUri = URI.createPlatformResourceURI(resource.getFullPath() + "." + JexResource.JEX_EXTENSION, true);
    IJavaElement javaElement = JdtHelper.findIJavaElement(javaProject, segments, 1);
    if (javaElement != null) {
      JdtTestAnnotationsToModelConverter testAnnotationsToModelConverter = new JdtTestAnnotationsToModelConverter(JexFactory.eINSTANCE.createExercise(), javaElement);
      if (testAnnotationsToModelConverter.canConvert()) {
        Exercise exercise = testAnnotationsToModelConverter.convert();
        Resource jexResource = resourceSet.createResource(testsResourceUri);
        jexResource.getContents().add(exercise);
        return true;
      }
View Full Code Here

Examples of org.apache.aries.blueprint.di.ExecutionContext.canConvert()

        private Method findMethodWithConversion(Object value) throws ComponentDefinitionException {
            ExecutionContext ctx = ExecutionContext.Holder.getContext();
            List<Method> matchingMethods = new ArrayList<Method>();
            for (Method m : setters) {
                Type paramType = m.getGenericParameterTypes()[0];
                if (ctx.canConvert(value, new GenericType(paramType))) matchingMethods.add(m);
            }
           
            if (matchingMethods.isEmpty()) return null;
            else if (matchingMethods.size() == 1) return matchingMethods.get(0);
            else throw new ComponentDefinitionException(
View Full Code Here

Examples of org.apache.aries.blueprint.di.ExecutionContext.canConvert()

        private Method findMethodWithConversion(Collection<Method> setterMethods, Object value) throws Exception {
            ExecutionContext ctx = ExecutionContext.Holder.getContext();
            List<Method> matchingMethods = new ArrayList<Method>();
            for (Method m : setterMethods) {
                Type paramType = m.getGenericParameterTypes()[0];
                if (ctx.canConvert(value, new GenericType(paramType))) matchingMethods.add(m);
            }
           
            if (matchingMethods.isEmpty()) return null;
            else if (matchingMethods.size() == 1) return matchingMethods.get(0);
            else throw new ComponentDefinitionException(
View Full Code Here

Examples of org.apache.aries.blueprint.di.ExecutionContext.canConvert()

        private Method findMethodWithConversion(Object value) throws ComponentDefinitionException {
            ExecutionContext ctx = ExecutionContext.Holder.getContext();
            List<Method> matchingMethods = new ArrayList<Method>();
            for (Method m : setters) {
                Type paramType = m.getGenericParameterTypes()[0];
                if (ctx.canConvert(value, new GenericType(paramType))) matchingMethods.add(m);
            }
           
            if (matchingMethods.isEmpty()) return null;
            else if (matchingMethods.size() == 1) return matchingMethods.get(0);
            else throw new ComponentDefinitionException(
View Full Code Here

Examples of org.apache.aries.blueprint.di.ExecutionContext.canConvert()

        private Method findMethodWithConversion(Collection<Method> setterMethods, Object value) throws Exception {
            ExecutionContext ctx = ExecutionContext.Holder.getContext();
            List<Method> matchingMethods = new ArrayList<Method>();
            for (Method m : setterMethods) {
                Type paramType = m.getGenericParameterTypes()[0];
                if (ctx.canConvert(value, new GenericType(paramType))) matchingMethods.add(m);
            }
           
            if (matchingMethods.isEmpty()) return null;
            else if (matchingMethods.size() == 1) return matchingMethods.get(0);
            else throw new ComponentDefinitionException(
View Full Code Here

Examples of org.apache.aries.blueprint.di.ExecutionContext.canConvert()

        private Method findMethodWithConversion(Collection<Method> setterMethods, Object value) throws Exception {
            ExecutionContext ctx = ExecutionContext.Holder.getContext();
            List<Method> matchingMethods = new ArrayList<Method>();
            for (Method m : setterMethods) {
                Type paramType = m.getGenericParameterTypes()[0];
                if (ctx.canConvert(value, new GenericType(paramType))) matchingMethods.add(m);
            }
           
            if (matchingMethods.isEmpty()) return null;
            else if (matchingMethods.size() == 1) return matchingMethods.get(0);
            else throw new ComponentDefinitionException(
View Full Code Here

Examples of org.apache.hivemind.service.ClassFab.canConvert()

    }

    public void testCanConvert()
    {
      final ClassFab cf = newClassFab("BamBam", Object.class);
      assertTrue( cf.canConvert( String.class ) );
      assertFalse(cf.canConvert(CglibBeanInterfaceFactory.createCglibBean().getClass()));
      assertFalse(cf.canConvert(JavassistBeanInterfaceFactory.createJavassistBean().getClass()));
      assertFalse(cf.canConvert(JdkBeanInterfaceFactory.createJdkBean().getClass()));
    }
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.