⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 templateunit.java

📁 Jamon是一个Java文本模板引擎
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        return m_methods.values().iterator();    }    public Iterator<MethodUnit> getImplementedMethodUnits()    {        return new SequentialIterator<MethodUnit>(getDeclaredMethodUnits(),                                                  m_overrides.iterator());    }    public Collection<String> getAbstractMethodNames()    {        return m_abstractMethodNames;    }    private Iterable<ImportNode> getImports()    {        return m_imports;    }    public void addStaticImport(StaticImportNode p_node)    {        m_staticImports.add(p_node);    }    private Iterable<StaticImportNode> getStaticImports()    {        return m_staticImports;    }    public void addImport(ImportNode p_node)    {        m_imports.add(p_node);    }    public void addInterface(String p_interface)    {        m_interfaces.add(p_interface);    }    public void setParentPath(String p_parentPath)    {        m_parentPath = p_parentPath;        m_dependencies.add(m_parentPath);    }    public String getParentPath()    {        return m_parentPath;    }    public boolean hasParentPath()    {        return m_parentPath != null;    }    public boolean isParent()    {        return m_isParent;    }    public void setIsParent()    {        m_isParent = true;    }    public void printClassContent(CodeWriter p_writer)    {        for (ClassNode node : m_classContent)        {            p_writer.printLocation(node.getLocation());            p_writer.println(node.getContent());        }    }    public void addClassContent(ClassNode p_node)    {        m_classContent.add(p_node);    }    public void addCallPath(String p_callPath)    {        m_dependencies.add(p_callPath);    }    private InheritedArgs m_inheritedArgs;    private TemplateDescription m_parentDescription =        TemplateDescription.EMPTY;    private final List<RequiredArgument> m_declaredRequiredArgs =        new LinkedList<RequiredArgument>();    private final List<FragmentArgument> m_fragmentArgs =        new LinkedList<FragmentArgument>();    private final Set<OptionalArgument> m_declaredOptionalArgs =        new HashSet<OptionalArgument>();    private final Set<FragmentArgument> m_declaredFragmentArgs =        new HashSet<FragmentArgument>();    private final Map<String, DefUnit> m_defs = new HashMap<String, DefUnit>();    private final Map<String, MethodUnit> m_methods =        new HashMap<String, MethodUnit>();    private final List<OverriddenMethodUnit> m_overrides =        new LinkedList<OverriddenMethodUnit>();    private final List<ImportNode> m_imports = new LinkedList<ImportNode>();    private final List<StaticImportNode> m_staticImports =        new LinkedList<StaticImportNode>();    private final List<String> m_interfaces = new LinkedList<String>();    private String m_parentPath;    private boolean m_isParent = false;    private final List<ClassNode> m_classContent = new LinkedList<ClassNode>();    private final Set<String> m_dependencies = new HashSet<String>();    private final Set<String> m_callNames = new HashSet<String>();    private final Collection<String> m_abstractMethodNames =        new HashSet<String>();    private final GenericParams m_genericParams = new GenericParams();    private String m_jamonContextType;    private final List<AnnotationNode> m_annotations = new LinkedList<AnnotationNode>();    public Iterator<RequiredArgument> getParentRenderArgs()    {        return new SequentialIterator<RequiredArgument>            (m_parentDescription.getRequiredArgs().iterator(),             m_parentDescription.getFragmentInterfaces().iterator());    }    public void printImports(CodeWriter p_writer)    {        for (ImportNode node : getImports())        {            p_writer.printLocation(node.getLocation());            p_writer.println("import " + node.getName() + ";");        }        for (StaticImportNode node : getStaticImports())        {            p_writer.printLocation(node.getLocation());            p_writer.println("import static " + node.getName() + ";");        }        p_writer.println();    }    public void printParentRenderArgs(CodeWriter p_writer)    {        printArgs(p_writer, getParentRenderArgs());    }    public void printParentRenderArgsDecl(CodeWriter p_writer)    {        printArgsDecl(p_writer, getParentRenderArgs());    }    public Iterator<RequiredArgument> getDeclaredRenderArgs()    {        return new SequentialIterator<RequiredArgument>(            m_declaredRequiredArgs.iterator(),            m_declaredFragmentArgs.iterator());    }    public Iterator<AbstractArgument> getDeclaredArgs()    {        return new SequentialIterator<AbstractArgument>(                getDeclaredRenderArgs(),                m_declaredOptionalArgs.iterator());    }    public void printDeclaredRenderArgs(CodeWriter p_writer)    {        printArgs(p_writer, getDeclaredRenderArgs());    }    public void printDeclaredRenderArgsDecl(CodeWriter p_writer)    {        printArgsDecl(p_writer, getDeclaredRenderArgs());    }    public void printInterfaces(CodeWriter p_writer)    {        if (m_interfaces.size() > 0)        {            p_writer.print("  implements ");            for (Iterator<String> i = m_interfaces.iterator(); i.hasNext(); )            {                p_writer.print(i.next());                if (i.hasNext())                {                    p_writer.print(", ");                }            }        }    }    @Override    protected void generateInterfaceSummary(StringBuilder p_buf)    {        super.generateInterfaceSummary(p_buf);        p_buf.append("GenericParams:");        p_buf.append(getGenericParams().generateGenericsDeclaration());        p_buf.append("\n");        if(m_parentDescription != null)        {            p_buf.append("Parent sig: ");            p_buf.append(m_parentDescription.getSignature());            p_buf.append("\n");        }        for(Iterator<FragmentArgument> i = getFragmentArgs(); i.hasNext(); )        {            FragmentArgument arg = i.next();            p_buf.append("Fragment: ");            p_buf.append(arg.getName());            p_buf.append("\n");            arg.getFragmentUnit().generateInterfaceSummary(p_buf);        }    }    public String getSignature()    {        try        {            StringBuilder buf = new StringBuilder();            generateInterfaceSummary(buf);            return StringUtils.byteArrayToHexString                (MessageDigest.getInstance("MD5").digest                     (buf.toString().getBytes()));        }        catch (NoSuchAlgorithmException e)        {            throw new RuntimeException("Unable to get md5 instance");        }    }    public GenericParams getGenericParams() { return m_genericParams; }    public void setJamonContextType(String p_jamonContextType)    {        m_jamonContextType = p_jamonContextType;    }    public String getJamonContextType() { return m_jamonContextType; }    public boolean isOriginatingJamonContext()    {        return m_jamonContextType != null            && (! hasParentPath()                || m_parentDescription.getJamonContextType() == null);    }    public void addGenericsParamNode(GenericsParamNode p_node)    {        m_genericParams.addParam(p_node);    }    public void addAnnotationNode(AnnotationNode p_node)    {        m_annotations.add(p_node);    }    public Iterable<AnnotationNode> getAnnotations() { return m_annotations; }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -