Java 类freemarker.template.SimpleCollection 实例源码

项目:private-freemarker    文件:SaicObjectWrapper.java   
@SuppressWarnings("rawtypes")
@Override
public TemplateModel wrap(Object obj) throws TemplateModelException {
       if (obj == null) {
           return super.wrap(null);
       }
       if (obj instanceof TemplateModel) {
           return (TemplateModel) obj;
       }
       if (obj instanceof String) {
           return new SimpleScalar((String) obj);
       }
       if (obj instanceof Number) {
           return new SimpleNumber((Number) obj);
       }
       if (obj instanceof java.util.Date) {
           if(obj instanceof java.sql.Date) {
               return new SimpleDate((java.sql.Date) obj);
           }
           if(obj instanceof java.sql.Time) {
               return new SimpleDate((java.sql.Time) obj);
           }
           if(obj instanceof java.sql.Timestamp) {
               return new SimpleDate((java.sql.Timestamp) obj);
           }
           return new SimpleDate((java.util.Date) obj, getDefaultDateType());
       }
       if (obj.getClass().isArray()) {
           obj = convertArray(obj);
       }
       if (obj instanceof Collection) {
           return new SimpleSequence((Collection) obj, this);
       }
       if (obj instanceof Boolean) {
           return obj.equals(Boolean.TRUE) ? TemplateBooleanModel.TRUE : TemplateBooleanModel.FALSE;
       }
       if (obj instanceof Iterator) {
           return new SimpleCollection((Iterator) obj, this);
       }
       return handleUnknownType(obj);
   }
项目:vertx-web    文件:JsonObjectAdapter.java   
@Override
public TemplateCollectionModel keys() throws TemplateModelException {
  return new SimpleCollection(jsonObject.fieldNames(), getObjectWrapper());
}
项目:vertx-web    文件:JsonObjectAdapter.java   
@Override
public TemplateCollectionModel values() throws TemplateModelException {
  return new SimpleCollection(jsonObject.getMap().values(), getObjectWrapper());
}
项目:private-freemarker    文件:SaicObjectWrapper.java   
@SuppressWarnings("rawtypes")
@Override
public TemplateModel wrap(Object obj) throws TemplateModelException {
       if (obj == null) {
           return super.wrap(null);
       }
       if (obj instanceof TemplateModel) {
           return (TemplateModel) obj;
       }
       if (obj instanceof String) {
           return new SimpleScalar((String) obj);
       }
       if (obj instanceof Number) {
           return new SimpleNumber((Number) obj);
       }
       if (obj instanceof java.util.Date) {
           if(obj instanceof java.sql.Date) {
               return new SimpleDate((java.sql.Date) obj);
           }
           if(obj instanceof java.sql.Time) {
               return new SimpleDate((java.sql.Time) obj);
           }
           if(obj instanceof java.sql.Timestamp) {
               return new SimpleDate((java.sql.Timestamp) obj);
           }
           return new SimpleDate((java.util.Date) obj, getDefaultDateType());
       }
       if (obj.getClass().isArray()) {
           obj = convertArray(obj);
       }
       if (obj instanceof Collection) {
           return new SimpleSequence((Collection) obj, this);
       }
       if (obj instanceof Boolean) {
           return obj.equals(Boolean.TRUE) ? TemplateBooleanModel.TRUE : TemplateBooleanModel.FALSE;
       }
       if (obj instanceof Iterator) {
           return new SimpleCollection((Iterator) obj, this);
       }
       return handleUnknownType(obj);
   }
项目:StaticWeb    文件:JSONTemplateHashModel.java   
@Override
public TemplateCollectionModel values() throws TemplateModelException {
    return new SimpleCollection(toWrap.keys(), wrapper);
}