Class ReportJSONBuilder
java.lang.Object
br.ufsc.labsec.signature.conformanceVerifier.report.builder.ReportJSONBuilder
- All Implemented Interfaces:
- ReportBuilder<org.json.JSONObject,org.json.JSONObject>
public class ReportJSONBuilder extends Object implements ReportBuilder<org.json.JSONObject,org.json.JSONObject>
- 
Constructor SummaryConstructors Constructor Description ReportJSONBuilder()
- 
Method SummaryModifier and Type Method Description ReportBuilder<org.json.JSONObject,org.json.JSONObject>createElement(ReportElement value)Cria um elemento baseado em um relatório.ReportBuilder<org.json.JSONObject,org.json.JSONObject>createElement(String tag)ReportBuilder<org.json.JSONObject,org.json.JSONObject>createElement(String tag, boolean value)Cria um elemento com um conteúdo booleanoReportBuilder<org.json.JSONObject,org.json.JSONObject>createElement(String tag, Number value)Cria um elemento com um conteúdo numéricoReportBuilder<org.json.JSONObject,org.json.JSONObject>createElement(String tag, String value)Cria um elemento com um conteúdo de textoReportBuilder<org.json.JSONObject,org.json.JSONObject>createElement(String tag, Consumer<ReportBuilder<org.json.JSONObject,org.json.JSONObject>> consumer)Cria um elemento e o constrói com base em uma função anônima, esse método abstrai a pilha para a criação de elementos complexos.
 Um exemplo do uso é na criação do elemento de certificado em DigitalIdentityReportReportBuilder<org.json.JSONObject,org.json.JSONObject>createElementForEach(String tag, String pluralTag, Collection<String> values)Cria um elemento lista (plural tag) e elementos filhos dele com a tag<T> ReportBuilder<org.json.JSONObject,org.json.JSONObject>createElementForEach(String tag, String pluralTag, Collection<T> values, BiConsumer<T,ReportBuilder<org.json.JSONObject,org.json.JSONObject>> consumer)Cria uma lista de elementos e os constrói com base em uma função anônima.ReportBuilder<org.json.JSONObject,org.json.JSONObject>createElementForEach(Collection<? extends ReportElement> values)Este método leva em conta a possibilidade de relatórios de tipos diferentes estarem presentes na lista.org.json.JSONObjectgetCurrentElement()Obtém o elemento atualorg.json.JSONObjectgetRoot()Obtém o elemento raizvoidgoToElement(String tag)org.json.JSONObjectpopElement()voidsetCurrentElement(String tag)Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface br.ufsc.labsec.signature.conformanceVerifier.report.builder.ReportBuildercreateElement
- 
Constructor Details- 
ReportJSONBuilderpublic ReportJSONBuilder()
 
- 
- 
Method Details- 
createElementDescription copied from interface:ReportBuilderCria um elemento baseado em um relatório. O builder é 'emprestado' para o relatório, assim, o elemento a ser criado é adicionado ao topo da pilha e depois é removido- Specified by:
- createElementin interface- ReportBuilder<org.json.JSONObject,org.json.JSONObject>
- Parameters:
- value- relatório
- Returns:
- builder
 
- 
createElement- Specified by:
- createElementin interface- ReportBuilder<org.json.JSONObject,org.json.JSONObject>
 
- 
createElementpublic ReportBuilder<org.json.JSONObject,org.json.JSONObject> createElement(String tag, String value)Description copied from interface:ReportBuilderCria um elemento com um conteúdo de texto- Specified by:
- createElementin interface- ReportBuilder<org.json.JSONObject,org.json.JSONObject>
- Parameters:
- tag- tag do elemento
- value- valor do elemento
- Returns:
- builder
 
- 
createElementpublic ReportBuilder<org.json.JSONObject,org.json.JSONObject> createElement(String tag, Number value)Description copied from interface:ReportBuilderCria um elemento com um conteúdo numérico- Specified by:
- createElementin interface- ReportBuilder<org.json.JSONObject,org.json.JSONObject>
- Parameters:
- tag- tag do elemento
- value- valor do elemento
- Returns:
- builder
 
- 
createElementpublic ReportBuilder<org.json.JSONObject,org.json.JSONObject> createElement(String tag, boolean value)Description copied from interface:ReportBuilderCria um elemento com um conteúdo booleano- Specified by:
- createElementin interface- ReportBuilder<org.json.JSONObject,org.json.JSONObject>
- Parameters:
- tag- tag do elemento
- value- valor do elemento
- Returns:
- builder
 
- 
createElementpublic ReportBuilder<org.json.JSONObject,org.json.JSONObject> createElement(String tag, Consumer<ReportBuilder<org.json.JSONObject,org.json.JSONObject>> consumer)Description copied from interface:ReportBuilderCria um elemento e o constrói com base em uma função anônima, esse método abstrai a pilha para a criação de elementos complexos.
 Um exemplo do uso é na criação do elemento de certificado em DigitalIdentityReport- Specified by:
- createElementin interface- ReportBuilder<org.json.JSONObject,org.json.JSONObject>
- Parameters:
- tag- tag do elemento
- consumer- função de criação do elemento
- Returns:
- builder
- See Also:
- DigitalIdentityReport
 
- 
createElementForEachpublic <T> ReportBuilder<org.json.JSONObject,org.json.JSONObject> createElementForEach(String tag, String pluralTag, Collection<T> values, BiConsumer<T,ReportBuilder<org.json.JSONObject,org.json.JSONObject>> consumer)Description copied from interface:ReportBuilderCria uma lista de elementos e os constrói com base em uma função anônima. Esse método abstrai a pilha para a criação de elementos complexos.
 O uso desse método é recomendado para a criação de listas de elementos que não são relatórios. O consumer, ou a função que o implementa, deve receber de argumento o valor T e o builder, nesta ordem.
 Um exemplo do uso é na criação do elemento conformities emReport.buildConformity(SignatureReport.Conformity, ReportBuilder)(SignatureReport.Conformity, ReportBuilder) Report#buildConformity}- Specified by:
- createElementForEachin interface- ReportBuilder<org.json.JSONObject,org.json.JSONObject>
- Type Parameters:
- T- tipo dos valores
- Parameters:
- tag- tag do elemento
- pluralTag- tag da lista
- values- valores da lista
- consumer- função de criação do elemento
- Returns:
- builder
 
- 
createElementForEachpublic ReportBuilder<org.json.JSONObject,org.json.JSONObject> createElementForEach(Collection<? extends ReportElement> values)Description copied from interface:ReportBuilderEste método leva em conta a possibilidade de relatórios de tipos diferentes estarem presentes na lista. Primeiramente, os relatório são agrupados pela tag pluralizada e são adicionados ao elemento com esta tag. Caso o elemento com a tag pluralizada não exista, ele é criado. - Specified by:
- createElementForEachin interface- ReportBuilder<org.json.JSONObject,org.json.JSONObject>
- Parameters:
- values- relatórios
- Returns:
- builder
 
- 
createElementForEachpublic ReportBuilder<org.json.JSONObject,org.json.JSONObject> createElementForEach(String tag, String pluralTag, Collection<String> values)Description copied from interface:ReportBuilderCria um elemento lista (plural tag) e elementos filhos dele com a tag- Specified by:
- createElementForEachin interface- ReportBuilder<org.json.JSONObject,org.json.JSONObject>
- Parameters:
- tag- tag dos elementos
- pluralTag- tag lista
- values- valor dos elementos
- Returns:
- builder
 
- 
getCurrentElementpublic org.json.JSONObject getCurrentElement()Description copied from interface:ReportBuilderObtém o elemento atual- Specified by:
- getCurrentElementin interface- ReportBuilder<org.json.JSONObject,org.json.JSONObject>
- Returns:
- elemento atual
 
- 
getRootpublic org.json.JSONObject getRoot()Description copied from interface:ReportBuilderObtém o elemento raiz- Specified by:
- getRootin interface- ReportBuilder<org.json.JSONObject,org.json.JSONObject>
- Returns:
- elemento raiz
 
- 
setCurrentElement- Specified by:
- setCurrentElementin interface- ReportBuilder<org.json.JSONObject,org.json.JSONObject>
 
- 
goToElement- Specified by:
- goToElementin interface- ReportBuilder<org.json.JSONObject,org.json.JSONObject>
 
- 
popElementpublic org.json.JSONObject popElement()- Specified by:
- popElementin interface- ReportBuilder<org.json.JSONObject,org.json.JSONObject>
 
 
-