Package freemarker.ext.beans

Examples of freemarker.ext.beans.BeansWrapper.wrap()


    ClientPackageForMethod packageForMethod = new ClientPackageForMethod(conversions);
    TypeDeclaration typeDeclaration = getDeclaration("org.codehaus.enunciate.samples.xfire_client.with.a.nested.pckg.NestedPackageClass");
    assertEquals("org.codehaus.enunciate.other.pckg.and.nested.pckg", packageForMethod.exec(Arrays.asList(wrapper.wrap(typeDeclaration))));
    assertEquals("org.codehaus.enunciate.other.pckg.and.nested.pckg", packageForMethod.exec(Arrays.asList(wrapper.wrap(typeDeclaration.getPackage()))));
    assertEquals("org.codehaus.enunciate.other.pckg.and.nested.pckg.plus.extra", packageForMethod.exec(Arrays.asList(wrapper.wrap("org.codehaus.enunciate.samples.xfire_client.with.a.nested.pckg.plus.extra"))));
    assertEquals("red.herring.xfire_client", packageForMethod.exec(Arrays.asList(wrapper.wrap("org.codehaus.enunciate.samples.xfire_client"))));
    for (FieldDeclaration fieldDeclaration : typeDeclaration.getFields()) {
      if ("items".equals(fieldDeclaration.getSimpleName())) {
        assertEquals("java.util", packageForMethod.exec(Arrays.asList(wrapper.wrap(fieldDeclaration.getType()))));
      }
      else if ("type".equals(fieldDeclaration.getSimpleName())) {
View Full Code Here


    assertEquals("org.codehaus.enunciate.other.pckg.and.nested.pckg", packageForMethod.exec(Arrays.asList(wrapper.wrap(typeDeclaration.getPackage()))));
    assertEquals("org.codehaus.enunciate.other.pckg.and.nested.pckg.plus.extra", packageForMethod.exec(Arrays.asList(wrapper.wrap("org.codehaus.enunciate.samples.xfire_client.with.a.nested.pckg.plus.extra"))));
    assertEquals("red.herring.xfire_client", packageForMethod.exec(Arrays.asList(wrapper.wrap("org.codehaus.enunciate.samples.xfire_client"))));
    for (FieldDeclaration fieldDeclaration : typeDeclaration.getFields()) {
      if ("items".equals(fieldDeclaration.getSimpleName())) {
        assertEquals("java.util", packageForMethod.exec(Arrays.asList(wrapper.wrap(fieldDeclaration.getType()))));
      }
      else if ("type".equals(fieldDeclaration.getSimpleName())) {
        assertEquals("org.codehaus.enunciate.other.pckg.and.nested.pckg", packageForMethod.exec(Arrays.asList(wrapper.wrap(fieldDeclaration.getType()))));
      }
    }
View Full Code Here

    for (FieldDeclaration fieldDeclaration : typeDeclaration.getFields()) {
      if ("items".equals(fieldDeclaration.getSimpleName())) {
        assertEquals("java.util", packageForMethod.exec(Arrays.asList(wrapper.wrap(fieldDeclaration.getType()))));
      }
      else if ("type".equals(fieldDeclaration.getSimpleName())) {
        assertEquals("org.codehaus.enunciate.other.pckg.and.nested.pckg", packageForMethod.exec(Arrays.asList(wrapper.wrap(fieldDeclaration.getType()))));
      }
    }
  }

  /**
 
View Full Code Here

        catch (Exception e) {
            throw new TemplateModelException(e.getMessage());
        }
        BeansWrapper bw = BeansWrapper.getDefaultInstance();
        Object obj = bw.newInstance(cl, args.subList(1, args.size()));
        return bw.wrap(obj);
    }
}
View Full Code Here

        Object[] args = arguments.toArray();
        BeansWrapper wrapper = getWrapper();
        for (int i = 0; i < args.length; i++) {
            args[i] = unwrap(args[i], wrapper);
        }
        return wrapper.wrap(((Function)getScriptable()).call(cx,
                ScriptableObject.getTopLevelScope(fnThis), fnThis, args));
    }

    private Object unwrap(Object arg, BeansWrapper wrapper)
            throws TemplateModelException
View Full Code Here

    public static TemplateModel autoWrap(Object obj, Environment env) {
       BeansWrapper wrapper = BeansWrapper.getDefaultInstance();
       TemplateModel templateModelObj = null;
       try {
           templateModelObj = wrapper.wrap(obj);
       } catch(TemplateModelException e) {
           throw new RuntimeException(e.getMessage());
       }
       return templateModelObj;
    }
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.