Package gap.hapax

Examples of gap.hapax.TemplateException


            try {
                template.render(top,out);
            }
            catch (TemplateException exc){
                throw new TemplateException("In template '"+xtm.source+"'.",exc);
            }
        }
        else
            throw new IllegalArgumentException();
    }
View Full Code Here


                template.render(top,out);

                return true;
            }
            catch (TemplateException exc){
                throw new TemplateException("In template '"+xtm.source+"'.",exc);
            }
        }
        else
            throw new IllegalArgumentException();
    }
View Full Code Here

                template.render(top,out);

                return;
            }
            catch (TemplateException exc){
                throw new TemplateException("In template '"+xtm.source+"'.",exc);
            }
            finally {
                out.close();
            }
        }
View Full Code Here

                    try {
                        template.render(top,out);
                    }
                    catch (TemplateException exc){
                        throw new TemplateException("In template '"+xtm.source+"'.",exc);
                    }
                }
                else
                    throw new TemplateException("Primitive type not found for name '"+childClassName+"'.");
 
            }
                break;
            case ListShort:
            case ListLong:{
                ClassDescriptor child = Classes.For(childClassName);
                if (null != child){

                    DefineClass(PackageFor(child,pkg),child,ImportsFor(child,imports),top,TemplateNames.PrefixChild);

                    top.setVariable(TemplateNames.ListClassName,listClassName);
                    if (gap.data.List.Type.ListShort == listType)
                        top.setVariable(TemplateNames.ListType,"Short");
                    else
                        top.setVariable(TemplateNames.ListType,"Long");

                    try {
                        template.render(top,out);
                    }
                    catch (TemplateException exc){
                        throw new TemplateException("In template '"+xtm.source+"'.",exc);
                    }
                }
                else if (null != childClass){

                    DefineClass(pkg,childClass,imports,top,TemplateNames.PrefixChild);

                    top.setVariable(TemplateNames.ListClassName,listClassName);
                    if (gap.data.List.Type.ListShort == listType)
                        top.setVariable(TemplateNames.ListType,"Short");
                    else
                        top.setVariable(TemplateNames.ListType,"Long");

                    try {
                        template.render(top,out);
                    }
                    catch (TemplateException exc){
                        throw new TemplateException("In template '"+xtm.source+"'.",exc);
                    }
                }
                else
                    throw new TemplateException("Child class descriptor not found for name '"+childClassName+"'.");
            }
                break;
            }
        }
        else
View Full Code Here

                    try {
                        template.render(top,out);
                    }
                    catch (TemplateException exc){
                        throw new TemplateException("In template '"+xtm.source+"'.",exc);
                    }
                }
                else
                    throw new TemplateException("Primitive type not found for name '"+mapChild.childValueClassName+"'.");
            }
                break;
            case MapShort: //(fall-through)
            case MapLong:{
                ClassDescriptor child = Classes.For(mapChild.childValueClassName);
                if (null != child){

                    DefineClass(PackageFor(child,pkg),child,ImportsFor(child,imports),top,TemplateNames.PrefixChild);

                    top.setVariable(TemplateNames.MapClassName,mapClassName);
                    top.setVariable(TemplateNames.MapKeyType,mapChild.childKeyFieldType);
                    top.setVariable(TemplateNames.MapKeyFieldName,mapChild.childKeyFieldName);
                    top.setVariable(TemplateNames.MapKeyFieldNameCamel,Camel(mapChild.childKeyFieldName));

                    try {
                        template.render(top,out);
                    }
                    catch (TemplateException exc){
                        throw new TemplateException("In template '"+xtm.source+"'.",exc);
                    }
                }
                else if (null != childClass){

                    DefineClass(pkg,childClass,imports,top,TemplateNames.PrefixChild);

                    top.setVariable(TemplateNames.MapClassName,mapClassName);
                    top.setVariable(TemplateNames.MapKeyType,mapChild.childKeyFieldType);
                    top.setVariable(TemplateNames.MapKeyFieldName,mapChild.childKeyFieldName);
                    top.setVariable(TemplateNames.MapKeyFieldNameCamel,Camel(mapChild.childKeyFieldName));

                    try {
                        template.render(top,out);
                    }
                    catch (TemplateException exc){
                        throw new TemplateException("In template '"+xtm.source+"'.",exc);
                    }
                }
                else
                    throw new TemplateException("Child class descriptor not found for name '"+mapChild.childValueClassName+"'.");
            }
                break;
            }
        }
        else
View Full Code Here

                    this.put(templateResource,template);

                    return new gap.hapax.TemplateRendererImpl(this,template);
                }
                catch (IOException iox){
                    throw new TemplateException(templateResource.toString(),iox);
                }
            }
        }
        else
            return new gap.hapax.TemplateRendererImpl(this,template);
View Full Code Here

            String target = template.toString();

            if (null != source && null != target && target.equals(source.getValue()))
                return true;
            else if (null == source)
                throw new TemplateException(String.format("Missing source for '%s'",name));
            else if (null == target)
                throw new TemplateException(String.format("Missing target for '%s'",name));
            else {
                String sourceString = source.getValue();
                if (null == sourceString)
                    throw new TemplateException(String.format("Missing source string for '%s'",name));
                else {
                    System.err.printf("Template Source '%s'%n",name);
                    System.err.println(sourceString);
                    System.err.printf("Template Target '%s'%n",name);
                    System.err.println(target);
                    return false;
                }
            }
        }
        else {
            throw new TemplateException(String.format("Missing template '%s'",name));
        }
    }
View Full Code Here

TOP

Related Classes of gap.hapax.TemplateException

Copyright © 2018 www.massapicom. 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.