From b2fda364b510fae487d75a1055ea14750b0a520c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Prante?= Date: Mon, 4 Mar 2024 22:29:32 +0100 Subject: [PATCH] clean up and reformat code, integrate javapoet, lift tests to java modules --- gradle/compile/java.gradle | 29 +- gradle/test/junit5.gradle | 16 +- j2html-codegen/build.gradle | 13 +- j2html-codegen/src/main/java/module-info.java | 7 + .../org/xbib/j2html/codegen/Generator.java | 14 +- j2html-codegen/src/test/java/module-info.java | 12 + .../codegen/{ => test}/GenerateTest.java | 7 +- .../j2html/codegen/{ => test}/ParserTest.java | 2 +- .../wattsi/AttributeDefinition.java | 2 +- .../wattsi}/CodeGeneratorComplianceTests.java | 11 +- .../{ => test}/wattsi/ElementDefinition.java | 2 +- .../{ => test}/wattsi/WattsiGenerator.java | 10 +- .../{ => test}/wattsi/WattsiSource.java | 2 +- .../xbib/j2html/codegen/test}/html.model | 0 .../codegen/test/wattsi}/2022-01.wattsi | 0 j2html/build.gradle | 11 + .../src/main/java/org/xbib/j2html/Config.java | 43 +- .../main/java/org/xbib/j2html/TagCreator.java | 3255 +++++++++++++---- .../org/xbib/j2html/attributes/Attribute.java | 5 +- .../org/xbib/j2html/rendering/FlatHtml.java | 12 +- .../xbib/j2html/rendering/IndentedHtml.java | 15 +- .../org/xbib/j2html/tags/ContainerTag.java | 25 +- .../xbib/j2html/tags/DomContentJoiner.java | 2 +- .../java/org/xbib/j2html/tags/EmptyTag.java | 9 +- .../j2html/tags/InlineStaticResource.java | 40 +- .../java/org/xbib/j2html/tags/Renderable.java | 7 +- .../main/java/org/xbib/j2html/tags/Tag.java | 134 +- .../main/java/org/xbib/j2html/tags/Text.java | 7 +- .../org/xbib/j2html/tags/UnescapedText.java | 7 +- .../xbib/j2html/tags/attributes/IAccept.java | 12 +- .../xbib/j2html/tags/attributes/IAction.java | 12 +- .../org/xbib/j2html/tags/attributes/IAlt.java | 12 +- .../xbib/j2html/tags/attributes/IAsync.java | 12 +- .../j2html/tags/attributes/IAutocomplete.java | 12 +- .../j2html/tags/attributes/IAutofocus.java | 12 +- .../j2html/tags/attributes/IAutoplay.java | 12 +- .../xbib/j2html/tags/attributes/ICharset.java | 12 +- .../xbib/j2html/tags/attributes/IChecked.java | 12 +- .../xbib/j2html/tags/attributes/ICite.java | 12 +- .../xbib/j2html/tags/attributes/ICols.java | 12 +- .../xbib/j2html/tags/attributes/IColspan.java | 12 +- .../xbib/j2html/tags/attributes/IContent.java | 12 +- .../j2html/tags/attributes/IControls.java | 12 +- .../xbib/j2html/tags/attributes/ICoords.java | 12 +- .../xbib/j2html/tags/attributes/IData.java | 12 +- .../j2html/tags/attributes/IDatetime.java | 12 +- .../xbib/j2html/tags/attributes/IDefault.java | 12 +- .../xbib/j2html/tags/attributes/IDefer.java | 12 +- .../xbib/j2html/tags/attributes/IDirname.java | 12 +- .../j2html/tags/attributes/IDisabled.java | 12 +- .../j2html/tags/attributes/IDownload.java | 12 +- .../xbib/j2html/tags/attributes/IEnctype.java | 12 +- .../org/xbib/j2html/tags/attributes/IFor.java | 12 +- .../xbib/j2html/tags/attributes/IForm.java | 12 +- .../j2html/tags/attributes/IFormaction.java | 12 +- .../xbib/j2html/tags/attributes/IHeaders.java | 12 +- .../xbib/j2html/tags/attributes/IHeight.java | 12 +- .../xbib/j2html/tags/attributes/IHigh.java | 12 +- .../xbib/j2html/tags/attributes/IHref.java | 12 +- .../j2html/tags/attributes/IHreflang.java | 12 +- .../xbib/j2html/tags/attributes/IIsmap.java | 12 +- .../xbib/j2html/tags/attributes/IKind.java | 12 +- .../xbib/j2html/tags/attributes/ILabel.java | 12 +- .../xbib/j2html/tags/attributes/IList.java | 12 +- .../xbib/j2html/tags/attributes/ILoop.java | 12 +- .../org/xbib/j2html/tags/attributes/ILow.java | 12 +- .../org/xbib/j2html/tags/attributes/IMax.java | 12 +- .../j2html/tags/attributes/IMaxlength.java | 12 +- .../xbib/j2html/tags/attributes/IMedia.java | 12 +- .../xbib/j2html/tags/attributes/IMethod.java | 12 +- .../org/xbib/j2html/tags/attributes/IMin.java | 12 +- .../j2html/tags/attributes/IMultiple.java | 12 +- .../xbib/j2html/tags/attributes/IMuted.java | 12 +- .../xbib/j2html/tags/attributes/IName.java | 12 +- .../j2html/tags/attributes/INovalidate.java | 12 +- .../xbib/j2html/tags/attributes/IOnabort.java | 12 +- .../j2html/tags/attributes/IOnafterprint.java | 12 +- .../tags/attributes/IOnbeforeprint.java | 12 +- .../tags/attributes/IOnbeforeunload.java | 12 +- .../j2html/tags/attributes/IOncanplay.java | 12 +- .../tags/attributes/IOncanplaythrough.java | 12 +- .../j2html/tags/attributes/IOncuechange.java | 12 +- .../tags/attributes/IOndurationchange.java | 12 +- .../j2html/tags/attributes/IOnemptied.java | 12 +- .../xbib/j2html/tags/attributes/IOnended.java | 12 +- .../xbib/j2html/tags/attributes/IOnerror.java | 12 +- .../j2html/tags/attributes/IOnhashchange.java | 12 +- .../xbib/j2html/tags/attributes/IOnload.java | 12 +- .../j2html/tags/attributes/IOnloadeddata.java | 12 +- .../tags/attributes/IOnloadedmetadata.java | 12 +- .../j2html/tags/attributes/IOnloadstart.java | 12 +- .../j2html/tags/attributes/IOnoffline.java | 12 +- .../j2html/tags/attributes/IOnonline.java | 12 +- .../j2html/tags/attributes/IOnpagehide.java | 12 +- .../j2html/tags/attributes/IOnpageshow.java | 12 +- .../xbib/j2html/tags/attributes/IOnpause.java | 12 +- .../xbib/j2html/tags/attributes/IOnplay.java | 12 +- .../j2html/tags/attributes/IOnplaying.java | 12 +- .../j2html/tags/attributes/IOnpopstate.java | 12 +- .../j2html/tags/attributes/IOnprogress.java | 12 +- .../j2html/tags/attributes/IOnratechange.java | 12 +- .../xbib/j2html/tags/attributes/IOnreset.java | 12 +- .../j2html/tags/attributes/IOnresize.java | 12 +- .../j2html/tags/attributes/IOnsearch.java | 12 +- .../j2html/tags/attributes/IOnseeked.java | 12 +- .../j2html/tags/attributes/IOnseeking.java | 12 +- .../j2html/tags/attributes/IOnstalled.java | 12 +- .../j2html/tags/attributes/IOnstorage.java | 12 +- .../j2html/tags/attributes/IOnsubmit.java | 12 +- .../j2html/tags/attributes/IOnsuspend.java | 12 +- .../j2html/tags/attributes/IOntimeupdate.java | 12 +- .../j2html/tags/attributes/IOntoggle.java | 12 +- .../j2html/tags/attributes/IOnunload.java | 12 +- .../tags/attributes/IOnvolumechanged.java | 12 +- .../j2html/tags/attributes/IOnwaiting.java | 12 +- .../xbib/j2html/tags/attributes/IOpen.java | 12 +- .../xbib/j2html/tags/attributes/IOptimum.java | 12 +- .../xbib/j2html/tags/attributes/IPattern.java | 12 +- .../j2html/tags/attributes/IPlaceholder.java | 12 +- .../xbib/j2html/tags/attributes/IPoster.java | 12 +- .../xbib/j2html/tags/attributes/IPreload.java | 12 +- .../j2html/tags/attributes/IReadonly.java | 12 +- .../org/xbib/j2html/tags/attributes/IRel.java | 12 +- .../j2html/tags/attributes/IRequired.java | 12 +- .../j2html/tags/attributes/IReversed.java | 12 +- .../xbib/j2html/tags/attributes/IRows.java | 12 +- .../xbib/j2html/tags/attributes/IRowspan.java | 12 +- .../xbib/j2html/tags/attributes/ISandbox.java | 12 +- .../xbib/j2html/tags/attributes/IScope.java | 12 +- .../j2html/tags/attributes/ISelected.java | 12 +- .../xbib/j2html/tags/attributes/IShape.java | 12 +- .../xbib/j2html/tags/attributes/ISize.java | 12 +- .../xbib/j2html/tags/attributes/ISizes.java | 12 +- .../xbib/j2html/tags/attributes/ISpan.java | 12 +- .../org/xbib/j2html/tags/attributes/ISrc.java | 12 +- .../xbib/j2html/tags/attributes/ISrcdoc.java | 12 +- .../xbib/j2html/tags/attributes/ISrclang.java | 12 +- .../xbib/j2html/tags/attributes/ISrcset.java | 12 +- .../xbib/j2html/tags/attributes/IStart.java | 12 +- .../xbib/j2html/tags/attributes/IStep.java | 12 +- .../xbib/j2html/tags/attributes/ITarget.java | 12 +- .../xbib/j2html/tags/attributes/IType.java | 12 +- .../xbib/j2html/tags/attributes/IUsemap.java | 12 +- .../xbib/j2html/tags/attributes/IValue.java | 12 +- .../xbib/j2html/tags/attributes/IWidth.java | 12 +- .../xbib/j2html/tags/attributes/IWrap.java | 12 +- .../xbib/j2html/tags/specialized/ATag.java | 6 +- .../xbib/j2html/tags/specialized/AbbrTag.java | 6 +- .../j2html/tags/specialized/AddressTag.java | 6 +- .../xbib/j2html/tags/specialized/AreaTag.java | 6 +- .../j2html/tags/specialized/ArticleTag.java | 6 +- .../j2html/tags/specialized/AsideTag.java | 6 +- .../j2html/tags/specialized/AudioTag.java | 6 +- .../xbib/j2html/tags/specialized/BTag.java | 6 +- .../xbib/j2html/tags/specialized/BaseTag.java | 6 +- .../xbib/j2html/tags/specialized/BdiTag.java | 6 +- .../xbib/j2html/tags/specialized/BdoTag.java | 6 +- .../tags/specialized/BlockquoteTag.java | 6 +- .../xbib/j2html/tags/specialized/BodyTag.java | 6 +- .../xbib/j2html/tags/specialized/BrTag.java | 6 +- .../j2html/tags/specialized/ButtonTag.java | 6 +- .../j2html/tags/specialized/CanvasTag.java | 6 +- .../j2html/tags/specialized/CaptionTag.java | 6 +- .../xbib/j2html/tags/specialized/CiteTag.java | 6 +- .../xbib/j2html/tags/specialized/CodeTag.java | 6 +- .../xbib/j2html/tags/specialized/ColTag.java | 6 +- .../j2html/tags/specialized/ColgroupTag.java | 6 +- .../xbib/j2html/tags/specialized/DataTag.java | 6 +- .../j2html/tags/specialized/DatalistTag.java | 6 +- .../xbib/j2html/tags/specialized/DdTag.java | 6 +- .../xbib/j2html/tags/specialized/DelTag.java | 6 +- .../j2html/tags/specialized/DetailsTag.java | 6 +- .../xbib/j2html/tags/specialized/DfnTag.java | 6 +- .../j2html/tags/specialized/DialogTag.java | 6 +- .../xbib/j2html/tags/specialized/DivTag.java | 6 +- .../xbib/j2html/tags/specialized/DlTag.java | 6 +- .../xbib/j2html/tags/specialized/DtTag.java | 6 +- .../xbib/j2html/tags/specialized/EmTag.java | 6 +- .../j2html/tags/specialized/EmbedTag.java | 6 +- .../j2html/tags/specialized/FieldsetTag.java | 6 +- .../tags/specialized/FigcaptionTag.java | 6 +- .../j2html/tags/specialized/FigureTag.java | 6 +- .../j2html/tags/specialized/FooterTag.java | 6 +- .../xbib/j2html/tags/specialized/FormTag.java | 6 +- .../xbib/j2html/tags/specialized/H1Tag.java | 6 +- .../xbib/j2html/tags/specialized/H2Tag.java | 6 +- .../xbib/j2html/tags/specialized/H3Tag.java | 6 +- .../xbib/j2html/tags/specialized/H4Tag.java | 6 +- .../xbib/j2html/tags/specialized/H5Tag.java | 6 +- .../xbib/j2html/tags/specialized/H6Tag.java | 6 +- .../xbib/j2html/tags/specialized/HeadTag.java | 6 +- .../j2html/tags/specialized/HeaderTag.java | 6 +- .../xbib/j2html/tags/specialized/HrTag.java | 6 +- .../xbib/j2html/tags/specialized/HtmlTag.java | 6 +- .../xbib/j2html/tags/specialized/ITag.java | 6 +- .../j2html/tags/specialized/IframeTag.java | 6 +- .../xbib/j2html/tags/specialized/ImgTag.java | 6 +- .../j2html/tags/specialized/InputTag.java | 6 +- .../xbib/j2html/tags/specialized/InsTag.java | 6 +- .../xbib/j2html/tags/specialized/KbdTag.java | 6 +- .../j2html/tags/specialized/KeygenTag.java | 6 +- .../j2html/tags/specialized/LabelTag.java | 6 +- .../j2html/tags/specialized/LegendTag.java | 6 +- .../xbib/j2html/tags/specialized/LiTag.java | 6 +- .../xbib/j2html/tags/specialized/LinkTag.java | 6 +- .../xbib/j2html/tags/specialized/MainTag.java | 6 +- .../xbib/j2html/tags/specialized/MapTag.java | 6 +- .../xbib/j2html/tags/specialized/MarkTag.java | 6 +- .../xbib/j2html/tags/specialized/MenuTag.java | 6 +- .../j2html/tags/specialized/MenuitemTag.java | 6 +- .../xbib/j2html/tags/specialized/MetaTag.java | 6 +- .../j2html/tags/specialized/MeterTag.java | 6 +- .../xbib/j2html/tags/specialized/NavTag.java | 6 +- .../j2html/tags/specialized/NoscriptTag.java | 6 +- .../j2html/tags/specialized/ObjectTag.java | 6 +- .../xbib/j2html/tags/specialized/OlTag.java | 6 +- .../j2html/tags/specialized/OptgroupTag.java | 6 +- .../j2html/tags/specialized/OptionTag.java | 6 +- .../j2html/tags/specialized/OutputTag.java | 6 +- .../xbib/j2html/tags/specialized/PTag.java | 6 +- .../j2html/tags/specialized/ParamTag.java | 6 +- .../j2html/tags/specialized/PictureTag.java | 6 +- .../xbib/j2html/tags/specialized/PreTag.java | 6 +- .../j2html/tags/specialized/ProgressTag.java | 6 +- .../xbib/j2html/tags/specialized/QTag.java | 6 +- .../xbib/j2html/tags/specialized/RpTag.java | 6 +- .../xbib/j2html/tags/specialized/RtTag.java | 6 +- .../xbib/j2html/tags/specialized/RubyTag.java | 6 +- .../xbib/j2html/tags/specialized/STag.java | 6 +- .../xbib/j2html/tags/specialized/SampTag.java | 6 +- .../j2html/tags/specialized/ScriptTag.java | 6 +- .../j2html/tags/specialized/SectionTag.java | 6 +- .../j2html/tags/specialized/SelectTag.java | 6 +- .../xbib/j2html/tags/specialized/SlotTag.java | 6 +- .../j2html/tags/specialized/SmallTag.java | 6 +- .../j2html/tags/specialized/SourceTag.java | 6 +- .../xbib/j2html/tags/specialized/SpanTag.java | 6 +- .../j2html/tags/specialized/StrongTag.java | 6 +- .../j2html/tags/specialized/StyleTag.java | 6 +- .../xbib/j2html/tags/specialized/SubTag.java | 6 +- .../j2html/tags/specialized/SummaryTag.java | 6 +- .../xbib/j2html/tags/specialized/SupTag.java | 6 +- .../j2html/tags/specialized/TableTag.java | 6 +- .../j2html/tags/specialized/TbodyTag.java | 6 +- .../xbib/j2html/tags/specialized/TdTag.java | 6 +- .../j2html/tags/specialized/TemplateTag.java | 6 +- .../j2html/tags/specialized/TextareaTag.java | 6 +- .../j2html/tags/specialized/TfootTag.java | 6 +- .../xbib/j2html/tags/specialized/ThTag.java | 6 +- .../j2html/tags/specialized/TheadTag.java | 6 +- .../xbib/j2html/tags/specialized/TimeTag.java | 6 +- .../j2html/tags/specialized/TitleTag.java | 6 +- .../xbib/j2html/tags/specialized/TrTag.java | 6 +- .../j2html/tags/specialized/TrackTag.java | 6 +- .../xbib/j2html/tags/specialized/UTag.java | 6 +- .../xbib/j2html/tags/specialized/UlTag.java | 6 +- .../xbib/j2html/tags/specialized/VarTag.java | 6 +- .../j2html/tags/specialized/VideoTag.java | 6 +- .../xbib/j2html/tags/specialized/WbrTag.java | 6 +- .../java/org/xbib/j2html/utils/CSSMin.java | 14 +- .../org/xbib/j2html/utils/EscapeUtil.java | 3 +- .../java/org/xbib/j2html/utils/JSMin.java | 14 +- j2html/src/test/java/module-info.java | 19 + .../j2html/tags/InlineStaticResourceTest.java | 47 - .../j2html/{ => test}/PerformanceTest.java | 25 +- .../{ => test}/RenderPerformanceTest.java | 12 +- .../j2html/{ => test}/TextEscaperTest.java | 3 +- .../attributes/AttrShortFormTest.java | 2 +- .../{ => test}/attributes/AttributeTest.java | 3 +- .../{ => test}/comparison/ComparisonData.java | 4 +- .../RenderPerformanceComparisonTest.java | 2 +- .../{ => test}/comparison/TestJ2html.java | 10 +- .../{ => test}/comparison/TestVelocity.java | 2 +- .../j2html/FiveHundredEmployees.java | 4 +- .../comparison/j2html/HelloWorld.java | 2 +- .../{ => test}/comparison/j2html/Macros.java | 2 +- .../j2html/MultiplicationTable.java | 7 +- .../{ => test}/comparison/model/Employee.java | 2 +- .../j2html/{ => test}/model/BrowserTitle.java | 2 +- .../xbib/j2html/{ => test}/model/Button.java | 2 +- .../j2html/{ => test}/model/ButtonModel.java | 2 +- .../model/DynamicHrefAttribute.java | 2 +- .../j2html/{ => test}/model/PageModel.java | 2 +- .../j2html/{ => test}/model/Template.java | 2 +- .../j2html/{ => test}/model/TextTemplate.java | 2 +- .../{ => test}/rendering/FlatHtmlTest.java | 6 +- .../rendering/IndentedHtmlTest.java | 6 +- .../rendering/RenderingCompatabilityTest.java | 3 +- .../{ => test}/tags/AttributesPerTagTest.java | 2 +- .../{ => test}/tags/ComplexRenderTest.java | 2 +- .../tags/ConvenienceMethodTest.java | 2 +- .../{ => test}/tags/DomContentJoinerTest.java | 8 +- .../xbib/j2html/{ => test}/tags/Employee.java | 2 +- .../test/tags/InlineStaticResourceTest.java | 52 + .../{ => test}/tags/RenderFormattedTest.java | 2 +- .../{ => test}/tags/TagCreatorTest.java | 3 +- .../xbib/j2html/{ => test}/tags/TagTest.java | 7 +- .../xbib/j2html/{ => test}/tags/TextTest.java | 2 +- j2html/src/test/resources/logging.properties | 4 + .../velocity/fiveHundredEmployees.vm | 0 .../test}/comparison/velocity/helloWorld.vm | 0 .../test}/comparison/velocity/macros.vm | 0 .../velocity/multiplicationTable.vm | 0 .../xbib/j2html/test/tags}/AnyContent.java | 0 .../tags}/test-without-trailing-semis.css | 0 .../{ => org/xbib/j2html/test/tags}/test.css | 0 .../{ => org/xbib/j2html/test/tags}/test.html | 0 .../{ => org/xbib/j2html/test/tags}/test.js | 0 javapoet/src/main/java/module-info.java | 4 + .../org/xbib/javapoet/AnnotationSpec.java | 278 ++ .../java/org/xbib/javapoet/ArrayTypeName.java | 104 + .../java/org/xbib/javapoet/ClassName.java | 314 ++ .../java/org/xbib/javapoet/CodeBlock.java | 459 +++ .../java/org/xbib/javapoet/CodeWriter.java | 535 +++ .../java/org/xbib/javapoet/FieldSpec.java | 164 + .../main/java/org/xbib/javapoet/JavaFile.java | 342 ++ .../java/org/xbib/javapoet/LineWrapper.java | 176 + .../java/org/xbib/javapoet/MethodSpec.java | 527 +++ .../java/org/xbib/javapoet/NameAllocator.java | 154 + .../java/org/xbib/javapoet/ParameterSpec.java | 191 + .../xbib/javapoet/ParameterizedTypeName.java | 132 + .../main/java/org/xbib/javapoet/TypeName.java | 404 ++ .../main/java/org/xbib/javapoet/TypeSpec.java | 832 +++++ .../org/xbib/javapoet/TypeVariableName.java | 168 + .../src/main/java/org/xbib/javapoet/Util.java | 125 + .../org/xbib/javapoet/WildcardTypeName.java | 116 + settings.gradle | 1 + 327 files changed, 9031 insertions(+), 2068 deletions(-) create mode 100644 j2html-codegen/src/main/java/module-info.java create mode 100644 j2html-codegen/src/test/java/module-info.java rename j2html-codegen/src/test/java/org/xbib/j2html/codegen/{ => test}/GenerateTest.java (79%) rename j2html-codegen/src/test/java/org/xbib/j2html/codegen/{ => test}/ParserTest.java (98%) rename j2html-codegen/src/test/java/org/xbib/j2html/codegen/{ => test}/wattsi/AttributeDefinition.java (75%) rename j2html-codegen/src/test/java/org/xbib/j2html/codegen/{ => test/wattsi}/CodeGeneratorComplianceTests.java (85%) rename j2html-codegen/src/test/java/org/xbib/j2html/codegen/{ => test}/wattsi/ElementDefinition.java (72%) rename j2html-codegen/src/test/java/org/xbib/j2html/codegen/{ => test}/wattsi/WattsiGenerator.java (92%) rename j2html-codegen/src/test/java/org/xbib/j2html/codegen/{ => test}/wattsi/WattsiSource.java (99%) rename j2html-codegen/src/test/resources/{ => org/xbib/j2html/codegen/test}/html.model (100%) rename j2html-codegen/src/test/resources/{ => org/xbib/j2html/codegen/test/wattsi}/2022-01.wattsi (100%) create mode 100644 j2html/src/test/java/module-info.java delete mode 100644 j2html/src/test/java/org/xbib/j2html/tags/InlineStaticResourceTest.java rename j2html/src/test/java/org/xbib/j2html/{ => test}/PerformanceTest.java (77%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/RenderPerformanceTest.java (97%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/TextEscaperTest.java (94%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/attributes/AttrShortFormTest.java (98%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/attributes/AttributeTest.java (91%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/comparison/ComparisonData.java (81%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/comparison/RenderPerformanceComparisonTest.java (95%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/comparison/TestJ2html.java (64%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/comparison/TestVelocity.java (97%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/comparison/j2html/FiveHundredEmployees.java (83%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/comparison/j2html/HelloWorld.java (93%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/comparison/j2html/Macros.java (96%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/comparison/j2html/MultiplicationTable.java (72%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/comparison/model/Employee.java (89%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/model/BrowserTitle.java (87%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/model/Button.java (96%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/model/ButtonModel.java (83%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/model/DynamicHrefAttribute.java (93%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/model/PageModel.java (93%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/model/Template.java (94%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/model/TextTemplate.java (87%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/rendering/FlatHtmlTest.java (94%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/rendering/IndentedHtmlTest.java (97%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/rendering/RenderingCompatabilityTest.java (98%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/tags/AttributesPerTagTest.java (99%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/tags/ComplexRenderTest.java (99%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/tags/ConvenienceMethodTest.java (98%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/tags/DomContentJoinerTest.java (50%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/tags/Employee.java (86%) create mode 100644 j2html/src/test/java/org/xbib/j2html/test/tags/InlineStaticResourceTest.java rename j2html/src/test/java/org/xbib/j2html/{ => test}/tags/RenderFormattedTest.java (98%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/tags/TagCreatorTest.java (99%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/tags/TagTest.java (97%) rename j2html/src/test/java/org/xbib/j2html/{ => test}/tags/TextTest.java (96%) create mode 100644 j2html/src/test/resources/logging.properties rename j2html/src/test/resources/{ => org/xbib/j2html/test}/comparison/velocity/fiveHundredEmployees.vm (100%) rename j2html/src/test/resources/{ => org/xbib/j2html/test}/comparison/velocity/helloWorld.vm (100%) rename j2html/src/test/resources/{ => org/xbib/j2html/test}/comparison/velocity/macros.vm (100%) rename j2html/src/test/resources/{ => org/xbib/j2html/test}/comparison/velocity/multiplicationTable.vm (100%) rename j2html/src/test/resources/{ => org/xbib/j2html/test/tags}/AnyContent.java (100%) rename j2html/src/test/resources/{ => org/xbib/j2html/test/tags}/test-without-trailing-semis.css (100%) rename j2html/src/test/resources/{ => org/xbib/j2html/test/tags}/test.css (100%) rename j2html/src/test/resources/{ => org/xbib/j2html/test/tags}/test.html (100%) rename j2html/src/test/resources/{ => org/xbib/j2html/test/tags}/test.js (100%) create mode 100644 javapoet/src/main/java/module-info.java create mode 100644 javapoet/src/main/java/org/xbib/javapoet/AnnotationSpec.java create mode 100644 javapoet/src/main/java/org/xbib/javapoet/ArrayTypeName.java create mode 100644 javapoet/src/main/java/org/xbib/javapoet/ClassName.java create mode 100644 javapoet/src/main/java/org/xbib/javapoet/CodeBlock.java create mode 100644 javapoet/src/main/java/org/xbib/javapoet/CodeWriter.java create mode 100644 javapoet/src/main/java/org/xbib/javapoet/FieldSpec.java create mode 100644 javapoet/src/main/java/org/xbib/javapoet/JavaFile.java create mode 100644 javapoet/src/main/java/org/xbib/javapoet/LineWrapper.java create mode 100644 javapoet/src/main/java/org/xbib/javapoet/MethodSpec.java create mode 100644 javapoet/src/main/java/org/xbib/javapoet/NameAllocator.java create mode 100644 javapoet/src/main/java/org/xbib/javapoet/ParameterSpec.java create mode 100644 javapoet/src/main/java/org/xbib/javapoet/ParameterizedTypeName.java create mode 100644 javapoet/src/main/java/org/xbib/javapoet/TypeName.java create mode 100644 javapoet/src/main/java/org/xbib/javapoet/TypeSpec.java create mode 100644 javapoet/src/main/java/org/xbib/javapoet/TypeVariableName.java create mode 100644 javapoet/src/main/java/org/xbib/javapoet/Util.java create mode 100644 javapoet/src/main/java/org/xbib/javapoet/WildcardTypeName.java diff --git a/gradle/compile/java.gradle b/gradle/compile/java.gradle index be4708e..9e850ff 100644 --- a/gradle/compile/java.gradle +++ b/gradle/compile/java.gradle @@ -16,14 +16,31 @@ jar { duplicatesStrategy = DuplicatesStrategy.INCLUDE } + tasks.withType(JavaCompile) { - options.fork = true - options.forkOptions.jvmArgs += ['-Duser.language=en','-Duser.country=US'] - options.compilerArgs.add('-Xlint:all') - options.encoding = 'UTF-8' + doFirst { + options.fork = true + options.forkOptions.jvmArgs += ['-Duser.language=en','-Duser.country=US'] + options.encoding = 'UTF-8' + options.compilerArgs.add('-Xlint:all') + // enforce presence of module-info.java + options.compilerArgs.add("--module-path") + options.compilerArgs.add(classpath.asPath) + classpath = files() + } } tasks.withType(Javadoc) { - options.addStringOption('Xdoclint:none', '-quiet') - options.encoding = 'UTF-8' + doFirst { + options.addStringOption('Xdoclint:none', '-quiet') + options.encoding = 'UTF-8' + } +} + +tasks.withType(JavaExec) { + doFirst { + jvmArguments.add("--module-path") + jvmArguments.add(classpath.asPath) + classpath = files() + } } diff --git a/gradle/test/junit5.gradle b/gradle/test/junit5.gradle index 2d244c6..7e05284 100644 --- a/gradle/test/junit5.gradle +++ b/gradle/test/junit5.gradle @@ -8,17 +8,11 @@ dependencies { test { useJUnitPlatform() failFast = false - jvmArgs '--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED', - '--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED', - '--add-exports=java.base/sun.nio.ch=ALL-UNNAMED', - '--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED', - '--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED', - '--add-opens=jdk.compiler/com.sun.tools.javac=ALL-UNNAMED', - '--add-opens=java.base/java.lang=ALL-UNNAMED', - '--add-opens=java.base/java.lang.reflect=ALL-UNNAMED', - '--add-opens=java.base/java.io=ALL-UNNAMED', - '--add-opens=java.base/java.nio=ALL-UNNAMED', - '--add-opens=java.base/java.util=ALL-UNNAMED' + // for mockito + jvmArgs '--add-modules=jdk.unsupported', + '--add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED', + '--add-opens=jdk.unsupported/sun.reflect=ALL-UNNAMED' + systemProperty 'java.util.logging.config.file', 'src/test/resources/logging.properties' testLogging { events 'STARTED', 'PASSED', 'FAILED', 'SKIPPED' diff --git a/j2html-codegen/build.gradle b/j2html-codegen/build.gradle index be6303e..fd5bb4a 100644 --- a/j2html-codegen/build.gradle +++ b/j2html-codegen/build.gradle @@ -1,5 +1,16 @@ dependencies { implementation libs.jsoup - implementation libs.javapoet + implementation project(':javapoet') testImplementation testLibs.mockito.core } + +def moduleName = 'org.xbib.j2html.codegen.test' +def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ] + +tasks.named('compileTestJava') { + options.compilerArgs += patchArgs +} + +tasks.named('test') { + jvmArgs += patchArgs +} diff --git a/j2html-codegen/src/main/java/module-info.java b/j2html-codegen/src/main/java/module-info.java new file mode 100644 index 0000000..6a32f10 --- /dev/null +++ b/j2html-codegen/src/main/java/module-info.java @@ -0,0 +1,7 @@ +module org.xbib.j2html.codegen { + requires org.xbib.javapoet; + requires java.compiler; + exports org.xbib.j2html.codegen; + exports org.xbib.j2html.codegen.generators; + exports org.xbib.j2html.codegen.model; +} diff --git a/j2html-codegen/src/main/java/org/xbib/j2html/codegen/Generator.java b/j2html-codegen/src/main/java/org/xbib/j2html/codegen/Generator.java index 5b67a24..6ca383f 100644 --- a/j2html-codegen/src/main/java/org/xbib/j2html/codegen/Generator.java +++ b/j2html-codegen/src/main/java/org/xbib/j2html/codegen/Generator.java @@ -1,12 +1,12 @@ package org.xbib.j2html.codegen; -import com.squareup.javapoet.ClassName; -import com.squareup.javapoet.JavaFile; -import com.squareup.javapoet.MethodSpec; -import com.squareup.javapoet.ParameterizedTypeName; -import com.squareup.javapoet.TypeName; -import com.squareup.javapoet.TypeSpec; -import com.squareup.javapoet.TypeVariableName; +import org.xbib.javapoet.ClassName; +import org.xbib.javapoet.JavaFile; +import org.xbib.javapoet.MethodSpec; +import org.xbib.javapoet.ParameterizedTypeName; +import org.xbib.javapoet.TypeName; +import org.xbib.javapoet.TypeSpec; +import org.xbib.javapoet.TypeVariableName; import java.io.IOException; import java.nio.file.Path; import java.util.HashMap; diff --git a/j2html-codegen/src/test/java/module-info.java b/j2html-codegen/src/test/java/module-info.java new file mode 100644 index 0000000..3abd842 --- /dev/null +++ b/j2html-codegen/src/test/java/module-info.java @@ -0,0 +1,12 @@ +module org.xbib.j2html.codegen.test { + requires transitive org.junit.jupiter.api; + requires org.jsoup; + requires org.mockito; + requires org.xbib.javapoet; + requires java.compiler; + requires org.xbib.j2html.codegen; + exports org.xbib.j2html.codegen.test; + exports org.xbib.j2html.codegen.test.wattsi; + opens org.xbib.j2html.codegen.test; + opens org.xbib.j2html.codegen.test.wattsi; +} diff --git a/j2html-codegen/src/test/java/org/xbib/j2html/codegen/GenerateTest.java b/j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/GenerateTest.java similarity index 79% rename from j2html-codegen/src/test/java/org/xbib/j2html/codegen/GenerateTest.java rename to j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/GenerateTest.java index 30eecb1..969927c 100644 --- a/j2html-codegen/src/test/java/org/xbib/j2html/codegen/GenerateTest.java +++ b/j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/GenerateTest.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.codegen; +package org.xbib.j2html.codegen.test; import java.io.IOException; import java.io.InputStream; @@ -6,12 +6,15 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import org.junit.jupiter.api.Test; +import org.xbib.j2html.codegen.Generator; +import org.xbib.j2html.codegen.Model; +import org.xbib.j2html.codegen.Parser; public class GenerateTest { @Test public void generate() throws IOException { - try (InputStream inputStream = getClass().getResourceAsStream("/html.model")) { + try (InputStream inputStream = getClass().getResourceAsStream("html.model")) { String definitions = new String(inputStream.readAllBytes()); Model model = new Model(); Parser.parse(definitions, model); diff --git a/j2html-codegen/src/test/java/org/xbib/j2html/codegen/ParserTest.java b/j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/ParserTest.java similarity index 98% rename from j2html-codegen/src/test/java/org/xbib/j2html/codegen/ParserTest.java rename to j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/ParserTest.java index 0bac859..a7a7063 100644 --- a/j2html-codegen/src/test/java/org/xbib/j2html/codegen/ParserTest.java +++ b/j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/ParserTest.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.codegen; +package org.xbib.j2html.codegen.test; import org.junit.jupiter.api.Test; import org.mockito.InOrder; diff --git a/j2html-codegen/src/test/java/org/xbib/j2html/codegen/wattsi/AttributeDefinition.java b/j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/wattsi/AttributeDefinition.java similarity index 75% rename from j2html-codegen/src/test/java/org/xbib/j2html/codegen/wattsi/AttributeDefinition.java rename to j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/wattsi/AttributeDefinition.java index 92b41b1..a3b8e56 100644 --- a/j2html-codegen/src/test/java/org/xbib/j2html/codegen/wattsi/AttributeDefinition.java +++ b/j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/wattsi/AttributeDefinition.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.codegen.wattsi; +package org.xbib.j2html.codegen.test.wattsi; public interface AttributeDefinition { diff --git a/j2html-codegen/src/test/java/org/xbib/j2html/codegen/CodeGeneratorComplianceTests.java b/j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/wattsi/CodeGeneratorComplianceTests.java similarity index 85% rename from j2html-codegen/src/test/java/org/xbib/j2html/codegen/CodeGeneratorComplianceTests.java rename to j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/wattsi/CodeGeneratorComplianceTests.java index 6cf733f..739a1cd 100644 --- a/j2html-codegen/src/test/java/org/xbib/j2html/codegen/CodeGeneratorComplianceTests.java +++ b/j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/wattsi/CodeGeneratorComplianceTests.java @@ -1,17 +1,14 @@ -package org.xbib.j2html.codegen; +package org.xbib.j2html.codegen.test.wattsi; -import org.xbib.j2html.codegen.wattsi.WattsiSource; +import java.io.InputStream; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.xbib.j2html.codegen.generators.TagCreatorCodeGenerator; -import org.xbib.j2html.codegen.wattsi.ElementDefinition; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -26,8 +23,8 @@ public class CodeGeneratorComplianceTests { @BeforeAll public static void setUp() throws IOException { - Path source = Paths.get("src","test","resources","2022-01.wattsi"); - Document doc = Jsoup.parse(source.toFile(), "UTF-8", "https://html.spec.whatwg.org/"); + InputStream inputStream = CodeGeneratorComplianceTests.class.getResourceAsStream("2022-01.wattsi"); + Document doc = Jsoup.parse(inputStream, "UTF-8", "https://html.spec.whatwg.org/"); specification = new WattsiSource(doc); } diff --git a/j2html-codegen/src/test/java/org/xbib/j2html/codegen/wattsi/ElementDefinition.java b/j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/wattsi/ElementDefinition.java similarity index 72% rename from j2html-codegen/src/test/java/org/xbib/j2html/codegen/wattsi/ElementDefinition.java rename to j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/wattsi/ElementDefinition.java index fd634e8..bee3b30 100644 --- a/j2html-codegen/src/test/java/org/xbib/j2html/codegen/wattsi/ElementDefinition.java +++ b/j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/wattsi/ElementDefinition.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.codegen.wattsi; +package org.xbib.j2html.codegen.test.wattsi; public interface ElementDefinition { diff --git a/j2html-codegen/src/test/java/org/xbib/j2html/codegen/wattsi/WattsiGenerator.java b/j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/wattsi/WattsiGenerator.java similarity index 92% rename from j2html-codegen/src/test/java/org/xbib/j2html/codegen/wattsi/WattsiGenerator.java rename to j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/wattsi/WattsiGenerator.java index 45f42bf..18f8980 100644 --- a/j2html-codegen/src/test/java/org/xbib/j2html/codegen/wattsi/WattsiGenerator.java +++ b/j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/wattsi/WattsiGenerator.java @@ -1,8 +1,8 @@ -package org.xbib.j2html.codegen.wattsi; +package org.xbib.j2html.codegen.test.wattsi; -import com.squareup.javapoet.ClassName; -import com.squareup.javapoet.MethodSpec; -import com.squareup.javapoet.TypeSpec; +import org.xbib.javapoet.ClassName; +import org.xbib.javapoet.MethodSpec; +import org.xbib.javapoet.TypeSpec; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; @@ -21,7 +21,7 @@ public class WattsiGenerator { List attributes = wattsi.attributeDefinitions(); for (ElementDefinition element : elements) { ClassName className = ClassName.get( - "com.j2html", + "org.xbib.j2html", capitalize(element.name()) + "Tag" ); TypeSpec.Builder type = TypeSpec.classBuilder(className) diff --git a/j2html-codegen/src/test/java/org/xbib/j2html/codegen/wattsi/WattsiSource.java b/j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/wattsi/WattsiSource.java similarity index 99% rename from j2html-codegen/src/test/java/org/xbib/j2html/codegen/wattsi/WattsiSource.java rename to j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/wattsi/WattsiSource.java index 5328378..f2b30b4 100644 --- a/j2html-codegen/src/test/java/org/xbib/j2html/codegen/wattsi/WattsiSource.java +++ b/j2html-codegen/src/test/java/org/xbib/j2html/codegen/test/wattsi/WattsiSource.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.codegen.wattsi; +package org.xbib.j2html.codegen.test.wattsi; import java.util.ArrayList; import java.util.Arrays; diff --git a/j2html-codegen/src/test/resources/html.model b/j2html-codegen/src/test/resources/org/xbib/j2html/codegen/test/html.model similarity index 100% rename from j2html-codegen/src/test/resources/html.model rename to j2html-codegen/src/test/resources/org/xbib/j2html/codegen/test/html.model diff --git a/j2html-codegen/src/test/resources/2022-01.wattsi b/j2html-codegen/src/test/resources/org/xbib/j2html/codegen/test/wattsi/2022-01.wattsi similarity index 100% rename from j2html-codegen/src/test/resources/2022-01.wattsi rename to j2html-codegen/src/test/resources/org/xbib/j2html/codegen/test/wattsi/2022-01.wattsi diff --git a/j2html/build.gradle b/j2html/build.gradle index c7cd742..58d09bf 100644 --- a/j2html/build.gradle +++ b/j2html/build.gradle @@ -3,3 +3,14 @@ dependencies { testImplementation testLibs.velocity testImplementation testLibs.junit.benchmarks } + +def moduleName = 'org.xbib.j2html.test' +def patchArgs = ['--patch-module', "$moduleName=" + files(sourceSets.test.resources.srcDirs).asPath ] + +tasks.named('compileTestJava') { + options.compilerArgs += patchArgs +} + +tasks.named('test') { + jvmArgs += patchArgs +} diff --git a/j2html/src/main/java/org/xbib/j2html/Config.java b/j2html/src/main/java/org/xbib/j2html/Config.java index 2f716f8..3a5cc83 100644 --- a/j2html/src/main/java/org/xbib/j2html/Config.java +++ b/j2html/src/main/java/org/xbib/j2html/Config.java @@ -1,5 +1,6 @@ package org.xbib.j2html; +import java.util.Collections; import org.xbib.j2html.utils.CSSMin; import org.xbib.j2html.utils.EscapeUtil; import org.xbib.j2html.utils.Indenter; @@ -7,8 +8,6 @@ import org.xbib.j2html.utils.JSMin; import org.xbib.j2html.utils.Minifier; import org.xbib.j2html.utils.TextEscaper; -import java.util.Collections; - public class Config { /** @@ -51,11 +50,11 @@ public class Config { private Config( - TextEscaper _textEscaper, - Minifier _cssMinifier, - Minifier _jsMinifier, - boolean _closeEmptyTags, - Indenter _indenter + TextEscaper _textEscaper, + Minifier _cssMinifier, + Minifier _jsMinifier, + boolean _closeEmptyTags, + Indenter _indenter ) { this._textEscaper = _textEscaper; this._cssMinifier = _cssMinifier; @@ -97,42 +96,42 @@ public class Config { return _indenter; } - public Config withTextEscaper(TextEscaper textEscaper){ + public Config withTextEscaper(TextEscaper textEscaper) { Config copy = new Config(this); copy._textEscaper = textEscaper; return copy; } - public Config withCssMinifier(Minifier cssMinifier){ + public Config withCssMinifier(Minifier cssMinifier) { Config copy = new Config(this); copy._cssMinifier = cssMinifier; return copy; } - public Config withJsMinifier(Minifier jsMinifier){ + public Config withJsMinifier(Minifier jsMinifier) { Config copy = new Config(this); copy._jsMinifier = jsMinifier; return copy; } - public Config withEmptyTagsClosed(boolean closeEmptyTags){ + public Config withEmptyTagsClosed(boolean closeEmptyTags) { Config copy = new Config(this); copy._closeEmptyTags = closeEmptyTags; return copy; } - public Config withIndenter(Indenter indenter){ + public Config withIndenter(Indenter indenter) { Config copy = new Config(this); copy._indenter = indenter; return copy; } private static final Config DEFAULTS = new Config( - EscapeUtil::escape, - CSSMin::compressCss, - JSMin::compressJs, - false, - (level, text) -> String.join("", Collections.nCopies(level, FOUR_SPACES)) + text + EscapeUtil::escape, + CSSMin::compressCss, + JSMin::compressJs, + false, + (level, text) -> String.join("", Collections.nCopies(level, FOUR_SPACES)) + text ); public static Config defaults() { @@ -141,11 +140,11 @@ public class Config { public static Config global() { return new Config( - textEscaper, - cssMinifier, - jsMinifier, - closeEmptyTags, - indenter + textEscaper, + cssMinifier, + jsMinifier, + closeEmptyTags, + indenter ); } diff --git a/j2html/src/main/java/org/xbib/j2html/TagCreator.java b/j2html/src/main/java/org/xbib/j2html/TagCreator.java index e297530..d458896 100644 --- a/j2html/src/main/java/org/xbib/j2html/TagCreator.java +++ b/j2html/src/main/java/org/xbib/j2html/TagCreator.java @@ -1,5 +1,19 @@ package org.xbib.j2html; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Optional; +import java.util.function.BiFunction; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.xbib.j2html.attributes.Attr; import org.xbib.j2html.tags.ContainerTag; import org.xbib.j2html.tags.DomContent; @@ -9,15 +23,119 @@ import org.xbib.j2html.tags.InlineStaticResource; import org.xbib.j2html.tags.Tag; import org.xbib.j2html.tags.Text; import org.xbib.j2html.tags.UnescapedText; -import org.xbib.j2html.tags.specialized.*; - -import java.util.*; -import java.util.Map.Entry; -import java.util.function.BiFunction; -import java.util.function.Function; -import java.util.function.Predicate; -import java.util.stream.Collectors; -import java.util.stream.Stream; +import org.xbib.j2html.tags.specialized.ATag; +import org.xbib.j2html.tags.specialized.AbbrTag; +import org.xbib.j2html.tags.specialized.AddressTag; +import org.xbib.j2html.tags.specialized.AreaTag; +import org.xbib.j2html.tags.specialized.ArticleTag; +import org.xbib.j2html.tags.specialized.AsideTag; +import org.xbib.j2html.tags.specialized.AudioTag; +import org.xbib.j2html.tags.specialized.BTag; +import org.xbib.j2html.tags.specialized.BaseTag; +import org.xbib.j2html.tags.specialized.BdiTag; +import org.xbib.j2html.tags.specialized.BdoTag; +import org.xbib.j2html.tags.specialized.BlockquoteTag; +import org.xbib.j2html.tags.specialized.BodyTag; +import org.xbib.j2html.tags.specialized.BrTag; +import org.xbib.j2html.tags.specialized.ButtonTag; +import org.xbib.j2html.tags.specialized.CanvasTag; +import org.xbib.j2html.tags.specialized.CaptionTag; +import org.xbib.j2html.tags.specialized.CiteTag; +import org.xbib.j2html.tags.specialized.CodeTag; +import org.xbib.j2html.tags.specialized.ColTag; +import org.xbib.j2html.tags.specialized.ColgroupTag; +import org.xbib.j2html.tags.specialized.DataTag; +import org.xbib.j2html.tags.specialized.DatalistTag; +import org.xbib.j2html.tags.specialized.DdTag; +import org.xbib.j2html.tags.specialized.DelTag; +import org.xbib.j2html.tags.specialized.DetailsTag; +import org.xbib.j2html.tags.specialized.DfnTag; +import org.xbib.j2html.tags.specialized.DialogTag; +import org.xbib.j2html.tags.specialized.DivTag; +import org.xbib.j2html.tags.specialized.DlTag; +import org.xbib.j2html.tags.specialized.DtTag; +import org.xbib.j2html.tags.specialized.EmTag; +import org.xbib.j2html.tags.specialized.EmbedTag; +import org.xbib.j2html.tags.specialized.FieldsetTag; +import org.xbib.j2html.tags.specialized.FigcaptionTag; +import org.xbib.j2html.tags.specialized.FigureTag; +import org.xbib.j2html.tags.specialized.FooterTag; +import org.xbib.j2html.tags.specialized.FormTag; +import org.xbib.j2html.tags.specialized.H1Tag; +import org.xbib.j2html.tags.specialized.H2Tag; +import org.xbib.j2html.tags.specialized.H3Tag; +import org.xbib.j2html.tags.specialized.H4Tag; +import org.xbib.j2html.tags.specialized.H5Tag; +import org.xbib.j2html.tags.specialized.H6Tag; +import org.xbib.j2html.tags.specialized.HeadTag; +import org.xbib.j2html.tags.specialized.HeaderTag; +import org.xbib.j2html.tags.specialized.HrTag; +import org.xbib.j2html.tags.specialized.HtmlTag; +import org.xbib.j2html.tags.specialized.ITag; +import org.xbib.j2html.tags.specialized.IframeTag; +import org.xbib.j2html.tags.specialized.ImgTag; +import org.xbib.j2html.tags.specialized.InputTag; +import org.xbib.j2html.tags.specialized.InsTag; +import org.xbib.j2html.tags.specialized.KbdTag; +import org.xbib.j2html.tags.specialized.KeygenTag; +import org.xbib.j2html.tags.specialized.LabelTag; +import org.xbib.j2html.tags.specialized.LegendTag; +import org.xbib.j2html.tags.specialized.LiTag; +import org.xbib.j2html.tags.specialized.LinkTag; +import org.xbib.j2html.tags.specialized.MainTag; +import org.xbib.j2html.tags.specialized.MapTag; +import org.xbib.j2html.tags.specialized.MarkTag; +import org.xbib.j2html.tags.specialized.MenuTag; +import org.xbib.j2html.tags.specialized.MenuitemTag; +import org.xbib.j2html.tags.specialized.MetaTag; +import org.xbib.j2html.tags.specialized.MeterTag; +import org.xbib.j2html.tags.specialized.NavTag; +import org.xbib.j2html.tags.specialized.NoscriptTag; +import org.xbib.j2html.tags.specialized.ObjectTag; +import org.xbib.j2html.tags.specialized.OlTag; +import org.xbib.j2html.tags.specialized.OptgroupTag; +import org.xbib.j2html.tags.specialized.OptionTag; +import org.xbib.j2html.tags.specialized.OutputTag; +import org.xbib.j2html.tags.specialized.PTag; +import org.xbib.j2html.tags.specialized.ParamTag; +import org.xbib.j2html.tags.specialized.PictureTag; +import org.xbib.j2html.tags.specialized.PreTag; +import org.xbib.j2html.tags.specialized.ProgressTag; +import org.xbib.j2html.tags.specialized.QTag; +import org.xbib.j2html.tags.specialized.RpTag; +import org.xbib.j2html.tags.specialized.RtTag; +import org.xbib.j2html.tags.specialized.RubyTag; +import org.xbib.j2html.tags.specialized.STag; +import org.xbib.j2html.tags.specialized.SampTag; +import org.xbib.j2html.tags.specialized.ScriptTag; +import org.xbib.j2html.tags.specialized.SectionTag; +import org.xbib.j2html.tags.specialized.SelectTag; +import org.xbib.j2html.tags.specialized.SlotTag; +import org.xbib.j2html.tags.specialized.SmallTag; +import org.xbib.j2html.tags.specialized.SourceTag; +import org.xbib.j2html.tags.specialized.SpanTag; +import org.xbib.j2html.tags.specialized.StrongTag; +import org.xbib.j2html.tags.specialized.StyleTag; +import org.xbib.j2html.tags.specialized.SubTag; +import org.xbib.j2html.tags.specialized.SummaryTag; +import org.xbib.j2html.tags.specialized.SupTag; +import org.xbib.j2html.tags.specialized.TableTag; +import org.xbib.j2html.tags.specialized.TbodyTag; +import org.xbib.j2html.tags.specialized.TdTag; +import org.xbib.j2html.tags.specialized.TemplateTag; +import org.xbib.j2html.tags.specialized.TextareaTag; +import org.xbib.j2html.tags.specialized.TfootTag; +import org.xbib.j2html.tags.specialized.ThTag; +import org.xbib.j2html.tags.specialized.TheadTag; +import org.xbib.j2html.tags.specialized.TimeTag; +import org.xbib.j2html.tags.specialized.TitleTag; +import org.xbib.j2html.tags.specialized.TrTag; +import org.xbib.j2html.tags.specialized.TrackTag; +import org.xbib.j2html.tags.specialized.UTag; +import org.xbib.j2html.tags.specialized.UlTag; +import org.xbib.j2html.tags.specialized.VarTag; +import org.xbib.j2html.tags.specialized.VideoTag; +import org.xbib.j2html.tags.specialized.WbrTag; public class TagCreator { @@ -130,7 +248,7 @@ public class TagCreator { public static DomContent each(Collection collection, BiFunction mapper) { ContainerTag dom = tag(null); int i = 0; - for(T t : collection){ + for (T t : collection) { dom.with(mapper.apply(i++, t)); } return dom; @@ -206,28 +324,28 @@ public class TagCreator { return new EmptyTag<>(tagName); } - public static Text fileAsEscapedString(String path) { - return text(InlineStaticResource.getFileAsString(path)); + public static Text fileAsEscapedString(InputStream inputStream) { + return text(get(inputStream)); } - public static UnescapedText fileAsString(String path) { - return rawHtml(InlineStaticResource.getFileAsString(path)); + public static UnescapedText fileAsString(InputStream inputStream) { + return rawHtml(get(inputStream)); } - public static StyleTag styleWithInlineFile(String path) { - return (StyleTag) InlineStaticResource.get(path, InlineStaticResource.TargetFormat.CSS); + public static StyleTag styleWithInlineFile(InputStream inputStream) { + return (StyleTag) InlineStaticResource.get(inputStream, InlineStaticResource.TargetFormat.CSS); } - public static ScriptTag scriptWithInlineFile(String path) { - return (ScriptTag) InlineStaticResource.get(path, InlineStaticResource.TargetFormat.JS); + public static ScriptTag scriptWithInlineFile(InputStream inputStream) { + return (ScriptTag) InlineStaticResource.get(inputStream, InlineStaticResource.TargetFormat.JS); } - public static StyleTag styleWithInlineFile_min(String path) { - return (StyleTag) InlineStaticResource.get(path, InlineStaticResource.TargetFormat.CSS_MIN); + public static StyleTag styleWithInlineFile_min(InputStream inputStream) { + return (StyleTag) InlineStaticResource.get(inputStream, InlineStaticResource.TargetFormat.CSS_MIN); } - public static ScriptTag scriptWithInlineFile_min(String path) { - return (ScriptTag) InlineStaticResource.get(path, InlineStaticResource.TargetFormat.JS_MIN); + public static ScriptTag scriptWithInlineFile_min(InputStream inputStream) { + return (ScriptTag) InlineStaticResource.get(inputStream, InlineStaticResource.TargetFormat.JS_MIN); } public static DomContent document() { @@ -238,9 +356,13 @@ public class TagCreator { return new HtmlTag(); } - public static HtmlTag html(String text) { return html().withText(text); } + public static HtmlTag html(String text) { + return html().withText(text); + } - public static HtmlTag html(DomContent... dc) { return html().with(dc); } + public static HtmlTag html(DomContent... dc) { + return html().with(dc); + } public static HtmlTag html(Attr.ShortForm shortAttr) { return Attr.addTo(html(), shortAttr); @@ -303,715 +425,2412 @@ public class TagCreator { } // EmptyTags, generated in class j2html.tags.generators.TagCreatorCodeGenerator - public static AreaTag area () { return new AreaTag(); } - public static AreaTag area (Attr.ShortForm shortAttr) { return Attr.addTo( new AreaTag(), shortAttr); } + public static AreaTag area() { + return new AreaTag(); + } - public static BaseTag base () { return new BaseTag(); } - public static BaseTag base (Attr.ShortForm shortAttr) { return Attr.addTo( new BaseTag(), shortAttr); } + public static AreaTag area(Attr.ShortForm shortAttr) { + return Attr.addTo(new AreaTag(), shortAttr); + } - public static BrTag br () { return new BrTag(); } - public static BrTag br (Attr.ShortForm shortAttr) { return Attr.addTo( new BrTag(), shortAttr); } + public static BaseTag base() { + return new BaseTag(); + } - public static ColTag col () { return new ColTag(); } - public static ColTag col (Attr.ShortForm shortAttr) { return Attr.addTo( new ColTag(), shortAttr); } + public static BaseTag base(Attr.ShortForm shortAttr) { + return Attr.addTo(new BaseTag(), shortAttr); + } - public static EmbedTag embed () { return new EmbedTag(); } - public static EmbedTag embed (Attr.ShortForm shortAttr) { return Attr.addTo( new EmbedTag(), shortAttr); } + public static BrTag br() { + return new BrTag(); + } - public static HrTag hr () { return new HrTag(); } - public static HrTag hr (Attr.ShortForm shortAttr) { return Attr.addTo( new HrTag(), shortAttr); } + public static BrTag br(Attr.ShortForm shortAttr) { + return Attr.addTo(new BrTag(), shortAttr); + } - public static ImgTag img () { return new ImgTag(); } - public static ImgTag img (Attr.ShortForm shortAttr) { return Attr.addTo( new ImgTag(), shortAttr); } + public static ColTag col() { + return new ColTag(); + } - public static InputTag input () { return new InputTag(); } - public static InputTag input (Attr.ShortForm shortAttr) { return Attr.addTo( new InputTag(), shortAttr); } + public static ColTag col(Attr.ShortForm shortAttr) { + return Attr.addTo(new ColTag(), shortAttr); + } - public static KeygenTag keygen () { return new KeygenTag(); } - public static KeygenTag keygen (Attr.ShortForm shortAttr) { return Attr.addTo( new KeygenTag(), shortAttr); } + public static EmbedTag embed() { + return new EmbedTag(); + } - public static LinkTag link () { return new LinkTag(); } - public static LinkTag link (Attr.ShortForm shortAttr) { return Attr.addTo( new LinkTag(), shortAttr); } + public static EmbedTag embed(Attr.ShortForm shortAttr) { + return Attr.addTo(new EmbedTag(), shortAttr); + } - public static MetaTag meta () { return new MetaTag(); } - public static MetaTag meta (Attr.ShortForm shortAttr) { return Attr.addTo( new MetaTag(), shortAttr); } + public static HrTag hr() { + return new HrTag(); + } - public static ParamTag param () { return new ParamTag(); } - public static ParamTag param (Attr.ShortForm shortAttr) { return Attr.addTo( new ParamTag(), shortAttr); } + public static HrTag hr(Attr.ShortForm shortAttr) { + return Attr.addTo(new HrTag(), shortAttr); + } - public static SourceTag source () { return new SourceTag(); } - public static SourceTag source (Attr.ShortForm shortAttr) { return Attr.addTo( new SourceTag(), shortAttr); } + public static ImgTag img() { + return new ImgTag(); + } - public static TrackTag track () { return new TrackTag(); } - public static TrackTag track (Attr.ShortForm shortAttr) { return Attr.addTo( new TrackTag(), shortAttr); } + public static ImgTag img(Attr.ShortForm shortAttr) { + return Attr.addTo(new ImgTag(), shortAttr); + } - public static WbrTag wbr () { return new WbrTag(); } - public static WbrTag wbr (Attr.ShortForm shortAttr) { return Attr.addTo( new WbrTag(), shortAttr); } + public static InputTag input() { + return new InputTag(); + } + + public static InputTag input(Attr.ShortForm shortAttr) { + return Attr.addTo(new InputTag(), shortAttr); + } + + public static KeygenTag keygen() { + return new KeygenTag(); + } + + public static KeygenTag keygen(Attr.ShortForm shortAttr) { + return Attr.addTo(new KeygenTag(), shortAttr); + } + + public static LinkTag link() { + return new LinkTag(); + } + + public static LinkTag link(Attr.ShortForm shortAttr) { + return Attr.addTo(new LinkTag(), shortAttr); + } + + public static MetaTag meta() { + return new MetaTag(); + } + + public static MetaTag meta(Attr.ShortForm shortAttr) { + return Attr.addTo(new MetaTag(), shortAttr); + } + + public static ParamTag param() { + return new ParamTag(); + } + + public static ParamTag param(Attr.ShortForm shortAttr) { + return Attr.addTo(new ParamTag(), shortAttr); + } + + public static SourceTag source() { + return new SourceTag(); + } + + public static SourceTag source(Attr.ShortForm shortAttr) { + return Attr.addTo(new SourceTag(), shortAttr); + } + + public static TrackTag track() { + return new TrackTag(); + } + + public static TrackTag track(Attr.ShortForm shortAttr) { + return Attr.addTo(new TrackTag(), shortAttr); + } + + public static WbrTag wbr() { + return new WbrTag(); + } + + public static WbrTag wbr(Attr.ShortForm shortAttr) { + return Attr.addTo(new WbrTag(), shortAttr); + } // ContainerTags, generated in class j2html.tags.generators.TagCreatorCodeGenerator - public static ATag a () { return new ATag(); } - public static ATag a (String text) { return new ATag().withText(text); } - public static ATag a (DomContent... dc) { return new ATag().with(dc); } - public static ATag a (Attr.ShortForm shortAttr) { return Attr.addTo( new ATag(), shortAttr); } - public static ATag a (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new ATag().withText(text), shortAttr); } - public static ATag a (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new ATag().with(dc), shortAttr); } - - public static AbbrTag abbr () { return new AbbrTag(); } - public static AbbrTag abbr (String text) { return new AbbrTag().withText(text); } - public static AbbrTag abbr (DomContent... dc) { return new AbbrTag().with(dc); } - public static AbbrTag abbr (Attr.ShortForm shortAttr) { return Attr.addTo( new AbbrTag(), shortAttr); } - public static AbbrTag abbr (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new AbbrTag().withText(text), shortAttr); } - public static AbbrTag abbr (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new AbbrTag().with(dc), shortAttr); } - - public static AddressTag address () { return new AddressTag(); } - public static AddressTag address (String text) { return new AddressTag().withText(text); } - public static AddressTag address (DomContent... dc) { return new AddressTag().with(dc); } - public static AddressTag address (Attr.ShortForm shortAttr) { return Attr.addTo( new AddressTag(), shortAttr); } - public static AddressTag address (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new AddressTag().withText(text), shortAttr); } - public static AddressTag address (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new AddressTag().with(dc), shortAttr); } - - public static ArticleTag article () { return new ArticleTag(); } - public static ArticleTag article (String text) { return new ArticleTag().withText(text); } - public static ArticleTag article (DomContent... dc) { return new ArticleTag().with(dc); } - public static ArticleTag article (Attr.ShortForm shortAttr) { return Attr.addTo( new ArticleTag(), shortAttr); } - public static ArticleTag article (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new ArticleTag().withText(text), shortAttr); } - public static ArticleTag article (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new ArticleTag().with(dc), shortAttr); } - - public static AsideTag aside () { return new AsideTag(); } - public static AsideTag aside (String text) { return new AsideTag().withText(text); } - public static AsideTag aside (DomContent... dc) { return new AsideTag().with(dc); } - public static AsideTag aside (Attr.ShortForm shortAttr) { return Attr.addTo( new AsideTag(), shortAttr); } - public static AsideTag aside (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new AsideTag().withText(text), shortAttr); } - public static AsideTag aside (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new AsideTag().with(dc), shortAttr); } - - public static AudioTag audio () { return new AudioTag(); } - public static AudioTag audio (String text) { return new AudioTag().withText(text); } - public static AudioTag audio (DomContent... dc) { return new AudioTag().with(dc); } - public static AudioTag audio (Attr.ShortForm shortAttr) { return Attr.addTo( new AudioTag(), shortAttr); } - public static AudioTag audio (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new AudioTag().withText(text), shortAttr); } - public static AudioTag audio (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new AudioTag().with(dc), shortAttr); } - - public static BTag b () { return new BTag(); } - public static BTag b (String text) { return new BTag().withText(text); } - public static BTag b (DomContent... dc) { return new BTag().with(dc); } - public static BTag b (Attr.ShortForm shortAttr) { return Attr.addTo( new BTag(), shortAttr); } - public static BTag b (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new BTag().withText(text), shortAttr); } - public static BTag b (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new BTag().with(dc), shortAttr); } - - public static BdiTag bdi () { return new BdiTag(); } - public static BdiTag bdi (String text) { return new BdiTag().withText(text); } - public static BdiTag bdi (DomContent... dc) { return new BdiTag().with(dc); } - public static BdiTag bdi (Attr.ShortForm shortAttr) { return Attr.addTo( new BdiTag(), shortAttr); } - public static BdiTag bdi (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new BdiTag().withText(text), shortAttr); } - public static BdiTag bdi (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new BdiTag().with(dc), shortAttr); } - - public static BdoTag bdo () { return new BdoTag(); } - public static BdoTag bdo (String text) { return new BdoTag().withText(text); } - public static BdoTag bdo (DomContent... dc) { return new BdoTag().with(dc); } - public static BdoTag bdo (Attr.ShortForm shortAttr) { return Attr.addTo( new BdoTag(), shortAttr); } - public static BdoTag bdo (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new BdoTag().withText(text), shortAttr); } - public static BdoTag bdo (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new BdoTag().with(dc), shortAttr); } - - public static BlockquoteTag blockquote () { return new BlockquoteTag(); } - public static BlockquoteTag blockquote (String text) { return new BlockquoteTag().withText(text); } - public static BlockquoteTag blockquote (DomContent... dc) { return new BlockquoteTag().with(dc); } - public static BlockquoteTag blockquote (Attr.ShortForm shortAttr) { return Attr.addTo( new BlockquoteTag(), shortAttr); } - public static BlockquoteTag blockquote (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new BlockquoteTag().withText(text), shortAttr); } - public static BlockquoteTag blockquote (Attr.ShortForm shortAttr, DomContent... dc){ return Attr.addTo( new BlockquoteTag().with(dc), shortAttr); } - - public static ButtonTag button () { return new ButtonTag(); } - public static ButtonTag button (String text) { return new ButtonTag().withText(text); } - public static ButtonTag button (DomContent... dc) { return new ButtonTag().with(dc); } - public static ButtonTag button (Attr.ShortForm shortAttr) { return Attr.addTo( new ButtonTag(), shortAttr); } - public static ButtonTag button (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new ButtonTag().withText(text), shortAttr); } - public static ButtonTag button (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new ButtonTag().with(dc), shortAttr); } - - public static CanvasTag canvas () { return new CanvasTag(); } - public static CanvasTag canvas (String text) { return new CanvasTag().withText(text); } - public static CanvasTag canvas (DomContent... dc) { return new CanvasTag().with(dc); } - public static CanvasTag canvas (Attr.ShortForm shortAttr) { return Attr.addTo( new CanvasTag(), shortAttr); } - public static CanvasTag canvas (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new CanvasTag().withText(text), shortAttr); } - public static CanvasTag canvas (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new CanvasTag().with(dc), shortAttr); } - - public static CaptionTag caption () { return new CaptionTag(); } - public static CaptionTag caption (String text) { return new CaptionTag().withText(text); } - public static CaptionTag caption (DomContent... dc) { return new CaptionTag().with(dc); } - public static CaptionTag caption (Attr.ShortForm shortAttr) { return Attr.addTo( new CaptionTag(), shortAttr); } - public static CaptionTag caption (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new CaptionTag().withText(text), shortAttr); } - public static CaptionTag caption (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new CaptionTag().with(dc), shortAttr); } - - public static CiteTag cite () { return new CiteTag(); } - public static CiteTag cite (String text) { return new CiteTag().withText(text); } - public static CiteTag cite (DomContent... dc) { return new CiteTag().with(dc); } - public static CiteTag cite (Attr.ShortForm shortAttr) { return Attr.addTo( new CiteTag(), shortAttr); } - public static CiteTag cite (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new CiteTag().withText(text), shortAttr); } - public static CiteTag cite (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new CiteTag().with(dc), shortAttr); } - - public static CodeTag code () { return new CodeTag(); } - public static CodeTag code (String text) { return new CodeTag().withText(text); } - public static CodeTag code (DomContent... dc) { return new CodeTag().with(dc); } - public static CodeTag code (Attr.ShortForm shortAttr) { return Attr.addTo( new CodeTag(), shortAttr); } - public static CodeTag code (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new CodeTag().withText(text), shortAttr); } - public static CodeTag code (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new CodeTag().with(dc), shortAttr); } - - public static ColgroupTag colgroup () { return new ColgroupTag(); } - public static ColgroupTag colgroup (String text) { return new ColgroupTag().withText(text); } - public static ColgroupTag colgroup (DomContent... dc) { return new ColgroupTag().with(dc); } - public static ColgroupTag colgroup (Attr.ShortForm shortAttr) { return Attr.addTo( new ColgroupTag(), shortAttr); } - public static ColgroupTag colgroup (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new ColgroupTag().withText(text), shortAttr); } - public static ColgroupTag colgroup (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new ColgroupTag().with(dc), shortAttr); } - - public static DataTag data () { return new DataTag(); } - public static DataTag data (String text) { return new DataTag().withText(text); } - public static DataTag data (DomContent... dc) { return new DataTag().with(dc); } - public static DataTag data (Attr.ShortForm shortAttr) { return Attr.addTo( new DataTag(), shortAttr); } - public static DataTag data (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new DataTag().withText(text), shortAttr); } - public static DataTag data (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new DataTag().with(dc), shortAttr); } - - public static DatalistTag datalist () { return new DatalistTag(); } - public static DatalistTag datalist (String text) { return new DatalistTag().withText(text); } - public static DatalistTag datalist (DomContent... dc) { return new DatalistTag().with(dc); } - public static DatalistTag datalist (Attr.ShortForm shortAttr) { return Attr.addTo( new DatalistTag(), shortAttr); } - public static DatalistTag datalist (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new DatalistTag().withText(text), shortAttr); } - public static DatalistTag datalist (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new DatalistTag().with(dc), shortAttr); } - - public static DdTag dd () { return new DdTag(); } - public static DdTag dd (String text) { return new DdTag().withText(text); } - public static DdTag dd (DomContent... dc) { return new DdTag().with(dc); } - public static DdTag dd (Attr.ShortForm shortAttr) { return Attr.addTo( new DdTag(), shortAttr); } - public static DdTag dd (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new DdTag().withText(text), shortAttr); } - public static DdTag dd (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new DdTag().with(dc), shortAttr); } - - public static DelTag del () { return new DelTag(); } - public static DelTag del (String text) { return new DelTag().withText(text); } - public static DelTag del (DomContent... dc) { return new DelTag().with(dc); } - public static DelTag del (Attr.ShortForm shortAttr) { return Attr.addTo( new DelTag(), shortAttr); } - public static DelTag del (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new DelTag().withText(text), shortAttr); } - public static DelTag del (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new DelTag().with(dc), shortAttr); } - - public static DetailsTag details () { return new DetailsTag(); } - public static DetailsTag details (String text) { return new DetailsTag().withText(text); } - public static DetailsTag details (DomContent... dc) { return new DetailsTag().with(dc); } - public static DetailsTag details (Attr.ShortForm shortAttr) { return Attr.addTo( new DetailsTag(), shortAttr); } - public static DetailsTag details (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new DetailsTag().withText(text), shortAttr); } - public static DetailsTag details (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new DetailsTag().with(dc), shortAttr); } - - public static DfnTag dfn () { return new DfnTag(); } - public static DfnTag dfn (String text) { return new DfnTag().withText(text); } - public static DfnTag dfn (DomContent... dc) { return new DfnTag().with(dc); } - public static DfnTag dfn (Attr.ShortForm shortAttr) { return Attr.addTo( new DfnTag(), shortAttr); } - public static DfnTag dfn (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new DfnTag().withText(text), shortAttr); } - public static DfnTag dfn (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new DfnTag().with(dc), shortAttr); } - - public static DialogTag dialog () { return new DialogTag(); } - public static DialogTag dialog (String text) { return new DialogTag().withText(text); } - public static DialogTag dialog (DomContent... dc) { return new DialogTag().with(dc); } - public static DialogTag dialog (Attr.ShortForm shortAttr) { return Attr.addTo( new DialogTag(), shortAttr); } - public static DialogTag dialog (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new DialogTag().withText(text), shortAttr); } - public static DialogTag dialog (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new DialogTag().with(dc), shortAttr); } - - public static DivTag div () { return new DivTag(); } - public static DivTag div (String text) { return new DivTag().withText(text); } - public static DivTag div (DomContent... dc) { return new DivTag().with(dc); } - public static DivTag div (Attr.ShortForm shortAttr) { return Attr.addTo( new DivTag(), shortAttr); } - public static DivTag div (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new DivTag().withText(text), shortAttr); } - public static DivTag div (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new DivTag().with(dc), shortAttr); } - - public static DlTag dl () { return new DlTag(); } - public static DlTag dl (String text) { return new DlTag().withText(text); } - public static DlTag dl (DomContent... dc) { return new DlTag().with(dc); } - public static DlTag dl (Attr.ShortForm shortAttr) { return Attr.addTo( new DlTag(), shortAttr); } - public static DlTag dl (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new DlTag().withText(text), shortAttr); } - public static DlTag dl (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new DlTag().with(dc), shortAttr); } - - public static DtTag dt () { return new DtTag(); } - public static DtTag dt (String text) { return new DtTag().withText(text); } - public static DtTag dt (DomContent... dc) { return new DtTag().with(dc); } - public static DtTag dt (Attr.ShortForm shortAttr) { return Attr.addTo( new DtTag(), shortAttr); } - public static DtTag dt (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new DtTag().withText(text), shortAttr); } - public static DtTag dt (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new DtTag().with(dc), shortAttr); } - - public static EmTag em () { return new EmTag(); } - public static EmTag em (String text) { return new EmTag().withText(text); } - public static EmTag em (DomContent... dc) { return new EmTag().with(dc); } - public static EmTag em (Attr.ShortForm shortAttr) { return Attr.addTo( new EmTag(), shortAttr); } - public static EmTag em (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new EmTag().withText(text), shortAttr); } - public static EmTag em (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new EmTag().with(dc), shortAttr); } - - public static FieldsetTag fieldset () { return new FieldsetTag(); } - public static FieldsetTag fieldset (String text) { return new FieldsetTag().withText(text); } - public static FieldsetTag fieldset (DomContent... dc) { return new FieldsetTag().with(dc); } - public static FieldsetTag fieldset (Attr.ShortForm shortAttr) { return Attr.addTo( new FieldsetTag(), shortAttr); } - public static FieldsetTag fieldset (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new FieldsetTag().withText(text), shortAttr); } - public static FieldsetTag fieldset (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new FieldsetTag().with(dc), shortAttr); } - - public static FigcaptionTag figcaption () { return new FigcaptionTag(); } - public static FigcaptionTag figcaption (String text) { return new FigcaptionTag().withText(text); } - public static FigcaptionTag figcaption (DomContent... dc) { return new FigcaptionTag().with(dc); } - public static FigcaptionTag figcaption (Attr.ShortForm shortAttr) { return Attr.addTo( new FigcaptionTag(), shortAttr); } - public static FigcaptionTag figcaption (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new FigcaptionTag().withText(text), shortAttr); } - public static FigcaptionTag figcaption (Attr.ShortForm shortAttr, DomContent... dc){ return Attr.addTo( new FigcaptionTag().with(dc), shortAttr); } - - public static FigureTag figure () { return new FigureTag(); } - public static FigureTag figure (String text) { return new FigureTag().withText(text); } - public static FigureTag figure (DomContent... dc) { return new FigureTag().with(dc); } - public static FigureTag figure (Attr.ShortForm shortAttr) { return Attr.addTo( new FigureTag(), shortAttr); } - public static FigureTag figure (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new FigureTag().withText(text), shortAttr); } - public static FigureTag figure (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new FigureTag().with(dc), shortAttr); } - - public static FooterTag footer () { return new FooterTag(); } - public static FooterTag footer (String text) { return new FooterTag().withText(text); } - public static FooterTag footer (DomContent... dc) { return new FooterTag().with(dc); } - public static FooterTag footer (Attr.ShortForm shortAttr) { return Attr.addTo( new FooterTag(), shortAttr); } - public static FooterTag footer (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new FooterTag().withText(text), shortAttr); } - public static FooterTag footer (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new FooterTag().with(dc), shortAttr); } - - public static FormTag form () { return new FormTag(); } - public static FormTag form (String text) { return new FormTag().withText(text); } - public static FormTag form (DomContent... dc) { return new FormTag().with(dc); } - public static FormTag form (Attr.ShortForm shortAttr) { return Attr.addTo( new FormTag(), shortAttr); } - public static FormTag form (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new FormTag().withText(text), shortAttr); } - public static FormTag form (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new FormTag().with(dc), shortAttr); } - - public static H1Tag h1 () { return new H1Tag(); } - public static H1Tag h1 (String text) { return new H1Tag().withText(text); } - public static H1Tag h1 (DomContent... dc) { return new H1Tag().with(dc); } - public static H1Tag h1 (Attr.ShortForm shortAttr) { return Attr.addTo( new H1Tag(), shortAttr); } - public static H1Tag h1 (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new H1Tag().withText(text), shortAttr); } - public static H1Tag h1 (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new H1Tag().with(dc), shortAttr); } - - public static H2Tag h2 () { return new H2Tag(); } - public static H2Tag h2 (String text) { return new H2Tag().withText(text); } - public static H2Tag h2 (DomContent... dc) { return new H2Tag().with(dc); } - public static H2Tag h2 (Attr.ShortForm shortAttr) { return Attr.addTo( new H2Tag(), shortAttr); } - public static H2Tag h2 (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new H2Tag().withText(text), shortAttr); } - public static H2Tag h2 (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new H2Tag().with(dc), shortAttr); } - - public static H3Tag h3 () { return new H3Tag(); } - public static H3Tag h3 (String text) { return new H3Tag().withText(text); } - public static H3Tag h3 (DomContent... dc) { return new H3Tag().with(dc); } - public static H3Tag h3 (Attr.ShortForm shortAttr) { return Attr.addTo( new H3Tag(), shortAttr); } - public static H3Tag h3 (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new H3Tag().withText(text), shortAttr); } - public static H3Tag h3 (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new H3Tag().with(dc), shortAttr); } - - public static H4Tag h4 () { return new H4Tag(); } - public static H4Tag h4 (String text) { return new H4Tag().withText(text); } - public static H4Tag h4 (DomContent... dc) { return new H4Tag().with(dc); } - public static H4Tag h4 (Attr.ShortForm shortAttr) { return Attr.addTo( new H4Tag(), shortAttr); } - public static H4Tag h4 (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new H4Tag().withText(text), shortAttr); } - public static H4Tag h4 (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new H4Tag().with(dc), shortAttr); } - - public static H5Tag h5 () { return new H5Tag(); } - public static H5Tag h5 (String text) { return new H5Tag().withText(text); } - public static H5Tag h5 (DomContent... dc) { return new H5Tag().with(dc); } - public static H5Tag h5 (Attr.ShortForm shortAttr) { return Attr.addTo( new H5Tag(), shortAttr); } - public static H5Tag h5 (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new H5Tag().withText(text), shortAttr); } - public static H5Tag h5 (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new H5Tag().with(dc), shortAttr); } - - public static H6Tag h6 () { return new H6Tag(); } - public static H6Tag h6 (String text) { return new H6Tag().withText(text); } - public static H6Tag h6 (DomContent... dc) { return new H6Tag().with(dc); } - public static H6Tag h6 (Attr.ShortForm shortAttr) { return Attr.addTo( new H6Tag(), shortAttr); } - public static H6Tag h6 (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new H6Tag().withText(text), shortAttr); } - public static H6Tag h6 (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new H6Tag().with(dc), shortAttr); } - - public static HeaderTag header () { return new HeaderTag(); } - public static HeaderTag header (String text) { return new HeaderTag().withText(text); } - public static HeaderTag header (DomContent... dc) { return new HeaderTag().with(dc); } - public static HeaderTag header (Attr.ShortForm shortAttr) { return Attr.addTo( new HeaderTag(), shortAttr); } - public static HeaderTag header (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new HeaderTag().withText(text), shortAttr); } - public static HeaderTag header (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new HeaderTag().with(dc), shortAttr); } - - public static ITag i () { return new ITag(); } - public static ITag i (String text) { return new ITag().withText(text); } - public static ITag i (DomContent... dc) { return new ITag().with(dc); } - public static ITag i (Attr.ShortForm shortAttr) { return Attr.addTo( new ITag(), shortAttr); } - public static ITag i (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new ITag().withText(text), shortAttr); } - public static ITag i (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new ITag().with(dc), shortAttr); } - - public static IframeTag iframe () { return new IframeTag(); } - public static IframeTag iframe (String text) { return new IframeTag().withText(text); } - public static IframeTag iframe (DomContent... dc) { return new IframeTag().with(dc); } - public static IframeTag iframe (Attr.ShortForm shortAttr) { return Attr.addTo( new IframeTag(), shortAttr); } - public static IframeTag iframe (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new IframeTag().withText(text), shortAttr); } - public static IframeTag iframe (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new IframeTag().with(dc), shortAttr); } - - public static InsTag ins () { return new InsTag(); } - public static InsTag ins (String text) { return new InsTag().withText(text); } - public static InsTag ins (DomContent... dc) { return new InsTag().with(dc); } - public static InsTag ins (Attr.ShortForm shortAttr) { return Attr.addTo( new InsTag(), shortAttr); } - public static InsTag ins (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new InsTag().withText(text), shortAttr); } - public static InsTag ins (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new InsTag().with(dc), shortAttr); } - - public static KbdTag kbd () { return new KbdTag(); } - public static KbdTag kbd (String text) { return new KbdTag().withText(text); } - public static KbdTag kbd (DomContent... dc) { return new KbdTag().with(dc); } - public static KbdTag kbd (Attr.ShortForm shortAttr) { return Attr.addTo( new KbdTag(), shortAttr); } - public static KbdTag kbd (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new KbdTag().withText(text), shortAttr); } - public static KbdTag kbd (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new KbdTag().with(dc), shortAttr); } - - public static LabelTag label () { return new LabelTag(); } - public static LabelTag label (String text) { return new LabelTag().withText(text); } - public static LabelTag label (DomContent... dc) { return new LabelTag().with(dc); } - public static LabelTag label (Attr.ShortForm shortAttr) { return Attr.addTo( new LabelTag(), shortAttr); } - public static LabelTag label (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new LabelTag().withText(text), shortAttr); } - public static LabelTag label (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new LabelTag().with(dc), shortAttr); } - - public static LegendTag legend () { return new LegendTag(); } - public static LegendTag legend (String text) { return new LegendTag().withText(text); } - public static LegendTag legend (DomContent... dc) { return new LegendTag().with(dc); } - public static LegendTag legend (Attr.ShortForm shortAttr) { return Attr.addTo( new LegendTag(), shortAttr); } - public static LegendTag legend (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new LegendTag().withText(text), shortAttr); } - public static LegendTag legend (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new LegendTag().with(dc), shortAttr); } - - public static LiTag li () { return new LiTag(); } - public static LiTag li (String text) { return new LiTag().withText(text); } - public static LiTag li (DomContent... dc) { return new LiTag().with(dc); } - public static LiTag li (Attr.ShortForm shortAttr) { return Attr.addTo( new LiTag(), shortAttr); } - public static LiTag li (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new LiTag().withText(text), shortAttr); } - public static LiTag li (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new LiTag().with(dc), shortAttr); } - - public static MainTag main () { return new MainTag(); } - public static MainTag main (String text) { return new MainTag().withText(text); } - public static MainTag main (DomContent... dc) { return new MainTag().with(dc); } - public static MainTag main (Attr.ShortForm shortAttr) { return Attr.addTo( new MainTag(), shortAttr); } - public static MainTag main (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new MainTag().withText(text), shortAttr); } - public static MainTag main (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new MainTag().with(dc), shortAttr); } - - public static MapTag map () { return new MapTag(); } - public static MapTag map (String text) { return new MapTag().withText(text); } - public static MapTag map (DomContent... dc) { return new MapTag().with(dc); } - public static MapTag map (Attr.ShortForm shortAttr) { return Attr.addTo( new MapTag(), shortAttr); } - public static MapTag map (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new MapTag().withText(text), shortAttr); } - public static MapTag map (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new MapTag().with(dc), shortAttr); } - - public static MarkTag mark () { return new MarkTag(); } - public static MarkTag mark (String text) { return new MarkTag().withText(text); } - public static MarkTag mark (DomContent... dc) { return new MarkTag().with(dc); } - public static MarkTag mark (Attr.ShortForm shortAttr) { return Attr.addTo( new MarkTag(), shortAttr); } - public static MarkTag mark (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new MarkTag().withText(text), shortAttr); } - public static MarkTag mark (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new MarkTag().with(dc), shortAttr); } - - public static MenuTag menu () { return new MenuTag(); } - public static MenuTag menu (String text) { return new MenuTag().withText(text); } - public static MenuTag menu (DomContent... dc) { return new MenuTag().with(dc); } - public static MenuTag menu (Attr.ShortForm shortAttr) { return Attr.addTo( new MenuTag(), shortAttr); } - public static MenuTag menu (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new MenuTag().withText(text), shortAttr); } - public static MenuTag menu (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new MenuTag().with(dc), shortAttr); } - - public static MenuitemTag menuitem () { return new MenuitemTag(); } - public static MenuitemTag menuitem (String text) { return new MenuitemTag().withText(text); } - public static MenuitemTag menuitem (DomContent... dc) { return new MenuitemTag().with(dc); } - public static MenuitemTag menuitem (Attr.ShortForm shortAttr) { return Attr.addTo( new MenuitemTag(), shortAttr); } - public static MenuitemTag menuitem (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new MenuitemTag().withText(text), shortAttr); } - public static MenuitemTag menuitem (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new MenuitemTag().with(dc), shortAttr); } - - public static MeterTag meter () { return new MeterTag(); } - public static MeterTag meter (String text) { return new MeterTag().withText(text); } - public static MeterTag meter (DomContent... dc) { return new MeterTag().with(dc); } - public static MeterTag meter (Attr.ShortForm shortAttr) { return Attr.addTo( new MeterTag(), shortAttr); } - public static MeterTag meter (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new MeterTag().withText(text), shortAttr); } - public static MeterTag meter (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new MeterTag().with(dc), shortAttr); } - - public static NavTag nav () { return new NavTag(); } - public static NavTag nav (String text) { return new NavTag().withText(text); } - public static NavTag nav (DomContent... dc) { return new NavTag().with(dc); } - public static NavTag nav (Attr.ShortForm shortAttr) { return Attr.addTo( new NavTag(), shortAttr); } - public static NavTag nav (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new NavTag().withText(text), shortAttr); } - public static NavTag nav (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new NavTag().with(dc), shortAttr); } - - public static NoscriptTag noscript () { return new NoscriptTag(); } - public static NoscriptTag noscript (String text) { return new NoscriptTag().withText(text); } - public static NoscriptTag noscript (DomContent... dc) { return new NoscriptTag().with(dc); } - public static NoscriptTag noscript (Attr.ShortForm shortAttr) { return Attr.addTo( new NoscriptTag(), shortAttr); } - public static NoscriptTag noscript (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new NoscriptTag().withText(text), shortAttr); } - public static NoscriptTag noscript (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new NoscriptTag().with(dc), shortAttr); } - - public static ObjectTag object () { return new ObjectTag(); } - public static ObjectTag object (String text) { return new ObjectTag().withText(text); } - public static ObjectTag object (DomContent... dc) { return new ObjectTag().with(dc); } - public static ObjectTag object (Attr.ShortForm shortAttr) { return Attr.addTo( new ObjectTag(), shortAttr); } - public static ObjectTag object (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new ObjectTag().withText(text), shortAttr); } - public static ObjectTag object (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new ObjectTag().with(dc), shortAttr); } - - public static OlTag ol () { return new OlTag(); } - public static OlTag ol (String text) { return new OlTag().withText(text); } - public static OlTag ol (DomContent... dc) { return new OlTag().with(dc); } - public static OlTag ol (Attr.ShortForm shortAttr) { return Attr.addTo( new OlTag(), shortAttr); } - public static OlTag ol (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new OlTag().withText(text), shortAttr); } - public static OlTag ol (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new OlTag().with(dc), shortAttr); } - - public static OptgroupTag optgroup () { return new OptgroupTag(); } - public static OptgroupTag optgroup (String text) { return new OptgroupTag().withText(text); } - public static OptgroupTag optgroup (DomContent... dc) { return new OptgroupTag().with(dc); } - public static OptgroupTag optgroup (Attr.ShortForm shortAttr) { return Attr.addTo( new OptgroupTag(), shortAttr); } - public static OptgroupTag optgroup (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new OptgroupTag().withText(text), shortAttr); } - public static OptgroupTag optgroup (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new OptgroupTag().with(dc), shortAttr); } - - public static OptionTag option () { return new OptionTag(); } - public static OptionTag option (String text) { return new OptionTag().withText(text); } - public static OptionTag option (DomContent... dc) { return new OptionTag().with(dc); } - public static OptionTag option (Attr.ShortForm shortAttr) { return Attr.addTo( new OptionTag(), shortAttr); } - public static OptionTag option (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new OptionTag().withText(text), shortAttr); } - public static OptionTag option (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new OptionTag().with(dc), shortAttr); } - - public static OutputTag output () { return new OutputTag(); } - public static OutputTag output (String text) { return new OutputTag().withText(text); } - public static OutputTag output (DomContent... dc) { return new OutputTag().with(dc); } - public static OutputTag output (Attr.ShortForm shortAttr) { return Attr.addTo( new OutputTag(), shortAttr); } - public static OutputTag output (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new OutputTag().withText(text), shortAttr); } - public static OutputTag output (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new OutputTag().with(dc), shortAttr); } - - public static PTag p () { return new PTag(); } - public static PTag p (String text) { return new PTag().withText(text); } - public static PTag p (DomContent... dc) { return new PTag().with(dc); } - public static PTag p (Attr.ShortForm shortAttr) { return Attr.addTo( new PTag(), shortAttr); } - public static PTag p (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new PTag().withText(text), shortAttr); } - public static PTag p (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new PTag().with(dc), shortAttr); } - - public static PictureTag picture () { return new PictureTag(); } - public static PictureTag picture (String text) { return new PictureTag().withText(text); } - public static PictureTag picture (DomContent... dc) { return new PictureTag().with(dc); } - public static PictureTag picture (Attr.ShortForm shortAttr) { return Attr.addTo( new PictureTag(), shortAttr); } - public static PictureTag picture (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new PictureTag().withText(text), shortAttr); } - public static PictureTag picture (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new PictureTag().with(dc), shortAttr); } - - public static PreTag pre () { return new PreTag(); } - public static PreTag pre (String text) { return new PreTag().withText(text); } - public static PreTag pre (DomContent... dc) { return new PreTag().with(dc); } - public static PreTag pre (Attr.ShortForm shortAttr) { return Attr.addTo( new PreTag(), shortAttr); } - public static PreTag pre (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new PreTag().withText(text), shortAttr); } - public static PreTag pre (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new PreTag().with(dc), shortAttr); } - - public static ProgressTag progress () { return new ProgressTag(); } - public static ProgressTag progress (String text) { return new ProgressTag().withText(text); } - public static ProgressTag progress (DomContent... dc) { return new ProgressTag().with(dc); } - public static ProgressTag progress (Attr.ShortForm shortAttr) { return Attr.addTo( new ProgressTag(), shortAttr); } - public static ProgressTag progress (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new ProgressTag().withText(text), shortAttr); } - public static ProgressTag progress (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new ProgressTag().with(dc), shortAttr); } - - public static QTag q () { return new QTag(); } - public static QTag q (String text) { return new QTag().withText(text); } - public static QTag q (DomContent... dc) { return new QTag().with(dc); } - public static QTag q (Attr.ShortForm shortAttr) { return Attr.addTo( new QTag(), shortAttr); } - public static QTag q (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new QTag().withText(text), shortAttr); } - public static QTag q (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new QTag().with(dc), shortAttr); } - - public static RpTag rp () { return new RpTag(); } - public static RpTag rp (String text) { return new RpTag().withText(text); } - public static RpTag rp (DomContent... dc) { return new RpTag().with(dc); } - public static RpTag rp (Attr.ShortForm shortAttr) { return Attr.addTo( new RpTag(), shortAttr); } - public static RpTag rp (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new RpTag().withText(text), shortAttr); } - public static RpTag rp (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new RpTag().with(dc), shortAttr); } - - public static RtTag rt () { return new RtTag(); } - public static RtTag rt (String text) { return new RtTag().withText(text); } - public static RtTag rt (DomContent... dc) { return new RtTag().with(dc); } - public static RtTag rt (Attr.ShortForm shortAttr) { return Attr.addTo( new RtTag(), shortAttr); } - public static RtTag rt (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new RtTag().withText(text), shortAttr); } - public static RtTag rt (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new RtTag().with(dc), shortAttr); } - - public static RubyTag ruby () { return new RubyTag(); } - public static RubyTag ruby (String text) { return new RubyTag().withText(text); } - public static RubyTag ruby (DomContent... dc) { return new RubyTag().with(dc); } - public static RubyTag ruby (Attr.ShortForm shortAttr) { return Attr.addTo( new RubyTag(), shortAttr); } - public static RubyTag ruby (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new RubyTag().withText(text), shortAttr); } - public static RubyTag ruby (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new RubyTag().with(dc), shortAttr); } - - public static STag s () { return new STag(); } - public static STag s (String text) { return new STag().withText(text); } - public static STag s (DomContent... dc) { return new STag().with(dc); } - public static STag s (Attr.ShortForm shortAttr) { return Attr.addTo( new STag(), shortAttr); } - public static STag s (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new STag().withText(text), shortAttr); } - public static STag s (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new STag().with(dc), shortAttr); } - - public static SampTag samp () { return new SampTag(); } - public static SampTag samp (String text) { return new SampTag().withText(text); } - public static SampTag samp (DomContent... dc) { return new SampTag().with(dc); } - public static SampTag samp (Attr.ShortForm shortAttr) { return Attr.addTo( new SampTag(), shortAttr); } - public static SampTag samp (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new SampTag().withText(text), shortAttr); } - public static SampTag samp (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new SampTag().with(dc), shortAttr); } - - public static ScriptTag script () { return new ScriptTag(); } - public static ScriptTag script (String text) { return new ScriptTag().with(new UnescapedText(text)); } - public static ScriptTag script (DomContent... dc) { return new ScriptTag().with(dc); } - public static ScriptTag script (Attr.ShortForm shortAttr) { return Attr.addTo( new ScriptTag(), shortAttr); } - public static ScriptTag script (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new ScriptTag().with(new UnescapedText(text)), shortAttr); } - public static ScriptTag script (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new ScriptTag().with(dc), shortAttr); } - - public static SectionTag section () { return new SectionTag(); } - public static SectionTag section (String text) { return new SectionTag().withText(text); } - public static SectionTag section (DomContent... dc) { return new SectionTag().with(dc); } - public static SectionTag section (Attr.ShortForm shortAttr) { return Attr.addTo( new SectionTag(), shortAttr); } - public static SectionTag section (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new SectionTag().withText(text), shortAttr); } - public static SectionTag section (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new SectionTag().with(dc), shortAttr); } - - public static SelectTag select () { return new SelectTag(); } - public static SelectTag select (String text) { return new SelectTag().withText(text); } - public static SelectTag select (DomContent... dc) { return new SelectTag().with(dc); } - public static SelectTag select (Attr.ShortForm shortAttr) { return Attr.addTo( new SelectTag(), shortAttr); } - public static SelectTag select (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new SelectTag().withText(text), shortAttr); } - public static SelectTag select (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new SelectTag().with(dc), shortAttr); } - - public static SlotTag slot () { return new SlotTag(); } - public static SlotTag slot (String text) { return new SlotTag().withText(text); } - public static SlotTag slot (DomContent... dc) { return new SlotTag().with(dc); } - public static SlotTag slot (Attr.ShortForm shortAttr) { return Attr.addTo( new SlotTag(), shortAttr); } - public static SlotTag slot (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new SlotTag().withText(text), shortAttr); } - public static SlotTag slot (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new SlotTag().with(dc), shortAttr); } - - public static SmallTag small () { return new SmallTag(); } - public static SmallTag small (String text) { return new SmallTag().withText(text); } - public static SmallTag small (DomContent... dc) { return new SmallTag().with(dc); } - public static SmallTag small (Attr.ShortForm shortAttr) { return Attr.addTo( new SmallTag(), shortAttr); } - public static SmallTag small (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new SmallTag().withText(text), shortAttr); } - public static SmallTag small (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new SmallTag().with(dc), shortAttr); } - - public static SpanTag span () { return new SpanTag(); } - public static SpanTag span (String text) { return new SpanTag().withText(text); } - public static SpanTag span (DomContent... dc) { return new SpanTag().with(dc); } - public static SpanTag span (Attr.ShortForm shortAttr) { return Attr.addTo( new SpanTag(), shortAttr); } - public static SpanTag span (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new SpanTag().withText(text), shortAttr); } - public static SpanTag span (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new SpanTag().with(dc), shortAttr); } - - public static StrongTag strong () { return new StrongTag(); } - public static StrongTag strong (String text) { return new StrongTag().withText(text); } - public static StrongTag strong (DomContent... dc) { return new StrongTag().with(dc); } - public static StrongTag strong (Attr.ShortForm shortAttr) { return Attr.addTo( new StrongTag(), shortAttr); } - public static StrongTag strong (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new StrongTag().withText(text), shortAttr); } - public static StrongTag strong (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new StrongTag().with(dc), shortAttr); } - - public static StyleTag style () { return new StyleTag(); } - public static StyleTag style (String text) { return new StyleTag().with(new UnescapedText(text)); } - public static StyleTag style (DomContent... dc) { return new StyleTag().with(dc); } - public static StyleTag style (Attr.ShortForm shortAttr) { return Attr.addTo( new StyleTag(), shortAttr); } - public static StyleTag style (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new StyleTag().with(new UnescapedText(text)), shortAttr); } - public static StyleTag style (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new StyleTag().with(dc), shortAttr); } - - public static SubTag sub () { return new SubTag(); } - public static SubTag sub (String text) { return new SubTag().withText(text); } - public static SubTag sub (DomContent... dc) { return new SubTag().with(dc); } - public static SubTag sub (Attr.ShortForm shortAttr) { return Attr.addTo( new SubTag(), shortAttr); } - public static SubTag sub (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new SubTag().withText(text), shortAttr); } - public static SubTag sub (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new SubTag().with(dc), shortAttr); } - - public static SummaryTag summary () { return new SummaryTag(); } - public static SummaryTag summary (String text) { return new SummaryTag().withText(text); } - public static SummaryTag summary (DomContent... dc) { return new SummaryTag().with(dc); } - public static SummaryTag summary (Attr.ShortForm shortAttr) { return Attr.addTo( new SummaryTag(), shortAttr); } - public static SummaryTag summary (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new SummaryTag().withText(text), shortAttr); } - public static SummaryTag summary (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new SummaryTag().with(dc), shortAttr); } - - public static SupTag sup () { return new SupTag(); } - public static SupTag sup (String text) { return new SupTag().withText(text); } - public static SupTag sup (DomContent... dc) { return new SupTag().with(dc); } - public static SupTag sup (Attr.ShortForm shortAttr) { return Attr.addTo( new SupTag(), shortAttr); } - public static SupTag sup (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new SupTag().withText(text), shortAttr); } - public static SupTag sup (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new SupTag().with(dc), shortAttr); } - - public static TableTag table () { return new TableTag(); } - public static TableTag table (String text) { return new TableTag().withText(text); } - public static TableTag table (DomContent... dc) { return new TableTag().with(dc); } - public static TableTag table (Attr.ShortForm shortAttr) { return Attr.addTo( new TableTag(), shortAttr); } - public static TableTag table (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new TableTag().withText(text), shortAttr); } - public static TableTag table (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new TableTag().with(dc), shortAttr); } - - public static TbodyTag tbody () { return new TbodyTag(); } - public static TbodyTag tbody (String text) { return new TbodyTag().withText(text); } - public static TbodyTag tbody (DomContent... dc) { return new TbodyTag().with(dc); } - public static TbodyTag tbody (Attr.ShortForm shortAttr) { return Attr.addTo( new TbodyTag(), shortAttr); } - public static TbodyTag tbody (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new TbodyTag().withText(text), shortAttr); } - public static TbodyTag tbody (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new TbodyTag().with(dc), shortAttr); } - - public static TdTag td () { return new TdTag(); } - public static TdTag td (String text) { return new TdTag().withText(text); } - public static TdTag td (DomContent... dc) { return new TdTag().with(dc); } - public static TdTag td (Attr.ShortForm shortAttr) { return Attr.addTo( new TdTag(), shortAttr); } - public static TdTag td (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new TdTag().withText(text), shortAttr); } - public static TdTag td (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new TdTag().with(dc), shortAttr); } - - public static TemplateTag template () { return new TemplateTag(); } - public static TemplateTag template (String text) { return new TemplateTag().withText(text); } - public static TemplateTag template (DomContent... dc) { return new TemplateTag().with(dc); } - public static TemplateTag template (Attr.ShortForm shortAttr) { return Attr.addTo( new TemplateTag(), shortAttr); } - public static TemplateTag template (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new TemplateTag().withText(text), shortAttr); } - public static TemplateTag template (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new TemplateTag().with(dc), shortAttr); } - - public static TextareaTag textarea () { return new TextareaTag(); } - public static TextareaTag textarea (String text) { return new TextareaTag().withText(text); } - public static TextareaTag textarea (DomContent... dc) { return new TextareaTag().with(dc); } - public static TextareaTag textarea (Attr.ShortForm shortAttr) { return Attr.addTo( new TextareaTag(), shortAttr); } - public static TextareaTag textarea (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new TextareaTag().withText(text), shortAttr); } - public static TextareaTag textarea (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new TextareaTag().with(dc), shortAttr); } - - public static TfootTag tfoot () { return new TfootTag(); } - public static TfootTag tfoot (String text) { return new TfootTag().withText(text); } - public static TfootTag tfoot (DomContent... dc) { return new TfootTag().with(dc); } - public static TfootTag tfoot (Attr.ShortForm shortAttr) { return Attr.addTo( new TfootTag(), shortAttr); } - public static TfootTag tfoot (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new TfootTag().withText(text), shortAttr); } - public static TfootTag tfoot (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new TfootTag().with(dc), shortAttr); } - - public static ThTag th () { return new ThTag(); } - public static ThTag th (String text) { return new ThTag().withText(text); } - public static ThTag th (DomContent... dc) { return new ThTag().with(dc); } - public static ThTag th (Attr.ShortForm shortAttr) { return Attr.addTo( new ThTag(), shortAttr); } - public static ThTag th (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new ThTag().withText(text), shortAttr); } - public static ThTag th (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new ThTag().with(dc), shortAttr); } - - public static TheadTag thead () { return new TheadTag(); } - public static TheadTag thead (String text) { return new TheadTag().withText(text); } - public static TheadTag thead (DomContent... dc) { return new TheadTag().with(dc); } - public static TheadTag thead (Attr.ShortForm shortAttr) { return Attr.addTo( new TheadTag(), shortAttr); } - public static TheadTag thead (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new TheadTag().withText(text), shortAttr); } - public static TheadTag thead (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new TheadTag().with(dc), shortAttr); } - - public static TimeTag time () { return new TimeTag(); } - public static TimeTag time (String text) { return new TimeTag().withText(text); } - public static TimeTag time (DomContent... dc) { return new TimeTag().with(dc); } - public static TimeTag time (Attr.ShortForm shortAttr) { return Attr.addTo( new TimeTag(), shortAttr); } - public static TimeTag time (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new TimeTag().withText(text), shortAttr); } - public static TimeTag time (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new TimeTag().with(dc), shortAttr); } - - public static TitleTag title () { return new TitleTag(); } - public static TitleTag title (String text) { return new TitleTag().withText(text); } - public static TitleTag title (DomContent... dc) { return new TitleTag().with(dc); } - public static TitleTag title (Attr.ShortForm shortAttr) { return Attr.addTo( new TitleTag(), shortAttr); } - public static TitleTag title (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new TitleTag().withText(text), shortAttr); } - public static TitleTag title (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new TitleTag().with(dc), shortAttr); } - - public static TrTag tr () { return new TrTag(); } - public static TrTag tr (String text) { return new TrTag().withText(text); } - public static TrTag tr (DomContent... dc) { return new TrTag().with(dc); } - public static TrTag tr (Attr.ShortForm shortAttr) { return Attr.addTo( new TrTag(), shortAttr); } - public static TrTag tr (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new TrTag().withText(text), shortAttr); } - public static TrTag tr (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new TrTag().with(dc), shortAttr); } - - public static UTag u () { return new UTag(); } - public static UTag u (String text) { return new UTag().withText(text); } - public static UTag u (DomContent... dc) { return new UTag().with(dc); } - public static UTag u (Attr.ShortForm shortAttr) { return Attr.addTo( new UTag(), shortAttr); } - public static UTag u (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new UTag().withText(text), shortAttr); } - public static UTag u (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new UTag().with(dc), shortAttr); } - - public static UlTag ul () { return new UlTag(); } - public static UlTag ul (String text) { return new UlTag().withText(text); } - public static UlTag ul (DomContent... dc) { return new UlTag().with(dc); } - public static UlTag ul (Attr.ShortForm shortAttr) { return Attr.addTo( new UlTag(), shortAttr); } - public static UlTag ul (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new UlTag().withText(text), shortAttr); } - public static UlTag ul (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new UlTag().with(dc), shortAttr); } - - public static VarTag var () { return new VarTag(); } - public static VarTag var (String text) { return new VarTag().withText(text); } - public static VarTag var (DomContent... dc) { return new VarTag().with(dc); } - public static VarTag var (Attr.ShortForm shortAttr) { return Attr.addTo( new VarTag(), shortAttr); } - public static VarTag var (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new VarTag().withText(text), shortAttr); } - public static VarTag var (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new VarTag().with(dc), shortAttr); } - - public static VideoTag video () { return new VideoTag(); } - public static VideoTag video (String text) { return new VideoTag().withText(text); } - public static VideoTag video (DomContent... dc) { return new VideoTag().with(dc); } - public static VideoTag video (Attr.ShortForm shortAttr) { return Attr.addTo( new VideoTag(), shortAttr); } - public static VideoTag video (Attr.ShortForm shortAttr, String text) { return Attr.addTo( new VideoTag().withText(text), shortAttr); } - public static VideoTag video (Attr.ShortForm shortAttr, DomContent... dc) { return Attr.addTo( new VideoTag().with(dc), shortAttr); } + public static ATag a() { + return new ATag(); + } + public static ATag a(String text) { + return new ATag().withText(text); + } + + public static ATag a(DomContent... dc) { + return new ATag().with(dc); + } + + public static ATag a(Attr.ShortForm shortAttr) { + return Attr.addTo(new ATag(), shortAttr); + } + + public static ATag a(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new ATag().withText(text), shortAttr); + } + + public static ATag a(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new ATag().with(dc), shortAttr); + } + + public static AbbrTag abbr() { + return new AbbrTag(); + } + + public static AbbrTag abbr(String text) { + return new AbbrTag().withText(text); + } + + public static AbbrTag abbr(DomContent... dc) { + return new AbbrTag().with(dc); + } + + public static AbbrTag abbr(Attr.ShortForm shortAttr) { + return Attr.addTo(new AbbrTag(), shortAttr); + } + + public static AbbrTag abbr(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new AbbrTag().withText(text), shortAttr); + } + + public static AbbrTag abbr(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new AbbrTag().with(dc), shortAttr); + } + + public static AddressTag address() { + return new AddressTag(); + } + + public static AddressTag address(String text) { + return new AddressTag().withText(text); + } + + public static AddressTag address(DomContent... dc) { + return new AddressTag().with(dc); + } + + public static AddressTag address(Attr.ShortForm shortAttr) { + return Attr.addTo(new AddressTag(), shortAttr); + } + + public static AddressTag address(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new AddressTag().withText(text), shortAttr); + } + + public static AddressTag address(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new AddressTag().with(dc), shortAttr); + } + + public static ArticleTag article() { + return new ArticleTag(); + } + + public static ArticleTag article(String text) { + return new ArticleTag().withText(text); + } + + public static ArticleTag article(DomContent... dc) { + return new ArticleTag().with(dc); + } + + public static ArticleTag article(Attr.ShortForm shortAttr) { + return Attr.addTo(new ArticleTag(), shortAttr); + } + + public static ArticleTag article(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new ArticleTag().withText(text), shortAttr); + } + + public static ArticleTag article(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new ArticleTag().with(dc), shortAttr); + } + + public static AsideTag aside() { + return new AsideTag(); + } + + public static AsideTag aside(String text) { + return new AsideTag().withText(text); + } + + public static AsideTag aside(DomContent... dc) { + return new AsideTag().with(dc); + } + + public static AsideTag aside(Attr.ShortForm shortAttr) { + return Attr.addTo(new AsideTag(), shortAttr); + } + + public static AsideTag aside(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new AsideTag().withText(text), shortAttr); + } + + public static AsideTag aside(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new AsideTag().with(dc), shortAttr); + } + + public static AudioTag audio() { + return new AudioTag(); + } + + public static AudioTag audio(String text) { + return new AudioTag().withText(text); + } + + public static AudioTag audio(DomContent... dc) { + return new AudioTag().with(dc); + } + + public static AudioTag audio(Attr.ShortForm shortAttr) { + return Attr.addTo(new AudioTag(), shortAttr); + } + + public static AudioTag audio(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new AudioTag().withText(text), shortAttr); + } + + public static AudioTag audio(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new AudioTag().with(dc), shortAttr); + } + + public static BTag b() { + return new BTag(); + } + + public static BTag b(String text) { + return new BTag().withText(text); + } + + public static BTag b(DomContent... dc) { + return new BTag().with(dc); + } + + public static BTag b(Attr.ShortForm shortAttr) { + return Attr.addTo(new BTag(), shortAttr); + } + + public static BTag b(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new BTag().withText(text), shortAttr); + } + + public static BTag b(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new BTag().with(dc), shortAttr); + } + + public static BdiTag bdi() { + return new BdiTag(); + } + + public static BdiTag bdi(String text) { + return new BdiTag().withText(text); + } + + public static BdiTag bdi(DomContent... dc) { + return new BdiTag().with(dc); + } + + public static BdiTag bdi(Attr.ShortForm shortAttr) { + return Attr.addTo(new BdiTag(), shortAttr); + } + + public static BdiTag bdi(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new BdiTag().withText(text), shortAttr); + } + + public static BdiTag bdi(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new BdiTag().with(dc), shortAttr); + } + + public static BdoTag bdo() { + return new BdoTag(); + } + + public static BdoTag bdo(String text) { + return new BdoTag().withText(text); + } + + public static BdoTag bdo(DomContent... dc) { + return new BdoTag().with(dc); + } + + public static BdoTag bdo(Attr.ShortForm shortAttr) { + return Attr.addTo(new BdoTag(), shortAttr); + } + + public static BdoTag bdo(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new BdoTag().withText(text), shortAttr); + } + + public static BdoTag bdo(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new BdoTag().with(dc), shortAttr); + } + + public static BlockquoteTag blockquote() { + return new BlockquoteTag(); + } + + public static BlockquoteTag blockquote(String text) { + return new BlockquoteTag().withText(text); + } + + public static BlockquoteTag blockquote(DomContent... dc) { + return new BlockquoteTag().with(dc); + } + + public static BlockquoteTag blockquote(Attr.ShortForm shortAttr) { + return Attr.addTo(new BlockquoteTag(), shortAttr); + } + + public static BlockquoteTag blockquote(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new BlockquoteTag().withText(text), shortAttr); + } + + public static BlockquoteTag blockquote(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new BlockquoteTag().with(dc), shortAttr); + } + + public static ButtonTag button() { + return new ButtonTag(); + } + + public static ButtonTag button(String text) { + return new ButtonTag().withText(text); + } + + public static ButtonTag button(DomContent... dc) { + return new ButtonTag().with(dc); + } + + public static ButtonTag button(Attr.ShortForm shortAttr) { + return Attr.addTo(new ButtonTag(), shortAttr); + } + + public static ButtonTag button(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new ButtonTag().withText(text), shortAttr); + } + + public static ButtonTag button(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new ButtonTag().with(dc), shortAttr); + } + + public static CanvasTag canvas() { + return new CanvasTag(); + } + + public static CanvasTag canvas(String text) { + return new CanvasTag().withText(text); + } + + public static CanvasTag canvas(DomContent... dc) { + return new CanvasTag().with(dc); + } + + public static CanvasTag canvas(Attr.ShortForm shortAttr) { + return Attr.addTo(new CanvasTag(), shortAttr); + } + + public static CanvasTag canvas(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new CanvasTag().withText(text), shortAttr); + } + + public static CanvasTag canvas(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new CanvasTag().with(dc), shortAttr); + } + + public static CaptionTag caption() { + return new CaptionTag(); + } + + public static CaptionTag caption(String text) { + return new CaptionTag().withText(text); + } + + public static CaptionTag caption(DomContent... dc) { + return new CaptionTag().with(dc); + } + + public static CaptionTag caption(Attr.ShortForm shortAttr) { + return Attr.addTo(new CaptionTag(), shortAttr); + } + + public static CaptionTag caption(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new CaptionTag().withText(text), shortAttr); + } + + public static CaptionTag caption(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new CaptionTag().with(dc), shortAttr); + } + + public static CiteTag cite() { + return new CiteTag(); + } + + public static CiteTag cite(String text) { + return new CiteTag().withText(text); + } + + public static CiteTag cite(DomContent... dc) { + return new CiteTag().with(dc); + } + + public static CiteTag cite(Attr.ShortForm shortAttr) { + return Attr.addTo(new CiteTag(), shortAttr); + } + + public static CiteTag cite(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new CiteTag().withText(text), shortAttr); + } + + public static CiteTag cite(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new CiteTag().with(dc), shortAttr); + } + + public static CodeTag code() { + return new CodeTag(); + } + + public static CodeTag code(String text) { + return new CodeTag().withText(text); + } + + public static CodeTag code(DomContent... dc) { + return new CodeTag().with(dc); + } + + public static CodeTag code(Attr.ShortForm shortAttr) { + return Attr.addTo(new CodeTag(), shortAttr); + } + + public static CodeTag code(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new CodeTag().withText(text), shortAttr); + } + + public static CodeTag code(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new CodeTag().with(dc), shortAttr); + } + + public static ColgroupTag colgroup() { + return new ColgroupTag(); + } + + public static ColgroupTag colgroup(String text) { + return new ColgroupTag().withText(text); + } + + public static ColgroupTag colgroup(DomContent... dc) { + return new ColgroupTag().with(dc); + } + + public static ColgroupTag colgroup(Attr.ShortForm shortAttr) { + return Attr.addTo(new ColgroupTag(), shortAttr); + } + + public static ColgroupTag colgroup(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new ColgroupTag().withText(text), shortAttr); + } + + public static ColgroupTag colgroup(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new ColgroupTag().with(dc), shortAttr); + } + + public static DataTag data() { + return new DataTag(); + } + + public static DataTag data(String text) { + return new DataTag().withText(text); + } + + public static DataTag data(DomContent... dc) { + return new DataTag().with(dc); + } + + public static DataTag data(Attr.ShortForm shortAttr) { + return Attr.addTo(new DataTag(), shortAttr); + } + + public static DataTag data(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new DataTag().withText(text), shortAttr); + } + + public static DataTag data(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new DataTag().with(dc), shortAttr); + } + + public static DatalistTag datalist() { + return new DatalistTag(); + } + + public static DatalistTag datalist(String text) { + return new DatalistTag().withText(text); + } + + public static DatalistTag datalist(DomContent... dc) { + return new DatalistTag().with(dc); + } + + public static DatalistTag datalist(Attr.ShortForm shortAttr) { + return Attr.addTo(new DatalistTag(), shortAttr); + } + + public static DatalistTag datalist(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new DatalistTag().withText(text), shortAttr); + } + + public static DatalistTag datalist(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new DatalistTag().with(dc), shortAttr); + } + + public static DdTag dd() { + return new DdTag(); + } + + public static DdTag dd(String text) { + return new DdTag().withText(text); + } + + public static DdTag dd(DomContent... dc) { + return new DdTag().with(dc); + } + + public static DdTag dd(Attr.ShortForm shortAttr) { + return Attr.addTo(new DdTag(), shortAttr); + } + + public static DdTag dd(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new DdTag().withText(text), shortAttr); + } + + public static DdTag dd(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new DdTag().with(dc), shortAttr); + } + + public static DelTag del() { + return new DelTag(); + } + + public static DelTag del(String text) { + return new DelTag().withText(text); + } + + public static DelTag del(DomContent... dc) { + return new DelTag().with(dc); + } + + public static DelTag del(Attr.ShortForm shortAttr) { + return Attr.addTo(new DelTag(), shortAttr); + } + + public static DelTag del(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new DelTag().withText(text), shortAttr); + } + + public static DelTag del(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new DelTag().with(dc), shortAttr); + } + + public static DetailsTag details() { + return new DetailsTag(); + } + + public static DetailsTag details(String text) { + return new DetailsTag().withText(text); + } + + public static DetailsTag details(DomContent... dc) { + return new DetailsTag().with(dc); + } + + public static DetailsTag details(Attr.ShortForm shortAttr) { + return Attr.addTo(new DetailsTag(), shortAttr); + } + + public static DetailsTag details(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new DetailsTag().withText(text), shortAttr); + } + + public static DetailsTag details(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new DetailsTag().with(dc), shortAttr); + } + + public static DfnTag dfn() { + return new DfnTag(); + } + + public static DfnTag dfn(String text) { + return new DfnTag().withText(text); + } + + public static DfnTag dfn(DomContent... dc) { + return new DfnTag().with(dc); + } + + public static DfnTag dfn(Attr.ShortForm shortAttr) { + return Attr.addTo(new DfnTag(), shortAttr); + } + + public static DfnTag dfn(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new DfnTag().withText(text), shortAttr); + } + + public static DfnTag dfn(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new DfnTag().with(dc), shortAttr); + } + + public static DialogTag dialog() { + return new DialogTag(); + } + + public static DialogTag dialog(String text) { + return new DialogTag().withText(text); + } + + public static DialogTag dialog(DomContent... dc) { + return new DialogTag().with(dc); + } + + public static DialogTag dialog(Attr.ShortForm shortAttr) { + return Attr.addTo(new DialogTag(), shortAttr); + } + + public static DialogTag dialog(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new DialogTag().withText(text), shortAttr); + } + + public static DialogTag dialog(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new DialogTag().with(dc), shortAttr); + } + + public static DivTag div() { + return new DivTag(); + } + + public static DivTag div(String text) { + return new DivTag().withText(text); + } + + public static DivTag div(DomContent... dc) { + return new DivTag().with(dc); + } + + public static DivTag div(Attr.ShortForm shortAttr) { + return Attr.addTo(new DivTag(), shortAttr); + } + + public static DivTag div(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new DivTag().withText(text), shortAttr); + } + + public static DivTag div(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new DivTag().with(dc), shortAttr); + } + + public static DlTag dl() { + return new DlTag(); + } + + public static DlTag dl(String text) { + return new DlTag().withText(text); + } + + public static DlTag dl(DomContent... dc) { + return new DlTag().with(dc); + } + + public static DlTag dl(Attr.ShortForm shortAttr) { + return Attr.addTo(new DlTag(), shortAttr); + } + + public static DlTag dl(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new DlTag().withText(text), shortAttr); + } + + public static DlTag dl(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new DlTag().with(dc), shortAttr); + } + + public static DtTag dt() { + return new DtTag(); + } + + public static DtTag dt(String text) { + return new DtTag().withText(text); + } + + public static DtTag dt(DomContent... dc) { + return new DtTag().with(dc); + } + + public static DtTag dt(Attr.ShortForm shortAttr) { + return Attr.addTo(new DtTag(), shortAttr); + } + + public static DtTag dt(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new DtTag().withText(text), shortAttr); + } + + public static DtTag dt(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new DtTag().with(dc), shortAttr); + } + + public static EmTag em() { + return new EmTag(); + } + + public static EmTag em(String text) { + return new EmTag().withText(text); + } + + public static EmTag em(DomContent... dc) { + return new EmTag().with(dc); + } + + public static EmTag em(Attr.ShortForm shortAttr) { + return Attr.addTo(new EmTag(), shortAttr); + } + + public static EmTag em(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new EmTag().withText(text), shortAttr); + } + + public static EmTag em(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new EmTag().with(dc), shortAttr); + } + + public static FieldsetTag fieldset() { + return new FieldsetTag(); + } + + public static FieldsetTag fieldset(String text) { + return new FieldsetTag().withText(text); + } + + public static FieldsetTag fieldset(DomContent... dc) { + return new FieldsetTag().with(dc); + } + + public static FieldsetTag fieldset(Attr.ShortForm shortAttr) { + return Attr.addTo(new FieldsetTag(), shortAttr); + } + + public static FieldsetTag fieldset(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new FieldsetTag().withText(text), shortAttr); + } + + public static FieldsetTag fieldset(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new FieldsetTag().with(dc), shortAttr); + } + + public static FigcaptionTag figcaption() { + return new FigcaptionTag(); + } + + public static FigcaptionTag figcaption(String text) { + return new FigcaptionTag().withText(text); + } + + public static FigcaptionTag figcaption(DomContent... dc) { + return new FigcaptionTag().with(dc); + } + + public static FigcaptionTag figcaption(Attr.ShortForm shortAttr) { + return Attr.addTo(new FigcaptionTag(), shortAttr); + } + + public static FigcaptionTag figcaption(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new FigcaptionTag().withText(text), shortAttr); + } + + public static FigcaptionTag figcaption(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new FigcaptionTag().with(dc), shortAttr); + } + + public static FigureTag figure() { + return new FigureTag(); + } + + public static FigureTag figure(String text) { + return new FigureTag().withText(text); + } + + public static FigureTag figure(DomContent... dc) { + return new FigureTag().with(dc); + } + + public static FigureTag figure(Attr.ShortForm shortAttr) { + return Attr.addTo(new FigureTag(), shortAttr); + } + + public static FigureTag figure(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new FigureTag().withText(text), shortAttr); + } + + public static FigureTag figure(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new FigureTag().with(dc), shortAttr); + } + + public static FooterTag footer() { + return new FooterTag(); + } + + public static FooterTag footer(String text) { + return new FooterTag().withText(text); + } + + public static FooterTag footer(DomContent... dc) { + return new FooterTag().with(dc); + } + + public static FooterTag footer(Attr.ShortForm shortAttr) { + return Attr.addTo(new FooterTag(), shortAttr); + } + + public static FooterTag footer(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new FooterTag().withText(text), shortAttr); + } + + public static FooterTag footer(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new FooterTag().with(dc), shortAttr); + } + + public static FormTag form() { + return new FormTag(); + } + + public static FormTag form(String text) { + return new FormTag().withText(text); + } + + public static FormTag form(DomContent... dc) { + return new FormTag().with(dc); + } + + public static FormTag form(Attr.ShortForm shortAttr) { + return Attr.addTo(new FormTag(), shortAttr); + } + + public static FormTag form(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new FormTag().withText(text), shortAttr); + } + + public static FormTag form(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new FormTag().with(dc), shortAttr); + } + + public static H1Tag h1() { + return new H1Tag(); + } + + public static H1Tag h1(String text) { + return new H1Tag().withText(text); + } + + public static H1Tag h1(DomContent... dc) { + return new H1Tag().with(dc); + } + + public static H1Tag h1(Attr.ShortForm shortAttr) { + return Attr.addTo(new H1Tag(), shortAttr); + } + + public static H1Tag h1(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new H1Tag().withText(text), shortAttr); + } + + public static H1Tag h1(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new H1Tag().with(dc), shortAttr); + } + + public static H2Tag h2() { + return new H2Tag(); + } + + public static H2Tag h2(String text) { + return new H2Tag().withText(text); + } + + public static H2Tag h2(DomContent... dc) { + return new H2Tag().with(dc); + } + + public static H2Tag h2(Attr.ShortForm shortAttr) { + return Attr.addTo(new H2Tag(), shortAttr); + } + + public static H2Tag h2(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new H2Tag().withText(text), shortAttr); + } + + public static H2Tag h2(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new H2Tag().with(dc), shortAttr); + } + + public static H3Tag h3() { + return new H3Tag(); + } + + public static H3Tag h3(String text) { + return new H3Tag().withText(text); + } + + public static H3Tag h3(DomContent... dc) { + return new H3Tag().with(dc); + } + + public static H3Tag h3(Attr.ShortForm shortAttr) { + return Attr.addTo(new H3Tag(), shortAttr); + } + + public static H3Tag h3(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new H3Tag().withText(text), shortAttr); + } + + public static H3Tag h3(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new H3Tag().with(dc), shortAttr); + } + + public static H4Tag h4() { + return new H4Tag(); + } + + public static H4Tag h4(String text) { + return new H4Tag().withText(text); + } + + public static H4Tag h4(DomContent... dc) { + return new H4Tag().with(dc); + } + + public static H4Tag h4(Attr.ShortForm shortAttr) { + return Attr.addTo(new H4Tag(), shortAttr); + } + + public static H4Tag h4(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new H4Tag().withText(text), shortAttr); + } + + public static H4Tag h4(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new H4Tag().with(dc), shortAttr); + } + + public static H5Tag h5() { + return new H5Tag(); + } + + public static H5Tag h5(String text) { + return new H5Tag().withText(text); + } + + public static H5Tag h5(DomContent... dc) { + return new H5Tag().with(dc); + } + + public static H5Tag h5(Attr.ShortForm shortAttr) { + return Attr.addTo(new H5Tag(), shortAttr); + } + + public static H5Tag h5(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new H5Tag().withText(text), shortAttr); + } + + public static H5Tag h5(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new H5Tag().with(dc), shortAttr); + } + + public static H6Tag h6() { + return new H6Tag(); + } + + public static H6Tag h6(String text) { + return new H6Tag().withText(text); + } + + public static H6Tag h6(DomContent... dc) { + return new H6Tag().with(dc); + } + + public static H6Tag h6(Attr.ShortForm shortAttr) { + return Attr.addTo(new H6Tag(), shortAttr); + } + + public static H6Tag h6(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new H6Tag().withText(text), shortAttr); + } + + public static H6Tag h6(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new H6Tag().with(dc), shortAttr); + } + + public static HeaderTag header() { + return new HeaderTag(); + } + + public static HeaderTag header(String text) { + return new HeaderTag().withText(text); + } + + public static HeaderTag header(DomContent... dc) { + return new HeaderTag().with(dc); + } + + public static HeaderTag header(Attr.ShortForm shortAttr) { + return Attr.addTo(new HeaderTag(), shortAttr); + } + + public static HeaderTag header(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new HeaderTag().withText(text), shortAttr); + } + + public static HeaderTag header(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new HeaderTag().with(dc), shortAttr); + } + + public static ITag i() { + return new ITag(); + } + + public static ITag i(String text) { + return new ITag().withText(text); + } + + public static ITag i(DomContent... dc) { + return new ITag().with(dc); + } + + public static ITag i(Attr.ShortForm shortAttr) { + return Attr.addTo(new ITag(), shortAttr); + } + + public static ITag i(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new ITag().withText(text), shortAttr); + } + + public static ITag i(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new ITag().with(dc), shortAttr); + } + + public static IframeTag iframe() { + return new IframeTag(); + } + + public static IframeTag iframe(String text) { + return new IframeTag().withText(text); + } + + public static IframeTag iframe(DomContent... dc) { + return new IframeTag().with(dc); + } + + public static IframeTag iframe(Attr.ShortForm shortAttr) { + return Attr.addTo(new IframeTag(), shortAttr); + } + + public static IframeTag iframe(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new IframeTag().withText(text), shortAttr); + } + + public static IframeTag iframe(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new IframeTag().with(dc), shortAttr); + } + + public static InsTag ins() { + return new InsTag(); + } + + public static InsTag ins(String text) { + return new InsTag().withText(text); + } + + public static InsTag ins(DomContent... dc) { + return new InsTag().with(dc); + } + + public static InsTag ins(Attr.ShortForm shortAttr) { + return Attr.addTo(new InsTag(), shortAttr); + } + + public static InsTag ins(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new InsTag().withText(text), shortAttr); + } + + public static InsTag ins(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new InsTag().with(dc), shortAttr); + } + + public static KbdTag kbd() { + return new KbdTag(); + } + + public static KbdTag kbd(String text) { + return new KbdTag().withText(text); + } + + public static KbdTag kbd(DomContent... dc) { + return new KbdTag().with(dc); + } + + public static KbdTag kbd(Attr.ShortForm shortAttr) { + return Attr.addTo(new KbdTag(), shortAttr); + } + + public static KbdTag kbd(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new KbdTag().withText(text), shortAttr); + } + + public static KbdTag kbd(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new KbdTag().with(dc), shortAttr); + } + + public static LabelTag label() { + return new LabelTag(); + } + + public static LabelTag label(String text) { + return new LabelTag().withText(text); + } + + public static LabelTag label(DomContent... dc) { + return new LabelTag().with(dc); + } + + public static LabelTag label(Attr.ShortForm shortAttr) { + return Attr.addTo(new LabelTag(), shortAttr); + } + + public static LabelTag label(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new LabelTag().withText(text), shortAttr); + } + + public static LabelTag label(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new LabelTag().with(dc), shortAttr); + } + + public static LegendTag legend() { + return new LegendTag(); + } + + public static LegendTag legend(String text) { + return new LegendTag().withText(text); + } + + public static LegendTag legend(DomContent... dc) { + return new LegendTag().with(dc); + } + + public static LegendTag legend(Attr.ShortForm shortAttr) { + return Attr.addTo(new LegendTag(), shortAttr); + } + + public static LegendTag legend(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new LegendTag().withText(text), shortAttr); + } + + public static LegendTag legend(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new LegendTag().with(dc), shortAttr); + } + + public static LiTag li() { + return new LiTag(); + } + + public static LiTag li(String text) { + return new LiTag().withText(text); + } + + public static LiTag li(DomContent... dc) { + return new LiTag().with(dc); + } + + public static LiTag li(Attr.ShortForm shortAttr) { + return Attr.addTo(new LiTag(), shortAttr); + } + + public static LiTag li(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new LiTag().withText(text), shortAttr); + } + + public static LiTag li(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new LiTag().with(dc), shortAttr); + } + + public static MainTag main() { + return new MainTag(); + } + + public static MainTag main(String text) { + return new MainTag().withText(text); + } + + public static MainTag main(DomContent... dc) { + return new MainTag().with(dc); + } + + public static MainTag main(Attr.ShortForm shortAttr) { + return Attr.addTo(new MainTag(), shortAttr); + } + + public static MainTag main(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new MainTag().withText(text), shortAttr); + } + + public static MainTag main(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new MainTag().with(dc), shortAttr); + } + + public static MapTag map() { + return new MapTag(); + } + + public static MapTag map(String text) { + return new MapTag().withText(text); + } + + public static MapTag map(DomContent... dc) { + return new MapTag().with(dc); + } + + public static MapTag map(Attr.ShortForm shortAttr) { + return Attr.addTo(new MapTag(), shortAttr); + } + + public static MapTag map(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new MapTag().withText(text), shortAttr); + } + + public static MapTag map(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new MapTag().with(dc), shortAttr); + } + + public static MarkTag mark() { + return new MarkTag(); + } + + public static MarkTag mark(String text) { + return new MarkTag().withText(text); + } + + public static MarkTag mark(DomContent... dc) { + return new MarkTag().with(dc); + } + + public static MarkTag mark(Attr.ShortForm shortAttr) { + return Attr.addTo(new MarkTag(), shortAttr); + } + + public static MarkTag mark(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new MarkTag().withText(text), shortAttr); + } + + public static MarkTag mark(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new MarkTag().with(dc), shortAttr); + } + + public static MenuTag menu() { + return new MenuTag(); + } + + public static MenuTag menu(String text) { + return new MenuTag().withText(text); + } + + public static MenuTag menu(DomContent... dc) { + return new MenuTag().with(dc); + } + + public static MenuTag menu(Attr.ShortForm shortAttr) { + return Attr.addTo(new MenuTag(), shortAttr); + } + + public static MenuTag menu(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new MenuTag().withText(text), shortAttr); + } + + public static MenuTag menu(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new MenuTag().with(dc), shortAttr); + } + + public static MenuitemTag menuitem() { + return new MenuitemTag(); + } + + public static MenuitemTag menuitem(String text) { + return new MenuitemTag().withText(text); + } + + public static MenuitemTag menuitem(DomContent... dc) { + return new MenuitemTag().with(dc); + } + + public static MenuitemTag menuitem(Attr.ShortForm shortAttr) { + return Attr.addTo(new MenuitemTag(), shortAttr); + } + + public static MenuitemTag menuitem(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new MenuitemTag().withText(text), shortAttr); + } + + public static MenuitemTag menuitem(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new MenuitemTag().with(dc), shortAttr); + } + + public static MeterTag meter() { + return new MeterTag(); + } + + public static MeterTag meter(String text) { + return new MeterTag().withText(text); + } + + public static MeterTag meter(DomContent... dc) { + return new MeterTag().with(dc); + } + + public static MeterTag meter(Attr.ShortForm shortAttr) { + return Attr.addTo(new MeterTag(), shortAttr); + } + + public static MeterTag meter(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new MeterTag().withText(text), shortAttr); + } + + public static MeterTag meter(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new MeterTag().with(dc), shortAttr); + } + + public static NavTag nav() { + return new NavTag(); + } + + public static NavTag nav(String text) { + return new NavTag().withText(text); + } + + public static NavTag nav(DomContent... dc) { + return new NavTag().with(dc); + } + + public static NavTag nav(Attr.ShortForm shortAttr) { + return Attr.addTo(new NavTag(), shortAttr); + } + + public static NavTag nav(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new NavTag().withText(text), shortAttr); + } + + public static NavTag nav(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new NavTag().with(dc), shortAttr); + } + + public static NoscriptTag noscript() { + return new NoscriptTag(); + } + + public static NoscriptTag noscript(String text) { + return new NoscriptTag().withText(text); + } + + public static NoscriptTag noscript(DomContent... dc) { + return new NoscriptTag().with(dc); + } + + public static NoscriptTag noscript(Attr.ShortForm shortAttr) { + return Attr.addTo(new NoscriptTag(), shortAttr); + } + + public static NoscriptTag noscript(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new NoscriptTag().withText(text), shortAttr); + } + + public static NoscriptTag noscript(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new NoscriptTag().with(dc), shortAttr); + } + + public static ObjectTag object() { + return new ObjectTag(); + } + + public static ObjectTag object(String text) { + return new ObjectTag().withText(text); + } + + public static ObjectTag object(DomContent... dc) { + return new ObjectTag().with(dc); + } + + public static ObjectTag object(Attr.ShortForm shortAttr) { + return Attr.addTo(new ObjectTag(), shortAttr); + } + + public static ObjectTag object(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new ObjectTag().withText(text), shortAttr); + } + + public static ObjectTag object(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new ObjectTag().with(dc), shortAttr); + } + + public static OlTag ol() { + return new OlTag(); + } + + public static OlTag ol(String text) { + return new OlTag().withText(text); + } + + public static OlTag ol(DomContent... dc) { + return new OlTag().with(dc); + } + + public static OlTag ol(Attr.ShortForm shortAttr) { + return Attr.addTo(new OlTag(), shortAttr); + } + + public static OlTag ol(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new OlTag().withText(text), shortAttr); + } + + public static OlTag ol(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new OlTag().with(dc), shortAttr); + } + + public static OptgroupTag optgroup() { + return new OptgroupTag(); + } + + public static OptgroupTag optgroup(String text) { + return new OptgroupTag().withText(text); + } + + public static OptgroupTag optgroup(DomContent... dc) { + return new OptgroupTag().with(dc); + } + + public static OptgroupTag optgroup(Attr.ShortForm shortAttr) { + return Attr.addTo(new OptgroupTag(), shortAttr); + } + + public static OptgroupTag optgroup(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new OptgroupTag().withText(text), shortAttr); + } + + public static OptgroupTag optgroup(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new OptgroupTag().with(dc), shortAttr); + } + + public static OptionTag option() { + return new OptionTag(); + } + + public static OptionTag option(String text) { + return new OptionTag().withText(text); + } + + public static OptionTag option(DomContent... dc) { + return new OptionTag().with(dc); + } + + public static OptionTag option(Attr.ShortForm shortAttr) { + return Attr.addTo(new OptionTag(), shortAttr); + } + + public static OptionTag option(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new OptionTag().withText(text), shortAttr); + } + + public static OptionTag option(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new OptionTag().with(dc), shortAttr); + } + + public static OutputTag output() { + return new OutputTag(); + } + + public static OutputTag output(String text) { + return new OutputTag().withText(text); + } + + public static OutputTag output(DomContent... dc) { + return new OutputTag().with(dc); + } + + public static OutputTag output(Attr.ShortForm shortAttr) { + return Attr.addTo(new OutputTag(), shortAttr); + } + + public static OutputTag output(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new OutputTag().withText(text), shortAttr); + } + + public static OutputTag output(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new OutputTag().with(dc), shortAttr); + } + + public static PTag p() { + return new PTag(); + } + + public static PTag p(String text) { + return new PTag().withText(text); + } + + public static PTag p(DomContent... dc) { + return new PTag().with(dc); + } + + public static PTag p(Attr.ShortForm shortAttr) { + return Attr.addTo(new PTag(), shortAttr); + } + + public static PTag p(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new PTag().withText(text), shortAttr); + } + + public static PTag p(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new PTag().with(dc), shortAttr); + } + + public static PictureTag picture() { + return new PictureTag(); + } + + public static PictureTag picture(String text) { + return new PictureTag().withText(text); + } + + public static PictureTag picture(DomContent... dc) { + return new PictureTag().with(dc); + } + + public static PictureTag picture(Attr.ShortForm shortAttr) { + return Attr.addTo(new PictureTag(), shortAttr); + } + + public static PictureTag picture(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new PictureTag().withText(text), shortAttr); + } + + public static PictureTag picture(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new PictureTag().with(dc), shortAttr); + } + + public static PreTag pre() { + return new PreTag(); + } + + public static PreTag pre(String text) { + return new PreTag().withText(text); + } + + public static PreTag pre(DomContent... dc) { + return new PreTag().with(dc); + } + + public static PreTag pre(Attr.ShortForm shortAttr) { + return Attr.addTo(new PreTag(), shortAttr); + } + + public static PreTag pre(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new PreTag().withText(text), shortAttr); + } + + public static PreTag pre(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new PreTag().with(dc), shortAttr); + } + + public static ProgressTag progress() { + return new ProgressTag(); + } + + public static ProgressTag progress(String text) { + return new ProgressTag().withText(text); + } + + public static ProgressTag progress(DomContent... dc) { + return new ProgressTag().with(dc); + } + + public static ProgressTag progress(Attr.ShortForm shortAttr) { + return Attr.addTo(new ProgressTag(), shortAttr); + } + + public static ProgressTag progress(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new ProgressTag().withText(text), shortAttr); + } + + public static ProgressTag progress(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new ProgressTag().with(dc), shortAttr); + } + + public static QTag q() { + return new QTag(); + } + + public static QTag q(String text) { + return new QTag().withText(text); + } + + public static QTag q(DomContent... dc) { + return new QTag().with(dc); + } + + public static QTag q(Attr.ShortForm shortAttr) { + return Attr.addTo(new QTag(), shortAttr); + } + + public static QTag q(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new QTag().withText(text), shortAttr); + } + + public static QTag q(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new QTag().with(dc), shortAttr); + } + + public static RpTag rp() { + return new RpTag(); + } + + public static RpTag rp(String text) { + return new RpTag().withText(text); + } + + public static RpTag rp(DomContent... dc) { + return new RpTag().with(dc); + } + + public static RpTag rp(Attr.ShortForm shortAttr) { + return Attr.addTo(new RpTag(), shortAttr); + } + + public static RpTag rp(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new RpTag().withText(text), shortAttr); + } + + public static RpTag rp(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new RpTag().with(dc), shortAttr); + } + + public static RtTag rt() { + return new RtTag(); + } + + public static RtTag rt(String text) { + return new RtTag().withText(text); + } + + public static RtTag rt(DomContent... dc) { + return new RtTag().with(dc); + } + + public static RtTag rt(Attr.ShortForm shortAttr) { + return Attr.addTo(new RtTag(), shortAttr); + } + + public static RtTag rt(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new RtTag().withText(text), shortAttr); + } + + public static RtTag rt(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new RtTag().with(dc), shortAttr); + } + + public static RubyTag ruby() { + return new RubyTag(); + } + + public static RubyTag ruby(String text) { + return new RubyTag().withText(text); + } + + public static RubyTag ruby(DomContent... dc) { + return new RubyTag().with(dc); + } + + public static RubyTag ruby(Attr.ShortForm shortAttr) { + return Attr.addTo(new RubyTag(), shortAttr); + } + + public static RubyTag ruby(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new RubyTag().withText(text), shortAttr); + } + + public static RubyTag ruby(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new RubyTag().with(dc), shortAttr); + } + + public static STag s() { + return new STag(); + } + + public static STag s(String text) { + return new STag().withText(text); + } + + public static STag s(DomContent... dc) { + return new STag().with(dc); + } + + public static STag s(Attr.ShortForm shortAttr) { + return Attr.addTo(new STag(), shortAttr); + } + + public static STag s(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new STag().withText(text), shortAttr); + } + + public static STag s(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new STag().with(dc), shortAttr); + } + + public static SampTag samp() { + return new SampTag(); + } + + public static SampTag samp(String text) { + return new SampTag().withText(text); + } + + public static SampTag samp(DomContent... dc) { + return new SampTag().with(dc); + } + + public static SampTag samp(Attr.ShortForm shortAttr) { + return Attr.addTo(new SampTag(), shortAttr); + } + + public static SampTag samp(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new SampTag().withText(text), shortAttr); + } + + public static SampTag samp(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new SampTag().with(dc), shortAttr); + } + + public static ScriptTag script() { + return new ScriptTag(); + } + + public static ScriptTag script(String text) { + return new ScriptTag().with(new UnescapedText(text)); + } + + public static ScriptTag script(DomContent... dc) { + return new ScriptTag().with(dc); + } + + public static ScriptTag script(Attr.ShortForm shortAttr) { + return Attr.addTo(new ScriptTag(), shortAttr); + } + + public static ScriptTag script(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new ScriptTag().with(new UnescapedText(text)), shortAttr); + } + + public static ScriptTag script(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new ScriptTag().with(dc), shortAttr); + } + + public static SectionTag section() { + return new SectionTag(); + } + + public static SectionTag section(String text) { + return new SectionTag().withText(text); + } + + public static SectionTag section(DomContent... dc) { + return new SectionTag().with(dc); + } + + public static SectionTag section(Attr.ShortForm shortAttr) { + return Attr.addTo(new SectionTag(), shortAttr); + } + + public static SectionTag section(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new SectionTag().withText(text), shortAttr); + } + + public static SectionTag section(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new SectionTag().with(dc), shortAttr); + } + + public static SelectTag select() { + return new SelectTag(); + } + + public static SelectTag select(String text) { + return new SelectTag().withText(text); + } + + public static SelectTag select(DomContent... dc) { + return new SelectTag().with(dc); + } + + public static SelectTag select(Attr.ShortForm shortAttr) { + return Attr.addTo(new SelectTag(), shortAttr); + } + + public static SelectTag select(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new SelectTag().withText(text), shortAttr); + } + + public static SelectTag select(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new SelectTag().with(dc), shortAttr); + } + + public static SlotTag slot() { + return new SlotTag(); + } + + public static SlotTag slot(String text) { + return new SlotTag().withText(text); + } + + public static SlotTag slot(DomContent... dc) { + return new SlotTag().with(dc); + } + + public static SlotTag slot(Attr.ShortForm shortAttr) { + return Attr.addTo(new SlotTag(), shortAttr); + } + + public static SlotTag slot(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new SlotTag().withText(text), shortAttr); + } + + public static SlotTag slot(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new SlotTag().with(dc), shortAttr); + } + + public static SmallTag small() { + return new SmallTag(); + } + + public static SmallTag small(String text) { + return new SmallTag().withText(text); + } + + public static SmallTag small(DomContent... dc) { + return new SmallTag().with(dc); + } + + public static SmallTag small(Attr.ShortForm shortAttr) { + return Attr.addTo(new SmallTag(), shortAttr); + } + + public static SmallTag small(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new SmallTag().withText(text), shortAttr); + } + + public static SmallTag small(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new SmallTag().with(dc), shortAttr); + } + + public static SpanTag span() { + return new SpanTag(); + } + + public static SpanTag span(String text) { + return new SpanTag().withText(text); + } + + public static SpanTag span(DomContent... dc) { + return new SpanTag().with(dc); + } + + public static SpanTag span(Attr.ShortForm shortAttr) { + return Attr.addTo(new SpanTag(), shortAttr); + } + + public static SpanTag span(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new SpanTag().withText(text), shortAttr); + } + + public static SpanTag span(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new SpanTag().with(dc), shortAttr); + } + + public static StrongTag strong() { + return new StrongTag(); + } + + public static StrongTag strong(String text) { + return new StrongTag().withText(text); + } + + public static StrongTag strong(DomContent... dc) { + return new StrongTag().with(dc); + } + + public static StrongTag strong(Attr.ShortForm shortAttr) { + return Attr.addTo(new StrongTag(), shortAttr); + } + + public static StrongTag strong(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new StrongTag().withText(text), shortAttr); + } + + public static StrongTag strong(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new StrongTag().with(dc), shortAttr); + } + + public static StyleTag style() { + return new StyleTag(); + } + + public static StyleTag style(String text) { + return new StyleTag().with(new UnescapedText(text)); + } + + public static StyleTag style(DomContent... dc) { + return new StyleTag().with(dc); + } + + public static StyleTag style(Attr.ShortForm shortAttr) { + return Attr.addTo(new StyleTag(), shortAttr); + } + + public static StyleTag style(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new StyleTag().with(new UnescapedText(text)), shortAttr); + } + + public static StyleTag style(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new StyleTag().with(dc), shortAttr); + } + + public static SubTag sub() { + return new SubTag(); + } + + public static SubTag sub(String text) { + return new SubTag().withText(text); + } + + public static SubTag sub(DomContent... dc) { + return new SubTag().with(dc); + } + + public static SubTag sub(Attr.ShortForm shortAttr) { + return Attr.addTo(new SubTag(), shortAttr); + } + + public static SubTag sub(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new SubTag().withText(text), shortAttr); + } + + public static SubTag sub(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new SubTag().with(dc), shortAttr); + } + + public static SummaryTag summary() { + return new SummaryTag(); + } + + public static SummaryTag summary(String text) { + return new SummaryTag().withText(text); + } + + public static SummaryTag summary(DomContent... dc) { + return new SummaryTag().with(dc); + } + + public static SummaryTag summary(Attr.ShortForm shortAttr) { + return Attr.addTo(new SummaryTag(), shortAttr); + } + + public static SummaryTag summary(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new SummaryTag().withText(text), shortAttr); + } + + public static SummaryTag summary(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new SummaryTag().with(dc), shortAttr); + } + + public static SupTag sup() { + return new SupTag(); + } + + public static SupTag sup(String text) { + return new SupTag().withText(text); + } + + public static SupTag sup(DomContent... dc) { + return new SupTag().with(dc); + } + + public static SupTag sup(Attr.ShortForm shortAttr) { + return Attr.addTo(new SupTag(), shortAttr); + } + + public static SupTag sup(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new SupTag().withText(text), shortAttr); + } + + public static SupTag sup(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new SupTag().with(dc), shortAttr); + } + + public static TableTag table() { + return new TableTag(); + } + + public static TableTag table(String text) { + return new TableTag().withText(text); + } + + public static TableTag table(DomContent... dc) { + return new TableTag().with(dc); + } + + public static TableTag table(Attr.ShortForm shortAttr) { + return Attr.addTo(new TableTag(), shortAttr); + } + + public static TableTag table(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new TableTag().withText(text), shortAttr); + } + + public static TableTag table(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new TableTag().with(dc), shortAttr); + } + + public static TbodyTag tbody() { + return new TbodyTag(); + } + + public static TbodyTag tbody(String text) { + return new TbodyTag().withText(text); + } + + public static TbodyTag tbody(DomContent... dc) { + return new TbodyTag().with(dc); + } + + public static TbodyTag tbody(Attr.ShortForm shortAttr) { + return Attr.addTo(new TbodyTag(), shortAttr); + } + + public static TbodyTag tbody(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new TbodyTag().withText(text), shortAttr); + } + + public static TbodyTag tbody(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new TbodyTag().with(dc), shortAttr); + } + + public static TdTag td() { + return new TdTag(); + } + + public static TdTag td(String text) { + return new TdTag().withText(text); + } + + public static TdTag td(DomContent... dc) { + return new TdTag().with(dc); + } + + public static TdTag td(Attr.ShortForm shortAttr) { + return Attr.addTo(new TdTag(), shortAttr); + } + + public static TdTag td(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new TdTag().withText(text), shortAttr); + } + + public static TdTag td(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new TdTag().with(dc), shortAttr); + } + + public static TemplateTag template() { + return new TemplateTag(); + } + + public static TemplateTag template(String text) { + return new TemplateTag().withText(text); + } + + public static TemplateTag template(DomContent... dc) { + return new TemplateTag().with(dc); + } + + public static TemplateTag template(Attr.ShortForm shortAttr) { + return Attr.addTo(new TemplateTag(), shortAttr); + } + + public static TemplateTag template(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new TemplateTag().withText(text), shortAttr); + } + + public static TemplateTag template(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new TemplateTag().with(dc), shortAttr); + } + + public static TextareaTag textarea() { + return new TextareaTag(); + } + + public static TextareaTag textarea(String text) { + return new TextareaTag().withText(text); + } + + public static TextareaTag textarea(DomContent... dc) { + return new TextareaTag().with(dc); + } + + public static TextareaTag textarea(Attr.ShortForm shortAttr) { + return Attr.addTo(new TextareaTag(), shortAttr); + } + + public static TextareaTag textarea(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new TextareaTag().withText(text), shortAttr); + } + + public static TextareaTag textarea(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new TextareaTag().with(dc), shortAttr); + } + + public static TfootTag tfoot() { + return new TfootTag(); + } + + public static TfootTag tfoot(String text) { + return new TfootTag().withText(text); + } + + public static TfootTag tfoot(DomContent... dc) { + return new TfootTag().with(dc); + } + + public static TfootTag tfoot(Attr.ShortForm shortAttr) { + return Attr.addTo(new TfootTag(), shortAttr); + } + + public static TfootTag tfoot(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new TfootTag().withText(text), shortAttr); + } + + public static TfootTag tfoot(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new TfootTag().with(dc), shortAttr); + } + + public static ThTag th() { + return new ThTag(); + } + + public static ThTag th(String text) { + return new ThTag().withText(text); + } + + public static ThTag th(DomContent... dc) { + return new ThTag().with(dc); + } + + public static ThTag th(Attr.ShortForm shortAttr) { + return Attr.addTo(new ThTag(), shortAttr); + } + + public static ThTag th(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new ThTag().withText(text), shortAttr); + } + + public static ThTag th(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new ThTag().with(dc), shortAttr); + } + + public static TheadTag thead() { + return new TheadTag(); + } + + public static TheadTag thead(String text) { + return new TheadTag().withText(text); + } + + public static TheadTag thead(DomContent... dc) { + return new TheadTag().with(dc); + } + + public static TheadTag thead(Attr.ShortForm shortAttr) { + return Attr.addTo(new TheadTag(), shortAttr); + } + + public static TheadTag thead(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new TheadTag().withText(text), shortAttr); + } + + public static TheadTag thead(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new TheadTag().with(dc), shortAttr); + } + + public static TimeTag time() { + return new TimeTag(); + } + + public static TimeTag time(String text) { + return new TimeTag().withText(text); + } + + public static TimeTag time(DomContent... dc) { + return new TimeTag().with(dc); + } + + public static TimeTag time(Attr.ShortForm shortAttr) { + return Attr.addTo(new TimeTag(), shortAttr); + } + + public static TimeTag time(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new TimeTag().withText(text), shortAttr); + } + + public static TimeTag time(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new TimeTag().with(dc), shortAttr); + } + + public static TitleTag title() { + return new TitleTag(); + } + + public static TitleTag title(String text) { + return new TitleTag().withText(text); + } + + public static TitleTag title(DomContent... dc) { + return new TitleTag().with(dc); + } + + public static TitleTag title(Attr.ShortForm shortAttr) { + return Attr.addTo(new TitleTag(), shortAttr); + } + + public static TitleTag title(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new TitleTag().withText(text), shortAttr); + } + + public static TitleTag title(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new TitleTag().with(dc), shortAttr); + } + + public static TrTag tr() { + return new TrTag(); + } + + public static TrTag tr(String text) { + return new TrTag().withText(text); + } + + public static TrTag tr(DomContent... dc) { + return new TrTag().with(dc); + } + + public static TrTag tr(Attr.ShortForm shortAttr) { + return Attr.addTo(new TrTag(), shortAttr); + } + + public static TrTag tr(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new TrTag().withText(text), shortAttr); + } + + public static TrTag tr(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new TrTag().with(dc), shortAttr); + } + + public static UTag u() { + return new UTag(); + } + + public static UTag u(String text) { + return new UTag().withText(text); + } + + public static UTag u(DomContent... dc) { + return new UTag().with(dc); + } + + public static UTag u(Attr.ShortForm shortAttr) { + return Attr.addTo(new UTag(), shortAttr); + } + + public static UTag u(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new UTag().withText(text), shortAttr); + } + + public static UTag u(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new UTag().with(dc), shortAttr); + } + + public static UlTag ul() { + return new UlTag(); + } + + public static UlTag ul(String text) { + return new UlTag().withText(text); + } + + public static UlTag ul(DomContent... dc) { + return new UlTag().with(dc); + } + + public static UlTag ul(Attr.ShortForm shortAttr) { + return Attr.addTo(new UlTag(), shortAttr); + } + + public static UlTag ul(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new UlTag().withText(text), shortAttr); + } + + public static UlTag ul(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new UlTag().with(dc), shortAttr); + } + + public static VarTag var() { + return new VarTag(); + } + + public static VarTag var(String text) { + return new VarTag().withText(text); + } + + public static VarTag var(DomContent... dc) { + return new VarTag().with(dc); + } + + public static VarTag var(Attr.ShortForm shortAttr) { + return Attr.addTo(new VarTag(), shortAttr); + } + + public static VarTag var(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new VarTag().withText(text), shortAttr); + } + + public static VarTag var(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new VarTag().with(dc), shortAttr); + } + + public static VideoTag video() { + return new VideoTag(); + } + + public static VideoTag video(String text) { + return new VideoTag().withText(text); + } + + public static VideoTag video(DomContent... dc) { + return new VideoTag().with(dc); + } + + public static VideoTag video(Attr.ShortForm shortAttr) { + return Attr.addTo(new VideoTag(), shortAttr); + } + + public static VideoTag video(Attr.ShortForm shortAttr, String text) { + return Attr.addTo(new VideoTag().withText(text), shortAttr); + } + + public static VideoTag video(Attr.ShortForm shortAttr, DomContent... dc) { + return Attr.addTo(new VideoTag().with(dc), shortAttr); + } + + private static String get(InputStream inputStream) { + try { + return new String(inputStream.readAllBytes(), StandardCharsets.UTF_8); + } catch (IOException e) { + throw new RuntimeException(e); + } + } } diff --git a/j2html/src/main/java/org/xbib/j2html/attributes/Attribute.java b/j2html/src/main/java/org/xbib/j2html/attributes/Attribute.java index ca36f56..7669702 100644 --- a/j2html/src/main/java/org/xbib/j2html/attributes/Attribute.java +++ b/j2html/src/main/java/org/xbib/j2html/attributes/Attribute.java @@ -1,13 +1,12 @@ package org.xbib.j2html.attributes; +import java.io.IOException; import org.xbib.j2html.Config; import org.xbib.j2html.rendering.TagBuilder; import org.xbib.j2html.tags.Renderable; -import java.io.IOException; - public class Attribute implements Renderable { - private String name; + private final String name; private String value; public Attribute(String name, String value) { diff --git a/j2html/src/main/java/org/xbib/j2html/rendering/FlatHtml.java b/j2html/src/main/java/org/xbib/j2html/rendering/FlatHtml.java index 7c44465..c93cd57 100644 --- a/j2html/src/main/java/org/xbib/j2html/rendering/FlatHtml.java +++ b/j2html/src/main/java/org/xbib/j2html/rendering/FlatHtml.java @@ -1,10 +1,9 @@ package org.xbib.j2html.rendering; +import java.io.IOException; import org.xbib.j2html.Config; import org.xbib.j2html.utils.TextEscaper; -import java.io.IOException; - /** * Composes HTML without any extra line breaks or indentation. * @@ -50,6 +49,7 @@ public class FlatHtml implements HtmlBuilder { /** * Returns an HtmlBuilder that will generate flat HTML in memory * using the given Config. + * * @param config The Config which will specify text escapement, tag closing, etc. * @return An HtmlBuilder for flat HTML. */ @@ -135,10 +135,10 @@ public class FlatHtml implements HtmlBuilder { @Override public TagBuilder appendAttribute(String name, String value) throws IOException { out.append(" ") - .append(name) - .append("=\"") - .append(textEscaper.escape(value)) - .append("\""); + .append(name) + .append("=\"") + .append(textEscaper.escape(value)) + .append("\""); return this; } diff --git a/j2html/src/main/java/org/xbib/j2html/rendering/IndentedHtml.java b/j2html/src/main/java/org/xbib/j2html/rendering/IndentedHtml.java index c490ec9..d5f6fe6 100644 --- a/j2html/src/main/java/org/xbib/j2html/rendering/IndentedHtml.java +++ b/j2html/src/main/java/org/xbib/j2html/rendering/IndentedHtml.java @@ -1,12 +1,11 @@ package org.xbib.j2html.rendering; -import org.xbib.j2html.Config; -import org.xbib.j2html.utils.Indenter; -import org.xbib.j2html.utils.TextEscaper; - import java.io.IOException; import java.util.ArrayDeque; import java.util.Deque; +import org.xbib.j2html.Config; +import org.xbib.j2html.utils.Indenter; +import org.xbib.j2html.utils.TextEscaper; /** * Composes HTML with lines breaks and indentation between tags and text. @@ -195,10 +194,10 @@ public class IndentedHtml implements HtmlBuilder { @Override public TagBuilder appendAttribute(String name, String value) throws IOException { out.append(" ") - .append(name) - .append("=\"") - .append(textEscaper.escape(value)) - .append("\""); + .append(name) + .append("=\"") + .append(textEscaper.escape(value)) + .append("\""); return this; } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/ContainerTag.java b/j2html/src/main/java/org/xbib/j2html/tags/ContainerTag.java index db9124a..40f3deb 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/ContainerTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/ContainerTag.java @@ -1,16 +1,15 @@ package org.xbib.j2html.tags; -import org.xbib.j2html.Config; -import org.xbib.j2html.attributes.Attribute; -import org.xbib.j2html.rendering.TagBuilder; -import org.xbib.j2html.rendering.FlatHtml; -import org.xbib.j2html.rendering.HtmlBuilder; -import org.xbib.j2html.rendering.IndentedHtml; - import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; +import org.xbib.j2html.Config; +import org.xbib.j2html.attributes.Attribute; +import org.xbib.j2html.rendering.FlatHtml; +import org.xbib.j2html.rendering.HtmlBuilder; +import org.xbib.j2html.rendering.IndentedHtml; +import org.xbib.j2html.rendering.TagBuilder; public class ContainerTag> extends Tag { @@ -148,7 +147,7 @@ public class ContainerTag> extends Tag { public String renderFormatted() { try { return render(IndentedHtml.into(new StringBuilder(), Config.global())).toString(); - }catch (IOException e) { + } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } } @@ -157,17 +156,17 @@ public class ContainerTag> extends Tag { public A render(HtmlBuilder builder, Object model) throws IOException { if (hasTagName()) { TagBuilder tagBuilder = builder.appendStartTag(getTagName()); - for(Attribute attribute : getAttributes()){ + for (Attribute attribute : getAttributes()) { attribute.render(tagBuilder, model); } tagBuilder.completeTag(); } - for(DomContent child : children){ + for (DomContent child : children) { child.render(builder, model); } - if(hasTagName()) { + if (hasTagName()) { builder.appendEndTag(getTagName()); } @@ -178,8 +177,8 @@ public class ContainerTag> extends Tag { @Deprecated public void renderModel(Appendable writer, Object model) throws IOException { HtmlBuilder builder = (writer instanceof HtmlBuilder) - ? (HtmlBuilder) writer - : FlatHtml.into(writer, Config.global()); + ? (HtmlBuilder) writer + : FlatHtml.into(writer, Config.global()); render(builder, model); } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/DomContentJoiner.java b/j2html/src/main/java/org/xbib/j2html/tags/DomContentJoiner.java index 1660064..a212ad7 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/DomContentJoiner.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/DomContentJoiner.java @@ -16,7 +16,7 @@ public class DomContentJoiner { } else { throw new RuntimeException("You can only join DomContent and String objects"); } - if (i < stringOrDomObjects.length-1) { + if (i < stringOrDomObjects.length - 1) { sb.append(delimiter); } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/EmptyTag.java b/j2html/src/main/java/org/xbib/j2html/tags/EmptyTag.java index a89141b..07d4c51 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/EmptyTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/EmptyTag.java @@ -1,12 +1,11 @@ package org.xbib.j2html.tags; +import java.io.IOException; import org.xbib.j2html.Config; import org.xbib.j2html.attributes.Attribute; -import org.xbib.j2html.rendering.TagBuilder; import org.xbib.j2html.rendering.FlatHtml; import org.xbib.j2html.rendering.HtmlBuilder; - -import java.io.IOException; +import org.xbib.j2html.rendering.TagBuilder; public class EmptyTag> extends Tag { @@ -34,8 +33,8 @@ public class EmptyTag> extends Tag { @Deprecated public void renderModel(Appendable writer, Object model) throws IOException { HtmlBuilder builder = (writer instanceof HtmlBuilder) - ? (HtmlBuilder) writer - : FlatHtml.into(writer, Config.global()); + ? (HtmlBuilder) writer + : FlatHtml.into(writer, Config.global()); render(builder, model); } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/InlineStaticResource.java b/j2html/src/main/java/org/xbib/j2html/tags/InlineStaticResource.java index bb37720..1f11ca9 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/InlineStaticResource.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/InlineStaticResource.java @@ -1,43 +1,29 @@ package org.xbib.j2html.tags; -import org.xbib.j2html.Config; -import java.io.FileInputStream; +import java.io.IOException; import java.io.InputStream; -import java.util.Scanner; - +import java.nio.charset.StandardCharsets; +import org.xbib.j2html.Config; import static org.xbib.j2html.TagCreator.rawHtml; import static org.xbib.j2html.TagCreator.script; import static org.xbib.j2html.TagCreator.style; public class InlineStaticResource { - public static ContainerTag> get(String path, TargetFormat format) { - String fileString = getFileAsString(path); - return switch (format) { - case CSS_MIN -> style().with(rawHtml(Config.cssMinifier.minify(fileString))); - case JS_MIN -> script().with(rawHtml(Config.jsMinifier.minify((fileString)))); - case CSS -> style().with(rawHtml(fileString)); - case JS -> script().with(rawHtml(fileString)); - }; - } - - public static String getFileAsString(String path) { + public static ContainerTag> get(InputStream inputStream, TargetFormat format) { try { - return streamToString(InlineStaticResource.class.getResourceAsStream(path)); - } catch (Exception expected) { - try { - return streamToString(new FileInputStream(path)); - } catch (Exception exception) { - throw new RuntimeException("Couldn't find file with path='" + path + "'"); - } + String fileString = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8); + return switch (format) { + case CSS_MIN -> style().with(rawHtml(Config.cssMinifier.minify(fileString))); + case JS_MIN -> script().with(rawHtml(Config.jsMinifier.minify((fileString)))); + case CSS -> style().with(rawHtml(fileString)); + case JS -> script().with(rawHtml(fileString)); + }; + } catch (IOException e) { + throw new RuntimeException(e); } } - private static String streamToString(InputStream inputStream) { - Scanner s = new Scanner(inputStream).useDelimiter("\\A"); - return s.hasNext() ? s.next() : ""; - } - public enum TargetFormat {CSS_MIN, CSS, JS_MIN, JS} } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/Renderable.java b/j2html/src/main/java/org/xbib/j2html/tags/Renderable.java index a545e4f..295ca98 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/Renderable.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/Renderable.java @@ -1,11 +1,10 @@ package org.xbib.j2html.tags; -import org.xbib.j2html.Config; -import org.xbib.j2html.rendering.FlatHtml; -import org.xbib.j2html.rendering.HtmlBuilder; - import java.io.IOException; import java.io.UncheckedIOException; +import org.xbib.j2html.Config; +import org.xbib.j2html.rendering.FlatHtml; +import org.xbib.j2html.rendering.HtmlBuilder; public interface Renderable { diff --git a/j2html/src/main/java/org/xbib/j2html/tags/Tag.java b/j2html/src/main/java/org/xbib/j2html/tags/Tag.java index 2defc8a..2723437 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/Tag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/Tag.java @@ -1,9 +1,9 @@ package org.xbib.j2html.tags; -import org.xbib.j2html.attributes.Attr; -import org.xbib.j2html.attributes.Attribute; import java.util.ArrayList; import java.util.Iterator; +import org.xbib.j2html.attributes.Attr; +import org.xbib.j2html.attributes.Attribute; public abstract class Tag> extends DomContent implements IInstance { private final String tagName; @@ -32,7 +32,7 @@ public abstract class Tag> extends DomContent implements IInsta * @param name the attribute * @param value the attribute value */ - boolean setAttribute(String name, String value) { + public boolean setAttribute(String name, String value) { if (value == null) { return attributes.add(new Attribute(name)); } @@ -146,68 +146,132 @@ public abstract class Tag> extends DomContent implements IInsta translate */ - public T withAccesskey(String accesskey){ return attr(Attr.ACCESSKEY, accesskey); } + public T withAccesskey(String accesskey) { + return attr(Attr.ACCESSKEY, accesskey); + } - public T withClass(String className) { return attr(Attr.CLASS, className); } + public T withClass(String className) { + return attr(Attr.CLASS, className); + } - public T isContenteditable(){ return attr(Attr.CONTENTEDITABLE, "true"); } + public T isContenteditable() { + return attr(Attr.CONTENTEDITABLE, "true"); + } - public T withData(String dataAttr, String value) { return attr(Attr.DATA + "-" + dataAttr, value); } + public T withData(String dataAttr, String value) { + return attr(Attr.DATA + "-" + dataAttr, value); + } - public T withDir(String dir) { return attr(Attr.DIR, dir); } + public T withDir(String dir) { + return attr(Attr.DIR, dir); + } - public T isDraggable(){ return attr(Attr.DRAGGABLE, "true"); } + public T isDraggable() { + return attr(Attr.DRAGGABLE, "true"); + } - public T isHidden() { return attr(Attr.HIDDEN, null); } + public T isHidden() { + return attr(Attr.HIDDEN, null); + } - public T withId(String id) { return attr(Attr.ID, id); } + public T withId(String id) { + return attr(Attr.ID, id); + } - public T withIs(String element){ return attr(Attr.IS, element); } + public T withIs(String element) { + return attr(Attr.IS, element); + } - public T withLang(String lang) { return attr(Attr.LANG, lang); } + public T withLang(String lang) { + return attr(Attr.LANG, lang); + } - public T withSlot(String name){ return attr(Attr.SLOT, name); } + public T withSlot(String name) { + return attr(Attr.SLOT, name); + } - public T isSpellcheck(){ return attr(Attr.SPELLCHECK, "true"); } + public T isSpellcheck() { + return attr(Attr.SPELLCHECK, "true"); + } - public T withStyle(String style) { return attr(Attr.STYLE, style); } + public T withStyle(String style) { + return attr(Attr.STYLE, style); + } - public T withTabindex(int index){ return attr(Attr.TABINDEX, index); } + public T withTabindex(int index) { + return attr(Attr.TABINDEX, index); + } - public T withTitle(String title) { return attr(Attr.TITLE, title); } + public T withTitle(String title) { + return attr(Attr.TITLE, title); + } - public T isTranslate(){ return attr(Attr.TRANSLATE, "yes"); } + public T isTranslate() { + return attr(Attr.TRANSLATE, "yes"); + } // ----- start of withCond$ATTR variants ----- - public T withCondAccessKey(boolean condition, String accesskey){ return condAttr(condition, Attr.ACCESSKEY, accesskey); } + public T withCondAccessKey(boolean condition, String accesskey) { + return condAttr(condition, Attr.ACCESSKEY, accesskey); + } - public T withCondClass(boolean condition, String className) { return condAttr(condition, Attr.CLASS, className); } + public T withCondClass(boolean condition, String className) { + return condAttr(condition, Attr.CLASS, className); + } - public T withCondContenteditable(boolean condition){ return attr(Attr.CONTENTEDITABLE, (condition)?"true":"false");} + public T withCondContenteditable(boolean condition) { + return attr(Attr.CONTENTEDITABLE, (condition) ? "true" : "false"); + } - public T withCondData(boolean condition, String dataAttr, String value) { return condAttr(condition, Attr.DATA + "-" + dataAttr, value); } + public T withCondData(boolean condition, String dataAttr, String value) { + return condAttr(condition, Attr.DATA + "-" + dataAttr, value); + } - public T withCondDir(boolean condition, String dir) { return condAttr(condition, Attr.DIR, dir); } + public T withCondDir(boolean condition, String dir) { + return condAttr(condition, Attr.DIR, dir); + } - public T withCondDraggable(boolean condition){ return attr(Attr.DRAGGABLE, (condition)?"true":"false"); } + public T withCondDraggable(boolean condition) { + return attr(Attr.DRAGGABLE, (condition) ? "true" : "false"); + } - public T withCondHidden(boolean condition) { return condAttr(condition, Attr.HIDDEN, null); } + public T withCondHidden(boolean condition) { + return condAttr(condition, Attr.HIDDEN, null); + } - public T withCondId(boolean condition, String id) { return condAttr(condition, Attr.ID, id); } + public T withCondId(boolean condition, String id) { + return condAttr(condition, Attr.ID, id); + } - public T withCondIs(boolean condition, String element){ return condAttr(condition, Attr.IS, element); } + public T withCondIs(boolean condition, String element) { + return condAttr(condition, Attr.IS, element); + } - public T withCondLang(boolean condition, String lang) { return condAttr(condition, Attr.LANG, lang); } + public T withCondLang(boolean condition, String lang) { + return condAttr(condition, Attr.LANG, lang); + } - public T withCondSlot(boolean condition, String name){ return condAttr(condition, Attr.SLOT, name); } + public T withCondSlot(boolean condition, String name) { + return condAttr(condition, Attr.SLOT, name); + } - public T withCondSpellcheck(boolean condition){ return attr(Attr.SPELLCHECK, (condition)?"true":"false"); } + public T withCondSpellcheck(boolean condition) { + return attr(Attr.SPELLCHECK, (condition) ? "true" : "false"); + } - public T withCondStyle(boolean condition, String style) { return condAttr(condition, Attr.STYLE, style); } + public T withCondStyle(boolean condition, String style) { + return condAttr(condition, Attr.STYLE, style); + } - public T withCondTabindex(boolean condition, int index){ return condAttr(condition, Attr.TABINDEX, index+""); } + public T withCondTabindex(boolean condition, int index) { + return condAttr(condition, Attr.TABINDEX, index + ""); + } - public T withCondTitle(boolean condition, String title) { return condAttr(condition, Attr.TITLE, title); } + public T withCondTitle(boolean condition, String title) { + return condAttr(condition, Attr.TITLE, title); + } - public T withCondTranslate(boolean condition){ return attr(Attr.TRANSLATE, (condition)?"yes":"no"); } + public T withCondTranslate(boolean condition) { + return attr(Attr.TRANSLATE, (condition) ? "yes" : "no"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/Text.java b/j2html/src/main/java/org/xbib/j2html/tags/Text.java index 75743d2..de369a4 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/Text.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/Text.java @@ -1,11 +1,10 @@ package org.xbib.j2html.tags; +import java.io.IOException; import org.xbib.j2html.Config; import org.xbib.j2html.rendering.FlatHtml; import org.xbib.j2html.rendering.HtmlBuilder; -import java.io.IOException; - public class Text extends DomContent { private final String text; @@ -24,8 +23,8 @@ public class Text extends DomContent { @Deprecated public void renderModel(Appendable writer, Object model) throws IOException { HtmlBuilder builder = (writer instanceof HtmlBuilder) - ? (HtmlBuilder) writer - : FlatHtml.into(writer, Config.global()); + ? (HtmlBuilder) writer + : FlatHtml.into(writer, Config.global()); render(builder, model); } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/UnescapedText.java b/j2html/src/main/java/org/xbib/j2html/tags/UnescapedText.java index a64fbcb..d8b1451 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/UnescapedText.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/UnescapedText.java @@ -1,11 +1,10 @@ package org.xbib.j2html.tags; +import java.io.IOException; import org.xbib.j2html.Config; import org.xbib.j2html.rendering.FlatHtml; import org.xbib.j2html.rendering.HtmlBuilder; -import java.io.IOException; - public class UnescapedText extends DomContent { private final String text; @@ -24,8 +23,8 @@ public class UnescapedText extends DomContent { @Deprecated public void renderModel(Appendable writer, Object model) throws IOException { HtmlBuilder builder = (writer instanceof HtmlBuilder) - ? (HtmlBuilder) writer - : FlatHtml.into(writer, Config.global()); + ? (HtmlBuilder) writer + : FlatHtml.into(writer, Config.global()); render(builder, model); } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAccept.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAccept.java index c78b528..a3d73a6 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAccept.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAccept.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IAccept> extends IInstance { - default T withAccept(final String accept_) { - return self().attr("accept", accept_); - } + default T withAccept(final String accept_) { + return self().attr("accept", accept_); + } - default T withCondAccept(final boolean enable, final String accept_) { - return enable ? self().attr("accept", accept_) : self(); - } + default T withCondAccept(final boolean enable, final String accept_) { + return enable ? self().attr("accept", accept_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAction.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAction.java index c6b02ad..97c121d 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAction.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAction.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IAction> extends IInstance { - default T withAction(final String action_) { - return self().attr("action", action_); - } + default T withAction(final String action_) { + return self().attr("action", action_); + } - default T withCondAction(final boolean enable, final String action_) { - return enable ? self().attr("action", action_) : self(); - } + default T withCondAction(final boolean enable, final String action_) { + return enable ? self().attr("action", action_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAlt.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAlt.java index 8580679..ad73c83 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAlt.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAlt.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IAlt> extends IInstance { - default T withAlt(final String alt_) { - return self().attr("alt", alt_); - } + default T withAlt(final String alt_) { + return self().attr("alt", alt_); + } - default T withCondAlt(final boolean enable, final String alt_) { - return enable ? self().attr("alt", alt_) : self(); - } + default T withCondAlt(final boolean enable, final String alt_) { + return enable ? self().attr("alt", alt_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAsync.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAsync.java index 68a3c1e..f0abf41 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAsync.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAsync.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IAsync> extends IInstance { - default T isAsync() { - return self().attr("async"); - } + default T isAsync() { + return self().attr("async"); + } - default T withCondAsync(final boolean enable) { - return enable ? self().attr("async") : self(); - } + default T withCondAsync(final boolean enable) { + return enable ? self().attr("async") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAutocomplete.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAutocomplete.java index 431d1f0..b8273f7 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAutocomplete.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAutocomplete.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IAutocomplete> extends IInstance { - default T isAutocomplete() { - return self().attr("autocomplete", "on"); - } + default T isAutocomplete() { + return self().attr("autocomplete", "on"); + } - default T withCondAutocomplete(final boolean enable) { - return enable ? self().attr("autocomplete", "on") : self(); - } + default T withCondAutocomplete(final boolean enable) { + return enable ? self().attr("autocomplete", "on") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAutofocus.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAutofocus.java index f74c5f0..47f89e3 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAutofocus.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAutofocus.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IAutofocus> extends IInstance { - default T isAutofocus() { - return self().attr("autofocus"); - } + default T isAutofocus() { + return self().attr("autofocus"); + } - default T withCondAutofocus(final boolean enable) { - return enable ? self().attr("autofocus") : self(); - } + default T withCondAutofocus(final boolean enable) { + return enable ? self().attr("autofocus") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAutoplay.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAutoplay.java index 8a13e04..e7e4a94 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAutoplay.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IAutoplay.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IAutoplay> extends IInstance { - default T isAutoplay() { - return self().attr("autoplay"); - } + default T isAutoplay() { + return self().attr("autoplay"); + } - default T withCondAutoplay(final boolean enable) { - return enable ? self().attr("autoplay") : self(); - } + default T withCondAutoplay(final boolean enable) { + return enable ? self().attr("autoplay") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ICharset.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ICharset.java index c724e6b..031b83f 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ICharset.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ICharset.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface ICharset> extends IInstance { - default T withCharset(final String charset_) { - return self().attr("charset", charset_); - } + default T withCharset(final String charset_) { + return self().attr("charset", charset_); + } - default T withCondCharset(final boolean enable, final String charset_) { - return enable ? self().attr("charset", charset_) : self(); - } + default T withCondCharset(final boolean enable, final String charset_) { + return enable ? self().attr("charset", charset_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IChecked.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IChecked.java index 1673c39..c5fdcad 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IChecked.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IChecked.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IChecked> extends IInstance { - default T isChecked() { - return self().attr("checked"); - } + default T isChecked() { + return self().attr("checked"); + } - default T withCondChecked(final boolean enable) { - return enable ? self().attr("checked") : self(); - } + default T withCondChecked(final boolean enable) { + return enable ? self().attr("checked") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ICite.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ICite.java index 72ff5cf..f4b6668 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ICite.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ICite.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface ICite> extends IInstance { - default T withCite(final String cite_) { - return self().attr("cite", cite_); - } + default T withCite(final String cite_) { + return self().attr("cite", cite_); + } - default T withCondCite(final boolean enable, final String cite_) { - return enable ? self().attr("cite", cite_) : self(); - } + default T withCondCite(final boolean enable, final String cite_) { + return enable ? self().attr("cite", cite_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ICols.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ICols.java index ada3968..ea1cd71 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ICols.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ICols.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface ICols> extends IInstance { - default T withCols(final String cols_) { - return self().attr("cols", cols_); - } + default T withCols(final String cols_) { + return self().attr("cols", cols_); + } - default T withCondCols(final boolean enable, final String cols_) { - return enable ? self().attr("cols", cols_) : self(); - } + default T withCondCols(final boolean enable, final String cols_) { + return enable ? self().attr("cols", cols_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IColspan.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IColspan.java index 7cb4323..683d72a 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IColspan.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IColspan.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IColspan> extends IInstance { - default T withColspan(final String colspan_) { - return self().attr("colspan", colspan_); - } + default T withColspan(final String colspan_) { + return self().attr("colspan", colspan_); + } - default T withCondColspan(final boolean enable, final String colspan_) { - return enable ? self().attr("colspan", colspan_) : self(); - } + default T withCondColspan(final boolean enable, final String colspan_) { + return enable ? self().attr("colspan", colspan_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IContent.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IContent.java index 7990529..15cb874 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IContent.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IContent.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IContent> extends IInstance { - default T withContent(final String content_) { - return self().attr("content", content_); - } + default T withContent(final String content_) { + return self().attr("content", content_); + } - default T withCondContent(final boolean enable, final String content_) { - return enable ? self().attr("content", content_) : self(); - } + default T withCondContent(final boolean enable, final String content_) { + return enable ? self().attr("content", content_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IControls.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IControls.java index 1c2586b..5033383 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IControls.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IControls.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IControls> extends IInstance { - default T isControls() { - return self().attr("controls"); - } + default T isControls() { + return self().attr("controls"); + } - default T withCondControls(final boolean enable) { - return enable ? self().attr("controls") : self(); - } + default T withCondControls(final boolean enable) { + return enable ? self().attr("controls") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ICoords.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ICoords.java index def7f7c..e575ed7 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ICoords.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ICoords.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface ICoords> extends IInstance { - default T withCoords(final String coords_) { - return self().attr("coords", coords_); - } + default T withCoords(final String coords_) { + return self().attr("coords", coords_); + } - default T withCondCoords(final boolean enable, final String coords_) { - return enable ? self().attr("coords", coords_) : self(); - } + default T withCondCoords(final boolean enable, final String coords_) { + return enable ? self().attr("coords", coords_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IData.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IData.java index 562ea2e..d730391 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IData.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IData.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IData> extends IInstance { - default T withData(final String data_) { - return self().attr("data", data_); - } + default T withData(final String data_) { + return self().attr("data", data_); + } - default T withCondData(final boolean enable, final String data_) { - return enable ? self().attr("data", data_) : self(); - } + default T withCondData(final boolean enable, final String data_) { + return enable ? self().attr("data", data_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDatetime.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDatetime.java index 56afefd..930421e 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDatetime.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDatetime.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IDatetime> extends IInstance { - default T withDatetime(final String datetime_) { - return self().attr("datetime", datetime_); - } + default T withDatetime(final String datetime_) { + return self().attr("datetime", datetime_); + } - default T withCondDatetime(final boolean enable, final String datetime_) { - return enable ? self().attr("datetime", datetime_) : self(); - } + default T withCondDatetime(final boolean enable, final String datetime_) { + return enable ? self().attr("datetime", datetime_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDefault.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDefault.java index a5222e2..890c7ce 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDefault.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDefault.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IDefault> extends IInstance { - default T isDefault() { - return self().attr("default"); - } + default T isDefault() { + return self().attr("default"); + } - default T withCondDefault(final boolean enable) { - return enable ? self().attr("default") : self(); - } + default T withCondDefault(final boolean enable) { + return enable ? self().attr("default") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDefer.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDefer.java index 316fb7b..68c7cad 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDefer.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDefer.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IDefer> extends IInstance { - default T isDefer() { - return self().attr("defer"); - } + default T isDefer() { + return self().attr("defer"); + } - default T withCondDefer(final boolean enable) { - return enable ? self().attr("defer") : self(); - } + default T withCondDefer(final boolean enable) { + return enable ? self().attr("defer") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDirname.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDirname.java index 3cc29e1..da95ded 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDirname.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDirname.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IDirname> extends IInstance { - default T withDirname(final String dirname_) { - return self().attr("dirname", dirname_); - } + default T withDirname(final String dirname_) { + return self().attr("dirname", dirname_); + } - default T withCondDirname(final boolean enable, final String dirname_) { - return enable ? self().attr("dirname", dirname_) : self(); - } + default T withCondDirname(final boolean enable, final String dirname_) { + return enable ? self().attr("dirname", dirname_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDisabled.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDisabled.java index 20c6e67..f5b9391 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDisabled.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDisabled.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IDisabled> extends IInstance { - default T isDisabled() { - return self().attr("disabled"); - } + default T isDisabled() { + return self().attr("disabled"); + } - default T withCondDisabled(final boolean enable) { - return enable ? self().attr("disabled") : self(); - } + default T withCondDisabled(final boolean enable) { + return enable ? self().attr("disabled") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDownload.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDownload.java index ce161ae..f4f075f 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDownload.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IDownload.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IDownload> extends IInstance { - default T isDownload() { - return self().attr("download"); - } + default T isDownload() { + return self().attr("download"); + } - default T withCondDownload(final boolean enable) { - return enable ? self().attr("download") : self(); - } + default T withCondDownload(final boolean enable) { + return enable ? self().attr("download") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IEnctype.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IEnctype.java index 08a8dc4..af81bf7 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IEnctype.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IEnctype.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IEnctype> extends IInstance { - default T withEnctype(final String enctype_) { - return self().attr("enctype", enctype_); - } + default T withEnctype(final String enctype_) { + return self().attr("enctype", enctype_); + } - default T withCondEnctype(final boolean enable, final String enctype_) { - return enable ? self().attr("enctype", enctype_) : self(); - } + default T withCondEnctype(final boolean enable, final String enctype_) { + return enable ? self().attr("enctype", enctype_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IFor.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IFor.java index 9822873..2e29701 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IFor.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IFor.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IFor> extends IInstance { - default T withFor(final String for_) { - return self().attr("for", for_); - } + default T withFor(final String for_) { + return self().attr("for", for_); + } - default T withCondFor(final boolean enable, final String for_) { - return enable ? self().attr("for", for_) : self(); - } + default T withCondFor(final boolean enable, final String for_) { + return enable ? self().attr("for", for_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IForm.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IForm.java index 4093e23..1fe631c 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IForm.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IForm.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IForm> extends IInstance { - default T withForm(final String form_) { - return self().attr("form", form_); - } + default T withForm(final String form_) { + return self().attr("form", form_); + } - default T withCondForm(final boolean enable, final String form_) { - return enable ? self().attr("form", form_) : self(); - } + default T withCondForm(final boolean enable, final String form_) { + return enable ? self().attr("form", form_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IFormaction.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IFormaction.java index d2ecea9..18e151a 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IFormaction.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IFormaction.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IFormaction> extends IInstance { - default T withFormaction(final String formaction_) { - return self().attr("formaction", formaction_); - } + default T withFormaction(final String formaction_) { + return self().attr("formaction", formaction_); + } - default T withCondFormaction(final boolean enable, final String formaction_) { - return enable ? self().attr("formaction", formaction_) : self(); - } + default T withCondFormaction(final boolean enable, final String formaction_) { + return enable ? self().attr("formaction", formaction_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHeaders.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHeaders.java index d1a4fcb..8e9ae35 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHeaders.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHeaders.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IHeaders> extends IInstance { - default T withHeaders(final String headers_) { - return self().attr("headers", headers_); - } + default T withHeaders(final String headers_) { + return self().attr("headers", headers_); + } - default T withCondHeaders(final boolean enable, final String headers_) { - return enable ? self().attr("headers", headers_) : self(); - } + default T withCondHeaders(final boolean enable, final String headers_) { + return enable ? self().attr("headers", headers_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHeight.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHeight.java index a117029..16ea933 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHeight.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHeight.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IHeight> extends IInstance { - default T withHeight(final String height_) { - return self().attr("height", height_); - } + default T withHeight(final String height_) { + return self().attr("height", height_); + } - default T withCondHeight(final boolean enable, final String height_) { - return enable ? self().attr("height", height_) : self(); - } + default T withCondHeight(final boolean enable, final String height_) { + return enable ? self().attr("height", height_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHigh.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHigh.java index 18de2d9..54c7c41 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHigh.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHigh.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IHigh> extends IInstance { - default T withHigh(final String high_) { - return self().attr("high", high_); - } + default T withHigh(final String high_) { + return self().attr("high", high_); + } - default T withCondHigh(final boolean enable, final String high_) { - return enable ? self().attr("high", high_) : self(); - } + default T withCondHigh(final boolean enable, final String high_) { + return enable ? self().attr("high", high_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHref.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHref.java index 5039865..15d27fa 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHref.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHref.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IHref> extends IInstance { - default T withHref(final String href_) { - return self().attr("href", href_); - } + default T withHref(final String href_) { + return self().attr("href", href_); + } - default T withCondHref(final boolean enable, final String href_) { - return enable ? self().attr("href", href_) : self(); - } + default T withCondHref(final boolean enable, final String href_) { + return enable ? self().attr("href", href_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHreflang.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHreflang.java index 72e259d..abd4681 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHreflang.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IHreflang.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IHreflang> extends IInstance { - default T withHreflang(final String hreflang_) { - return self().attr("hreflang", hreflang_); - } + default T withHreflang(final String hreflang_) { + return self().attr("hreflang", hreflang_); + } - default T withCondHreflang(final boolean enable, final String hreflang_) { - return enable ? self().attr("hreflang", hreflang_) : self(); - } + default T withCondHreflang(final boolean enable, final String hreflang_) { + return enable ? self().attr("hreflang", hreflang_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IIsmap.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IIsmap.java index e680565..733cac7 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IIsmap.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IIsmap.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IIsmap> extends IInstance { - default T isIsmap() { - return self().attr("ismap"); - } + default T isIsmap() { + return self().attr("ismap"); + } - default T withCondIsmap(final boolean enable) { - return enable ? self().attr("ismap") : self(); - } + default T withCondIsmap(final boolean enable) { + return enable ? self().attr("ismap") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IKind.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IKind.java index ed80968..24c3216 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IKind.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IKind.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IKind> extends IInstance { - default T withKind(final String kind_) { - return self().attr("kind", kind_); - } + default T withKind(final String kind_) { + return self().attr("kind", kind_); + } - default T withCondKind(final boolean enable, final String kind_) { - return enable ? self().attr("kind", kind_) : self(); - } + default T withCondKind(final boolean enable, final String kind_) { + return enable ? self().attr("kind", kind_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ILabel.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ILabel.java index 044212b..5438478 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ILabel.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ILabel.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface ILabel> extends IInstance { - default T withLabel(final String label_) { - return self().attr("label", label_); - } + default T withLabel(final String label_) { + return self().attr("label", label_); + } - default T withCondLabel(final boolean enable, final String label_) { - return enable ? self().attr("label", label_) : self(); - } + default T withCondLabel(final boolean enable, final String label_) { + return enable ? self().attr("label", label_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IList.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IList.java index 9a12b0a..eaab42a 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IList.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IList.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IList> extends IInstance { - default T withList(final String list_) { - return self().attr("list", list_); - } + default T withList(final String list_) { + return self().attr("list", list_); + } - default T withCondList(final boolean enable, final String list_) { - return enable ? self().attr("list", list_) : self(); - } + default T withCondList(final boolean enable, final String list_) { + return enable ? self().attr("list", list_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ILoop.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ILoop.java index 0494c1d..0b4565b 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ILoop.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ILoop.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface ILoop> extends IInstance { - default T isLoop() { - return self().attr("loop"); - } + default T isLoop() { + return self().attr("loop"); + } - default T withCondLoop(final boolean enable) { - return enable ? self().attr("loop") : self(); - } + default T withCondLoop(final boolean enable) { + return enable ? self().attr("loop") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ILow.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ILow.java index 982ee3a..3ea297d 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ILow.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ILow.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface ILow> extends IInstance { - default T withLow(final String low_) { - return self().attr("low", low_); - } + default T withLow(final String low_) { + return self().attr("low", low_); + } - default T withCondLow(final boolean enable, final String low_) { - return enable ? self().attr("low", low_) : self(); - } + default T withCondLow(final boolean enable, final String low_) { + return enable ? self().attr("low", low_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMax.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMax.java index 4c8675e..ac3e483 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMax.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMax.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IMax> extends IInstance { - default T withMax(final String max_) { - return self().attr("max", max_); - } + default T withMax(final String max_) { + return self().attr("max", max_); + } - default T withCondMax(final boolean enable, final String max_) { - return enable ? self().attr("max", max_) : self(); - } + default T withCondMax(final boolean enable, final String max_) { + return enable ? self().attr("max", max_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMaxlength.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMaxlength.java index 26ddfb0..15db635 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMaxlength.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMaxlength.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IMaxlength> extends IInstance { - default T withMaxlength(final String maxlength_) { - return self().attr("maxlength", maxlength_); - } + default T withMaxlength(final String maxlength_) { + return self().attr("maxlength", maxlength_); + } - default T withCondMaxlength(final boolean enable, final String maxlength_) { - return enable ? self().attr("maxlength", maxlength_) : self(); - } + default T withCondMaxlength(final boolean enable, final String maxlength_) { + return enable ? self().attr("maxlength", maxlength_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMedia.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMedia.java index c8dcc0d..ca7576f 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMedia.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMedia.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IMedia> extends IInstance { - default T withMedia(final String media_) { - return self().attr("media", media_); - } + default T withMedia(final String media_) { + return self().attr("media", media_); + } - default T withCondMedia(final boolean enable, final String media_) { - return enable ? self().attr("media", media_) : self(); - } + default T withCondMedia(final boolean enable, final String media_) { + return enable ? self().attr("media", media_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMethod.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMethod.java index 21815ec..05b9b13 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMethod.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMethod.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IMethod> extends IInstance { - default T withMethod(final String method_) { - return self().attr("method", method_); - } + default T withMethod(final String method_) { + return self().attr("method", method_); + } - default T withCondMethod(final boolean enable, final String method_) { - return enable ? self().attr("method", method_) : self(); - } + default T withCondMethod(final boolean enable, final String method_) { + return enable ? self().attr("method", method_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMin.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMin.java index f8eaa1d..487b8f1 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMin.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMin.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IMin> extends IInstance { - default T withMin(final String min_) { - return self().attr("min", min_); - } + default T withMin(final String min_) { + return self().attr("min", min_); + } - default T withCondMin(final boolean enable, final String min_) { - return enable ? self().attr("min", min_) : self(); - } + default T withCondMin(final boolean enable, final String min_) { + return enable ? self().attr("min", min_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMultiple.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMultiple.java index 37ced27..b698d65 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMultiple.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMultiple.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IMultiple> extends IInstance { - default T isMultiple() { - return self().attr("multiple"); - } + default T isMultiple() { + return self().attr("multiple"); + } - default T withCondMultiple(final boolean enable) { - return enable ? self().attr("multiple") : self(); - } + default T withCondMultiple(final boolean enable) { + return enable ? self().attr("multiple") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMuted.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMuted.java index 25a7f89..3f46b2f 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMuted.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IMuted.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IMuted> extends IInstance { - default T isMuted() { - return self().attr("muted"); - } + default T isMuted() { + return self().attr("muted"); + } - default T withCondMuted(final boolean enable) { - return enable ? self().attr("muted") : self(); - } + default T withCondMuted(final boolean enable) { + return enable ? self().attr("muted") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IName.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IName.java index c13008b..ed21c8a 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IName.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IName.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IName> extends IInstance { - default T withName(final String name_) { - return self().attr("name", name_); - } + default T withName(final String name_) { + return self().attr("name", name_); + } - default T withCondName(final boolean enable, final String name_) { - return enable ? self().attr("name", name_) : self(); - } + default T withCondName(final boolean enable, final String name_) { + return enable ? self().attr("name", name_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/INovalidate.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/INovalidate.java index 8051a92..977d7c8 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/INovalidate.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/INovalidate.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface INovalidate> extends IInstance { - default T isNovalidate() { - return self().attr("novalidate"); - } + default T isNovalidate() { + return self().attr("novalidate"); + } - default T withCondNovalidate(final boolean enable) { - return enable ? self().attr("novalidate") : self(); - } + default T withCondNovalidate(final boolean enable) { + return enable ? self().attr("novalidate") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnabort.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnabort.java index 2189abe..6a8b669 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnabort.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnabort.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnabort> extends IInstance { - default T withOnabort(final String onabort_) { - return self().attr("onabort", onabort_); - } + default T withOnabort(final String onabort_) { + return self().attr("onabort", onabort_); + } - default T withCondOnabort(final boolean enable, final String onabort_) { - return enable ? self().attr("onabort", onabort_) : self(); - } + default T withCondOnabort(final boolean enable, final String onabort_) { + return enable ? self().attr("onabort", onabort_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnafterprint.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnafterprint.java index d370812..5bbda74 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnafterprint.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnafterprint.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnafterprint> extends IInstance { - default T withOnafterprint(final String onafterprint_) { - return self().attr("onafterprint", onafterprint_); - } + default T withOnafterprint(final String onafterprint_) { + return self().attr("onafterprint", onafterprint_); + } - default T withCondOnafterprint(final boolean enable, final String onafterprint_) { - return enable ? self().attr("onafterprint", onafterprint_) : self(); - } + default T withCondOnafterprint(final boolean enable, final String onafterprint_) { + return enable ? self().attr("onafterprint", onafterprint_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnbeforeprint.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnbeforeprint.java index 4f2c23c..59a1be8 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnbeforeprint.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnbeforeprint.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnbeforeprint> extends IInstance { - default T withOnbeforeprint(final String onbeforeprint_) { - return self().attr("onbeforeprint", onbeforeprint_); - } + default T withOnbeforeprint(final String onbeforeprint_) { + return self().attr("onbeforeprint", onbeforeprint_); + } - default T withCondOnbeforeprint(final boolean enable, final String onbeforeprint_) { - return enable ? self().attr("onbeforeprint", onbeforeprint_) : self(); - } + default T withCondOnbeforeprint(final boolean enable, final String onbeforeprint_) { + return enable ? self().attr("onbeforeprint", onbeforeprint_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnbeforeunload.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnbeforeunload.java index 48af6ab..d702f85 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnbeforeunload.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnbeforeunload.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnbeforeunload> extends IInstance { - default T withOnbeforeunload(final String onbeforeunload_) { - return self().attr("onbeforeunload", onbeforeunload_); - } + default T withOnbeforeunload(final String onbeforeunload_) { + return self().attr("onbeforeunload", onbeforeunload_); + } - default T withCondOnbeforeunload(final boolean enable, final String onbeforeunload_) { - return enable ? self().attr("onbeforeunload", onbeforeunload_) : self(); - } + default T withCondOnbeforeunload(final boolean enable, final String onbeforeunload_) { + return enable ? self().attr("onbeforeunload", onbeforeunload_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOncanplay.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOncanplay.java index 83316e9..d886ec4 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOncanplay.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOncanplay.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOncanplay> extends IInstance { - default T withOncanplay(final String oncanplay_) { - return self().attr("oncanplay", oncanplay_); - } + default T withOncanplay(final String oncanplay_) { + return self().attr("oncanplay", oncanplay_); + } - default T withCondOncanplay(final boolean enable, final String oncanplay_) { - return enable ? self().attr("oncanplay", oncanplay_) : self(); - } + default T withCondOncanplay(final boolean enable, final String oncanplay_) { + return enable ? self().attr("oncanplay", oncanplay_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOncanplaythrough.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOncanplaythrough.java index ba3a7cb..3f3fd9d 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOncanplaythrough.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOncanplaythrough.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOncanplaythrough> extends IInstance { - default T withOncanplaythrough(final String oncanplaythrough_) { - return self().attr("oncanplaythrough", oncanplaythrough_); - } + default T withOncanplaythrough(final String oncanplaythrough_) { + return self().attr("oncanplaythrough", oncanplaythrough_); + } - default T withCondOncanplaythrough(final boolean enable, final String oncanplaythrough_) { - return enable ? self().attr("oncanplaythrough", oncanplaythrough_) : self(); - } + default T withCondOncanplaythrough(final boolean enable, final String oncanplaythrough_) { + return enable ? self().attr("oncanplaythrough", oncanplaythrough_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOncuechange.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOncuechange.java index f0ac7c0..59082b0 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOncuechange.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOncuechange.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOncuechange> extends IInstance { - default T withOncuechange(final String oncuechange_) { - return self().attr("oncuechange", oncuechange_); - } + default T withOncuechange(final String oncuechange_) { + return self().attr("oncuechange", oncuechange_); + } - default T withCondOncuechange(final boolean enable, final String oncuechange_) { - return enable ? self().attr("oncuechange", oncuechange_) : self(); - } + default T withCondOncuechange(final boolean enable, final String oncuechange_) { + return enable ? self().attr("oncuechange", oncuechange_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOndurationchange.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOndurationchange.java index 11b445c..658f9ab 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOndurationchange.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOndurationchange.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOndurationchange> extends IInstance { - default T withOndurationchange(final String ondurationchange_) { - return self().attr("ondurationchange", ondurationchange_); - } + default T withOndurationchange(final String ondurationchange_) { + return self().attr("ondurationchange", ondurationchange_); + } - default T withCondOndurationchange(final boolean enable, final String ondurationchange_) { - return enable ? self().attr("ondurationchange", ondurationchange_) : self(); - } + default T withCondOndurationchange(final boolean enable, final String ondurationchange_) { + return enable ? self().attr("ondurationchange", ondurationchange_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnemptied.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnemptied.java index bf94854..4eb3c1a 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnemptied.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnemptied.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnemptied> extends IInstance { - default T withOnemptied(final String onemptied_) { - return self().attr("onemptied", onemptied_); - } + default T withOnemptied(final String onemptied_) { + return self().attr("onemptied", onemptied_); + } - default T withCondOnemptied(final boolean enable, final String onemptied_) { - return enable ? self().attr("onemptied", onemptied_) : self(); - } + default T withCondOnemptied(final boolean enable, final String onemptied_) { + return enable ? self().attr("onemptied", onemptied_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnended.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnended.java index 9b6e9c0..a15c04d 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnended.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnended.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnended> extends IInstance { - default T withOnended(final String onended_) { - return self().attr("onended", onended_); - } + default T withOnended(final String onended_) { + return self().attr("onended", onended_); + } - default T withCondOnended(final boolean enable, final String onended_) { - return enable ? self().attr("onended", onended_) : self(); - } + default T withCondOnended(final boolean enable, final String onended_) { + return enable ? self().attr("onended", onended_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnerror.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnerror.java index 32b050b..3eaf1f5 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnerror.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnerror.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnerror> extends IInstance { - default T withOnerror(final String onerror_) { - return self().attr("onerror", onerror_); - } + default T withOnerror(final String onerror_) { + return self().attr("onerror", onerror_); + } - default T withCondOnerror(final boolean enable, final String onerror_) { - return enable ? self().attr("onerror", onerror_) : self(); - } + default T withCondOnerror(final boolean enable, final String onerror_) { + return enable ? self().attr("onerror", onerror_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnhashchange.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnhashchange.java index 0512caa..d31129b 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnhashchange.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnhashchange.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnhashchange> extends IInstance { - default T withOnhashchange(final String onhashchange_) { - return self().attr("onhashchange", onhashchange_); - } + default T withOnhashchange(final String onhashchange_) { + return self().attr("onhashchange", onhashchange_); + } - default T withCondOnhashchange(final boolean enable, final String onhashchange_) { - return enable ? self().attr("onhashchange", onhashchange_) : self(); - } + default T withCondOnhashchange(final boolean enable, final String onhashchange_) { + return enable ? self().attr("onhashchange", onhashchange_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnload.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnload.java index fa00cbf..e64215b 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnload.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnload.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnload> extends IInstance { - default T withOnload(final String onload_) { - return self().attr("onload", onload_); - } + default T withOnload(final String onload_) { + return self().attr("onload", onload_); + } - default T withCondOnload(final boolean enable, final String onload_) { - return enable ? self().attr("onload", onload_) : self(); - } + default T withCondOnload(final boolean enable, final String onload_) { + return enable ? self().attr("onload", onload_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnloadeddata.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnloadeddata.java index 824e228..e4ebacd 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnloadeddata.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnloadeddata.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnloadeddata> extends IInstance { - default T withOnloadeddata(final String onloadeddata_) { - return self().attr("onloadeddata", onloadeddata_); - } + default T withOnloadeddata(final String onloadeddata_) { + return self().attr("onloadeddata", onloadeddata_); + } - default T withCondOnloadeddata(final boolean enable, final String onloadeddata_) { - return enable ? self().attr("onloadeddata", onloadeddata_) : self(); - } + default T withCondOnloadeddata(final boolean enable, final String onloadeddata_) { + return enable ? self().attr("onloadeddata", onloadeddata_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnloadedmetadata.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnloadedmetadata.java index ab0526e..b71cac0 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnloadedmetadata.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnloadedmetadata.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnloadedmetadata> extends IInstance { - default T withOnloadedmetadata(final String onloadedmetadata_) { - return self().attr("onloadedmetadata", onloadedmetadata_); - } + default T withOnloadedmetadata(final String onloadedmetadata_) { + return self().attr("onloadedmetadata", onloadedmetadata_); + } - default T withCondOnloadedmetadata(final boolean enable, final String onloadedmetadata_) { - return enable ? self().attr("onloadedmetadata", onloadedmetadata_) : self(); - } + default T withCondOnloadedmetadata(final boolean enable, final String onloadedmetadata_) { + return enable ? self().attr("onloadedmetadata", onloadedmetadata_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnloadstart.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnloadstart.java index 9e46a33..4126984 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnloadstart.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnloadstart.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnloadstart> extends IInstance { - default T withOnloadstart(final String onloadstart_) { - return self().attr("onloadstart", onloadstart_); - } + default T withOnloadstart(final String onloadstart_) { + return self().attr("onloadstart", onloadstart_); + } - default T withCondOnloadstart(final boolean enable, final String onloadstart_) { - return enable ? self().attr("onloadstart", onloadstart_) : self(); - } + default T withCondOnloadstart(final boolean enable, final String onloadstart_) { + return enable ? self().attr("onloadstart", onloadstart_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnoffline.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnoffline.java index 7523c80..f7d6c21 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnoffline.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnoffline.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnoffline> extends IInstance { - default T withOnoffline(final String onoffline_) { - return self().attr("onoffline", onoffline_); - } + default T withOnoffline(final String onoffline_) { + return self().attr("onoffline", onoffline_); + } - default T withCondOnoffline(final boolean enable, final String onoffline_) { - return enable ? self().attr("onoffline", onoffline_) : self(); - } + default T withCondOnoffline(final boolean enable, final String onoffline_) { + return enable ? self().attr("onoffline", onoffline_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnonline.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnonline.java index eaab613..61ff378 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnonline.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnonline.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnonline> extends IInstance { - default T withOnonline(final String ononline_) { - return self().attr("ononline", ononline_); - } + default T withOnonline(final String ononline_) { + return self().attr("ononline", ononline_); + } - default T withCondOnonline(final boolean enable, final String ononline_) { - return enable ? self().attr("ononline", ononline_) : self(); - } + default T withCondOnonline(final boolean enable, final String ononline_) { + return enable ? self().attr("ononline", ononline_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnpagehide.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnpagehide.java index 8280c44..8955d4f 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnpagehide.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnpagehide.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnpagehide> extends IInstance { - default T withOnpagehide(final String onpagehide_) { - return self().attr("onpagehide", onpagehide_); - } + default T withOnpagehide(final String onpagehide_) { + return self().attr("onpagehide", onpagehide_); + } - default T withCondOnpagehide(final boolean enable, final String onpagehide_) { - return enable ? self().attr("onpagehide", onpagehide_) : self(); - } + default T withCondOnpagehide(final boolean enable, final String onpagehide_) { + return enable ? self().attr("onpagehide", onpagehide_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnpageshow.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnpageshow.java index 346d04c..a92c86b 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnpageshow.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnpageshow.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnpageshow> extends IInstance { - default T withOnpageshow(final String onpageshow_) { - return self().attr("onpageshow", onpageshow_); - } + default T withOnpageshow(final String onpageshow_) { + return self().attr("onpageshow", onpageshow_); + } - default T withCondOnpageshow(final boolean enable, final String onpageshow_) { - return enable ? self().attr("onpageshow", onpageshow_) : self(); - } + default T withCondOnpageshow(final boolean enable, final String onpageshow_) { + return enable ? self().attr("onpageshow", onpageshow_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnpause.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnpause.java index 2719424..4035678 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnpause.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnpause.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnpause> extends IInstance { - default T withOnpause(final String onpause_) { - return self().attr("onpause", onpause_); - } + default T withOnpause(final String onpause_) { + return self().attr("onpause", onpause_); + } - default T withCondOnpause(final boolean enable, final String onpause_) { - return enable ? self().attr("onpause", onpause_) : self(); - } + default T withCondOnpause(final boolean enable, final String onpause_) { + return enable ? self().attr("onpause", onpause_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnplay.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnplay.java index 6c7ca5e..ffc1633 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnplay.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnplay.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnplay> extends IInstance { - default T withOnplay(final String onplay_) { - return self().attr("onplay", onplay_); - } + default T withOnplay(final String onplay_) { + return self().attr("onplay", onplay_); + } - default T withCondOnplay(final boolean enable, final String onplay_) { - return enable ? self().attr("onplay", onplay_) : self(); - } + default T withCondOnplay(final boolean enable, final String onplay_) { + return enable ? self().attr("onplay", onplay_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnplaying.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnplaying.java index 50618a5..28d2d5e 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnplaying.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnplaying.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnplaying> extends IInstance { - default T withOnplaying(final String onplaying_) { - return self().attr("onplaying", onplaying_); - } + default T withOnplaying(final String onplaying_) { + return self().attr("onplaying", onplaying_); + } - default T withCondOnplaying(final boolean enable, final String onplaying_) { - return enable ? self().attr("onplaying", onplaying_) : self(); - } + default T withCondOnplaying(final boolean enable, final String onplaying_) { + return enable ? self().attr("onplaying", onplaying_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnpopstate.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnpopstate.java index 1965ee2..00a413e 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnpopstate.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnpopstate.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnpopstate> extends IInstance { - default T withOnpopstate(final String onpopstate_) { - return self().attr("onpopstate", onpopstate_); - } + default T withOnpopstate(final String onpopstate_) { + return self().attr("onpopstate", onpopstate_); + } - default T withCondOnpopstate(final boolean enable, final String onpopstate_) { - return enable ? self().attr("onpopstate", onpopstate_) : self(); - } + default T withCondOnpopstate(final boolean enable, final String onpopstate_) { + return enable ? self().attr("onpopstate", onpopstate_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnprogress.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnprogress.java index fd4d23d..d41005b 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnprogress.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnprogress.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnprogress> extends IInstance { - default T withOnprogress(final String onprogress_) { - return self().attr("onprogress", onprogress_); - } + default T withOnprogress(final String onprogress_) { + return self().attr("onprogress", onprogress_); + } - default T withCondOnprogress(final boolean enable, final String onprogress_) { - return enable ? self().attr("onprogress", onprogress_) : self(); - } + default T withCondOnprogress(final boolean enable, final String onprogress_) { + return enable ? self().attr("onprogress", onprogress_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnratechange.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnratechange.java index 07f7e8c..3c32f1e 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnratechange.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnratechange.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnratechange> extends IInstance { - default T withOnratechange(final String onratechange_) { - return self().attr("onratechange", onratechange_); - } + default T withOnratechange(final String onratechange_) { + return self().attr("onratechange", onratechange_); + } - default T withCondOnratechange(final boolean enable, final String onratechange_) { - return enable ? self().attr("onratechange", onratechange_) : self(); - } + default T withCondOnratechange(final boolean enable, final String onratechange_) { + return enable ? self().attr("onratechange", onratechange_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnreset.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnreset.java index ece4385..97df970 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnreset.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnreset.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnreset> extends IInstance { - default T withOnreset(final String onreset_) { - return self().attr("onreset", onreset_); - } + default T withOnreset(final String onreset_) { + return self().attr("onreset", onreset_); + } - default T withCondOnreset(final boolean enable, final String onreset_) { - return enable ? self().attr("onreset", onreset_) : self(); - } + default T withCondOnreset(final boolean enable, final String onreset_) { + return enable ? self().attr("onreset", onreset_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnresize.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnresize.java index 593dac0..de77a64 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnresize.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnresize.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnresize> extends IInstance { - default T withOnresize(final String onresize_) { - return self().attr("onresize", onresize_); - } + default T withOnresize(final String onresize_) { + return self().attr("onresize", onresize_); + } - default T withCondOnresize(final boolean enable, final String onresize_) { - return enable ? self().attr("onresize", onresize_) : self(); - } + default T withCondOnresize(final boolean enable, final String onresize_) { + return enable ? self().attr("onresize", onresize_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnsearch.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnsearch.java index 437627f..a00d463 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnsearch.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnsearch.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnsearch> extends IInstance { - default T withOnsearch(final String onsearch_) { - return self().attr("onsearch", onsearch_); - } + default T withOnsearch(final String onsearch_) { + return self().attr("onsearch", onsearch_); + } - default T withCondOnsearch(final boolean enable, final String onsearch_) { - return enable ? self().attr("onsearch", onsearch_) : self(); - } + default T withCondOnsearch(final boolean enable, final String onsearch_) { + return enable ? self().attr("onsearch", onsearch_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnseeked.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnseeked.java index 789ad9b..9188333 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnseeked.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnseeked.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnseeked> extends IInstance { - default T withOnseeked(final String onseeked_) { - return self().attr("onseeked", onseeked_); - } + default T withOnseeked(final String onseeked_) { + return self().attr("onseeked", onseeked_); + } - default T withCondOnseeked(final boolean enable, final String onseeked_) { - return enable ? self().attr("onseeked", onseeked_) : self(); - } + default T withCondOnseeked(final boolean enable, final String onseeked_) { + return enable ? self().attr("onseeked", onseeked_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnseeking.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnseeking.java index c5899b1..c4ff3ac 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnseeking.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnseeking.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnseeking> extends IInstance { - default T withOnseeking(final String onseeking_) { - return self().attr("onseeking", onseeking_); - } + default T withOnseeking(final String onseeking_) { + return self().attr("onseeking", onseeking_); + } - default T withCondOnseeking(final boolean enable, final String onseeking_) { - return enable ? self().attr("onseeking", onseeking_) : self(); - } + default T withCondOnseeking(final boolean enable, final String onseeking_) { + return enable ? self().attr("onseeking", onseeking_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnstalled.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnstalled.java index c3cea40..6a45bfe 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnstalled.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnstalled.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnstalled> extends IInstance { - default T withOnstalled(final String onstalled_) { - return self().attr("onstalled", onstalled_); - } + default T withOnstalled(final String onstalled_) { + return self().attr("onstalled", onstalled_); + } - default T withCondOnstalled(final boolean enable, final String onstalled_) { - return enable ? self().attr("onstalled", onstalled_) : self(); - } + default T withCondOnstalled(final boolean enable, final String onstalled_) { + return enable ? self().attr("onstalled", onstalled_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnstorage.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnstorage.java index 83fdbb6..dde076a 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnstorage.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnstorage.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnstorage> extends IInstance { - default T withOnstorage(final String onstorage_) { - return self().attr("onstorage", onstorage_); - } + default T withOnstorage(final String onstorage_) { + return self().attr("onstorage", onstorage_); + } - default T withCondOnstorage(final boolean enable, final String onstorage_) { - return enable ? self().attr("onstorage", onstorage_) : self(); - } + default T withCondOnstorage(final boolean enable, final String onstorage_) { + return enable ? self().attr("onstorage", onstorage_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnsubmit.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnsubmit.java index 377b496..f1e6ac1 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnsubmit.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnsubmit.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnsubmit> extends IInstance { - default T withOnsubmit(final String onsubmit_) { - return self().attr("onsubmit", onsubmit_); - } + default T withOnsubmit(final String onsubmit_) { + return self().attr("onsubmit", onsubmit_); + } - default T withCondOnsubmit(final boolean enable, final String onsubmit_) { - return enable ? self().attr("onsubmit", onsubmit_) : self(); - } + default T withCondOnsubmit(final boolean enable, final String onsubmit_) { + return enable ? self().attr("onsubmit", onsubmit_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnsuspend.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnsuspend.java index a5e4f5c..05b204e 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnsuspend.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnsuspend.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnsuspend> extends IInstance { - default T withOnsuspend(final String onsuspend_) { - return self().attr("onsuspend", onsuspend_); - } + default T withOnsuspend(final String onsuspend_) { + return self().attr("onsuspend", onsuspend_); + } - default T withCondOnsuspend(final boolean enable, final String onsuspend_) { - return enable ? self().attr("onsuspend", onsuspend_) : self(); - } + default T withCondOnsuspend(final boolean enable, final String onsuspend_) { + return enable ? self().attr("onsuspend", onsuspend_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOntimeupdate.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOntimeupdate.java index f787393..812bc18 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOntimeupdate.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOntimeupdate.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOntimeupdate> extends IInstance { - default T withOntimeupdate(final String ontimeupdate_) { - return self().attr("ontimeupdate", ontimeupdate_); - } + default T withOntimeupdate(final String ontimeupdate_) { + return self().attr("ontimeupdate", ontimeupdate_); + } - default T withCondOntimeupdate(final boolean enable, final String ontimeupdate_) { - return enable ? self().attr("ontimeupdate", ontimeupdate_) : self(); - } + default T withCondOntimeupdate(final boolean enable, final String ontimeupdate_) { + return enable ? self().attr("ontimeupdate", ontimeupdate_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOntoggle.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOntoggle.java index 26c7070..74e3d1b 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOntoggle.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOntoggle.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOntoggle> extends IInstance { - default T withOntoggle(final String ontoggle_) { - return self().attr("ontoggle", ontoggle_); - } + default T withOntoggle(final String ontoggle_) { + return self().attr("ontoggle", ontoggle_); + } - default T withCondOntoggle(final boolean enable, final String ontoggle_) { - return enable ? self().attr("ontoggle", ontoggle_) : self(); - } + default T withCondOntoggle(final boolean enable, final String ontoggle_) { + return enable ? self().attr("ontoggle", ontoggle_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnunload.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnunload.java index a1e9c47..4087a1c 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnunload.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnunload.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnunload> extends IInstance { - default T withOnunload(final String onunload_) { - return self().attr("onunload", onunload_); - } + default T withOnunload(final String onunload_) { + return self().attr("onunload", onunload_); + } - default T withCondOnunload(final boolean enable, final String onunload_) { - return enable ? self().attr("onunload", onunload_) : self(); - } + default T withCondOnunload(final boolean enable, final String onunload_) { + return enable ? self().attr("onunload", onunload_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnvolumechanged.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnvolumechanged.java index 9013552..7059cb0 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnvolumechanged.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnvolumechanged.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnvolumechanged> extends IInstance { - default T withOnvolumechanged(final String onvolumechanged_) { - return self().attr("onvolumechanged", onvolumechanged_); - } + default T withOnvolumechanged(final String onvolumechanged_) { + return self().attr("onvolumechanged", onvolumechanged_); + } - default T withCondOnvolumechanged(final boolean enable, final String onvolumechanged_) { - return enable ? self().attr("onvolumechanged", onvolumechanged_) : self(); - } + default T withCondOnvolumechanged(final boolean enable, final String onvolumechanged_) { + return enable ? self().attr("onvolumechanged", onvolumechanged_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnwaiting.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnwaiting.java index 01526c9..6e99442 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnwaiting.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOnwaiting.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOnwaiting> extends IInstance { - default T withOnwaiting(final String onwaiting_) { - return self().attr("onwaiting", onwaiting_); - } + default T withOnwaiting(final String onwaiting_) { + return self().attr("onwaiting", onwaiting_); + } - default T withCondOnwaiting(final boolean enable, final String onwaiting_) { - return enable ? self().attr("onwaiting", onwaiting_) : self(); - } + default T withCondOnwaiting(final boolean enable, final String onwaiting_) { + return enable ? self().attr("onwaiting", onwaiting_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOpen.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOpen.java index 6b1f26c..8465b4c 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOpen.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOpen.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOpen> extends IInstance { - default T isOpen() { - return self().attr("open"); - } + default T isOpen() { + return self().attr("open"); + } - default T withCondOpen(final boolean enable) { - return enable ? self().attr("open") : self(); - } + default T withCondOpen(final boolean enable) { + return enable ? self().attr("open") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOptimum.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOptimum.java index 1aff956..9b2d9b0 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOptimum.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IOptimum.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IOptimum> extends IInstance { - default T withOptimum(final String optimum_) { - return self().attr("optimum", optimum_); - } + default T withOptimum(final String optimum_) { + return self().attr("optimum", optimum_); + } - default T withCondOptimum(final boolean enable, final String optimum_) { - return enable ? self().attr("optimum", optimum_) : self(); - } + default T withCondOptimum(final boolean enable, final String optimum_) { + return enable ? self().attr("optimum", optimum_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IPattern.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IPattern.java index 22bb110..32c2fca 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IPattern.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IPattern.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IPattern> extends IInstance { - default T withPattern(final String pattern_) { - return self().attr("pattern", pattern_); - } + default T withPattern(final String pattern_) { + return self().attr("pattern", pattern_); + } - default T withCondPattern(final boolean enable, final String pattern_) { - return enable ? self().attr("pattern", pattern_) : self(); - } + default T withCondPattern(final boolean enable, final String pattern_) { + return enable ? self().attr("pattern", pattern_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IPlaceholder.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IPlaceholder.java index dfeb8f3..51bce5f 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IPlaceholder.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IPlaceholder.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IPlaceholder> extends IInstance { - default T withPlaceholder(final String placeholder_) { - return self().attr("placeholder", placeholder_); - } + default T withPlaceholder(final String placeholder_) { + return self().attr("placeholder", placeholder_); + } - default T withCondPlaceholder(final boolean enable, final String placeholder_) { - return enable ? self().attr("placeholder", placeholder_) : self(); - } + default T withCondPlaceholder(final boolean enable, final String placeholder_) { + return enable ? self().attr("placeholder", placeholder_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IPoster.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IPoster.java index c384309..3f3c9cc 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IPoster.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IPoster.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IPoster> extends IInstance { - default T withPoster(final String poster_) { - return self().attr("poster", poster_); - } + default T withPoster(final String poster_) { + return self().attr("poster", poster_); + } - default T withCondPoster(final boolean enable, final String poster_) { - return enable ? self().attr("poster", poster_) : self(); - } + default T withCondPoster(final boolean enable, final String poster_) { + return enable ? self().attr("poster", poster_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IPreload.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IPreload.java index 1577970..5a1cea8 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IPreload.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IPreload.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IPreload> extends IInstance { - default T withPreload(final String preload_) { - return self().attr("preload", preload_); - } + default T withPreload(final String preload_) { + return self().attr("preload", preload_); + } - default T withCondPreload(final boolean enable, final String preload_) { - return enable ? self().attr("preload", preload_) : self(); - } + default T withCondPreload(final boolean enable, final String preload_) { + return enable ? self().attr("preload", preload_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IReadonly.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IReadonly.java index aecd3aa..258e0bd 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IReadonly.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IReadonly.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IReadonly> extends IInstance { - default T isReadonly() { - return self().attr("readonly"); - } + default T isReadonly() { + return self().attr("readonly"); + } - default T withCondReadonly(final boolean enable) { - return enable ? self().attr("readonly") : self(); - } + default T withCondReadonly(final boolean enable) { + return enable ? self().attr("readonly") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IRel.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IRel.java index 3ae0135..d89073f 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IRel.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IRel.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IRel> extends IInstance { - default T withRel(final String rel_) { - return self().attr("rel", rel_); - } + default T withRel(final String rel_) { + return self().attr("rel", rel_); + } - default T withCondRel(final boolean enable, final String rel_) { - return enable ? self().attr("rel", rel_) : self(); - } + default T withCondRel(final boolean enable, final String rel_) { + return enable ? self().attr("rel", rel_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IRequired.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IRequired.java index 708b71f..998c28e 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IRequired.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IRequired.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IRequired> extends IInstance { - default T isRequired() { - return self().attr("required"); - } + default T isRequired() { + return self().attr("required"); + } - default T withCondRequired(final boolean enable) { - return enable ? self().attr("required") : self(); - } + default T withCondRequired(final boolean enable) { + return enable ? self().attr("required") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IReversed.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IReversed.java index 92c034d..fc2fdea 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IReversed.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IReversed.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IReversed> extends IInstance { - default T isReversed() { - return self().attr("reversed"); - } + default T isReversed() { + return self().attr("reversed"); + } - default T withCondReversed(final boolean enable) { - return enable ? self().attr("reversed") : self(); - } + default T withCondReversed(final boolean enable) { + return enable ? self().attr("reversed") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IRows.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IRows.java index 4d296ae..93f1036 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IRows.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IRows.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IRows> extends IInstance { - default T withRows(final String rows_) { - return self().attr("rows", rows_); - } + default T withRows(final String rows_) { + return self().attr("rows", rows_); + } - default T withCondRows(final boolean enable, final String rows_) { - return enable ? self().attr("rows", rows_) : self(); - } + default T withCondRows(final boolean enable, final String rows_) { + return enable ? self().attr("rows", rows_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IRowspan.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IRowspan.java index a131c78..f523c5a 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IRowspan.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IRowspan.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IRowspan> extends IInstance { - default T withRowspan(final String rowspan_) { - return self().attr("rowspan", rowspan_); - } + default T withRowspan(final String rowspan_) { + return self().attr("rowspan", rowspan_); + } - default T withCondRowspan(final boolean enable, final String rowspan_) { - return enable ? self().attr("rowspan", rowspan_) : self(); - } + default T withCondRowspan(final boolean enable, final String rowspan_) { + return enable ? self().attr("rowspan", rowspan_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISandbox.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISandbox.java index b37ce43..bb7b66d 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISandbox.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISandbox.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface ISandbox> extends IInstance { - default T isSandbox() { - return self().attr("sandbox"); - } + default T isSandbox() { + return self().attr("sandbox"); + } - default T withCondSandbox(final boolean enable) { - return enable ? self().attr("sandbox") : self(); - } + default T withCondSandbox(final boolean enable) { + return enable ? self().attr("sandbox") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IScope.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IScope.java index 7ab76b9..5792ce6 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IScope.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IScope.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IScope> extends IInstance { - default T withScope(final String scope_) { - return self().attr("scope", scope_); - } + default T withScope(final String scope_) { + return self().attr("scope", scope_); + } - default T withCondScope(final boolean enable, final String scope_) { - return enable ? self().attr("scope", scope_) : self(); - } + default T withCondScope(final boolean enable, final String scope_) { + return enable ? self().attr("scope", scope_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISelected.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISelected.java index 11917c3..49b8dfb 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISelected.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISelected.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface ISelected> extends IInstance { - default T isSelected() { - return self().attr("selected"); - } + default T isSelected() { + return self().attr("selected"); + } - default T withCondSelected(final boolean enable) { - return enable ? self().attr("selected") : self(); - } + default T withCondSelected(final boolean enable) { + return enable ? self().attr("selected") : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IShape.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IShape.java index ada87f1..031ac24 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IShape.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IShape.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IShape> extends IInstance { - default T withShape(final String shape_) { - return self().attr("shape", shape_); - } + default T withShape(final String shape_) { + return self().attr("shape", shape_); + } - default T withCondShape(final boolean enable, final String shape_) { - return enable ? self().attr("shape", shape_) : self(); - } + default T withCondShape(final boolean enable, final String shape_) { + return enable ? self().attr("shape", shape_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISize.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISize.java index 58ce732..f79b9aa 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISize.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISize.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface ISize> extends IInstance { - default T withSize(final String size_) { - return self().attr("size", size_); - } + default T withSize(final String size_) { + return self().attr("size", size_); + } - default T withCondSize(final boolean enable, final String size_) { - return enable ? self().attr("size", size_) : self(); - } + default T withCondSize(final boolean enable, final String size_) { + return enable ? self().attr("size", size_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISizes.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISizes.java index dd084ff..b7404a9 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISizes.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISizes.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface ISizes> extends IInstance { - default T withSizes(final String sizes_) { - return self().attr("sizes", sizes_); - } + default T withSizes(final String sizes_) { + return self().attr("sizes", sizes_); + } - default T withCondSizes(final boolean enable, final String sizes_) { - return enable ? self().attr("sizes", sizes_) : self(); - } + default T withCondSizes(final boolean enable, final String sizes_) { + return enable ? self().attr("sizes", sizes_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISpan.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISpan.java index 57f3dc7..b11b4d4 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISpan.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISpan.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface ISpan> extends IInstance { - default T withSpan(final String span_) { - return self().attr("span", span_); - } + default T withSpan(final String span_) { + return self().attr("span", span_); + } - default T withCondSpan(final boolean enable, final String span_) { - return enable ? self().attr("span", span_) : self(); - } + default T withCondSpan(final boolean enable, final String span_) { + return enable ? self().attr("span", span_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISrc.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISrc.java index 4cdc3a7..9cf774a 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISrc.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISrc.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface ISrc> extends IInstance { - default T withSrc(final String src_) { - return self().attr("src", src_); - } + default T withSrc(final String src_) { + return self().attr("src", src_); + } - default T withCondSrc(final boolean enable, final String src_) { - return enable ? self().attr("src", src_) : self(); - } + default T withCondSrc(final boolean enable, final String src_) { + return enable ? self().attr("src", src_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISrcdoc.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISrcdoc.java index d89bcd7..3471d35 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISrcdoc.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISrcdoc.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface ISrcdoc> extends IInstance { - default T withSrcdoc(final String srcdoc_) { - return self().attr("srcdoc", srcdoc_); - } + default T withSrcdoc(final String srcdoc_) { + return self().attr("srcdoc", srcdoc_); + } - default T withCondSrcdoc(final boolean enable, final String srcdoc_) { - return enable ? self().attr("srcdoc", srcdoc_) : self(); - } + default T withCondSrcdoc(final boolean enable, final String srcdoc_) { + return enable ? self().attr("srcdoc", srcdoc_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISrclang.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISrclang.java index 260e0a5..57bb354 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISrclang.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISrclang.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface ISrclang> extends IInstance { - default T withSrclang(final String srclang_) { - return self().attr("srclang", srclang_); - } + default T withSrclang(final String srclang_) { + return self().attr("srclang", srclang_); + } - default T withCondSrclang(final boolean enable, final String srclang_) { - return enable ? self().attr("srclang", srclang_) : self(); - } + default T withCondSrclang(final boolean enable, final String srclang_) { + return enable ? self().attr("srclang", srclang_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISrcset.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISrcset.java index 2a3777b..1510a28 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISrcset.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ISrcset.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface ISrcset> extends IInstance { - default T withSrcset(final String srcset_) { - return self().attr("srcset", srcset_); - } + default T withSrcset(final String srcset_) { + return self().attr("srcset", srcset_); + } - default T withCondSrcset(final boolean enable, final String srcset_) { - return enable ? self().attr("srcset", srcset_) : self(); - } + default T withCondSrcset(final boolean enable, final String srcset_) { + return enable ? self().attr("srcset", srcset_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IStart.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IStart.java index 8661dca..2d38e4a 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IStart.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IStart.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IStart> extends IInstance { - default T withStart(final String start_) { - return self().attr("start", start_); - } + default T withStart(final String start_) { + return self().attr("start", start_); + } - default T withCondStart(final boolean enable, final String start_) { - return enable ? self().attr("start", start_) : self(); - } + default T withCondStart(final boolean enable, final String start_) { + return enable ? self().attr("start", start_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IStep.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IStep.java index 804cb65..39d157c 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IStep.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IStep.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IStep> extends IInstance { - default T withStep(final String step_) { - return self().attr("step", step_); - } + default T withStep(final String step_) { + return self().attr("step", step_); + } - default T withCondStep(final boolean enable, final String step_) { - return enable ? self().attr("step", step_) : self(); - } + default T withCondStep(final boolean enable, final String step_) { + return enable ? self().attr("step", step_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ITarget.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ITarget.java index 9b83581..e26d134 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/ITarget.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/ITarget.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface ITarget> extends IInstance { - default T withTarget(final String target_) { - return self().attr("target", target_); - } + default T withTarget(final String target_) { + return self().attr("target", target_); + } - default T withCondTarget(final boolean enable, final String target_) { - return enable ? self().attr("target", target_) : self(); - } + default T withCondTarget(final boolean enable, final String target_) { + return enable ? self().attr("target", target_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IType.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IType.java index 2c999c4..072c6d8 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IType.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IType.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IType> extends IInstance { - default T withType(final String type_) { - return self().attr("type", type_); - } + default T withType(final String type_) { + return self().attr("type", type_); + } - default T withCondType(final boolean enable, final String type_) { - return enable ? self().attr("type", type_) : self(); - } + default T withCondType(final boolean enable, final String type_) { + return enable ? self().attr("type", type_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IUsemap.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IUsemap.java index 72c4508..7e8192d 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IUsemap.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IUsemap.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IUsemap> extends IInstance { - default T withUsemap(final String usemap_) { - return self().attr("usemap", usemap_); - } + default T withUsemap(final String usemap_) { + return self().attr("usemap", usemap_); + } - default T withCondUsemap(final boolean enable, final String usemap_) { - return enable ? self().attr("usemap", usemap_) : self(); - } + default T withCondUsemap(final boolean enable, final String usemap_) { + return enable ? self().attr("usemap", usemap_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IValue.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IValue.java index e53aff3..8880975 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IValue.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IValue.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IValue> extends IInstance { - default T withValue(final String value_) { - return self().attr("value", value_); - } + default T withValue(final String value_) { + return self().attr("value", value_); + } - default T withCondValue(final boolean enable, final String value_) { - return enable ? self().attr("value", value_) : self(); - } + default T withCondValue(final boolean enable, final String value_) { + return enable ? self().attr("value", value_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IWidth.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IWidth.java index 6e23708..2e41d47 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IWidth.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IWidth.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IWidth> extends IInstance { - default T withWidth(final String width_) { - return self().attr("width", width_); - } + default T withWidth(final String width_) { + return self().attr("width", width_); + } - default T withCondWidth(final boolean enable, final String width_) { - return enable ? self().attr("width", width_) : self(); - } + default T withCondWidth(final boolean enable, final String width_) { + return enable ? self().attr("width", width_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IWrap.java b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IWrap.java index 0f462a5..4fdd8cb 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/attributes/IWrap.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/attributes/IWrap.java @@ -4,11 +4,11 @@ import org.xbib.j2html.tags.IInstance; import org.xbib.j2html.tags.Tag; public interface IWrap> extends IInstance { - default T withWrap(final String wrap_) { - return self().attr("wrap", wrap_); - } + default T withWrap(final String wrap_) { + return self().attr("wrap", wrap_); + } - default T withCondWrap(final boolean enable, final String wrap_) { - return enable ? self().attr("wrap", wrap_) : self(); - } + default T withCondWrap(final boolean enable, final String wrap_) { + return enable ? self().attr("wrap", wrap_) : self(); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ATag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ATag.java index ede5955..6bc7d70 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ATag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ATag.java @@ -10,7 +10,7 @@ import org.xbib.j2html.tags.attributes.ITarget; import org.xbib.j2html.tags.attributes.IType; public class ATag extends ContainerTag implements IDownload, IHref, IHreflang, IMedia, IRel, ITarget, IType { - public ATag() { - super("a"); - } + public ATag() { + super("a"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/AbbrTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/AbbrTag.java index 1041ab7..81c9b5e 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/AbbrTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/AbbrTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class AbbrTag extends ContainerTag { - public AbbrTag() { - super("abbr"); - } + public AbbrTag() { + super("abbr"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/AddressTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/AddressTag.java index 2609cc0..8dd01db 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/AddressTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/AddressTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class AddressTag extends ContainerTag { - public AddressTag() { - super("address"); - } + public AddressTag() { + super("address"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/AreaTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/AreaTag.java index 1401c41..947ff60 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/AreaTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/AreaTag.java @@ -12,7 +12,7 @@ import org.xbib.j2html.tags.attributes.IShape; import org.xbib.j2html.tags.attributes.ITarget; public class AreaTag extends EmptyTag implements IAlt, ICoords, IDownload, IHref, IHreflang, IMedia, IRel, IShape, ITarget { - public AreaTag() { - super("area"); - } + public AreaTag() { + super("area"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ArticleTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ArticleTag.java index eab819a..3a9c26b 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ArticleTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ArticleTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class ArticleTag extends ContainerTag { - public ArticleTag() { - super("article"); - } + public ArticleTag() { + super("article"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/AsideTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/AsideTag.java index f11bf4b..53eef8d 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/AsideTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/AsideTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class AsideTag extends ContainerTag { - public AsideTag() { - super("aside"); - } + public AsideTag() { + super("aside"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/AudioTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/AudioTag.java index 9bcb4e2..5011120 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/AudioTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/AudioTag.java @@ -31,7 +31,7 @@ import org.xbib.j2html.tags.attributes.IPreload; import org.xbib.j2html.tags.attributes.ISrc; public class AudioTag extends ContainerTag implements IAutoplay, IControls, ILoop, IMuted, IOnabort, IOncanplay, IOncanplaythrough, IOndurationchange, IOnemptied, IOnended, IOnerror, IOnloadeddata, IOnloadedmetadata, IOnloadstart, IOnpause, IOnplay, IOnplaying, IOnprogress, IOnratechange, IOnseeked, IOnseeking, IOnstalled, IOnsuspend, IOntimeupdate, IOnvolumechanged, IOnwaiting, IPreload, ISrc { - public AudioTag() { - super("audio"); - } + public AudioTag() { + super("audio"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/BTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/BTag.java index f0ad5a2..f720148 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/BTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/BTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class BTag extends ContainerTag { - public BTag() { - super("b"); - } + public BTag() { + super("b"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/BaseTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/BaseTag.java index 474d67e..2e9218d 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/BaseTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/BaseTag.java @@ -5,7 +5,7 @@ import org.xbib.j2html.tags.attributes.IHref; import org.xbib.j2html.tags.attributes.ITarget; public class BaseTag extends EmptyTag implements IHref, ITarget { - public BaseTag() { - super("base"); - } + public BaseTag() { + super("base"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/BdiTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/BdiTag.java index 6860ed6..65bbf4e 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/BdiTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/BdiTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class BdiTag extends ContainerTag { - public BdiTag() { - super("bdi"); - } + public BdiTag() { + super("bdi"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/BdoTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/BdoTag.java index 3f1fb97..9df7991 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/BdoTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/BdoTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class BdoTag extends ContainerTag { - public BdoTag() { - super("bdo"); - } + public BdoTag() { + super("bdo"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/BlockquoteTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/BlockquoteTag.java index a8d6dbb..e2a04b4 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/BlockquoteTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/BlockquoteTag.java @@ -4,7 +4,7 @@ import org.xbib.j2html.tags.ContainerTag; import org.xbib.j2html.tags.attributes.ICite; public class BlockquoteTag extends ContainerTag implements ICite { - public BlockquoteTag() { - super("blockquote"); - } + public BlockquoteTag() { + super("blockquote"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/BodyTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/BodyTag.java index 5baeec5..b419dc2 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/BodyTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/BodyTag.java @@ -17,7 +17,7 @@ import org.xbib.j2html.tags.attributes.IOnstorage; import org.xbib.j2html.tags.attributes.IOnunload; public class BodyTag extends ContainerTag implements IOnafterprint, IOnbeforeprint, IOnbeforeunload, IOnerror, IOnhashchange, IOnload, IOnoffline, IOnonline, IOnpagehide, IOnpageshow, IOnpopstate, IOnresize, IOnstorage, IOnunload { - public BodyTag() { - super("body"); - } + public BodyTag() { + super("body"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/BrTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/BrTag.java index bec8b7c..ed8591c 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/BrTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/BrTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.EmptyTag; public class BrTag extends EmptyTag { - public BrTag() { - super("br"); - } + public BrTag() { + super("br"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ButtonTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ButtonTag.java index 421d784..8e53e7c 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ButtonTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ButtonTag.java @@ -10,7 +10,7 @@ import org.xbib.j2html.tags.attributes.IType; import org.xbib.j2html.tags.attributes.IValue; public class ButtonTag extends ContainerTag implements IAutofocus, IDisabled, IForm, IFormaction, IName, IType, IValue { - public ButtonTag() { - super("button"); - } + public ButtonTag() { + super("button"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/CanvasTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/CanvasTag.java index 0c5b8f0..88b48e5 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/CanvasTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/CanvasTag.java @@ -5,7 +5,7 @@ import org.xbib.j2html.tags.attributes.IHeight; import org.xbib.j2html.tags.attributes.IWidth; public class CanvasTag extends ContainerTag implements IHeight, IWidth { - public CanvasTag() { - super("canvas"); - } + public CanvasTag() { + super("canvas"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/CaptionTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/CaptionTag.java index 8f80d0c..ec03d7d 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/CaptionTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/CaptionTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class CaptionTag extends ContainerTag { - public CaptionTag() { - super("caption"); - } + public CaptionTag() { + super("caption"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/CiteTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/CiteTag.java index eceb9f7..419df88 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/CiteTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/CiteTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class CiteTag extends ContainerTag { - public CiteTag() { - super("cite"); - } + public CiteTag() { + super("cite"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/CodeTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/CodeTag.java index 3f3e9c9..d4d6eec 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/CodeTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/CodeTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class CodeTag extends ContainerTag { - public CodeTag() { - super("code"); - } + public CodeTag() { + super("code"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ColTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ColTag.java index 0d2f721..7dccc8d 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ColTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ColTag.java @@ -4,7 +4,7 @@ import org.xbib.j2html.tags.EmptyTag; import org.xbib.j2html.tags.attributes.ISpan; public class ColTag extends EmptyTag implements ISpan { - public ColTag() { - super("col"); - } + public ColTag() { + super("col"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ColgroupTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ColgroupTag.java index 69be95f..fcd6c5c 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ColgroupTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ColgroupTag.java @@ -4,7 +4,7 @@ import org.xbib.j2html.tags.ContainerTag; import org.xbib.j2html.tags.attributes.ISpan; public class ColgroupTag extends ContainerTag implements ISpan { - public ColgroupTag() { - super("colgroup"); - } + public ColgroupTag() { + super("colgroup"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DataTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DataTag.java index 825ac7d..fcf5b4c 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DataTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DataTag.java @@ -4,7 +4,7 @@ import org.xbib.j2html.tags.ContainerTag; import org.xbib.j2html.tags.attributes.IValue; public class DataTag extends ContainerTag implements IValue { - public DataTag() { - super("data"); - } + public DataTag() { + super("data"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DatalistTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DatalistTag.java index 400bf73..33f0432 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DatalistTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DatalistTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class DatalistTag extends ContainerTag { - public DatalistTag() { - super("datalist"); - } + public DatalistTag() { + super("datalist"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DdTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DdTag.java index bca5fe5..9408696 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DdTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DdTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class DdTag extends ContainerTag { - public DdTag() { - super("dd"); - } + public DdTag() { + super("dd"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DelTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DelTag.java index 20cb9da..e63be83 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DelTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DelTag.java @@ -5,7 +5,7 @@ import org.xbib.j2html.tags.attributes.ICite; import org.xbib.j2html.tags.attributes.IDatetime; public class DelTag extends ContainerTag implements ICite, IDatetime { - public DelTag() { - super("del"); - } + public DelTag() { + super("del"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DetailsTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DetailsTag.java index edf49a9..4d81afc 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DetailsTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DetailsTag.java @@ -5,7 +5,7 @@ import org.xbib.j2html.tags.attributes.IOntoggle; import org.xbib.j2html.tags.attributes.IOpen; public class DetailsTag extends ContainerTag implements IOntoggle, IOpen { - public DetailsTag() { - super("details"); - } + public DetailsTag() { + super("details"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DfnTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DfnTag.java index a121438..bc309d0 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DfnTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DfnTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class DfnTag extends ContainerTag { - public DfnTag() { - super("dfn"); - } + public DfnTag() { + super("dfn"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DialogTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DialogTag.java index 2e6b6f6..306580d 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DialogTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DialogTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class DialogTag extends ContainerTag { - public DialogTag() { - super("dialog"); - } + public DialogTag() { + super("dialog"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DivTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DivTag.java index aefbfba..6ade2cf 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DivTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DivTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class DivTag extends ContainerTag { - public DivTag() { - super("div"); - } + public DivTag() { + super("div"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DlTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DlTag.java index 7a1f830..fad3ec4 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DlTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DlTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class DlTag extends ContainerTag { - public DlTag() { - super("dl"); - } + public DlTag() { + super("dl"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DtTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DtTag.java index 3d8d060..9191dfb 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/DtTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/DtTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class DtTag extends ContainerTag { - public DtTag() { - super("dt"); - } + public DtTag() { + super("dt"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/EmTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/EmTag.java index 24d85cc..4687861 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/EmTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/EmTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class EmTag extends ContainerTag { - public EmTag() { - super("em"); - } + public EmTag() { + super("em"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/EmbedTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/EmbedTag.java index 9d50892..36861bf 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/EmbedTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/EmbedTag.java @@ -10,7 +10,7 @@ import org.xbib.j2html.tags.attributes.IType; import org.xbib.j2html.tags.attributes.IWidth; public class EmbedTag extends EmptyTag implements IHeight, IOnabort, IOncanplay, IOnerror, ISrc, IType, IWidth { - public EmbedTag() { - super("embed"); - } + public EmbedTag() { + super("embed"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/FieldsetTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/FieldsetTag.java index 1212269..ecd685f 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/FieldsetTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/FieldsetTag.java @@ -6,7 +6,7 @@ import org.xbib.j2html.tags.attributes.IForm; import org.xbib.j2html.tags.attributes.IName; public class FieldsetTag extends ContainerTag implements IDisabled, IForm, IName { - public FieldsetTag() { - super("fieldset"); - } + public FieldsetTag() { + super("fieldset"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/FigcaptionTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/FigcaptionTag.java index 04f6727..c1a7a21 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/FigcaptionTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/FigcaptionTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class FigcaptionTag extends ContainerTag { - public FigcaptionTag() { - super("figcaption"); - } + public FigcaptionTag() { + super("figcaption"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/FigureTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/FigureTag.java index f608acb..4cbb3c8 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/FigureTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/FigureTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class FigureTag extends ContainerTag { - public FigureTag() { - super("figure"); - } + public FigureTag() { + super("figure"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/FooterTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/FooterTag.java index f8d3b36..8a24fb7 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/FooterTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/FooterTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class FooterTag extends ContainerTag { - public FooterTag() { - super("footer"); - } + public FooterTag() { + super("footer"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/FormTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/FormTag.java index f779aec..e0723d5 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/FormTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/FormTag.java @@ -13,7 +13,7 @@ import org.xbib.j2html.tags.attributes.IRel; import org.xbib.j2html.tags.attributes.ITarget; public class FormTag extends ContainerTag implements IAction, IAutocomplete, IEnctype, IMethod, IName, INovalidate, IOnreset, IOnsubmit, IRel, ITarget { - public FormTag() { - super("form"); - } + public FormTag() { + super("form"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/H1Tag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/H1Tag.java index 9976429..874ff14 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/H1Tag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/H1Tag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class H1Tag extends ContainerTag { - public H1Tag() { - super("h1"); - } + public H1Tag() { + super("h1"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/H2Tag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/H2Tag.java index fdcc805..190303b 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/H2Tag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/H2Tag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class H2Tag extends ContainerTag { - public H2Tag() { - super("h2"); - } + public H2Tag() { + super("h2"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/H3Tag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/H3Tag.java index 14d5e15..b84d487 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/H3Tag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/H3Tag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class H3Tag extends ContainerTag { - public H3Tag() { - super("h3"); - } + public H3Tag() { + super("h3"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/H4Tag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/H4Tag.java index 68f64e2..f04adf9 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/H4Tag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/H4Tag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class H4Tag extends ContainerTag { - public H4Tag() { - super("h4"); - } + public H4Tag() { + super("h4"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/H5Tag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/H5Tag.java index 1d166e5..5b4339d 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/H5Tag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/H5Tag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class H5Tag extends ContainerTag { - public H5Tag() { - super("h5"); - } + public H5Tag() { + super("h5"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/H6Tag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/H6Tag.java index 4a796f4..574f1a7 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/H6Tag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/H6Tag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class H6Tag extends ContainerTag { - public H6Tag() { - super("h6"); - } + public H6Tag() { + super("h6"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/HeadTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/HeadTag.java index 1d5aa68..7e5ec1c 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/HeadTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/HeadTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class HeadTag extends ContainerTag { - public HeadTag() { - super("head"); - } + public HeadTag() { + super("head"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/HeaderTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/HeaderTag.java index dca82d4..9eb6b39 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/HeaderTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/HeaderTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class HeaderTag extends ContainerTag { - public HeaderTag() { - super("header"); - } + public HeaderTag() { + super("header"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/HrTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/HrTag.java index 7347fd8..fe9dfee 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/HrTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/HrTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.EmptyTag; public class HrTag extends EmptyTag { - public HrTag() { - super("hr"); - } + public HrTag() { + super("hr"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/HtmlTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/HtmlTag.java index faa714c..8117f90 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/HtmlTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/HtmlTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class HtmlTag extends ContainerTag { - public HtmlTag() { - super("html"); - } + public HtmlTag() { + super("html"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ITag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ITag.java index 5e62df3..e81f382 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ITag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ITag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class ITag extends ContainerTag { - public ITag() { - super("i"); - } + public ITag() { + super("i"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/IframeTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/IframeTag.java index 9897965..4cb3f40 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/IframeTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/IframeTag.java @@ -10,7 +10,7 @@ import org.xbib.j2html.tags.attributes.ISrcdoc; import org.xbib.j2html.tags.attributes.IWidth; public class IframeTag extends ContainerTag implements IHeight, IName, IOnload, ISandbox, ISrc, ISrcdoc, IWidth { - public IframeTag() { - super("iframe"); - } + public IframeTag() { + super("iframe"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ImgTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ImgTag.java index 5e2f259..ae7d26e 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ImgTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ImgTag.java @@ -14,7 +14,7 @@ import org.xbib.j2html.tags.attributes.IUsemap; import org.xbib.j2html.tags.attributes.IWidth; public class ImgTag extends EmptyTag implements IAlt, IHeight, IIsmap, IOnabort, IOnerror, IOnload, ISizes, ISrc, ISrcset, IUsemap, IWidth { - public ImgTag() { - super("img"); - } + public ImgTag() { + super("img"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/InputTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/InputTag.java index 5cc2f48..b5cbc2a 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/InputTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/InputTag.java @@ -31,7 +31,7 @@ import org.xbib.j2html.tags.attributes.IValue; import org.xbib.j2html.tags.attributes.IWidth; public class InputTag extends EmptyTag implements IAccept, IAlt, IAutocomplete, IAutofocus, IChecked, IDirname, IDisabled, IForm, IFormaction, IHeight, IList, IMax, IMaxlength, IMin, IMultiple, IName, IOnload, IOnsearch, IPattern, IPlaceholder, IReadonly, IRequired, ISize, ISrc, IStep, IType, IValue, IWidth { - public InputTag() { - super("input"); - } + public InputTag() { + super("input"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/InsTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/InsTag.java index fcdb7ca..f0d3e42 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/InsTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/InsTag.java @@ -5,7 +5,7 @@ import org.xbib.j2html.tags.attributes.ICite; import org.xbib.j2html.tags.attributes.IDatetime; public class InsTag extends ContainerTag implements ICite, IDatetime { - public InsTag() { - super("ins"); - } + public InsTag() { + super("ins"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/KbdTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/KbdTag.java index 7eb1a70..94f309f 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/KbdTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/KbdTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class KbdTag extends ContainerTag { - public KbdTag() { - super("kbd"); - } + public KbdTag() { + super("kbd"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/KeygenTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/KeygenTag.java index 6a7dafa..761ad53 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/KeygenTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/KeygenTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.EmptyTag; public class KeygenTag extends EmptyTag { - public KeygenTag() { - super("keygen"); - } + public KeygenTag() { + super("keygen"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/LabelTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/LabelTag.java index 2157f65..0de9478 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/LabelTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/LabelTag.java @@ -5,7 +5,7 @@ import org.xbib.j2html.tags.attributes.IFor; import org.xbib.j2html.tags.attributes.IForm; public class LabelTag extends ContainerTag implements IFor, IForm { - public LabelTag() { - super("label"); - } + public LabelTag() { + super("label"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/LegendTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/LegendTag.java index 50dbcd0..fe40607 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/LegendTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/LegendTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class LegendTag extends ContainerTag { - public LegendTag() { - super("legend"); - } + public LegendTag() { + super("legend"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/LiTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/LiTag.java index 6840abb..dd7bc40 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/LiTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/LiTag.java @@ -4,7 +4,7 @@ import org.xbib.j2html.tags.ContainerTag; import org.xbib.j2html.tags.attributes.IValue; public class LiTag extends ContainerTag implements IValue { - public LiTag() { - super("li"); - } + public LiTag() { + super("li"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/LinkTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/LinkTag.java index c5419ba..a2baed5 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/LinkTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/LinkTag.java @@ -10,7 +10,7 @@ import org.xbib.j2html.tags.attributes.ISizes; import org.xbib.j2html.tags.attributes.IType; public class LinkTag extends EmptyTag implements IHref, IHreflang, IMedia, IOnload, IRel, ISizes, IType { - public LinkTag() { - super("link"); - } + public LinkTag() { + super("link"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/MainTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/MainTag.java index 1329dfa..57afd68 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/MainTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/MainTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class MainTag extends ContainerTag { - public MainTag() { - super("main"); - } + public MainTag() { + super("main"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/MapTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/MapTag.java index 726bd2e..7acef2b 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/MapTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/MapTag.java @@ -4,7 +4,7 @@ import org.xbib.j2html.tags.ContainerTag; import org.xbib.j2html.tags.attributes.IName; public class MapTag extends ContainerTag implements IName { - public MapTag() { - super("map"); - } + public MapTag() { + super("map"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/MarkTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/MarkTag.java index be9775a..4fd5d79 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/MarkTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/MarkTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class MarkTag extends ContainerTag { - public MarkTag() { - super("mark"); - } + public MarkTag() { + super("mark"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/MenuTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/MenuTag.java index b225988..7417d7c 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/MenuTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/MenuTag.java @@ -4,7 +4,7 @@ import org.xbib.j2html.tags.ContainerTag; import org.xbib.j2html.tags.attributes.IType; public class MenuTag extends ContainerTag implements IType { - public MenuTag() { - super("menu"); - } + public MenuTag() { + super("menu"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/MenuitemTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/MenuitemTag.java index e697021..49cf463 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/MenuitemTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/MenuitemTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class MenuitemTag extends ContainerTag { - public MenuitemTag() { - super("menuitem"); - } + public MenuitemTag() { + super("menuitem"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/MetaTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/MetaTag.java index 33872a8..bd1ed93 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/MetaTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/MetaTag.java @@ -6,7 +6,7 @@ import org.xbib.j2html.tags.attributes.IContent; import org.xbib.j2html.tags.attributes.IName; public class MetaTag extends EmptyTag implements ICharset, IContent, IName { - public MetaTag() { - super("meta"); - } + public MetaTag() { + super("meta"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/MeterTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/MeterTag.java index 9de80eb..bfc6b28 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/MeterTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/MeterTag.java @@ -10,7 +10,7 @@ import org.xbib.j2html.tags.attributes.IOptimum; import org.xbib.j2html.tags.attributes.IValue; public class MeterTag extends ContainerTag implements IForm, IHigh, ILow, IMax, IMin, IOptimum, IValue { - public MeterTag() { - super("meter"); - } + public MeterTag() { + super("meter"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/NavTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/NavTag.java index 07bb467..8551328 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/NavTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/NavTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class NavTag extends ContainerTag { - public NavTag() { - super("nav"); - } + public NavTag() { + super("nav"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/NoscriptTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/NoscriptTag.java index bb26283..6971e5f 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/NoscriptTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/NoscriptTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class NoscriptTag extends ContainerTag { - public NoscriptTag() { - super("noscript"); - } + public NoscriptTag() { + super("noscript"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ObjectTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ObjectTag.java index 758e4ec..98d7bc3 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ObjectTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ObjectTag.java @@ -13,7 +13,7 @@ import org.xbib.j2html.tags.attributes.IUsemap; import org.xbib.j2html.tags.attributes.IWidth; public class ObjectTag extends ContainerTag implements IData, IForm, IHeight, IName, IOnabort, IOncanplay, IOnerror, IType, IUsemap, IWidth { - public ObjectTag() { - super("object"); - } + public ObjectTag() { + super("object"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/OlTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/OlTag.java index 3164cca..5e047e0 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/OlTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/OlTag.java @@ -5,7 +5,7 @@ import org.xbib.j2html.tags.attributes.IReversed; import org.xbib.j2html.tags.attributes.IStart; public class OlTag extends ContainerTag implements IReversed, IStart { - public OlTag() { - super("ol"); - } + public OlTag() { + super("ol"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/OptgroupTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/OptgroupTag.java index 40f0c29..1b6438e 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/OptgroupTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/OptgroupTag.java @@ -5,7 +5,7 @@ import org.xbib.j2html.tags.attributes.IDisabled; import org.xbib.j2html.tags.attributes.ILabel; public class OptgroupTag extends ContainerTag implements IDisabled, ILabel { - public OptgroupTag() { - super("optgroup"); - } + public OptgroupTag() { + super("optgroup"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/OptionTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/OptionTag.java index e55cee7..eaa86eb 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/OptionTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/OptionTag.java @@ -7,7 +7,7 @@ import org.xbib.j2html.tags.attributes.ISelected; import org.xbib.j2html.tags.attributes.IValue; public class OptionTag extends ContainerTag implements IDisabled, ILabel, ISelected, IValue { - public OptionTag() { - super("option"); - } + public OptionTag() { + super("option"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/OutputTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/OutputTag.java index 054f47d..f88cb0e 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/OutputTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/OutputTag.java @@ -6,7 +6,7 @@ import org.xbib.j2html.tags.attributes.IForm; import org.xbib.j2html.tags.attributes.IName; public class OutputTag extends ContainerTag implements IFor, IForm, IName { - public OutputTag() { - super("output"); - } + public OutputTag() { + super("output"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/PTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/PTag.java index a72cfe0..daa5add 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/PTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/PTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class PTag extends ContainerTag { - public PTag() { - super("p"); - } + public PTag() { + super("p"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ParamTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ParamTag.java index 507cd06..c405b75 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ParamTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ParamTag.java @@ -5,7 +5,7 @@ import org.xbib.j2html.tags.attributes.IName; import org.xbib.j2html.tags.attributes.IValue; public class ParamTag extends EmptyTag implements IName, IValue { - public ParamTag() { - super("param"); - } + public ParamTag() { + super("param"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/PictureTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/PictureTag.java index b3ad221..e1af6e9 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/PictureTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/PictureTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class PictureTag extends ContainerTag { - public PictureTag() { - super("picture"); - } + public PictureTag() { + super("picture"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/PreTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/PreTag.java index a2b1250..7218a4b 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/PreTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/PreTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class PreTag extends ContainerTag { - public PreTag() { - super("pre"); - } + public PreTag() { + super("pre"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ProgressTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ProgressTag.java index 91eaae9..d6d317b 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ProgressTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ProgressTag.java @@ -5,7 +5,7 @@ import org.xbib.j2html.tags.attributes.IMax; import org.xbib.j2html.tags.attributes.IValue; public class ProgressTag extends ContainerTag implements IMax, IValue { - public ProgressTag() { - super("progress"); - } + public ProgressTag() { + super("progress"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/QTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/QTag.java index 526bba7..971d682 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/QTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/QTag.java @@ -4,7 +4,7 @@ import org.xbib.j2html.tags.ContainerTag; import org.xbib.j2html.tags.attributes.ICite; public class QTag extends ContainerTag implements ICite { - public QTag() { - super("q"); - } + public QTag() { + super("q"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/RpTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/RpTag.java index bdc2622..f923f60 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/RpTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/RpTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class RpTag extends ContainerTag { - public RpTag() { - super("rp"); - } + public RpTag() { + super("rp"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/RtTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/RtTag.java index 8f6c2b7..5f38f20 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/RtTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/RtTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class RtTag extends ContainerTag { - public RtTag() { - super("rt"); - } + public RtTag() { + super("rt"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/RubyTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/RubyTag.java index e9f51eb..7dfa0f1 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/RubyTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/RubyTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class RubyTag extends ContainerTag { - public RubyTag() { - super("ruby"); - } + public RubyTag() { + super("ruby"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/STag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/STag.java index 4843c5a..5477ca4 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/STag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/STag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class STag extends ContainerTag { - public STag() { - super("s"); - } + public STag() { + super("s"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SampTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SampTag.java index b9485df..12377d6 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SampTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SampTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class SampTag extends ContainerTag { - public SampTag() { - super("samp"); - } + public SampTag() { + super("samp"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ScriptTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ScriptTag.java index 9075580..1cf38ac 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ScriptTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ScriptTag.java @@ -10,7 +10,7 @@ import org.xbib.j2html.tags.attributes.ISrc; import org.xbib.j2html.tags.attributes.IType; public class ScriptTag extends ContainerTag implements IAsync, ICharset, IDefer, IOnerror, IOnload, ISrc, IType { - public ScriptTag() { - super("script"); - } + public ScriptTag() { + super("script"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SectionTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SectionTag.java index 9ae1152..d62b9de 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SectionTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SectionTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class SectionTag extends ContainerTag { - public SectionTag() { - super("section"); - } + public SectionTag() { + super("section"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SelectTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SelectTag.java index 5b6b311..728cf98 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SelectTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SelectTag.java @@ -10,7 +10,7 @@ import org.xbib.j2html.tags.attributes.IRequired; import org.xbib.j2html.tags.attributes.ISize; public class SelectTag extends ContainerTag implements IAutofocus, IDisabled, IForm, IMultiple, IName, IRequired, ISize { - public SelectTag() { - super("select"); - } + public SelectTag() { + super("select"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SlotTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SlotTag.java index db929c4..eb2b7be 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SlotTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SlotTag.java @@ -4,7 +4,7 @@ import org.xbib.j2html.tags.ContainerTag; import org.xbib.j2html.tags.attributes.IName; public class SlotTag extends ContainerTag implements IName { - public SlotTag() { - super("slot"); - } + public SlotTag() { + super("slot"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SmallTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SmallTag.java index 12a710c..b18f57c 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SmallTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SmallTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class SmallTag extends ContainerTag { - public SmallTag() { - super("small"); - } + public SmallTag() { + super("small"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SourceTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SourceTag.java index 4c09590..0da4d7f 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SourceTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SourceTag.java @@ -8,7 +8,7 @@ import org.xbib.j2html.tags.attributes.ISrcset; import org.xbib.j2html.tags.attributes.IType; public class SourceTag extends EmptyTag implements IMedia, ISizes, ISrc, ISrcset, IType { - public SourceTag() { - super("source"); - } + public SourceTag() { + super("source"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SpanTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SpanTag.java index 51ce4e2..53dfa16 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SpanTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SpanTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class SpanTag extends ContainerTag { - public SpanTag() { - super("span"); - } + public SpanTag() { + super("span"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/StrongTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/StrongTag.java index 27ce5e2..1639e70 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/StrongTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/StrongTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class StrongTag extends ContainerTag { - public StrongTag() { - super("strong"); - } + public StrongTag() { + super("strong"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/StyleTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/StyleTag.java index 47c2c7c..0ca2827 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/StyleTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/StyleTag.java @@ -7,7 +7,7 @@ import org.xbib.j2html.tags.attributes.IOnload; import org.xbib.j2html.tags.attributes.IType; public class StyleTag extends ContainerTag implements IMedia, IOnerror, IOnload, IType { - public StyleTag() { - super("style"); - } + public StyleTag() { + super("style"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SubTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SubTag.java index 56b875e..a652948 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SubTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SubTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class SubTag extends ContainerTag { - public SubTag() { - super("sub"); - } + public SubTag() { + super("sub"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SummaryTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SummaryTag.java index d60d7e3..ac890ee 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SummaryTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SummaryTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class SummaryTag extends ContainerTag { - public SummaryTag() { - super("summary"); - } + public SummaryTag() { + super("summary"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SupTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SupTag.java index 6cc48eb..93ae3fe 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/SupTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/SupTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class SupTag extends ContainerTag { - public SupTag() { - super("sup"); - } + public SupTag() { + super("sup"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TableTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TableTag.java index 83f131b..36d495f 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TableTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TableTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class TableTag extends ContainerTag { - public TableTag() { - super("table"); - } + public TableTag() { + super("table"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TbodyTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TbodyTag.java index 18c9529..a187bc6 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TbodyTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TbodyTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class TbodyTag extends ContainerTag { - public TbodyTag() { - super("tbody"); - } + public TbodyTag() { + super("tbody"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TdTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TdTag.java index d37e356..856d793 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TdTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TdTag.java @@ -6,7 +6,7 @@ import org.xbib.j2html.tags.attributes.IHeaders; import org.xbib.j2html.tags.attributes.IRowspan; public class TdTag extends ContainerTag implements IColspan, IHeaders, IRowspan { - public TdTag() { - super("td"); - } + public TdTag() { + super("td"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TemplateTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TemplateTag.java index 90114aa..ae8e96b 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TemplateTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TemplateTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class TemplateTag extends ContainerTag { - public TemplateTag() { - super("template"); - } + public TemplateTag() { + super("template"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TextareaTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TextareaTag.java index 01730b4..a3101a8 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TextareaTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TextareaTag.java @@ -15,7 +15,7 @@ import org.xbib.j2html.tags.attributes.IRows; import org.xbib.j2html.tags.attributes.IWrap; public class TextareaTag extends ContainerTag implements IAutofocus, ICols, IDirname, IDisabled, IForm, IMaxlength, IName, IPlaceholder, IReadonly, IRequired, IRows, IWrap { - public TextareaTag() { - super("textarea"); - } + public TextareaTag() { + super("textarea"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TfootTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TfootTag.java index 5e7ef23..a904460 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TfootTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TfootTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class TfootTag extends ContainerTag { - public TfootTag() { - super("tfoot"); - } + public TfootTag() { + super("tfoot"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ThTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ThTag.java index 52f7a35..f4b25f6 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/ThTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/ThTag.java @@ -7,7 +7,7 @@ import org.xbib.j2html.tags.attributes.IRowspan; import org.xbib.j2html.tags.attributes.IScope; public class ThTag extends ContainerTag implements IColspan, IHeaders, IRowspan, IScope { - public ThTag() { - super("th"); - } + public ThTag() { + super("th"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TheadTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TheadTag.java index c293354..ce9dc77 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TheadTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TheadTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class TheadTag extends ContainerTag { - public TheadTag() { - super("thead"); - } + public TheadTag() { + super("thead"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TimeTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TimeTag.java index fa974be..1faf3b5 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TimeTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TimeTag.java @@ -4,7 +4,7 @@ import org.xbib.j2html.tags.ContainerTag; import org.xbib.j2html.tags.attributes.IDatetime; public class TimeTag extends ContainerTag implements IDatetime { - public TimeTag() { - super("time"); - } + public TimeTag() { + super("time"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TitleTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TitleTag.java index 358f59e..478bfc1 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TitleTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TitleTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class TitleTag extends ContainerTag { - public TitleTag() { - super("title"); - } + public TitleTag() { + super("title"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TrTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TrTag.java index 6d6d484..2f7df2c 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TrTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TrTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class TrTag extends ContainerTag { - public TrTag() { - super("tr"); - } + public TrTag() { + super("tr"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TrackTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TrackTag.java index 5fa105f..8aa6a1c 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/TrackTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/TrackTag.java @@ -9,7 +9,7 @@ import org.xbib.j2html.tags.attributes.ISrc; import org.xbib.j2html.tags.attributes.ISrclang; public class TrackTag extends EmptyTag implements IDefault, IKind, ILabel, IOncuechange, ISrc, ISrclang { - public TrackTag() { - super("track"); - } + public TrackTag() { + super("track"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/UTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/UTag.java index ad80613..382c669 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/UTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/UTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class UTag extends ContainerTag { - public UTag() { - super("u"); - } + public UTag() { + super("u"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/UlTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/UlTag.java index 7fbb65f..ec6a2b6 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/UlTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/UlTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class UlTag extends ContainerTag { - public UlTag() { - super("ul"); - } + public UlTag() { + super("ul"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/VarTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/VarTag.java index 1cde64a..cb70d91 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/VarTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/VarTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.ContainerTag; public class VarTag extends ContainerTag { - public VarTag() { - super("var"); - } + public VarTag() { + super("var"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/VideoTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/VideoTag.java index 570de01..b3bc919 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/VideoTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/VideoTag.java @@ -34,7 +34,7 @@ import org.xbib.j2html.tags.attributes.ISrc; import org.xbib.j2html.tags.attributes.IWidth; public class VideoTag extends ContainerTag implements IAutoplay, IControls, IHeight, ILoop, IMuted, IOnabort, IOncanplay, IOncanplaythrough, IOndurationchange, IOnemptied, IOnended, IOnerror, IOnloadeddata, IOnloadedmetadata, IOnloadstart, IOnpause, IOnplay, IOnplaying, IOnprogress, IOnratechange, IOnseeked, IOnseeking, IOnstalled, IOnsuspend, IOntimeupdate, IOnvolumechanged, IOnwaiting, IPoster, IPreload, ISrc, IWidth { - public VideoTag() { - super("video"); - } + public VideoTag() { + super("video"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/tags/specialized/WbrTag.java b/j2html/src/main/java/org/xbib/j2html/tags/specialized/WbrTag.java index 2a86897..0ffa9ae 100644 --- a/j2html/src/main/java/org/xbib/j2html/tags/specialized/WbrTag.java +++ b/j2html/src/main/java/org/xbib/j2html/tags/specialized/WbrTag.java @@ -3,7 +3,7 @@ package org.xbib.j2html.tags.specialized; import org.xbib.j2html.tags.EmptyTag; public class WbrTag extends EmptyTag { - public WbrTag() { - super("wbr"); - } + public WbrTag() { + super("wbr"); + } } diff --git a/j2html/src/main/java/org/xbib/j2html/utils/CSSMin.java b/j2html/src/main/java/org/xbib/j2html/utils/CSSMin.java index 9babbd4..ec38823 100644 --- a/j2html/src/main/java/org/xbib/j2html/utils/CSSMin.java +++ b/j2html/src/main/java/org/xbib/j2html/utils/CSSMin.java @@ -76,8 +76,8 @@ public class CSSMin { public static String compressCss(String input) { try { int k, - j, // Number of open braces - n; // Current position in stream + j, // Number of open braces + n; // Current position in stream char curr; BufferedReader br = new BufferedReader(new StringReader(input)); @@ -224,7 +224,7 @@ class Selector { private ArrayList parseProperties(String contents) { ArrayList parts = new ArrayList<>(); boolean bInsideString = false, - bInsideURL = false; + bInsideURL = false; int j = 0; String substr; for (int i = 0; i < contents.length(); i++) { @@ -246,7 +246,7 @@ class Selector { j = i + 1; } } - substr = contents.substring(j, contents.length()); + substr = contents.substring(j); if (!(substr.trim().equals(""))) { parts.add(substr); } @@ -303,7 +303,7 @@ class Property implements Comparable { j = i + 1; } } - substr = property.substring(j, property.length()); + substr = property.substring(j); if (!(substr.trim().equals(""))) { parts.add(substr); } @@ -312,7 +312,7 @@ class Property implements Comparable { } String prop = parts.get(0).trim(); - if (!(prop.length() > 2 && prop.substring(0, 2).equals("--"))) { + if (!(prop.length() > 2 && prop.startsWith("--"))) { prop = prop.toLowerCase(); } this.property = prop; @@ -419,7 +419,7 @@ class Property implements Comparable { class Part { private String contents; - private String property; + private final String property; /** * Create a new property by parsing the given string. diff --git a/j2html/src/main/java/org/xbib/j2html/utils/EscapeUtil.java b/j2html/src/main/java/org/xbib/j2html/utils/EscapeUtil.java index c8cc918..5651072 100644 --- a/j2html/src/main/java/org/xbib/j2html/utils/EscapeUtil.java +++ b/j2html/src/main/java/org/xbib/j2html/utils/EscapeUtil.java @@ -6,7 +6,7 @@ public class EscapeUtil { if (s == null) { return null; } - StringBuilder escapedText = new StringBuilder(s.length()+16); + StringBuilder escapedText = new StringBuilder(s.length() + 16); char currentChar; for (int i = 0; i < s.length(); i++) { currentChar = s.charAt(i); @@ -32,5 +32,4 @@ public class EscapeUtil { } return escapedText.toString(); } - } diff --git a/j2html/src/main/java/org/xbib/j2html/utils/JSMin.java b/j2html/src/main/java/org/xbib/j2html/utils/JSMin.java index 2b88341..80ad9cd 100644 --- a/j2html/src/main/java/org/xbib/j2html/utils/JSMin.java +++ b/j2html/src/main/java/org/xbib/j2html/utils/JSMin.java @@ -86,12 +86,12 @@ public class JSMin { */ private static boolean isAlphanum(int c) { return ((c >= 'a' && c <= 'z') || - (c >= '0' && c <= '9') || - (c >= 'A' && c <= 'Z') || - c == '_' || - c == '$' || - c == '\\' || - c > 126); + (c >= '0' && c <= '9') || + (c >= 'A' && c <= 'Z') || + c == '_' || + c == '$' || + c == '\\' || + c > 126); } /** @@ -171,7 +171,7 @@ public class JSMin { */ private void action(int d) throws IOException, UnterminatedRegExpLiteralException, - UnterminatedCommentException, UnterminatedStringLiteralException { + UnterminatedCommentException, UnterminatedStringLiteralException { switch (d) { case 1: out.write(theA); diff --git a/j2html/src/test/java/module-info.java b/j2html/src/test/java/module-info.java new file mode 100644 index 0000000..d726253 --- /dev/null +++ b/j2html/src/test/java/module-info.java @@ -0,0 +1,19 @@ +module org.xbib.j2html.test { + requires transitive org.junit.jupiter.api; + requires org.hamcrest; + requires org.xbib.j2html; + exports org.xbib.j2html.test; + exports org.xbib.j2html.test.attributes; + exports org.xbib.j2html.test.comparison.j2html; + exports org.xbib.j2html.test.comparison.model; + exports org.xbib.j2html.test.model; + exports org.xbib.j2html.test.rendering; + exports org.xbib.j2html.test.tags; + opens org.xbib.j2html.test; + opens org.xbib.j2html.test.attributes; + opens org.xbib.j2html.test.comparison.j2html; + opens org.xbib.j2html.test.comparison.model; + opens org.xbib.j2html.test.model; + opens org.xbib.j2html.test.rendering; + opens org.xbib.j2html.test.tags; +} diff --git a/j2html/src/test/java/org/xbib/j2html/tags/InlineStaticResourceTest.java b/j2html/src/test/java/org/xbib/j2html/tags/InlineStaticResourceTest.java deleted file mode 100644 index b17addb..0000000 --- a/j2html/src/test/java/org/xbib/j2html/tags/InlineStaticResourceTest.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.xbib.j2html.tags; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import static org.xbib.j2html.TagCreator.fileAsEscapedString; -import static org.xbib.j2html.TagCreator.fileAsString; -import static org.xbib.j2html.TagCreator.scriptWithInlineFile_min; -import static org.xbib.j2html.TagCreator.styleWithInlineFile_min; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; - -public class InlineStaticResourceTest { - - private static final String EOL = System.getProperty("line.separator"); // System independent End Of Line - - @Test - public void testAllTags() throws Exception { - - String expectedCss = ""; - String expectedJs = ""; - String expectedHtml = "" + EOL + " Any content" + EOL + "" + EOL; - String expectedEscapedHtml = "<body>" + EOL + " Any content" + EOL + "</body>" + EOL; - String expectedAnyContent = "public class AnyContent {" + EOL + "}" + EOL; - - // classpath files - assertThat(styleWithInlineFile_min("/test.css").render(), is(expectedCss)); - assertThat(styleWithInlineFile_min("/test-without-trailing-semis.css").render(), is(expectedCss)); - assertThat(scriptWithInlineFile_min("/test.js").render(), is(expectedJs)); - assertThat(fileAsString("/test.html").render(), is(expectedHtml)); - assertThat(fileAsEscapedString("/test.html").render(), is(expectedEscapedHtml)); - assertThat(fileAsString("/AnyContent.java").render(), is(expectedAnyContent)); - - // files outside classpath - assertThat(styleWithInlineFile_min("src/test/resources/test.css").render(), is(expectedCss)); - assertThat(scriptWithInlineFile_min("src/test/resources/test.js").render(), is(expectedJs)); - assertThat(fileAsString("src/test/resources/test.html").render(), is(expectedHtml)); - assertThat(fileAsEscapedString("src/test/resources/test.html").render(), is(expectedEscapedHtml)); - assertThat(fileAsString("src/test/resources/AnyContent.java").render(), is(expectedAnyContent)); - } - - @Test - public void testExceptionForBadPath() { - Assertions.assertThrows(RuntimeException.class, () -> { - styleWithInlineFile_min("NOT A FILE"); - }); - } -} diff --git a/j2html/src/test/java/org/xbib/j2html/PerformanceTest.java b/j2html/src/test/java/org/xbib/j2html/test/PerformanceTest.java similarity index 77% rename from j2html/src/test/java/org/xbib/j2html/PerformanceTest.java rename to j2html/src/test/java/org/xbib/j2html/test/PerformanceTest.java index c33bdab..a2f8d92 100644 --- a/j2html/src/test/java/org/xbib/j2html/PerformanceTest.java +++ b/j2html/src/test/java/org/xbib/j2html/test/PerformanceTest.java @@ -1,19 +1,10 @@ -package org.xbib.j2html; +package org.xbib.j2html.test; -//import com.carrotsearch.junitbenchmarks.BenchmarkOptions; -//import com.carrotsearch.junitbenchmarks.BenchmarkRule; -//import com.carrotsearch.junitbenchmarks.Clock; import org.junit.jupiter.api.Test; import org.xbib.j2html.utils.EscapeUtil; -import org.apache.commons.lang3.StringEscapeUtils; -//@FixMethodOrder(MethodSorters.NAME_ASCENDING) -//@BenchmarkOptions(callgc = false, benchmarkRounds = 10000, warmupRounds = 200, concurrency = 2, clock = Clock.NANO_TIME) public class PerformanceTest { - //@Rule - //public TestRule benchmarkRun = new BenchmarkRule(); - private String shortTestString = "\n" + "

Heading!

\n" + " \n" @@ -34,22 +25,12 @@ public class PerformanceTest { + ""; @Test - public void testSimpleEscaperShort() throws Exception { + public void testSimpleEscaperShort() { EscapeUtil.escape(shortTestString); } @Test - public void testSimpleEscaperLong() throws Exception { + public void testSimpleEscaperLong() { EscapeUtil.escape(longTestString); } - - @Test - public void testApacheEscaperShort() throws Exception { - StringEscapeUtils.escapeHtml4(shortTestString); - } - - @Test - public void testApacheEscaperLong() throws Exception { - StringEscapeUtils.escapeHtml4(longTestString); - } } diff --git a/j2html/src/test/java/org/xbib/j2html/RenderPerformanceTest.java b/j2html/src/test/java/org/xbib/j2html/test/RenderPerformanceTest.java similarity index 97% rename from j2html/src/test/java/org/xbib/j2html/RenderPerformanceTest.java rename to j2html/src/test/java/org/xbib/j2html/test/RenderPerformanceTest.java index 2ba1aed..52af5b1 100644 --- a/j2html/src/test/java/org/xbib/j2html/RenderPerformanceTest.java +++ b/j2html/src/test/java/org/xbib/j2html/test/RenderPerformanceTest.java @@ -1,14 +1,14 @@ -package org.xbib.j2html; +package org.xbib.j2html.test; //import com.carrotsearch.junitbenchmarks.BenchmarkOptions; //import com.carrotsearch.junitbenchmarks.BenchmarkRule; //import com.carrotsearch.junitbenchmarks.Clock; import org.junit.jupiter.api.Test; -import org.xbib.j2html.model.BrowserTitle; -import org.xbib.j2html.model.Button; -import org.xbib.j2html.model.ButtonModel; -import org.xbib.j2html.model.PageModel; -import org.xbib.j2html.model.TextTemplate; +import org.xbib.j2html.test.model.BrowserTitle; +import org.xbib.j2html.test.model.Button; +import org.xbib.j2html.test.model.ButtonModel; +import org.xbib.j2html.test.model.PageModel; +import org.xbib.j2html.test.model.TextTemplate; import org.xbib.j2html.tags.DomContent; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.xbib.j2html.TagCreator.attrs; diff --git a/j2html/src/test/java/org/xbib/j2html/TextEscaperTest.java b/j2html/src/test/java/org/xbib/j2html/test/TextEscaperTest.java similarity index 94% rename from j2html/src/test/java/org/xbib/j2html/TextEscaperTest.java rename to j2html/src/test/java/org/xbib/j2html/test/TextEscaperTest.java index bfe1602..d056d5c 100644 --- a/j2html/src/test/java/org/xbib/j2html/TextEscaperTest.java +++ b/j2html/src/test/java/org/xbib/j2html/test/TextEscaperTest.java @@ -1,6 +1,7 @@ -package org.xbib.j2html; +package org.xbib.j2html.test; import org.junit.jupiter.api.Test; +import org.xbib.j2html.Config; import org.xbib.j2html.utils.EscapeUtil; import org.xbib.j2html.utils.TextEscaper; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/j2html/src/test/java/org/xbib/j2html/attributes/AttrShortFormTest.java b/j2html/src/test/java/org/xbib/j2html/test/attributes/AttrShortFormTest.java similarity index 98% rename from j2html/src/test/java/org/xbib/j2html/attributes/AttrShortFormTest.java rename to j2html/src/test/java/org/xbib/j2html/test/attributes/AttrShortFormTest.java index f1c6b18..bf09904 100644 --- a/j2html/src/test/java/org/xbib/j2html/attributes/AttrShortFormTest.java +++ b/j2html/src/test/java/org/xbib/j2html/test/attributes/AttrShortFormTest.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.attributes; +package org.xbib.j2html.test.attributes; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/j2html/src/test/java/org/xbib/j2html/attributes/AttributeTest.java b/j2html/src/test/java/org/xbib/j2html/test/attributes/AttributeTest.java similarity index 91% rename from j2html/src/test/java/org/xbib/j2html/attributes/AttributeTest.java rename to j2html/src/test/java/org/xbib/j2html/test/attributes/AttributeTest.java index f2f0f71..c802dec 100644 --- a/j2html/src/test/java/org/xbib/j2html/attributes/AttributeTest.java +++ b/j2html/src/test/java/org/xbib/j2html/test/attributes/AttributeTest.java @@ -1,5 +1,6 @@ -package org.xbib.j2html.attributes; +package org.xbib.j2html.test.attributes; +import org.xbib.j2html.attributes.Attribute; import org.xbib.j2html.tags.ContainerTag; import org.junit.jupiter.api.Test; diff --git a/j2html/src/test/java/org/xbib/j2html/comparison/ComparisonData.java b/j2html/src/test/java/org/xbib/j2html/test/comparison/ComparisonData.java similarity index 81% rename from j2html/src/test/java/org/xbib/j2html/comparison/ComparisonData.java rename to j2html/src/test/java/org/xbib/j2html/test/comparison/ComparisonData.java index 4568a08..bb67fde 100644 --- a/j2html/src/test/java/org/xbib/j2html/comparison/ComparisonData.java +++ b/j2html/src/test/java/org/xbib/j2html/test/comparison/ComparisonData.java @@ -1,6 +1,6 @@ -package org.xbib.j2html.comparison; +package org.xbib.j2html.test.comparison; -import org.xbib.j2html.comparison.model.Employee; +import org.xbib.j2html.test.comparison.model.Employee; import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream; diff --git a/j2html/src/test/java/org/xbib/j2html/comparison/RenderPerformanceComparisonTest.java b/j2html/src/test/java/org/xbib/j2html/test/comparison/RenderPerformanceComparisonTest.java similarity index 95% rename from j2html/src/test/java/org/xbib/j2html/comparison/RenderPerformanceComparisonTest.java rename to j2html/src/test/java/org/xbib/j2html/test/comparison/RenderPerformanceComparisonTest.java index d5c2303..884d8a6 100644 --- a/j2html/src/test/java/org/xbib/j2html/comparison/RenderPerformanceComparisonTest.java +++ b/j2html/src/test/java/org/xbib/j2html/test/comparison/RenderPerformanceComparisonTest.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.comparison; +package org.xbib.j2html.test.comparison; //import com.carrotsearch.junitbenchmarks.BenchmarkOptions; //import com.carrotsearch.junitbenchmarks.BenchmarkRule; diff --git a/j2html/src/test/java/org/xbib/j2html/comparison/TestJ2html.java b/j2html/src/test/java/org/xbib/j2html/test/comparison/TestJ2html.java similarity index 64% rename from j2html/src/test/java/org/xbib/j2html/comparison/TestJ2html.java rename to j2html/src/test/java/org/xbib/j2html/test/comparison/TestJ2html.java index 0eef5fe..62bb4aa 100644 --- a/j2html/src/test/java/org/xbib/j2html/comparison/TestJ2html.java +++ b/j2html/src/test/java/org/xbib/j2html/test/comparison/TestJ2html.java @@ -1,9 +1,9 @@ -package org.xbib.j2html.comparison; +package org.xbib.j2html.test.comparison; -import org.xbib.j2html.comparison.j2html.FiveHundredEmployees; -import org.xbib.j2html.comparison.j2html.HelloWorld; -import org.xbib.j2html.comparison.j2html.Macros; -import org.xbib.j2html.comparison.j2html.MultiplicationTable; +import org.xbib.j2html.test.comparison.j2html.FiveHundredEmployees; +import org.xbib.j2html.test.comparison.j2html.HelloWorld; +import org.xbib.j2html.test.comparison.j2html.Macros; +import org.xbib.j2html.test.comparison.j2html.MultiplicationTable; public class TestJ2html { diff --git a/j2html/src/test/java/org/xbib/j2html/comparison/TestVelocity.java b/j2html/src/test/java/org/xbib/j2html/test/comparison/TestVelocity.java similarity index 97% rename from j2html/src/test/java/org/xbib/j2html/comparison/TestVelocity.java rename to j2html/src/test/java/org/xbib/j2html/test/comparison/TestVelocity.java index fc81fd9..3c0d4ac 100644 --- a/j2html/src/test/java/org/xbib/j2html/comparison/TestVelocity.java +++ b/j2html/src/test/java/org/xbib/j2html/test/comparison/TestVelocity.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.comparison; +package org.xbib.j2html.test.comparison; import java.io.StringWriter; import java.nio.charset.StandardCharsets; diff --git a/j2html/src/test/java/org/xbib/j2html/comparison/j2html/FiveHundredEmployees.java b/j2html/src/test/java/org/xbib/j2html/test/comparison/j2html/FiveHundredEmployees.java similarity index 83% rename from j2html/src/test/java/org/xbib/j2html/comparison/j2html/FiveHundredEmployees.java rename to j2html/src/test/java/org/xbib/j2html/test/comparison/j2html/FiveHundredEmployees.java index d10c4ed..a4719f2 100644 --- a/j2html/src/test/java/org/xbib/j2html/comparison/j2html/FiveHundredEmployees.java +++ b/j2html/src/test/java/org/xbib/j2html/test/comparison/j2html/FiveHundredEmployees.java @@ -1,6 +1,6 @@ -package org.xbib.j2html.comparison.j2html; +package org.xbib.j2html.test.comparison.j2html; -import org.xbib.j2html.comparison.ComparisonData; +import org.xbib.j2html.test.comparison.ComparisonData; import org.xbib.j2html.tags.specialized.UlTag; import static org.xbib.j2html.TagCreator.each; diff --git a/j2html/src/test/java/org/xbib/j2html/comparison/j2html/HelloWorld.java b/j2html/src/test/java/org/xbib/j2html/test/comparison/j2html/HelloWorld.java similarity index 93% rename from j2html/src/test/java/org/xbib/j2html/comparison/j2html/HelloWorld.java rename to j2html/src/test/java/org/xbib/j2html/test/comparison/j2html/HelloWorld.java index b9db834..59d21e8 100644 --- a/j2html/src/test/java/org/xbib/j2html/comparison/j2html/HelloWorld.java +++ b/j2html/src/test/java/org/xbib/j2html/test/comparison/j2html/HelloWorld.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.comparison.j2html; +package org.xbib.j2html.test.comparison.j2html; import org.xbib.j2html.tags.specialized.HtmlTag; diff --git a/j2html/src/test/java/org/xbib/j2html/comparison/j2html/Macros.java b/j2html/src/test/java/org/xbib/j2html/test/comparison/j2html/Macros.java similarity index 96% rename from j2html/src/test/java/org/xbib/j2html/comparison/j2html/Macros.java rename to j2html/src/test/java/org/xbib/j2html/test/comparison/j2html/Macros.java index 5314fbe..4fe8a69 100644 --- a/j2html/src/test/java/org/xbib/j2html/comparison/j2html/Macros.java +++ b/j2html/src/test/java/org/xbib/j2html/test/comparison/j2html/Macros.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.comparison.j2html; +package org.xbib.j2html.test.comparison.j2html; import org.xbib.j2html.tags.ContainerTag; import org.xbib.j2html.tags.DomContent; diff --git a/j2html/src/test/java/org/xbib/j2html/comparison/j2html/MultiplicationTable.java b/j2html/src/test/java/org/xbib/j2html/test/comparison/j2html/MultiplicationTable.java similarity index 72% rename from j2html/src/test/java/org/xbib/j2html/comparison/j2html/MultiplicationTable.java rename to j2html/src/test/java/org/xbib/j2html/test/comparison/j2html/MultiplicationTable.java index 0060e43..1d36a2a 100644 --- a/j2html/src/test/java/org/xbib/j2html/comparison/j2html/MultiplicationTable.java +++ b/j2html/src/test/java/org/xbib/j2html/test/comparison/j2html/MultiplicationTable.java @@ -1,6 +1,7 @@ -package org.xbib.j2html.comparison.j2html; +package org.xbib.j2html.test.comparison.j2html; -import org.xbib.j2html.comparison.ComparisonData; +import org.xbib.j2html.TagCreator; +import org.xbib.j2html.test.comparison.ComparisonData; import org.xbib.j2html.tags.ContainerTag; import static org.xbib.j2html.TagCreator.each; import static org.xbib.j2html.TagCreator.table; @@ -12,7 +13,7 @@ public class MultiplicationTable { public static ContainerTag tag = table( tbody( - each(ComparisonData.tableNumbers, i -> tr( + TagCreator.each(ComparisonData.tableNumbers, i -> tr( each(ComparisonData.tableNumbers, j -> td( String.valueOf(i * j) )) diff --git a/j2html/src/test/java/org/xbib/j2html/comparison/model/Employee.java b/j2html/src/test/java/org/xbib/j2html/test/comparison/model/Employee.java similarity index 89% rename from j2html/src/test/java/org/xbib/j2html/comparison/model/Employee.java rename to j2html/src/test/java/org/xbib/j2html/test/comparison/model/Employee.java index 701d520..750ebcf 100644 --- a/j2html/src/test/java/org/xbib/j2html/comparison/model/Employee.java +++ b/j2html/src/test/java/org/xbib/j2html/test/comparison/model/Employee.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.comparison.model; +package org.xbib.j2html.test.comparison.model; public class Employee { int id; diff --git a/j2html/src/test/java/org/xbib/j2html/model/BrowserTitle.java b/j2html/src/test/java/org/xbib/j2html/test/model/BrowserTitle.java similarity index 87% rename from j2html/src/test/java/org/xbib/j2html/model/BrowserTitle.java rename to j2html/src/test/java/org/xbib/j2html/test/model/BrowserTitle.java index a467e78..0ae6748 100644 --- a/j2html/src/test/java/org/xbib/j2html/model/BrowserTitle.java +++ b/j2html/src/test/java/org/xbib/j2html/test/model/BrowserTitle.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.model; +package org.xbib.j2html.test.model; import java.io.IOException; diff --git a/j2html/src/test/java/org/xbib/j2html/model/Button.java b/j2html/src/test/java/org/xbib/j2html/test/model/Button.java similarity index 96% rename from j2html/src/test/java/org/xbib/j2html/model/Button.java rename to j2html/src/test/java/org/xbib/j2html/test/model/Button.java index d8c43a6..7b934c0 100644 --- a/j2html/src/test/java/org/xbib/j2html/model/Button.java +++ b/j2html/src/test/java/org/xbib/j2html/test/model/Button.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.model; +package org.xbib.j2html.test.model; import org.xbib.j2html.tags.ContainerTag; import java.io.IOException; diff --git a/j2html/src/test/java/org/xbib/j2html/model/ButtonModel.java b/j2html/src/test/java/org/xbib/j2html/test/model/ButtonModel.java similarity index 83% rename from j2html/src/test/java/org/xbib/j2html/model/ButtonModel.java rename to j2html/src/test/java/org/xbib/j2html/test/model/ButtonModel.java index 341b713..45cdddc 100644 --- a/j2html/src/test/java/org/xbib/j2html/model/ButtonModel.java +++ b/j2html/src/test/java/org/xbib/j2html/test/model/ButtonModel.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.model; +package org.xbib.j2html.test.model; public class ButtonModel { private String text; diff --git a/j2html/src/test/java/org/xbib/j2html/model/DynamicHrefAttribute.java b/j2html/src/test/java/org/xbib/j2html/test/model/DynamicHrefAttribute.java similarity index 93% rename from j2html/src/test/java/org/xbib/j2html/model/DynamicHrefAttribute.java rename to j2html/src/test/java/org/xbib/j2html/test/model/DynamicHrefAttribute.java index 2ef1266..edaf010 100644 --- a/j2html/src/test/java/org/xbib/j2html/model/DynamicHrefAttribute.java +++ b/j2html/src/test/java/org/xbib/j2html/test/model/DynamicHrefAttribute.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.model; +package org.xbib.j2html.test.model; import org.xbib.j2html.attributes.Attribute; import java.io.IOException; diff --git a/j2html/src/test/java/org/xbib/j2html/model/PageModel.java b/j2html/src/test/java/org/xbib/j2html/test/model/PageModel.java similarity index 93% rename from j2html/src/test/java/org/xbib/j2html/model/PageModel.java rename to j2html/src/test/java/org/xbib/j2html/test/model/PageModel.java index ed413ae..4c84579 100644 --- a/j2html/src/test/java/org/xbib/j2html/model/PageModel.java +++ b/j2html/src/test/java/org/xbib/j2html/test/model/PageModel.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.model; +package org.xbib.j2html.test.model; public class PageModel { diff --git a/j2html/src/test/java/org/xbib/j2html/model/Template.java b/j2html/src/test/java/org/xbib/j2html/test/model/Template.java similarity index 94% rename from j2html/src/test/java/org/xbib/j2html/model/Template.java rename to j2html/src/test/java/org/xbib/j2html/test/model/Template.java index e9b87cd..7ada5b2 100644 --- a/j2html/src/test/java/org/xbib/j2html/model/Template.java +++ b/j2html/src/test/java/org/xbib/j2html/test/model/Template.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.model; +package org.xbib.j2html.test.model; import org.xbib.j2html.rendering.HtmlBuilder; import org.xbib.j2html.tags.DomContent; diff --git a/j2html/src/test/java/org/xbib/j2html/model/TextTemplate.java b/j2html/src/test/java/org/xbib/j2html/test/model/TextTemplate.java similarity index 87% rename from j2html/src/test/java/org/xbib/j2html/model/TextTemplate.java rename to j2html/src/test/java/org/xbib/j2html/test/model/TextTemplate.java index fdb6fb3..b8d9399 100644 --- a/j2html/src/test/java/org/xbib/j2html/model/TextTemplate.java +++ b/j2html/src/test/java/org/xbib/j2html/test/model/TextTemplate.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.model; +package org.xbib.j2html.test.model; import java.io.IOException; diff --git a/j2html/src/test/java/org/xbib/j2html/rendering/FlatHtmlTest.java b/j2html/src/test/java/org/xbib/j2html/test/rendering/FlatHtmlTest.java similarity index 94% rename from j2html/src/test/java/org/xbib/j2html/rendering/FlatHtmlTest.java rename to j2html/src/test/java/org/xbib/j2html/test/rendering/FlatHtmlTest.java index caa171e..065dea9 100644 --- a/j2html/src/test/java/org/xbib/j2html/rendering/FlatHtmlTest.java +++ b/j2html/src/test/java/org/xbib/j2html/test/rendering/FlatHtmlTest.java @@ -1,9 +1,11 @@ -package org.xbib.j2html.rendering; +package org.xbib.j2html.test.rendering; +import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.Test; import org.xbib.j2html.Config; import java.io.IOException; +import org.xbib.j2html.rendering.FlatHtml; import static org.xbib.j2html.TagCreator.div; import static org.xbib.j2html.TagCreator.input; @@ -14,7 +16,7 @@ public class FlatHtmlTest { @Test public void start_tags_contain_attributes() throws IOException { - assertThat( + MatcherAssert.assertThat( FlatHtml.inMemory().appendStartTag("abc") .appendAttribute("x", "X") .appendBooleanAttribute("y") diff --git a/j2html/src/test/java/org/xbib/j2html/rendering/IndentedHtmlTest.java b/j2html/src/test/java/org/xbib/j2html/test/rendering/IndentedHtmlTest.java similarity index 97% rename from j2html/src/test/java/org/xbib/j2html/rendering/IndentedHtmlTest.java rename to j2html/src/test/java/org/xbib/j2html/test/rendering/IndentedHtmlTest.java index 5b40fdb..d64b147 100644 --- a/j2html/src/test/java/org/xbib/j2html/rendering/IndentedHtmlTest.java +++ b/j2html/src/test/java/org/xbib/j2html/test/rendering/IndentedHtmlTest.java @@ -1,9 +1,11 @@ -package org.xbib.j2html.rendering; +package org.xbib.j2html.test.rendering; +import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.Test; import org.xbib.j2html.Config; import java.io.IOException; +import org.xbib.j2html.rendering.IndentedHtml; import static org.xbib.j2html.TagCreator.*; import static org.hamcrest.MatcherAssert.assertThat; @@ -13,7 +15,7 @@ public class IndentedHtmlTest { @Test public void unescaped_text_is_not_modified() throws Exception { - assertThat( + MatcherAssert.assertThat( IndentedHtml.inMemory().appendUnescapedText("<>&\"\'").output().toString(), is("<>&\"\'\n") ); diff --git a/j2html/src/test/java/org/xbib/j2html/rendering/RenderingCompatabilityTest.java b/j2html/src/test/java/org/xbib/j2html/test/rendering/RenderingCompatabilityTest.java similarity index 98% rename from j2html/src/test/java/org/xbib/j2html/rendering/RenderingCompatabilityTest.java rename to j2html/src/test/java/org/xbib/j2html/test/rendering/RenderingCompatabilityTest.java index 6b2a3d3..5f7bc6c 100644 --- a/j2html/src/test/java/org/xbib/j2html/rendering/RenderingCompatabilityTest.java +++ b/j2html/src/test/java/org/xbib/j2html/test/rendering/RenderingCompatabilityTest.java @@ -1,7 +1,8 @@ -package org.xbib.j2html.rendering; +package org.xbib.j2html.test.rendering; import org.junit.jupiter.api.Test; import org.xbib.j2html.attributes.Attribute; +import org.xbib.j2html.rendering.FlatHtml; import org.xbib.j2html.tags.DomContent; import java.io.IOException; diff --git a/j2html/src/test/java/org/xbib/j2html/tags/AttributesPerTagTest.java b/j2html/src/test/java/org/xbib/j2html/test/tags/AttributesPerTagTest.java similarity index 99% rename from j2html/src/test/java/org/xbib/j2html/tags/AttributesPerTagTest.java rename to j2html/src/test/java/org/xbib/j2html/test/tags/AttributesPerTagTest.java index aeb171a..15ce598 100644 --- a/j2html/src/test/java/org/xbib/j2html/tags/AttributesPerTagTest.java +++ b/j2html/src/test/java/org/xbib/j2html/test/tags/AttributesPerTagTest.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.tags; +package org.xbib.j2html.test.tags; import org.junit.jupiter.api.Test; import static org.xbib.j2html.TagCreator.*; diff --git a/j2html/src/test/java/org/xbib/j2html/tags/ComplexRenderTest.java b/j2html/src/test/java/org/xbib/j2html/test/tags/ComplexRenderTest.java similarity index 99% rename from j2html/src/test/java/org/xbib/j2html/tags/ComplexRenderTest.java rename to j2html/src/test/java/org/xbib/j2html/test/tags/ComplexRenderTest.java index 4455947..1a05d32 100644 --- a/j2html/src/test/java/org/xbib/j2html/tags/ComplexRenderTest.java +++ b/j2html/src/test/java/org/xbib/j2html/test/tags/ComplexRenderTest.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.tags; +package org.xbib.j2html.test.tags; import org.junit.jupiter.api.Test; import org.xbib.j2html.attributes.Attr; diff --git a/j2html/src/test/java/org/xbib/j2html/tags/ConvenienceMethodTest.java b/j2html/src/test/java/org/xbib/j2html/test/tags/ConvenienceMethodTest.java similarity index 98% rename from j2html/src/test/java/org/xbib/j2html/tags/ConvenienceMethodTest.java rename to j2html/src/test/java/org/xbib/j2html/test/tags/ConvenienceMethodTest.java index bc92588..a3b9e28 100644 --- a/j2html/src/test/java/org/xbib/j2html/tags/ConvenienceMethodTest.java +++ b/j2html/src/test/java/org/xbib/j2html/test/tags/ConvenienceMethodTest.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.tags; +package org.xbib.j2html.test.tags; import org.junit.jupiter.api.Test; import static org.xbib.j2html.TagCreator.a; diff --git a/j2html/src/test/java/org/xbib/j2html/tags/DomContentJoinerTest.java b/j2html/src/test/java/org/xbib/j2html/test/tags/DomContentJoinerTest.java similarity index 50% rename from j2html/src/test/java/org/xbib/j2html/tags/DomContentJoinerTest.java rename to j2html/src/test/java/org/xbib/j2html/test/tags/DomContentJoinerTest.java index 0db47f4..c95abc3 100644 --- a/j2html/src/test/java/org/xbib/j2html/tags/DomContentJoinerTest.java +++ b/j2html/src/test/java/org/xbib/j2html/test/tags/DomContentJoinerTest.java @@ -1,6 +1,10 @@ -package org.xbib.j2html.tags; +package org.xbib.j2html.test.tags; +import org.hamcrest.MatcherAssert; +import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; +import org.xbib.j2html.tags.DomContentJoiner; +import org.xbib.j2html.tags.UnescapedText; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; @@ -8,7 +12,7 @@ public class DomContentJoinerTest { @Test public void testJoin() { - assertThat(DomContentJoiner.join(",", true, "a", "b", "c"), is(new UnescapedText("a,b,c"))); + MatcherAssert.assertThat(DomContentJoiner.join(",", true, "a", "b", "c"), Matchers.is(new UnescapedText("a,b,c"))); assertThat(DomContentJoiner.join(",", false, "a", "b", "c"), is(new UnescapedText("a,b,c"))); } } diff --git a/j2html/src/test/java/org/xbib/j2html/tags/Employee.java b/j2html/src/test/java/org/xbib/j2html/test/tags/Employee.java similarity index 86% rename from j2html/src/test/java/org/xbib/j2html/tags/Employee.java rename to j2html/src/test/java/org/xbib/j2html/test/tags/Employee.java index 66ad431..4e295cf 100644 --- a/j2html/src/test/java/org/xbib/j2html/tags/Employee.java +++ b/j2html/src/test/java/org/xbib/j2html/test/tags/Employee.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.tags; +package org.xbib.j2html.test.tags; class Employee { final int id; diff --git a/j2html/src/test/java/org/xbib/j2html/test/tags/InlineStaticResourceTest.java b/j2html/src/test/java/org/xbib/j2html/test/tags/InlineStaticResourceTest.java new file mode 100644 index 0000000..add509b --- /dev/null +++ b/j2html/src/test/java/org/xbib/j2html/test/tags/InlineStaticResourceTest.java @@ -0,0 +1,52 @@ +package org.xbib.j2html.test.tags; + +import java.io.InputStream; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import static org.xbib.j2html.TagCreator.fileAsEscapedString; +import static org.xbib.j2html.TagCreator.fileAsString; +import static org.xbib.j2html.TagCreator.scriptWithInlineFile_min; +import static org.xbib.j2html.TagCreator.styleWithInlineFile_min; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +public class InlineStaticResourceTest { + + private static final String EOL = System.lineSeparator(); + + @Test + public void testAllTags() throws Exception { + + String expectedCss = ""; + String expectedJs = ""; + String expectedHtml = "" + EOL + " Any content" + EOL + "" + EOL; + String expectedEscapedHtml = "<body>" + EOL + " Any content" + EOL + "</body>" + EOL; + String expectedAnyContent = "public class AnyContent {" + EOL + "}" + EOL; + + try (InputStream inputStream = getClass().getResourceAsStream("test.css")) { + assertThat(styleWithInlineFile_min(inputStream).render(), is(expectedCss)); + } + try (InputStream inputStream = getClass().getResourceAsStream("test-without-trailing-semis.css")) { + assertThat(styleWithInlineFile_min(inputStream).render(), is(expectedCss)); + } + try (InputStream inputStream = getClass().getResourceAsStream("test.js")) { + assertThat(scriptWithInlineFile_min(inputStream).render(), is(expectedJs)); + } + try (InputStream inputStream = getClass().getResourceAsStream("test.html")) { + assertThat(fileAsString(inputStream).render(), is(expectedHtml)); + } + try (InputStream inputStream = getClass().getResourceAsStream("test.html")) { + assertThat(fileAsEscapedString(inputStream).render(), is(expectedEscapedHtml)); + } + try (InputStream inputStream = getClass().getResourceAsStream("AnyContent.java")) { + assertThat(fileAsString(inputStream).render(), is(expectedAnyContent)); + } + } + + @Test + public void testExceptionForBadPath() { + Assertions.assertThrows(RuntimeException.class, () -> { + styleWithInlineFile_min(null); + }); + } +} diff --git a/j2html/src/test/java/org/xbib/j2html/tags/RenderFormattedTest.java b/j2html/src/test/java/org/xbib/j2html/test/tags/RenderFormattedTest.java similarity index 98% rename from j2html/src/test/java/org/xbib/j2html/tags/RenderFormattedTest.java rename to j2html/src/test/java/org/xbib/j2html/test/tags/RenderFormattedTest.java index 8d28431..4719604 100644 --- a/j2html/src/test/java/org/xbib/j2html/tags/RenderFormattedTest.java +++ b/j2html/src/test/java/org/xbib/j2html/test/tags/RenderFormattedTest.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.tags; +package org.xbib.j2html.test.tags; import org.junit.jupiter.api.Test; import static org.xbib.j2html.TagCreator.div; diff --git a/j2html/src/test/java/org/xbib/j2html/tags/TagCreatorTest.java b/j2html/src/test/java/org/xbib/j2html/test/tags/TagCreatorTest.java similarity index 99% rename from j2html/src/test/java/org/xbib/j2html/tags/TagCreatorTest.java rename to j2html/src/test/java/org/xbib/j2html/test/tags/TagCreatorTest.java index 0b78f7f..b7f7e59 100644 --- a/j2html/src/test/java/org/xbib/j2html/tags/TagCreatorTest.java +++ b/j2html/src/test/java/org/xbib/j2html/test/tags/TagCreatorTest.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.tags; +package org.xbib.j2html.test.tags; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -9,6 +9,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; +import org.xbib.j2html.tags.DomContent; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.xbib.j2html.TagCreator.*; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/j2html/src/test/java/org/xbib/j2html/tags/TagTest.java b/j2html/src/test/java/org/xbib/j2html/test/tags/TagTest.java similarity index 97% rename from j2html/src/test/java/org/xbib/j2html/tags/TagTest.java rename to j2html/src/test/java/org/xbib/j2html/test/tags/TagTest.java index 0115678..9f53ff9 100644 --- a/j2html/src/test/java/org/xbib/j2html/tags/TagTest.java +++ b/j2html/src/test/java/org/xbib/j2html/test/tags/TagTest.java @@ -1,11 +1,14 @@ -package org.xbib.j2html.tags; +package org.xbib.j2html.test.tags; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.xbib.j2html.Config; import org.xbib.j2html.attributes.Attribute; -import org.xbib.j2html.model.DynamicHrefAttribute; +import org.xbib.j2html.test.model.DynamicHrefAttribute; +import org.xbib.j2html.tags.ContainerTag; +import org.xbib.j2html.tags.EmptyTag; +import org.xbib.j2html.tags.Tag; import org.xbib.j2html.tags.specialized.HtmlTag; import java.io.File; import java.io.FileWriter; diff --git a/j2html/src/test/java/org/xbib/j2html/tags/TextTest.java b/j2html/src/test/java/org/xbib/j2html/test/tags/TextTest.java similarity index 96% rename from j2html/src/test/java/org/xbib/j2html/tags/TextTest.java rename to j2html/src/test/java/org/xbib/j2html/test/tags/TextTest.java index 53f7450..a12ae39 100644 --- a/j2html/src/test/java/org/xbib/j2html/tags/TextTest.java +++ b/j2html/src/test/java/org/xbib/j2html/test/tags/TextTest.java @@ -1,4 +1,4 @@ -package org.xbib.j2html.tags; +package org.xbib.j2html.test.tags; import org.junit.jupiter.api.Test; import org.xbib.j2html.rendering.FlatHtml; diff --git a/j2html/src/test/resources/logging.properties b/j2html/src/test/resources/logging.properties new file mode 100644 index 0000000..8c597ae --- /dev/null +++ b/j2html/src/test/resources/logging.properties @@ -0,0 +1,4 @@ +handlers=java.util.logging.ConsoleHandler +.level=ALL +java.util.logging.ConsoleHandler.level=ALL +jdk.event.security.level=INFO diff --git a/j2html/src/test/resources/comparison/velocity/fiveHundredEmployees.vm b/j2html/src/test/resources/org/xbib/j2html/test/comparison/velocity/fiveHundredEmployees.vm similarity index 100% rename from j2html/src/test/resources/comparison/velocity/fiveHundredEmployees.vm rename to j2html/src/test/resources/org/xbib/j2html/test/comparison/velocity/fiveHundredEmployees.vm diff --git a/j2html/src/test/resources/comparison/velocity/helloWorld.vm b/j2html/src/test/resources/org/xbib/j2html/test/comparison/velocity/helloWorld.vm similarity index 100% rename from j2html/src/test/resources/comparison/velocity/helloWorld.vm rename to j2html/src/test/resources/org/xbib/j2html/test/comparison/velocity/helloWorld.vm diff --git a/j2html/src/test/resources/comparison/velocity/macros.vm b/j2html/src/test/resources/org/xbib/j2html/test/comparison/velocity/macros.vm similarity index 100% rename from j2html/src/test/resources/comparison/velocity/macros.vm rename to j2html/src/test/resources/org/xbib/j2html/test/comparison/velocity/macros.vm diff --git a/j2html/src/test/resources/comparison/velocity/multiplicationTable.vm b/j2html/src/test/resources/org/xbib/j2html/test/comparison/velocity/multiplicationTable.vm similarity index 100% rename from j2html/src/test/resources/comparison/velocity/multiplicationTable.vm rename to j2html/src/test/resources/org/xbib/j2html/test/comparison/velocity/multiplicationTable.vm diff --git a/j2html/src/test/resources/AnyContent.java b/j2html/src/test/resources/org/xbib/j2html/test/tags/AnyContent.java similarity index 100% rename from j2html/src/test/resources/AnyContent.java rename to j2html/src/test/resources/org/xbib/j2html/test/tags/AnyContent.java diff --git a/j2html/src/test/resources/test-without-trailing-semis.css b/j2html/src/test/resources/org/xbib/j2html/test/tags/test-without-trailing-semis.css similarity index 100% rename from j2html/src/test/resources/test-without-trailing-semis.css rename to j2html/src/test/resources/org/xbib/j2html/test/tags/test-without-trailing-semis.css diff --git a/j2html/src/test/resources/test.css b/j2html/src/test/resources/org/xbib/j2html/test/tags/test.css similarity index 100% rename from j2html/src/test/resources/test.css rename to j2html/src/test/resources/org/xbib/j2html/test/tags/test.css diff --git a/j2html/src/test/resources/test.html b/j2html/src/test/resources/org/xbib/j2html/test/tags/test.html similarity index 100% rename from j2html/src/test/resources/test.html rename to j2html/src/test/resources/org/xbib/j2html/test/tags/test.html diff --git a/j2html/src/test/resources/test.js b/j2html/src/test/resources/org/xbib/j2html/test/tags/test.js similarity index 100% rename from j2html/src/test/resources/test.js rename to j2html/src/test/resources/org/xbib/j2html/test/tags/test.js diff --git a/javapoet/src/main/java/module-info.java b/javapoet/src/main/java/module-info.java new file mode 100644 index 0000000..1da94ce --- /dev/null +++ b/javapoet/src/main/java/module-info.java @@ -0,0 +1,4 @@ +module org.xbib.javapoet { + requires java.compiler; + exports org.xbib.javapoet; +} diff --git a/javapoet/src/main/java/org/xbib/javapoet/AnnotationSpec.java b/javapoet/src/main/java/org/xbib/javapoet/AnnotationSpec.java new file mode 100644 index 0000000..1d63be3 --- /dev/null +++ b/javapoet/src/main/java/org/xbib/javapoet/AnnotationSpec.java @@ -0,0 +1,278 @@ +package org.xbib.javapoet; + +import java.io.IOException; +import java.lang.annotation.Annotation; +import java.lang.reflect.Array; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.AnnotationValue; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.TypeElement; +import javax.lang.model.element.VariableElement; +import javax.lang.model.type.TypeMirror; +import javax.lang.model.util.SimpleAnnotationValueVisitor8; +import static org.xbib.javapoet.Util.characterLiteralWithoutSingleQuotes; +import static org.xbib.javapoet.Util.checkArgument; +import static org.xbib.javapoet.Util.checkNotNull; + +public final class AnnotationSpec { + public static final String VALUE = "value"; + + public final TypeName type; + public final Map> members; + + private AnnotationSpec(Builder builder) { + this.type = builder.type; + this.members = Util.immutableMultimap(builder.members); + } + + void emit(CodeWriter codeWriter, boolean inline) throws IOException { + String whitespace = inline ? "" : "\n"; + String memberSeparator = inline ? ", " : ",\n"; + if (members.isEmpty()) { + // @Singleton + codeWriter.emit("@$T", type); + } else if (members.size() == 1 && members.containsKey("value")) { + // @Named("foo") + codeWriter.emit("@$T(", type); + emitAnnotationValues(codeWriter, whitespace, memberSeparator, members.get("value")); + codeWriter.emit(")"); + } else { + // Inline: + // @Column(name = "updated_at", nullable = false) + // + // Not inline: + // @Column( + // name = "updated_at", + // nullable = false + // ) + codeWriter.emit("@$T(" + whitespace, type); + codeWriter.indent(2); + for (Iterator>> i + = members.entrySet().iterator(); i.hasNext(); ) { + Map.Entry> entry = i.next(); + codeWriter.emit("$L = ", entry.getKey()); + emitAnnotationValues(codeWriter, whitespace, memberSeparator, entry.getValue()); + if (i.hasNext()) codeWriter.emit(memberSeparator); + } + codeWriter.unindent(2); + codeWriter.emit(whitespace + ")"); + } + } + + private void emitAnnotationValues(CodeWriter codeWriter, String whitespace, + String memberSeparator, List values) throws IOException { + if (values.size() == 1) { + codeWriter.indent(2); + codeWriter.emit(values.get(0)); + codeWriter.unindent(2); + return; + } + + codeWriter.emit("{" + whitespace); + codeWriter.indent(2); + boolean first = true; + for (CodeBlock codeBlock : values) { + if (!first) codeWriter.emit(memberSeparator); + codeWriter.emit(codeBlock); + first = false; + } + codeWriter.unindent(2); + codeWriter.emit(whitespace + "}"); + } + + public static AnnotationSpec get(Annotation annotation) { + return get(annotation, false); + } + + public static AnnotationSpec get(Annotation annotation, boolean includeDefaultValues) { + Builder builder = builder(annotation.annotationType()); + try { + Method[] methods = annotation.annotationType().getDeclaredMethods(); + Arrays.sort(methods, Comparator.comparing(Method::getName)); + for (Method method : methods) { + Object value = method.invoke(annotation); + if (!includeDefaultValues) { + if (Objects.deepEquals(value, method.getDefaultValue())) { + continue; + } + } + if (value.getClass().isArray()) { + for (int i = 0; i < Array.getLength(value); i++) { + builder.addMemberForValue(method.getName(), Array.get(value, i)); + } + continue; + } + if (value instanceof Annotation) { + builder.addMember(method.getName(), "$L", get((Annotation) value)); + continue; + } + builder.addMemberForValue(method.getName(), value); + } + } catch (Exception e) { + throw new RuntimeException("Reflecting " + annotation + " failed!", e); + } + return builder.build(); + } + + public static AnnotationSpec get(AnnotationMirror annotation) { + TypeElement element = (TypeElement) annotation.getAnnotationType().asElement(); + AnnotationSpec.Builder builder = AnnotationSpec.builder(ClassName.get(element)); + Visitor visitor = new Visitor(builder); + for (ExecutableElement executableElement : annotation.getElementValues().keySet()) { + String name = executableElement.getSimpleName().toString(); + AnnotationValue value = annotation.getElementValues().get(executableElement); + value.accept(visitor, name); + } + return builder.build(); + } + + public static Builder builder(ClassName type) { + checkNotNull(type, "type == null"); + return new Builder(type); + } + + public static Builder builder(Class type) { + return builder(ClassName.get(type)); + } + + public Builder toBuilder() { + Builder builder = new Builder(type); + for (Map.Entry> entry : members.entrySet()) { + builder.members.put(entry.getKey(), new ArrayList<>(entry.getValue())); + } + return builder; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null) return false; + if (getClass() != o.getClass()) return false; + return toString().equals(o.toString()); + } + + @Override + public int hashCode() { + return toString().hashCode(); + } + + @Override + public String toString() { + StringBuilder out = new StringBuilder(); + try { + CodeWriter codeWriter = new CodeWriter(out); + codeWriter.emit("$L", this); + return out.toString(); + } catch (IOException e) { + throw new AssertionError(); + } + } + + public static final class Builder { + private final TypeName type; + + public final Map> members = new LinkedHashMap<>(); + + private Builder(TypeName type) { + this.type = type; + } + + public Builder addMember(String name, String format, Object... args) { + return addMember(name, CodeBlock.of(format, args)); + } + + public Builder addMember(String name, CodeBlock codeBlock) { + List values = members.computeIfAbsent(name, k -> new ArrayList<>()); + values.add(codeBlock); + return this; + } + + /** + * Delegates to {@link #addMember(String, String, Object...)}, with parameter {@code format} + * depending on the given {@code value} object. Falls back to {@code "$L"} literal format if + * the class of the given {@code value} object is not supported. + */ + Builder addMemberForValue(String memberName, Object value) { + checkNotNull(memberName, "memberName == null"); + checkNotNull(value, "value == null, constant non-null value expected for %s", memberName); + checkArgument(SourceVersion.isName(memberName), "not a valid name: %s", memberName); + if (value instanceof Class) { + return addMember(memberName, "$T.class", value); + } + if (value instanceof Enum) { + return addMember(memberName, "$T.$L", value.getClass(), ((Enum) value).name()); + } + if (value instanceof String) { + return addMember(memberName, "$S", value); + } + if (value instanceof Float) { + return addMember(memberName, "$Lf", value); + } + if (value instanceof Long) { + return addMember(memberName, "$LL", value); + } + if (value instanceof Character) { + return addMember(memberName, "'$L'", characterLiteralWithoutSingleQuotes((char) value)); + } + return addMember(memberName, "$L", value); + } + + public AnnotationSpec build() { + for (String name : members.keySet()) { + checkNotNull(name, "name == null"); + checkArgument(SourceVersion.isName(name), "not a valid name: %s", name); + } + return new AnnotationSpec(this); + } + } + + /** + * Annotation value visitor adding members to the given builder instance. + */ + private static class Visitor extends SimpleAnnotationValueVisitor8 { + final Builder builder; + + Visitor(Builder builder) { + super(builder); + this.builder = builder; + } + + @Override + protected Builder defaultAction(Object o, String name) { + return builder.addMemberForValue(name, o); + } + + @Override + public Builder visitAnnotation(AnnotationMirror a, String name) { + return builder.addMember(name, "$L", get(a)); + } + + @Override + public Builder visitEnumConstant(VariableElement c, String name) { + return builder.addMember(name, "$T.$L", c.asType(), c.getSimpleName()); + } + + @Override + public Builder visitType(TypeMirror t, String name) { + return builder.addMember(name, "$T.class", t); + } + + @Override + public Builder visitArray(List values, String name) { + for (AnnotationValue value : values) { + value.accept(this, name); + } + return builder; + } + } +} diff --git a/javapoet/src/main/java/org/xbib/javapoet/ArrayTypeName.java b/javapoet/src/main/java/org/xbib/javapoet/ArrayTypeName.java new file mode 100644 index 0000000..8088998 --- /dev/null +++ b/javapoet/src/main/java/org/xbib/javapoet/ArrayTypeName.java @@ -0,0 +1,104 @@ +package org.xbib.javapoet; + +import java.io.IOException; +import java.lang.reflect.GenericArrayType; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import javax.lang.model.element.TypeParameterElement; +import javax.lang.model.type.ArrayType; +import static org.xbib.javapoet.Util.checkNotNull; + +public final class ArrayTypeName extends TypeName { + public final TypeName componentType; + + private ArrayTypeName(TypeName componentType) { + this(componentType, new ArrayList<>()); + } + + private ArrayTypeName(TypeName componentType, List annotations) { + super(annotations); + this.componentType = checkNotNull(componentType, "rawType == null"); + } + + @Override + public ArrayTypeName annotated(List annotations) { + return new ArrayTypeName(componentType, concatAnnotations(annotations)); + } + + @Override + public TypeName withoutAnnotations() { + return new ArrayTypeName(componentType); + } + + @Override + CodeWriter emit(CodeWriter out) throws IOException { + return emit(out, false); + } + + CodeWriter emit(CodeWriter out, boolean varargs) throws IOException { + emitLeafType(out); + return emitBrackets(out, varargs); + } + + private CodeWriter emitLeafType(CodeWriter out) throws IOException { + if (TypeName.asArray(componentType) != null) { + return TypeName.asArray(componentType).emitLeafType(out); + } + return componentType.emit(out); + } + + private CodeWriter emitBrackets(CodeWriter out, boolean varargs) throws IOException { + if (isAnnotated()) { + out.emit(" "); + emitAnnotations(out); + } + + if (TypeName.asArray(componentType) == null) { + // Last bracket. + return out.emit(varargs ? "..." : "[]"); + } + out.emit("[]"); + return TypeName.asArray(componentType).emitBrackets(out, varargs); + } + + + /** + * Returns an array type whose elements are all instances of {@code componentType}. + */ + public static ArrayTypeName of(TypeName componentType) { + return new ArrayTypeName(componentType); + } + + /** + * Returns an array type whose elements are all instances of {@code componentType}. + */ + public static ArrayTypeName of(Type componentType) { + return of(TypeName.get(componentType)); + } + + /** + * Returns an array type equivalent to {@code mirror}. + */ + public static ArrayTypeName get(ArrayType mirror) { + return get(mirror, new LinkedHashMap<>()); + } + + static ArrayTypeName get( + ArrayType mirror, Map typeVariables) { + return new ArrayTypeName(get(mirror.getComponentType(), typeVariables)); + } + + /** + * Returns an array type equivalent to {@code type}. + */ + public static ArrayTypeName get(GenericArrayType type) { + return get(type, new LinkedHashMap<>()); + } + + static ArrayTypeName get(GenericArrayType type, Map map) { + return ArrayTypeName.of(get(type.getGenericComponentType(), map)); + } +} diff --git a/javapoet/src/main/java/org/xbib/javapoet/ClassName.java b/javapoet/src/main/java/org/xbib/javapoet/ClassName.java new file mode 100644 index 0000000..187a2d1 --- /dev/null +++ b/javapoet/src/main/java/org/xbib/javapoet/ClassName.java @@ -0,0 +1,314 @@ +package org.xbib.javapoet; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.lang.model.element.Element; +import javax.lang.model.element.PackageElement; +import javax.lang.model.element.TypeElement; +import javax.lang.model.util.SimpleElementVisitor8; +import static org.xbib.javapoet.Util.checkArgument; +import static org.xbib.javapoet.Util.checkNotNull; + +/** + * A fully-qualified class name for top-level and member classes. + */ +public final class ClassName extends TypeName implements Comparable { + public static final ClassName OBJECT = ClassName.get(Object.class); + + /** + * The name representing the default Java package. + */ + private static final String NO_PACKAGE = ""; + + /** + * The package name of this class, or "" if this is in the default package. + */ + final String packageName; + + /** + * The enclosing class, or null if this is not enclosed in another class. + */ + final ClassName enclosingClassName; + + /** + * This class name, like "Entry" for java.util.Map.Entry. + */ + final String simpleName; + + private List simpleNames; + + /** + * The full class name like "java.util.Map.Entry". + */ + final String canonicalName; + + private ClassName(String packageName, ClassName enclosingClassName, String simpleName) { + this(packageName, enclosingClassName, simpleName, Collections.emptyList()); + } + + private ClassName(String packageName, ClassName enclosingClassName, String simpleName, + List annotations) { + super(annotations); + this.packageName = Objects.requireNonNull(packageName, "packageName == null"); + this.enclosingClassName = enclosingClassName; + this.simpleName = simpleName; + this.canonicalName = enclosingClassName != null + ? (enclosingClassName.canonicalName + '.' + simpleName) + : (packageName.isEmpty() ? simpleName : packageName + '.' + simpleName); + } + + @Override + public ClassName annotated(List annotations) { + return new ClassName(packageName, enclosingClassName, simpleName, + concatAnnotations(annotations)); + } + + @Override + public ClassName withoutAnnotations() { + if (!isAnnotated()) return this; + ClassName resultEnclosingClassName = enclosingClassName != null + ? enclosingClassName.withoutAnnotations() + : null; + return new ClassName(packageName, resultEnclosingClassName, simpleName); + } + + @Override + public boolean isAnnotated() { + return super.isAnnotated() || (enclosingClassName != null && enclosingClassName.isAnnotated()); + } + + /** + * Returns the package name, like {@code "java.util"} for {@code Map.Entry}. Returns the empty + * string for the default package. + */ + public String packageName() { + return packageName; + } + + /** + * Returns the enclosing class, like {@link Map} for {@code Map.Entry}. Returns null if this class + * is not nested in another class. + */ + public ClassName enclosingClassName() { + return enclosingClassName; + } + + /** + * Returns the top class in this nesting group. Equivalent to chained calls to {@link + * #enclosingClassName()} until the result's enclosing class is null. + */ + public ClassName topLevelClassName() { + return enclosingClassName != null ? enclosingClassName.topLevelClassName() : this; + } + + /** + * Return the binary name of a class. + */ + public String reflectionName() { + return enclosingClassName != null + ? (enclosingClassName.reflectionName() + '$' + simpleName) + : (packageName.isEmpty() ? simpleName : packageName + '.' + simpleName); + } + + public List simpleNames() { + if (simpleNames != null) { + return simpleNames; + } + + if (enclosingClassName == null) { + simpleNames = Collections.singletonList(simpleName); + } else { + List mutableNames = new ArrayList<>(); + mutableNames.addAll(enclosingClassName().simpleNames()); + mutableNames.add(simpleName); + simpleNames = Collections.unmodifiableList(mutableNames); + } + return simpleNames; + } + + /** + * Returns a class that shares the same enclosing package or class. If this class is enclosed by + * another class, this is equivalent to {@code enclosingClassName().nestedClass(name)}. Otherwise + * it is equivalent to {@code get(packageName(), name)}. + */ + public ClassName peerClass(String name) { + return new ClassName(packageName, enclosingClassName, name); + } + + /** + * Returns a new {@link ClassName} instance for the specified {@code name} as nested inside this + * class. + */ + public ClassName nestedClass(String name) { + return new ClassName(packageName, this, name); + } + + /** + * Returns the simple name of this class, like {@code "Entry"} for {@link Map.Entry}. + */ + public String simpleName() { + return simpleName; + } + + /** + * Returns the full class name of this class. + * Like {@code "java.util.Map.Entry"} for {@link Map.Entry}. + */ + public String canonicalName() { + return canonicalName; + } + + public static ClassName get(Class clazz) { + checkNotNull(clazz, "clazz == null"); + checkArgument(!clazz.isPrimitive(), "primitive types cannot be represented as a ClassName"); + checkArgument(!void.class.equals(clazz), "'void' type cannot be represented as a ClassName"); + checkArgument(!clazz.isArray(), "array types cannot be represented as a ClassName"); + + String anonymousSuffix = ""; + while (clazz.isAnonymousClass()) { + int lastDollar = clazz.getName().lastIndexOf('$'); + anonymousSuffix = clazz.getName().substring(lastDollar) + anonymousSuffix; + clazz = clazz.getEnclosingClass(); + } + String name = clazz.getSimpleName() + anonymousSuffix; + + if (clazz.getEnclosingClass() == null) { + // Avoid unreliable Class.getPackage(). https://github.com/square/javapoet/issues/295 + int lastDot = clazz.getName().lastIndexOf('.'); + String packageName = (lastDot != -1) ? clazz.getName().substring(0, lastDot) : NO_PACKAGE; + return new ClassName(packageName, null, name); + } + + return ClassName.get(clazz.getEnclosingClass()).nestedClass(name); + } + + /** + * Returns a new {@link ClassName} instance for the given fully-qualified class name string. This + * method assumes that the input is ASCII and follows typical Java style (lowercase package + * names, UpperCamelCase class names) and may produce incorrect results or throw + * {@link IllegalArgumentException} otherwise. For that reason, {@link #get(Class)} and + * {@link #get(Class)} should be preferred as they can correctly create {@link ClassName} + * instances without such restrictions. + */ + public static ClassName bestGuess(String classNameString) { + // Add the package name, like "java.util.concurrent", or "" for no package. + int p = 0; + while (p < classNameString.length() && Character.isLowerCase(classNameString.codePointAt(p))) { + p = classNameString.indexOf('.', p) + 1; + checkArgument(p != 0, "couldn't make a guess for %s", classNameString); + } + String packageName = p == 0 ? NO_PACKAGE : classNameString.substring(0, p - 1); + + // Add class names like "Map" and "Entry". + ClassName className = null; + for (String simpleName : classNameString.substring(p).split("\\.", -1)) { + checkArgument(!simpleName.isEmpty() && Character.isUpperCase(simpleName.codePointAt(0)), + "couldn't make a guess for %s", classNameString); + className = new ClassName(packageName, className, simpleName); + } + + return className; + } + + /** + * Returns a class name created from the given parts. For example, calling this with package name + * {@code "java.util"} and simple names {@code "Map"}, {@code "Entry"} yields {@link Map.Entry}. + */ + public static ClassName get(String packageName, String simpleName, String... simpleNames) { + ClassName className = new ClassName(packageName, null, simpleName); + for (String name : simpleNames) { + className = className.nestedClass(name); + } + return className; + } + + /** + * Returns the class name for {@code element}. + */ + public static ClassName get(TypeElement element) { + checkNotNull(element, "element == null"); + String simpleName = element.getSimpleName().toString(); + + return element.getEnclosingElement().accept(new SimpleElementVisitor8() { + @Override + public ClassName visitPackage(PackageElement packageElement, Void p) { + return new ClassName(packageElement.getQualifiedName().toString(), null, simpleName); + } + + @Override + public ClassName visitType(TypeElement enclosingClass, Void p) { + return ClassName.get(enclosingClass).nestedClass(simpleName); + } + + @Override + public ClassName visitUnknown(Element unknown, Void p) { + return get("", simpleName); + } + + @Override + public ClassName defaultAction(Element enclosingElement, Void p) { + throw new IllegalArgumentException("Unexpected type nesting: " + element); + } + }, null); + } + + @Override + public int compareTo(ClassName o) { + return canonicalName.compareTo(o.canonicalName); + } + + @Override + CodeWriter emit(CodeWriter out) throws IOException { + boolean charsEmitted = false; + for (ClassName className : enclosingClasses()) { + String simpleName; + if (charsEmitted) { + // We've already emitted an enclosing class. Emit as we go. + out.emit("."); + simpleName = className.simpleName; + + } else if (className.isAnnotated() || className == this) { + // We encountered the first enclosing class that must be emitted. + String qualifiedName = out.lookupName(className); + int dot = qualifiedName.lastIndexOf('.'); + if (dot != -1) { + out.emitAndIndent(qualifiedName.substring(0, dot + 1)); + simpleName = qualifiedName.substring(dot + 1); + charsEmitted = true; + } else { + simpleName = qualifiedName; + } + + } else { + // Don't emit this enclosing type. Keep going so we can be more precise. + continue; + } + + if (className.isAnnotated()) { + if (charsEmitted) out.emit(" "); + className.emitAnnotations(out); + } + + out.emit(simpleName); + charsEmitted = true; + } + + return out; + } + + /** + * Returns all enclosing classes in this, outermost first. + */ + private List enclosingClasses() { + List result = new ArrayList<>(); + for (ClassName c = this; c != null; c = c.enclosingClassName) { + result.add(c); + } + Collections.reverse(result); + return result; + } +} diff --git a/javapoet/src/main/java/org/xbib/javapoet/CodeBlock.java b/javapoet/src/main/java/org/xbib/javapoet/CodeBlock.java new file mode 100644 index 0000000..2b0b176 --- /dev/null +++ b/javapoet/src/main/java/org/xbib/javapoet/CodeBlock.java @@ -0,0 +1,459 @@ +package org.xbib.javapoet; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collector; +import java.util.stream.StreamSupport; +import javax.lang.model.element.Element; +import javax.lang.model.type.TypeMirror; +import static org.xbib.javapoet.Util.checkArgument; + +/** + * A fragment of a .java file, potentially containing declarations, statements, and documentation. + * Code blocks are not necessarily well-formed Java code, and are not validated. This class assumes + * javac will check correctness later! + * + *

Code blocks support placeholders like {@link java.text.Format}. Where {@link String#format} + * uses percent {@code %} to reference target values, this class uses dollar sign {@code $} and has + * its own set of permitted placeholders: + * + *

    + *
  • {@code $L} emits a literal value with no escaping. Arguments for literals may be + * strings, primitives, {@linkplain TypeSpec type declarations}, {@linkplain AnnotationSpec + * annotations} and even other code blocks. + *
  • {@code $N} emits a name, using name collision avoidance where necessary. Arguments + * for names may be strings (actually any {@linkplain CharSequence character sequence}), + * {@linkplain ParameterSpec parameters}, {@linkplain FieldSpec fields}, {@linkplain + * MethodSpec methods}, and {@linkplain TypeSpec types}. + *
  • {@code $S} escapes the value as a string, wraps it with double quotes, and emits + * that. For example, {@code 6" sandwich} is emitted {@code "6\" sandwich"}. + *
  • {@code $T} emits a type reference. Types will be imported if possible. Arguments + * for types may be {@linkplain Class classes}, {@linkplain javax.lang.model.type.TypeMirror + * ,* type mirrors}, and {@linkplain javax.lang.model.element.Element elements}. + *
  • {@code $$} emits a dollar sign. + *
  • {@code $W} emits a space or a newline, depending on its position on the line. This prefers + * to wrap lines before 100 columns. + *
  • {@code $Z} acts as a zero-width space. This prefers to wrap lines before 100 columns. + *
  • {@code $>} increases the indentation level. + *
  • {@code $<} decreases the indentation level. + *
  • {@code $[} begins a statement. For multiline statements, every line after the first line + * is double-indented. + *
  • {@code $]} ends a statement. + *
+ */ +public final class CodeBlock { + private static final Pattern NAMED_ARGUMENT = + Pattern.compile("\\$(?[\\w_]+):(?[\\w]).*"); + private static final Pattern LOWERCASE = Pattern.compile("[a-z]+[\\w_]*"); + + /** + * A heterogeneous list containing string literals and value placeholders. + */ + final List formatParts; + final List args; + + private CodeBlock(Builder builder) { + this.formatParts = Util.immutableList(builder.formatParts); + this.args = Util.immutableList(builder.args); + } + + public boolean isEmpty() { + return formatParts.isEmpty(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null) return false; + if (getClass() != o.getClass()) return false; + return toString().equals(o.toString()); + } + + @Override + public int hashCode() { + return toString().hashCode(); + } + + @Override + public String toString() { + StringBuilder out = new StringBuilder(); + try { + new CodeWriter(out).emit(this); + return out.toString(); + } catch (IOException e) { + throw new AssertionError(); + } + } + + public static CodeBlock of(String format, Object... args) { + return new Builder().add(format, args).build(); + } + + /** + * Joins {@code codeBlocks} into a single {@link CodeBlock}, each separated by {@code separator}. + * For example, joining {@code String s}, {@code Object o} and {@code int i} using {@code ", "} + * would produce {@code String s, Object o, int i}. + */ + public static CodeBlock join(Iterable codeBlocks, String separator) { + return StreamSupport.stream(codeBlocks.spliterator(), false).collect(joining(separator)); + } + + /** + * A {@link Collector} implementation that joins {@link CodeBlock} instances together into one + * separated by {@code separator}. For example, joining {@code String s}, {@code Object o} and + * {@code int i} using {@code ", "} would produce {@code String s, Object o, int i}. + */ + public static Collector joining(String separator) { + return Collector.of( + () -> new CodeBlockJoiner(separator, builder()), + CodeBlockJoiner::add, + CodeBlockJoiner::merge, + CodeBlockJoiner::join); + } + + /** + * A {@link Collector} implementation that joins {@link CodeBlock} instances together into one + * separated by {@code separator}. For example, joining {@code String s}, {@code Object o} and + * {@code int i} using {@code ", "} would produce {@code String s, Object o, int i}. + */ + public static Collector joining( + String separator, String prefix, String suffix) { + Builder builder = builder().add("$N", prefix); + return Collector.of( + () -> new CodeBlockJoiner(separator, builder), + CodeBlockJoiner::add, + CodeBlockJoiner::merge, + joiner -> { + builder.add(CodeBlock.of("$N", suffix)); + return joiner.join(); + }); + } + + public static Builder builder() { + return new Builder(); + } + + public Builder toBuilder() { + Builder builder = new Builder(); + builder.formatParts.addAll(formatParts); + builder.args.addAll(args); + return builder; + } + + public static final class Builder { + final List formatParts = new ArrayList<>(); + final List args = new ArrayList<>(); + + private Builder() { + } + + public boolean isEmpty() { + return formatParts.isEmpty(); + } + + /** + * Adds code using named arguments. + * + *

Named arguments specify their name after the '$' followed by : and the corresponding type + * character. Argument names consist of characters in {@code a-z, A-Z, 0-9, and _} and must + * start with a lowercase character. + * + *

For example, to refer to the type {@link java.lang.Integer} with the argument name {@code + * clazz} use a format string containing {@code $clazz:T} and include the key {@code clazz} with + * value {@code java.lang.Integer.class} in the argument map. + */ + public Builder addNamed(String format, Map arguments) { + int p = 0; + + for (String argument : arguments.keySet()) { + checkArgument(LOWERCASE.matcher(argument).matches(), + "argument '%s' must start with a lowercase character", argument); + } + + while (p < format.length()) { + int nextP = format.indexOf("$", p); + if (nextP == -1) { + formatParts.add(format.substring(p)); + break; + } + + if (p != nextP) { + formatParts.add(format.substring(p, nextP)); + p = nextP; + } + + Matcher matcher = null; + int colon = format.indexOf(':', p); + if (colon != -1) { + int endIndex = Math.min(colon + 2, format.length()); + matcher = NAMED_ARGUMENT.matcher(format.substring(p, endIndex)); + } + if (matcher != null && matcher.lookingAt()) { + String argumentName = matcher.group("argumentName"); + checkArgument(arguments.containsKey(argumentName), "Missing named argument for $%s", + argumentName); + char formatChar = matcher.group("typeChar").charAt(0); + addArgument(format, formatChar, arguments.get(argumentName)); + formatParts.add("$" + formatChar); + p += matcher.regionEnd(); + } else { + checkArgument(p < format.length() - 1, "dangling $ at end"); + checkArgument(isNoArgPlaceholder(format.charAt(p + 1)), + "unknown format $%s at %s in '%s'", format.charAt(p + 1), p + 1, format); + formatParts.add(format.substring(p, p + 2)); + p += 2; + } + } + + return this; + } + + /** + * Add code with positional or relative arguments. + * + *

Relative arguments map 1:1 with the placeholders in the format string. + * + *

Positional arguments use an index after the placeholder to identify which argument index + * to use. For example, for a literal to reference the 3rd argument: "$3L" (1 based index) + * + *

Mixing relative and positional arguments in a call to add is invalid and will result in an + * error. + */ + public Builder add(String format, Object... args) { + boolean hasRelative = false; + boolean hasIndexed = false; + + int relativeParameterCount = 0; + int[] indexedParameterCount = new int[args.length]; + + for (int p = 0; p < format.length(); ) { + if (format.charAt(p) != '$') { + int nextP = format.indexOf('$', p + 1); + if (nextP == -1) nextP = format.length(); + formatParts.add(format.substring(p, nextP)); + p = nextP; + continue; + } + + p++; // '$'. + + // Consume zero or more digits, leaving 'c' as the first non-digit char after the '$'. + int indexStart = p; + char c; + do { + checkArgument(p < format.length(), "dangling format characters in '%s'", format); + c = format.charAt(p++); + } while (c >= '0' && c <= '9'); + int indexEnd = p - 1; + + // If 'c' doesn't take an argument, we're done. + if (isNoArgPlaceholder(c)) { + checkArgument( + indexStart == indexEnd, "$$, $>, $<, $[, $], $W, and $Z may not have an index"); + formatParts.add("$" + c); + continue; + } + + // Find either the indexed argument, or the relative argument. (0-based). + int index; + if (indexStart < indexEnd) { + index = Integer.parseInt(format.substring(indexStart, indexEnd)) - 1; + hasIndexed = true; + if (args.length > 0) { + indexedParameterCount[index % args.length]++; // modulo is needed, checked below anyway + } + } else { + index = relativeParameterCount; + hasRelative = true; + relativeParameterCount++; + } + + checkArgument(index >= 0 && index < args.length, + "index %d for '%s' not in range (received %s arguments)", + index + 1, format.substring(indexStart - 1, indexEnd + 1), args.length); + checkArgument(!hasIndexed || !hasRelative, "cannot mix indexed and positional parameters"); + + addArgument(format, c, args[index]); + + formatParts.add("$" + c); + } + + if (hasRelative) { + checkArgument(relativeParameterCount >= args.length, + "unused arguments: expected %s, received %s", relativeParameterCount, args.length); + } + if (hasIndexed) { + List unused = new ArrayList<>(); + for (int i = 0; i < args.length; i++) { + if (indexedParameterCount[i] == 0) { + unused.add("$" + (i + 1)); + } + } + String s = unused.size() == 1 ? "" : "s"; + checkArgument(unused.isEmpty(), "unused argument%s: %s", s, String.join(", ", unused)); + } + return this; + } + + private boolean isNoArgPlaceholder(char c) { + return c == '$' || c == '>' || c == '<' || c == '[' || c == ']' || c == 'W' || c == 'Z'; + } + + private void addArgument(String format, char c, Object arg) { + switch (c) { + case 'N': + this.args.add(argToName(arg)); + break; + case 'L': + this.args.add(argToLiteral(arg)); + break; + case 'S': + this.args.add(argToString(arg)); + break; + case 'T': + this.args.add(argToType(arg)); + break; + default: + throw new IllegalArgumentException( + String.format("invalid format string: '%s'", format)); + } + } + + private String argToName(Object o) { + if (o instanceof CharSequence) return o.toString(); + if (o instanceof ParameterSpec) return ((ParameterSpec) o).name; + if (o instanceof FieldSpec) return ((FieldSpec) o).name; + if (o instanceof MethodSpec) return ((MethodSpec) o).name; + if (o instanceof TypeSpec) return ((TypeSpec) o).name; + throw new IllegalArgumentException("expected name but was " + o); + } + + private Object argToLiteral(Object o) { + return o; + } + + private String argToString(Object o) { + return o != null ? String.valueOf(o) : null; + } + + private TypeName argToType(Object o) { + if (o instanceof TypeName) return (TypeName) o; + if (o instanceof TypeMirror) return TypeName.get((TypeMirror) o); + if (o instanceof Element) return TypeName.get(((Element) o).asType()); + if (o instanceof Type) return TypeName.get((Type) o); + throw new IllegalArgumentException("expected type but was " + o); + } + + /** + * @param controlFlow the control flow construct and its code, such as "if (foo == 5)". + * Shouldn't contain braces or newline characters. + */ + public Builder beginControlFlow(String controlFlow, Object... args) { + add(controlFlow + " {\n", args); + indent(); + return this; + } + + /** + * @param controlFlow the control flow construct and its code, such as "else if (foo == 10)". + * Shouldn't contain braces or newline characters. + */ + public Builder nextControlFlow(String controlFlow, Object... args) { + unindent(); + add("} " + controlFlow + " {\n", args); + indent(); + return this; + } + + public Builder endControlFlow() { + unindent(); + add("}\n"); + return this; + } + + /** + * @param controlFlow the optional control flow construct and its code, such as + * "while(foo == 20)". Only used for "do/while" control flows. + */ + public Builder endControlFlow(String controlFlow, Object... args) { + unindent(); + add("} " + controlFlow + ";\n", args); + return this; + } + + public Builder addStatement(String format, Object... args) { + add("$["); + add(format, args); + add(";\n$]"); + return this; + } + + public Builder addStatement(CodeBlock codeBlock) { + return addStatement("$L", codeBlock); + } + + public Builder add(CodeBlock codeBlock) { + formatParts.addAll(codeBlock.formatParts); + args.addAll(codeBlock.args); + return this; + } + + public Builder indent() { + this.formatParts.add("$>"); + return this; + } + + public Builder unindent() { + this.formatParts.add("$<"); + return this; + } + + public Builder clear() { + formatParts.clear(); + args.clear(); + return this; + } + + public CodeBlock build() { + return new CodeBlock(this); + } + } + + private static final class CodeBlockJoiner { + private final String delimiter; + private final Builder builder; + private boolean first = true; + + CodeBlockJoiner(String delimiter, Builder builder) { + this.delimiter = delimiter; + this.builder = builder; + } + + CodeBlockJoiner add(CodeBlock codeBlock) { + if (!first) { + builder.add(delimiter); + } + first = false; + + builder.add(codeBlock); + return this; + } + + CodeBlockJoiner merge(CodeBlockJoiner other) { + CodeBlock otherBlock = other.builder.build(); + if (!otherBlock.isEmpty()) { + add(otherBlock); + } + return this; + } + + CodeBlock join() { + return builder.build(); + } + } +} diff --git a/javapoet/src/main/java/org/xbib/javapoet/CodeWriter.java b/javapoet/src/main/java/org/xbib/javapoet/CodeWriter.java new file mode 100644 index 0000000..821cb13 --- /dev/null +++ b/javapoet/src/main/java/org/xbib/javapoet/CodeWriter.java @@ -0,0 +1,535 @@ +package org.xbib.javapoet; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.ListIterator; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.regex.Pattern; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.Modifier; +import static java.lang.String.join; +import static org.xbib.javapoet.Util.checkArgument; +import static org.xbib.javapoet.Util.checkNotNull; +import static org.xbib.javapoet.Util.checkState; +import static org.xbib.javapoet.Util.stringLiteralWithDoubleQuotes; + +/** + * Converts a {@link JavaFile} to a string suitable to both human- and javac-consumption. This + * honors imports, indentation, and deferred variable names. + */ +final class CodeWriter { + /** + * Sentinel value that indicates that no user-provided package has been set. + */ + private static final String NO_PACKAGE = new String(); + private static final Pattern LINE_BREAKING_PATTERN = Pattern.compile("\\R"); + + private final String indent; + private final LineWrapper out; + private int indentLevel; + + private boolean javadoc = false; + private boolean comment = false; + private String packageName = NO_PACKAGE; + private final List typeSpecStack = new ArrayList<>(); + private final Set staticImportClassNames; + private final Set staticImports; + private final Set alwaysQualify; + private final Map importedTypes; + private final Map importableTypes = new LinkedHashMap<>(); + private final Set referencedNames = new LinkedHashSet<>(); + private final Multiset currentTypeVariables = new Multiset<>(); + private boolean trailingNewline; + + /** + * When emitting a statement, this is the line of the statement currently being written. The first + * line of a statement is indented normally and subsequent wrapped lines are double-indented. This + * is -1 when the currently-written line isn't part of a statement. + */ + int statementLine = -1; + + CodeWriter(Appendable out) { + this(out, " ", Collections.emptySet(), Collections.emptySet()); + } + + CodeWriter(Appendable out, String indent, Set staticImports, Set alwaysQualify) { + this(out, indent, Collections.emptyMap(), staticImports, alwaysQualify); + } + + CodeWriter(Appendable out, + String indent, + Map importedTypes, + Set staticImports, + Set alwaysQualify) { + this.out = new LineWrapper(out, indent, 100); + this.indent = checkNotNull(indent, "indent == null"); + this.importedTypes = checkNotNull(importedTypes, "importedTypes == null"); + this.staticImports = checkNotNull(staticImports, "staticImports == null"); + this.alwaysQualify = checkNotNull(alwaysQualify, "alwaysQualify == null"); + this.staticImportClassNames = new LinkedHashSet<>(); + for (String signature : staticImports) { + staticImportClassNames.add(signature.substring(0, signature.lastIndexOf('.'))); + } + } + + public Map importedTypes() { + return importedTypes; + } + + public CodeWriter indent() { + return indent(1); + } + + public CodeWriter indent(int levels) { + indentLevel += levels; + return this; + } + + public CodeWriter unindent() { + return unindent(1); + } + + public CodeWriter unindent(int levels) { + checkArgument(indentLevel - levels >= 0, "cannot unindent %s from %s", levels, indentLevel); + indentLevel -= levels; + return this; + } + + public CodeWriter pushPackage(String packageName) { + checkState(this.packageName == NO_PACKAGE, "package already set: %s", this.packageName); + this.packageName = checkNotNull(packageName, "packageName == null"); + return this; + } + + public CodeWriter popPackage() { + checkState(this.packageName != NO_PACKAGE, "package not set"); + this.packageName = NO_PACKAGE; + return this; + } + + public CodeWriter pushType(TypeSpec type) { + this.typeSpecStack.add(type); + return this; + } + + public CodeWriter popType() { + this.typeSpecStack.remove(typeSpecStack.size() - 1); + return this; + } + + public void emitComment(CodeBlock codeBlock) throws IOException { + trailingNewline = true; // Force the '//' prefix for the comment. + comment = true; + try { + emit(codeBlock); + emit("\n"); + } finally { + comment = false; + } + } + + public void emitJavadoc(CodeBlock javadocCodeBlock) throws IOException { + if (javadocCodeBlock.isEmpty()) return; + + emit("/**\n"); + javadoc = true; + try { + emit(javadocCodeBlock, true); + } finally { + javadoc = false; + } + emit(" */\n"); + } + + public void emitAnnotations(List annotations, boolean inline) throws IOException { + for (AnnotationSpec annotationSpec : annotations) { + annotationSpec.emit(this, inline); + emit(inline ? " " : "\n"); + } + } + + /** + * Emits {@code modifiers} in the standard order. Modifiers in {@code implicitModifiers} will not + * be emitted. + */ + public void emitModifiers(Set modifiers, Set implicitModifiers) + throws IOException { + if (modifiers.isEmpty()) return; + for (Modifier modifier : EnumSet.copyOf(modifiers)) { + if (implicitModifiers.contains(modifier)) continue; + emitAndIndent(modifier.name().toLowerCase(Locale.US)); + emitAndIndent(" "); + } + } + + public void emitModifiers(Set modifiers) throws IOException { + emitModifiers(modifiers, Collections.emptySet()); + } + + /** + * Emit type variables with their bounds. This should only be used when declaring type variables; + * everywhere else bounds are omitted. + */ + public void emitTypeVariables(List typeVariables) throws IOException { + if (typeVariables.isEmpty()) return; + + typeVariables.forEach(typeVariable -> currentTypeVariables.add(typeVariable.name)); + + emit("<"); + boolean firstTypeVariable = true; + for (TypeVariableName typeVariable : typeVariables) { + if (!firstTypeVariable) emit(", "); + emitAnnotations(typeVariable.annotations, true); + emit("$L", typeVariable.name); + boolean firstBound = true; + for (TypeName bound : typeVariable.bounds) { + emit(firstBound ? " extends $T" : " & $T", bound); + firstBound = false; + } + firstTypeVariable = false; + } + emit(">"); + } + + public void popTypeVariables(List typeVariables) throws IOException { + typeVariables.forEach(typeVariable -> currentTypeVariables.remove(typeVariable.name)); + } + + public CodeWriter emit(String s) throws IOException { + return emitAndIndent(s); + } + + public CodeWriter emit(String format, Object... args) throws IOException { + return emit(CodeBlock.of(format, args)); + } + + public CodeWriter emit(CodeBlock codeBlock) throws IOException { + return emit(codeBlock, false); + } + + public CodeWriter emit(CodeBlock codeBlock, boolean ensureTrailingNewline) throws IOException { + int a = 0; + ClassName deferredTypeName = null; // used by "import static" logic + ListIterator partIterator = codeBlock.formatParts.listIterator(); + while (partIterator.hasNext()) { + String part = partIterator.next(); + switch (part) { + case "$L": + emitLiteral(codeBlock.args.get(a++)); + break; + + case "$N": + emitAndIndent((String) codeBlock.args.get(a++)); + break; + + case "$S": + String string = (String) codeBlock.args.get(a++); + // Emit null as a literal null: no quotes. + emitAndIndent(string != null + ? stringLiteralWithDoubleQuotes(string, indent) + : "null"); + break; + + case "$T": + TypeName typeName = (TypeName) codeBlock.args.get(a++); + // defer "typeName.emit(this)" if next format part will be handled by the default case + if (typeName instanceof ClassName && partIterator.hasNext()) { + if (!codeBlock.formatParts.get(partIterator.nextIndex()).startsWith("$")) { + ClassName candidate = (ClassName) typeName; + if (staticImportClassNames.contains(candidate.canonicalName)) { + checkState(deferredTypeName == null, "pending type for static import?!"); + deferredTypeName = candidate; + break; + } + } + } + typeName.emit(this); + break; + + case "$$": + emitAndIndent("$"); + break; + + case "$>": + indent(); + break; + + case "$<": + unindent(); + break; + + case "$[": + checkState(statementLine == -1, "statement enter $[ followed by statement enter $["); + statementLine = 0; + break; + + case "$]": + checkState(statementLine != -1, "statement exit $] has no matching statement enter $["); + if (statementLine > 0) { + unindent(2); // End a multi-line statement. Decrease the indentation level. + } + statementLine = -1; + break; + + case "$W": + out.wrappingSpace(indentLevel + 2); + break; + + case "$Z": + out.zeroWidthSpace(indentLevel + 2); + break; + + default: + // handle deferred type + if (deferredTypeName != null) { + if (part.startsWith(".")) { + if (emitStaticImportMember(deferredTypeName.canonicalName, part)) { + // okay, static import hit and all was emitted, so clean-up and jump to next part + deferredTypeName = null; + break; + } + } + deferredTypeName.emit(this); + deferredTypeName = null; + } + emitAndIndent(part); + break; + } + } + if (ensureTrailingNewline && out.lastChar() != '\n') { + emit("\n"); + } + return this; + } + + public CodeWriter emitWrappingSpace() throws IOException { + out.wrappingSpace(indentLevel + 2); + return this; + } + + private static String extractMemberName(String part) { + checkArgument(Character.isJavaIdentifierStart(part.charAt(0)), "not an identifier: %s", part); + for (int i = 1; i <= part.length(); i++) { + if (!SourceVersion.isIdentifier(part.substring(0, i))) { + return part.substring(0, i - 1); + } + } + return part; + } + + private boolean emitStaticImportMember(String canonical, String part) throws IOException { + String partWithoutLeadingDot = part.substring(1); + if (partWithoutLeadingDot.isEmpty()) return false; + char first = partWithoutLeadingDot.charAt(0); + if (!Character.isJavaIdentifierStart(first)) return false; + String explicit = canonical + "." + extractMemberName(partWithoutLeadingDot); + String wildcard = canonical + ".*"; + if (staticImports.contains(explicit) || staticImports.contains(wildcard)) { + emitAndIndent(partWithoutLeadingDot); + return true; + } + return false; + } + + private void emitLiteral(Object o) throws IOException { + if (o instanceof TypeSpec) { + TypeSpec typeSpec = (TypeSpec) o; + typeSpec.emit(this, null, Collections.emptySet()); + } else if (o instanceof AnnotationSpec) { + AnnotationSpec annotationSpec = (AnnotationSpec) o; + annotationSpec.emit(this, true); + } else if (o instanceof CodeBlock) { + CodeBlock codeBlock = (CodeBlock) o; + emit(codeBlock); + } else { + emitAndIndent(String.valueOf(o)); + } + } + + /** + * Returns the best name to identify {@code className} with in the current context. This uses the + * available imports and the current scope to find the shortest name available. It does not honor + * names visible due to inheritance. + */ + String lookupName(ClassName className) { + // If the top level simple name is masked by a current type variable, use the canonical name. + String topLevelSimpleName = className.topLevelClassName().simpleName(); + if (currentTypeVariables.contains(topLevelSimpleName)) { + return className.canonicalName; + } + + // Find the shortest suffix of className that resolves to className. This uses both local type + // names (so `Entry` in `Map` refers to `Map.Entry`). Also uses imports. + boolean nameResolved = false; + for (ClassName c = className; c != null; c = c.enclosingClassName()) { + ClassName resolved = resolve(c.simpleName()); + nameResolved = resolved != null; + + if (resolved != null && Objects.equals(resolved.canonicalName, c.canonicalName)) { + int suffixOffset = c.simpleNames().size() - 1; + return join(".", className.simpleNames().subList( + suffixOffset, className.simpleNames().size())); + } + } + + // If the name resolved but wasn't a match, we're stuck with the fully qualified name. + if (nameResolved) { + return className.canonicalName; + } + + // If the class is in the same package, we're done. + if (Objects.equals(packageName, className.packageName())) { + referencedNames.add(topLevelSimpleName); + return join(".", className.simpleNames()); + } + + // We'll have to use the fully-qualified name. Mark the type as importable for a future pass. + if (!javadoc) { + importableType(className); + } + + return className.canonicalName; + } + + private void importableType(ClassName className) { + if (className.packageName().isEmpty()) { + return; + } else if (alwaysQualify.contains(className.simpleName)) { + // TODO what about nested types like java.util.Map.Entry? + return; + } + ClassName topLevelClassName = className.topLevelClassName(); + String simpleName = topLevelClassName.simpleName(); + ClassName replaced = importableTypes.put(simpleName, topLevelClassName); + if (replaced != null) { + importableTypes.put(simpleName, replaced); // On collision, prefer the first inserted. + } + } + + /** + * Returns the class referenced by {@code simpleName}, using the current nesting context and + * imports. + */ + // TODO(jwilson): also honor superclass members when resolving names. + private ClassName resolve(String simpleName) { + // Match a child of the current (potentially nested) class. + for (int i = typeSpecStack.size() - 1; i >= 0; i--) { + TypeSpec typeSpec = typeSpecStack.get(i); + if (typeSpec.nestedTypesSimpleNames.contains(simpleName)) { + return stackClassName(i, simpleName); + } + } + + // Match the top-level class. + if (typeSpecStack.size() > 0 && Objects.equals(typeSpecStack.get(0).name, simpleName)) { + return ClassName.get(packageName, simpleName); + } + + // Match an imported type. + ClassName importedType = importedTypes.get(simpleName); + if (importedType != null) return importedType; + + // No match. + return null; + } + + /** + * Returns the class named {@code simpleName} when nested in the class at {@code stackDepth}. + */ + private ClassName stackClassName(int stackDepth, String simpleName) { + ClassName className = ClassName.get(packageName, typeSpecStack.get(0).name); + for (int i = 1; i <= stackDepth; i++) { + className = className.nestedClass(typeSpecStack.get(i).name); + } + return className.nestedClass(simpleName); + } + + /** + * Emits {@code s} with indentation as required. It's important that all code that writes to + * {@link #out} does it through here, since we emit indentation lazily in order to avoid + * unnecessary trailing whitespace. + */ + CodeWriter emitAndIndent(String s) throws IOException { + boolean first = true; + for (String line : LINE_BREAKING_PATTERN.split(s, -1)) { + // Emit a newline character. Make sure blank lines in Javadoc & comments look good. + if (!first) { + if ((javadoc || comment) && trailingNewline) { + emitIndentation(); + out.append(javadoc ? " *" : "//"); + } + out.append("\n"); + trailingNewline = true; + if (statementLine != -1) { + if (statementLine == 0) { + indent(2); // Begin multiple-line statement. Increase the indentation level. + } + statementLine++; + } + } + + first = false; + if (line.isEmpty()) continue; // Don't indent empty lines. + + // Emit indentation and comment prefix if necessary. + if (trailingNewline) { + emitIndentation(); + if (javadoc) { + out.append(" * "); + } else if (comment) { + out.append("// "); + } + } + + out.append(line); + trailingNewline = false; + } + return this; + } + + private void emitIndentation() throws IOException { + for (int j = 0; j < indentLevel; j++) { + out.append(indent); + } + } + + /** + * Returns the types that should have been imported for this code. If there were any simple name + * collisions, that type's first use is imported. + */ + Map suggestedImports() { + Map result = new LinkedHashMap<>(importableTypes); + result.keySet().removeAll(referencedNames); + return result; + } + + // A makeshift multi-set implementation + private static final class Multiset { + private final Map map = new LinkedHashMap<>(); + + void add(T t) { + int count = map.getOrDefault(t, 0); + map.put(t, count + 1); + } + + void remove(T t) { + int count = map.getOrDefault(t, 0); + if (count == 0) { + throw new IllegalStateException(t + " is not in the multiset"); + } + map.put(t, count - 1); + } + + boolean contains(T t) { + return map.getOrDefault(t, 0) > 0; + } + } +} diff --git a/javapoet/src/main/java/org/xbib/javapoet/FieldSpec.java b/javapoet/src/main/java/org/xbib/javapoet/FieldSpec.java new file mode 100644 index 0000000..b6041ed --- /dev/null +++ b/javapoet/src/main/java/org/xbib/javapoet/FieldSpec.java @@ -0,0 +1,164 @@ +package org.xbib.javapoet; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.Modifier; +import static org.xbib.javapoet.Util.checkArgument; +import static org.xbib.javapoet.Util.checkNotNull; +import static org.xbib.javapoet.Util.checkState; + +/** + * A generated field declaration. + */ +public final class FieldSpec { + public final TypeName type; + public final String name; + public final CodeBlock javadoc; + public final List annotations; + public final Set modifiers; + public final CodeBlock initializer; + + private FieldSpec(Builder builder) { + this.type = checkNotNull(builder.type, "type == null"); + this.name = checkNotNull(builder.name, "name == null"); + this.javadoc = builder.javadoc.build(); + this.annotations = Util.immutableList(builder.annotations); + this.modifiers = Util.immutableSet(builder.modifiers); + this.initializer = (builder.initializer == null) + ? CodeBlock.builder().build() + : builder.initializer; + } + + public boolean hasModifier(Modifier modifier) { + return modifiers.contains(modifier); + } + + void emit(CodeWriter codeWriter, Set implicitModifiers) throws IOException { + codeWriter.emitJavadoc(javadoc); + codeWriter.emitAnnotations(annotations, false); + codeWriter.emitModifiers(modifiers, implicitModifiers); + codeWriter.emit("$T $L", type, name); + if (!initializer.isEmpty()) { + codeWriter.emit(" = "); + codeWriter.emit(initializer); + } + codeWriter.emit(";\n"); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null) return false; + if (getClass() != o.getClass()) return false; + return toString().equals(o.toString()); + } + + @Override + public int hashCode() { + return toString().hashCode(); + } + + @Override + public String toString() { + StringBuilder out = new StringBuilder(); + try { + CodeWriter codeWriter = new CodeWriter(out); + emit(codeWriter, Collections.emptySet()); + return out.toString(); + } catch (IOException e) { + throw new AssertionError(); + } + } + + public static Builder builder(TypeName type, String name, Modifier... modifiers) { + checkNotNull(type, "type == null"); + checkArgument(SourceVersion.isName(name), "not a valid name: %s", name); + return new Builder(type, name) + .addModifiers(modifiers); + } + + public static Builder builder(Type type, String name, Modifier... modifiers) { + return builder(TypeName.get(type), name, modifiers); + } + + public Builder toBuilder() { + Builder builder = new Builder(type, name); + builder.javadoc.add(javadoc); + builder.annotations.addAll(annotations); + builder.modifiers.addAll(modifiers); + builder.initializer = initializer.isEmpty() ? null : initializer; + return builder; + } + + public static final class Builder { + private final TypeName type; + private final String name; + + private final CodeBlock.Builder javadoc = CodeBlock.builder(); + private CodeBlock initializer = null; + + public final List annotations = new ArrayList<>(); + public final List modifiers = new ArrayList<>(); + + private Builder(TypeName type, String name) { + this.type = type; + this.name = name; + } + + public Builder addJavadoc(String format, Object... args) { + javadoc.add(format, args); + return this; + } + + public Builder addJavadoc(CodeBlock block) { + javadoc.add(block); + return this; + } + + public Builder addAnnotations(Iterable annotationSpecs) { + checkArgument(annotationSpecs != null, "annotationSpecs == null"); + for (AnnotationSpec annotationSpec : annotationSpecs) { + this.annotations.add(annotationSpec); + } + return this; + } + + public Builder addAnnotation(AnnotationSpec annotationSpec) { + this.annotations.add(annotationSpec); + return this; + } + + public Builder addAnnotation(ClassName annotation) { + this.annotations.add(AnnotationSpec.builder(annotation).build()); + return this; + } + + public Builder addAnnotation(Class annotation) { + return addAnnotation(ClassName.get(annotation)); + } + + public Builder addModifiers(Modifier... modifiers) { + Collections.addAll(this.modifiers, modifiers); + return this; + } + + public Builder initializer(String format, Object... args) { + return initializer(CodeBlock.of(format, args)); + } + + public Builder initializer(CodeBlock codeBlock) { + checkState(this.initializer == null, "initializer was already set"); + this.initializer = checkNotNull(codeBlock, "codeBlock == null"); + return this; + } + + public FieldSpec build() { + return new FieldSpec(this); + } + } +} diff --git a/javapoet/src/main/java/org/xbib/javapoet/JavaFile.java b/javapoet/src/main/java/org/xbib/javapoet/JavaFile.java new file mode 100644 index 0000000..0fee7ce --- /dev/null +++ b/javapoet/src/main/java/org/xbib/javapoet/JavaFile.java @@ -0,0 +1,342 @@ +package org.xbib.javapoet; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.net.URI; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.Collections; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; +import javax.annotation.processing.Filer; +import javax.lang.model.element.Element; +import javax.tools.JavaFileObject; +import javax.tools.JavaFileObject.Kind; +import javax.tools.SimpleJavaFileObject; +import static java.nio.charset.StandardCharsets.UTF_8; +import static org.xbib.javapoet.Util.checkArgument; +import static org.xbib.javapoet.Util.checkNotNull; + +/** + * A Java file containing a single top level class. + */ +public final class JavaFile { + private static final Appendable NULL_APPENDABLE = new Appendable() { + @Override + public Appendable append(CharSequence charSequence) { + return this; + } + + @Override + public Appendable append(CharSequence charSequence, int start, int end) { + return this; + } + + @Override + public Appendable append(char c) { + return this; + } + }; + + public final CodeBlock fileComment; + public final String packageName; + public final TypeSpec typeSpec; + public final boolean skipJavaLangImports; + private final Set staticImports; + private final Set alwaysQualify; + private final String indent; + + private JavaFile(Builder builder) { + this.fileComment = builder.fileComment.build(); + this.packageName = builder.packageName; + this.typeSpec = builder.typeSpec; + this.skipJavaLangImports = builder.skipJavaLangImports; + this.staticImports = Util.immutableSet(builder.staticImports); + this.indent = builder.indent; + + Set alwaysQualifiedNames = new LinkedHashSet<>(); + fillAlwaysQualifiedNames(builder.typeSpec, alwaysQualifiedNames); + this.alwaysQualify = Util.immutableSet(alwaysQualifiedNames); + } + + private void fillAlwaysQualifiedNames(TypeSpec spec, Set alwaysQualifiedNames) { + alwaysQualifiedNames.addAll(spec.alwaysQualifiedNames); + for (TypeSpec nested : spec.typeSpecs) { + fillAlwaysQualifiedNames(nested, alwaysQualifiedNames); + } + } + + public void writeTo(Appendable out) throws IOException { + // First pass: emit the entire class, just to collect the types we'll need to import. + CodeWriter importsCollector = new CodeWriter( + NULL_APPENDABLE, + indent, + staticImports, + alwaysQualify + ); + emit(importsCollector); + Map suggestedImports = importsCollector.suggestedImports(); + + // Second pass: write the code, taking advantage of the imports. + CodeWriter codeWriter + = new CodeWriter(out, indent, suggestedImports, staticImports, alwaysQualify); + emit(codeWriter); + } + + /** + * Writes this to {@code directory} as UTF-8 using the standard directory structure. + */ + public void writeTo(Path directory) throws IOException { + writeToPath(directory); + } + + /** + * Writes this to {@code directory} with the provided {@code charset} using the standard directory + * structure. + */ + public void writeTo(Path directory, Charset charset) throws IOException { + writeToPath(directory, charset); + } + + /** + * Writes this to {@code directory} as UTF-8 using the standard directory structure. + * Returns the {@link Path} instance to which source is actually written. + */ + public Path writeToPath(Path directory) throws IOException { + return writeToPath(directory, UTF_8); + } + + /** + * Writes this to {@code directory} with the provided {@code charset} using the standard directory + * structure. + * Returns the {@link Path} instance to which source is actually written. + */ + public Path writeToPath(Path directory, Charset charset) throws IOException { + checkArgument(Files.notExists(directory) || Files.isDirectory(directory), + "path %s exists but is not a directory.", directory); + Path outputDirectory = directory; + if (!packageName.isEmpty()) { + for (String packageComponent : packageName.split("\\.")) { + outputDirectory = outputDirectory.resolve(packageComponent); + } + Files.createDirectories(outputDirectory); + } + + Path outputPath = outputDirectory.resolve(typeSpec.name + ".java"); + try (Writer writer = new OutputStreamWriter(Files.newOutputStream(outputPath), charset)) { + writeTo(writer); + } + + return outputPath; + } + + /** + * Writes this to {@code directory} as UTF-8 using the standard directory structure. + */ + public void writeTo(File directory) throws IOException { + writeTo(directory.toPath()); + } + + /** + * Writes this to {@code directory} as UTF-8 using the standard directory structure. + * Returns the {@link File} instance to which source is actually written. + */ + public File writeToFile(File directory) throws IOException { + final Path outputPath = writeToPath(directory.toPath()); + return outputPath.toFile(); + } + + /** + * Writes this to {@code filer}. + */ + public void writeTo(Filer filer) throws IOException { + String fileName = packageName.isEmpty() + ? typeSpec.name + : packageName + "." + typeSpec.name; + List originatingElements = typeSpec.originatingElements; + JavaFileObject filerSourceFile = filer.createSourceFile(fileName, + originatingElements.toArray(new Element[originatingElements.size()])); + try (Writer writer = filerSourceFile.openWriter()) { + writeTo(writer); + } catch (Exception e) { + try { + filerSourceFile.delete(); + } catch (Exception ignored) { + } + throw e; + } + } + + private void emit(CodeWriter codeWriter) throws IOException { + codeWriter.pushPackage(packageName); + + if (!fileComment.isEmpty()) { + codeWriter.emitComment(fileComment); + } + + if (!packageName.isEmpty()) { + codeWriter.emit("package $L;\n", packageName); + codeWriter.emit("\n"); + } + + if (!staticImports.isEmpty()) { + for (String signature : staticImports) { + codeWriter.emit("import static $L;\n", signature); + } + codeWriter.emit("\n"); + } + + int importedTypesCount = 0; + for (ClassName className : new TreeSet<>(codeWriter.importedTypes().values())) { + // TODO what about nested types like java.util.Map.Entry? + if (skipJavaLangImports + && className.packageName().equals("java.lang") + && !alwaysQualify.contains(className.simpleName)) { + continue; + } + codeWriter.emit("import $L;\n", className.withoutAnnotations()); + importedTypesCount++; + } + + if (importedTypesCount > 0) { + codeWriter.emit("\n"); + } + + typeSpec.emit(codeWriter, null, Collections.emptySet()); + + codeWriter.popPackage(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null) return false; + if (getClass() != o.getClass()) return false; + return toString().equals(o.toString()); + } + + @Override + public int hashCode() { + return toString().hashCode(); + } + + @Override + public String toString() { + try { + StringBuilder result = new StringBuilder(); + writeTo(result); + return result.toString(); + } catch (IOException e) { + throw new AssertionError(); + } + } + + public JavaFileObject toJavaFileObject() { + URI uri = URI.create((packageName.isEmpty() + ? typeSpec.name + : packageName.replace('.', '/') + '/' + typeSpec.name) + + Kind.SOURCE.extension); + return new SimpleJavaFileObject(uri, Kind.SOURCE) { + private final long lastModified = System.currentTimeMillis(); + + @Override + public String getCharContent(boolean ignoreEncodingErrors) { + return JavaFile.this.toString(); + } + + @Override + public InputStream openInputStream() throws IOException { + return new ByteArrayInputStream(getCharContent(true).getBytes(UTF_8)); + } + + @Override + public long getLastModified() { + return lastModified; + } + }; + } + + public static Builder builder(String packageName, TypeSpec typeSpec) { + checkNotNull(packageName, "packageName == null"); + checkNotNull(typeSpec, "typeSpec == null"); + return new Builder(packageName, typeSpec); + } + + public Builder toBuilder() { + Builder builder = new Builder(packageName, typeSpec); + builder.fileComment.add(fileComment); + builder.skipJavaLangImports = skipJavaLangImports; + builder.indent = indent; + return builder; + } + + public static final class Builder { + private final String packageName; + private final TypeSpec typeSpec; + private final CodeBlock.Builder fileComment = CodeBlock.builder(); + private boolean skipJavaLangImports; + private String indent = " "; + + public final Set staticImports = new TreeSet<>(); + + private Builder(String packageName, TypeSpec typeSpec) { + this.packageName = packageName; + this.typeSpec = typeSpec; + } + + public Builder addFileComment(String format, Object... args) { + this.fileComment.add(format, args); + return this; + } + + public Builder addStaticImport(Enum constant) { + return addStaticImport(ClassName.get(constant.getDeclaringClass()), constant.name()); + } + + public Builder addStaticImport(Class clazz, String... names) { + return addStaticImport(ClassName.get(clazz), names); + } + + public Builder addStaticImport(ClassName className, String... names) { + checkArgument(className != null, "className == null"); + checkArgument(names != null, "names == null"); + checkArgument(names.length > 0, "names array is empty"); + for (String name : names) { + checkArgument(name != null, "null entry in names array: %s", Arrays.toString(names)); + staticImports.add(className.canonicalName + "." + name); + } + return this; + } + + /** + * Call this to omit imports for classes in {@code java.lang}, such as {@code java.lang.String}. + * + *

By default, JavaPoet explicitly imports types in {@code java.lang} to defend against + * naming conflicts. Suppose an (ill-advised) class is named {@code com.example.String}. When + * {@code java.lang} imports are skipped, generated code in {@code com.example} that references + * {@code java.lang.String} will get {@code com.example.String} instead. + */ + public Builder skipJavaLangImports(boolean skipJavaLangImports) { + this.skipJavaLangImports = skipJavaLangImports; + return this; + } + + public Builder indent(String indent) { + this.indent = indent; + return this; + } + + public JavaFile build() { + return new JavaFile(this); + } + } +} diff --git a/javapoet/src/main/java/org/xbib/javapoet/LineWrapper.java b/javapoet/src/main/java/org/xbib/javapoet/LineWrapper.java new file mode 100644 index 0000000..3328c4c --- /dev/null +++ b/javapoet/src/main/java/org/xbib/javapoet/LineWrapper.java @@ -0,0 +1,176 @@ +package org.xbib.javapoet; + +import java.io.IOException; +import static org.xbib.javapoet.Util.checkNotNull; + +/** + * Implements soft line wrapping on an appendable. To use, append characters using {@link #append} + * or soft-wrapping spaces using {@link #wrappingSpace}. + */ +final class LineWrapper { + private final RecordingAppendable out; + private final String indent; + private final int columnLimit; + private boolean closed; + + /** + * Characters written since the last wrapping space that haven't yet been flushed. + */ + private final StringBuilder buffer = new StringBuilder(); + + /** + * The number of characters since the most recent newline. Includes both out and the buffer. + */ + private int column = 0; + + /** + * -1 if we have no buffering; otherwise the number of {@code indent}s to write after wrapping. + */ + private int indentLevel = -1; + + /** + * Null if we have no buffering; otherwise the type to pass to the next call to {@link #flush}. + */ + private FlushType nextFlush; + + LineWrapper(Appendable out, String indent, int columnLimit) { + checkNotNull(out, "out == null"); + this.out = new RecordingAppendable(out); + this.indent = indent; + this.columnLimit = columnLimit; + } + + /** + * @return the last emitted char or {@link Character#MIN_VALUE} if nothing emitted yet. + */ + char lastChar() { + return out.lastChar; + } + + /** + * Emit {@code s}. This may be buffered to permit line wraps to be inserted. + */ + void append(String s) throws IOException { + if (closed) throw new IllegalStateException("closed"); + + if (nextFlush != null) { + int nextNewline = s.indexOf('\n'); + + // If s doesn't cause the current line to cross the limit, buffer it and return. We'll decide + // whether or not we have to wrap it later. + if (nextNewline == -1 && column + s.length() <= columnLimit) { + buffer.append(s); + column += s.length(); + return; + } + + // Wrap if appending s would overflow the current line. + boolean wrap = nextNewline == -1 || column + nextNewline > columnLimit; + flush(wrap ? FlushType.WRAP : nextFlush); + } + + out.append(s); + int lastNewline = s.lastIndexOf('\n'); + column = lastNewline != -1 + ? s.length() - lastNewline - 1 + : column + s.length(); + } + + /** + * Emit either a space or a newline character. + */ + void wrappingSpace(int indentLevel) throws IOException { + if (closed) throw new IllegalStateException("closed"); + + if (this.nextFlush != null) flush(nextFlush); + column++; // Increment the column even though the space is deferred to next call to flush(). + this.nextFlush = FlushType.SPACE; + this.indentLevel = indentLevel; + } + + /** + * Emit a newline character if the line will exceed it's limit, otherwise do nothing. + */ + void zeroWidthSpace(int indentLevel) throws IOException { + if (closed) throw new IllegalStateException("closed"); + + if (column == 0) return; + if (this.nextFlush != null) flush(nextFlush); + this.nextFlush = FlushType.EMPTY; + this.indentLevel = indentLevel; + } + + /** + * Flush any outstanding text and forbid future writes to this line wrapper. + */ + void close() throws IOException { + if (nextFlush != null) flush(nextFlush); + closed = true; + } + + /** + * Write the space followed by any buffered text that follows it. + */ + private void flush(FlushType flushType) throws IOException { + switch (flushType) { + case WRAP: + out.append('\n'); + for (int i = 0; i < indentLevel; i++) { + out.append(indent); + } + column = indentLevel * indent.length(); + column += buffer.length(); + break; + case SPACE: + out.append(' '); + break; + case EMPTY: + break; + default: + throw new IllegalArgumentException("Unknown FlushType: " + flushType); + } + + out.append(buffer); + buffer.delete(0, buffer.length()); + indentLevel = -1; + nextFlush = null; + } + + private enum FlushType { + WRAP, SPACE, EMPTY; + } + + /** + * A delegating {@link Appendable} that records info about the chars passing through it. + */ + static final class RecordingAppendable implements Appendable { + private final Appendable delegate; + + char lastChar = Character.MIN_VALUE; + + RecordingAppendable(Appendable delegate) { + this.delegate = delegate; + } + + @Override + public Appendable append(CharSequence csq) throws IOException { + int length = csq.length(); + if (length != 0) { + lastChar = csq.charAt(length - 1); + } + return delegate.append(csq); + } + + @Override + public Appendable append(CharSequence csq, int start, int end) throws IOException { + CharSequence sub = csq.subSequence(start, end); + return append(sub); + } + + @Override + public Appendable append(char c) throws IOException { + lastChar = c; + return delegate.append(c); + } + } +} diff --git a/javapoet/src/main/java/org/xbib/javapoet/MethodSpec.java b/javapoet/src/main/java/org/xbib/javapoet/MethodSpec.java new file mode 100644 index 0000000..c23ee37 --- /dev/null +++ b/javapoet/src/main/java/org/xbib/javapoet/MethodSpec.java @@ -0,0 +1,527 @@ +package org.xbib.javapoet; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.Element; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.Modifier; +import javax.lang.model.element.TypeParameterElement; +import javax.lang.model.type.DeclaredType; +import javax.lang.model.type.ExecutableType; +import javax.lang.model.type.TypeMirror; +import javax.lang.model.type.TypeVariable; +import javax.lang.model.util.Types; +import static org.xbib.javapoet.Util.checkArgument; +import static org.xbib.javapoet.Util.checkNotNull; +import static org.xbib.javapoet.Util.checkState; + +/** + * A generated constructor or method declaration. + */ +public final class MethodSpec { + static final String CONSTRUCTOR = ""; + + public final String name; + public final CodeBlock javadoc; + public final List annotations; + public final Set modifiers; + public final List typeVariables; + public final TypeName returnType; + public final List parameters; + public final boolean varargs; + public final List exceptions; + public final CodeBlock code; + public final CodeBlock defaultValue; + + private MethodSpec(Builder builder) { + CodeBlock code = builder.code.build(); + checkArgument(code.isEmpty() || !builder.modifiers.contains(Modifier.ABSTRACT), + "abstract method %s cannot have code", builder.name); + checkArgument(!builder.varargs || lastParameterIsArray(builder.parameters), + "last parameter of varargs method %s must be an array", builder.name); + + this.name = checkNotNull(builder.name, "name == null"); + this.javadoc = builder.javadoc.build(); + this.annotations = Util.immutableList(builder.annotations); + this.modifiers = Util.immutableSet(builder.modifiers); + this.typeVariables = Util.immutableList(builder.typeVariables); + this.returnType = builder.returnType; + this.parameters = Util.immutableList(builder.parameters); + this.varargs = builder.varargs; + this.exceptions = Util.immutableList(builder.exceptions); + this.defaultValue = builder.defaultValue; + this.code = code; + } + + private boolean lastParameterIsArray(List parameters) { + return !parameters.isEmpty() + && TypeName.asArray((parameters.get(parameters.size() - 1).type)) != null; + } + + void emit(CodeWriter codeWriter, String enclosingName, Set implicitModifiers) + throws IOException { + codeWriter.emitJavadoc(javadocWithParameters()); + codeWriter.emitAnnotations(annotations, false); + codeWriter.emitModifiers(modifiers, implicitModifiers); + + if (!typeVariables.isEmpty()) { + codeWriter.emitTypeVariables(typeVariables); + codeWriter.emit(" "); + } + + if (isConstructor()) { + codeWriter.emit("$L($Z", enclosingName); + } else { + codeWriter.emit("$T $L($Z", returnType, name); + } + + boolean firstParameter = true; + for (Iterator i = parameters.iterator(); i.hasNext(); ) { + ParameterSpec parameter = i.next(); + if (!firstParameter) codeWriter.emit(",").emitWrappingSpace(); + parameter.emit(codeWriter, !i.hasNext() && varargs); + firstParameter = false; + } + + codeWriter.emit(")"); + + if (defaultValue != null && !defaultValue.isEmpty()) { + codeWriter.emit(" default "); + codeWriter.emit(defaultValue); + } + + if (!exceptions.isEmpty()) { + codeWriter.emitWrappingSpace().emit("throws"); + boolean firstException = true; + for (TypeName exception : exceptions) { + if (!firstException) codeWriter.emit(","); + codeWriter.emitWrappingSpace().emit("$T", exception); + firstException = false; + } + } + + if (hasModifier(Modifier.ABSTRACT)) { + codeWriter.emit(";\n"); + } else if (hasModifier(Modifier.NATIVE)) { + // Code is allowed to support stuff like GWT JSNI. + codeWriter.emit(code); + codeWriter.emit(";\n"); + } else { + codeWriter.emit(" {\n"); + + codeWriter.indent(); + codeWriter.emit(code, true); + codeWriter.unindent(); + + codeWriter.emit("}\n"); + } + codeWriter.popTypeVariables(typeVariables); + } + + private CodeBlock javadocWithParameters() { + CodeBlock.Builder builder = javadoc.toBuilder(); + boolean emitTagNewline = true; + for (ParameterSpec parameterSpec : parameters) { + if (!parameterSpec.javadoc.isEmpty()) { + // Emit a new line before @param section only if the method javadoc is present. + if (emitTagNewline && !javadoc.isEmpty()) builder.add("\n"); + emitTagNewline = false; + builder.add("@param $L $L", parameterSpec.name, parameterSpec.javadoc); + } + } + return builder.build(); + } + + public boolean hasModifier(Modifier modifier) { + return modifiers.contains(modifier); + } + + public boolean isConstructor() { + return name.equals(CONSTRUCTOR); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null) return false; + if (getClass() != o.getClass()) return false; + return toString().equals(o.toString()); + } + + @Override + public int hashCode() { + return toString().hashCode(); + } + + @Override + public String toString() { + StringBuilder out = new StringBuilder(); + try { + CodeWriter codeWriter = new CodeWriter(out); + emit(codeWriter, "Constructor", Collections.emptySet()); + return out.toString(); + } catch (IOException e) { + throw new AssertionError(); + } + } + + public static Builder methodBuilder(String name) { + return new Builder(name); + } + + public static Builder constructorBuilder() { + return new Builder(CONSTRUCTOR); + } + + /** + * Returns a new method spec builder that overrides {@code method}. + * + *

This will copy its visibility modifiers, type parameters, return type, name, parameters, and + * throws declarations. An {@link Override} annotation will be added. + * + *

Note that in JavaPoet 1.2 through 1.7 this method retained annotations from the method and + * parameters of the overridden method. Since JavaPoet 1.8 annotations must be added separately. + */ + public static Builder overriding(ExecutableElement method) { + checkNotNull(method, "method == null"); + + Element enclosingClass = method.getEnclosingElement(); + if (enclosingClass.getModifiers().contains(Modifier.FINAL)) { + throw new IllegalArgumentException("Cannot override method on final class " + enclosingClass); + } + + Set modifiers = method.getModifiers(); + if (modifiers.contains(Modifier.PRIVATE) + || modifiers.contains(Modifier.FINAL) + || modifiers.contains(Modifier.STATIC)) { + throw new IllegalArgumentException("cannot override method with modifiers: " + modifiers); + } + + String methodName = method.getSimpleName().toString(); + MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder(methodName); + + methodBuilder.addAnnotation(Override.class); + + modifiers = new LinkedHashSet<>(modifiers); + modifiers.remove(Modifier.ABSTRACT); + modifiers.remove(Modifier.DEFAULT); + methodBuilder.addModifiers(modifiers); + + for (TypeParameterElement typeParameterElement : method.getTypeParameters()) { + TypeVariable var = (TypeVariable) typeParameterElement.asType(); + methodBuilder.addTypeVariable(TypeVariableName.get(var)); + } + + methodBuilder.returns(TypeName.get(method.getReturnType())); + methodBuilder.addParameters(ParameterSpec.parametersOf(method)); + methodBuilder.varargs(method.isVarArgs()); + + for (TypeMirror thrownType : method.getThrownTypes()) { + methodBuilder.addException(TypeName.get(thrownType)); + } + + return methodBuilder; + } + + /** + * Returns a new method spec builder that overrides {@code method} as a member of {@code + * enclosing}. This will resolve type parameters: for example overriding {@link + * Comparable#compareTo} in a type that implements {@code Comparable}, the {@code T} + * parameter will be resolved to {@code Movie}. + * + *

This will copy its visibility modifiers, type parameters, return type, name, parameters, and + * throws declarations. An {@link Override} annotation will be added. + * + *

Note that in JavaPoet 1.2 through 1.7 this method retained annotations from the method and + * parameters of the overridden method. Since JavaPoet 1.8 annotations must be added separately. + */ + public static Builder overriding( + ExecutableElement method, DeclaredType enclosing, Types types) { + ExecutableType executableType = (ExecutableType) types.asMemberOf(enclosing, method); + List resolvedParameterTypes = executableType.getParameterTypes(); + List resolvedThrownTypes = executableType.getThrownTypes(); + TypeMirror resolvedReturnType = executableType.getReturnType(); + + Builder builder = overriding(method); + builder.returns(TypeName.get(resolvedReturnType)); + for (int i = 0, size = builder.parameters.size(); i < size; i++) { + ParameterSpec parameter = builder.parameters.get(i); + TypeName type = TypeName.get(resolvedParameterTypes.get(i)); + builder.parameters.set(i, parameter.toBuilder(type, parameter.name).build()); + } + builder.exceptions.clear(); + for (int i = 0, size = resolvedThrownTypes.size(); i < size; i++) { + builder.addException(TypeName.get(resolvedThrownTypes.get(i))); + } + + return builder; + } + + public Builder toBuilder() { + Builder builder = new Builder(name); + builder.javadoc.add(javadoc); + builder.annotations.addAll(annotations); + builder.modifiers.addAll(modifiers); + builder.typeVariables.addAll(typeVariables); + builder.returnType = returnType; + builder.parameters.addAll(parameters); + builder.exceptions.addAll(exceptions); + builder.code.add(code); + builder.varargs = varargs; + builder.defaultValue = defaultValue; + return builder; + } + + public static final class Builder { + private String name; + + private final CodeBlock.Builder javadoc = CodeBlock.builder(); + private TypeName returnType; + private final Set exceptions = new LinkedHashSet<>(); + private final CodeBlock.Builder code = CodeBlock.builder(); + private boolean varargs; + private CodeBlock defaultValue; + + public final List typeVariables = new ArrayList<>(); + public final List annotations = new ArrayList<>(); + public final List modifiers = new ArrayList<>(); + public final List parameters = new ArrayList<>(); + + private Builder(String name) { + setName(name); + } + + public Builder setName(String name) { + checkNotNull(name, "name == null"); + checkArgument(name.equals(CONSTRUCTOR) || SourceVersion.isName(name), + "not a valid name: %s", name); + this.name = name; + this.returnType = name.equals(CONSTRUCTOR) ? null : TypeName.VOID; + return this; + } + + public Builder addJavadoc(String format, Object... args) { + javadoc.add(format, args); + return this; + } + + public Builder addJavadoc(CodeBlock block) { + javadoc.add(block); + return this; + } + + public Builder addAnnotations(Iterable annotationSpecs) { + checkArgument(annotationSpecs != null, "annotationSpecs == null"); + for (AnnotationSpec annotationSpec : annotationSpecs) { + this.annotations.add(annotationSpec); + } + return this; + } + + public Builder addAnnotation(AnnotationSpec annotationSpec) { + this.annotations.add(annotationSpec); + return this; + } + + public Builder addAnnotation(ClassName annotation) { + this.annotations.add(AnnotationSpec.builder(annotation).build()); + return this; + } + + public Builder addAnnotation(Class annotation) { + return addAnnotation(ClassName.get(annotation)); + } + + public Builder addModifiers(Modifier... modifiers) { + checkNotNull(modifiers, "modifiers == null"); + Collections.addAll(this.modifiers, modifiers); + return this; + } + + public Builder addModifiers(Iterable modifiers) { + checkNotNull(modifiers, "modifiers == null"); + for (Modifier modifier : modifiers) { + this.modifiers.add(modifier); + } + return this; + } + + public Builder addTypeVariables(Iterable typeVariables) { + checkArgument(typeVariables != null, "typeVariables == null"); + for (TypeVariableName typeVariable : typeVariables) { + this.typeVariables.add(typeVariable); + } + return this; + } + + public Builder addTypeVariable(TypeVariableName typeVariable) { + typeVariables.add(typeVariable); + return this; + } + + public Builder returns(TypeName returnType) { + checkState(!name.equals(CONSTRUCTOR), "constructor cannot have return type."); + this.returnType = returnType; + return this; + } + + public Builder returns(Type returnType) { + return returns(TypeName.get(returnType)); + } + + public Builder addParameters(Iterable parameterSpecs) { + checkArgument(parameterSpecs != null, "parameterSpecs == null"); + for (ParameterSpec parameterSpec : parameterSpecs) { + this.parameters.add(parameterSpec); + } + return this; + } + + public Builder addParameter(ParameterSpec parameterSpec) { + this.parameters.add(parameterSpec); + return this; + } + + public Builder addParameter(TypeName type, String name, Modifier... modifiers) { + return addParameter(ParameterSpec.builder(type, name, modifiers).build()); + } + + public Builder addParameter(Type type, String name, Modifier... modifiers) { + return addParameter(TypeName.get(type), name, modifiers); + } + + public Builder varargs() { + return varargs(true); + } + + public Builder varargs(boolean varargs) { + this.varargs = varargs; + return this; + } + + public Builder addExceptions(Iterable exceptions) { + checkArgument(exceptions != null, "exceptions == null"); + for (TypeName exception : exceptions) { + this.exceptions.add(exception); + } + return this; + } + + public Builder addException(TypeName exception) { + this.exceptions.add(exception); + return this; + } + + public Builder addException(Type exception) { + return addException(TypeName.get(exception)); + } + + public Builder addCode(String format, Object... args) { + code.add(format, args); + return this; + } + + public Builder addNamedCode(String format, Map args) { + code.addNamed(format, args); + return this; + } + + public Builder addCode(CodeBlock codeBlock) { + code.add(codeBlock); + return this; + } + + public Builder addComment(String format, Object... args) { + code.add("// " + format + "\n", args); + return this; + } + + public Builder defaultValue(String format, Object... args) { + return defaultValue(CodeBlock.of(format, args)); + } + + public Builder defaultValue(CodeBlock codeBlock) { + checkState(this.defaultValue == null, "defaultValue was already set"); + this.defaultValue = checkNotNull(codeBlock, "codeBlock == null"); + return this; + } + + /** + * @param controlFlow the control flow construct and its code, such as "if (foo == 5)". + * Shouldn't contain braces or newline characters. + */ + public Builder beginControlFlow(String controlFlow, Object... args) { + code.beginControlFlow(controlFlow, args); + return this; + } + + /** + * @param codeBlock the control flow construct and its code, such as "if (foo == 5)". + * Shouldn't contain braces or newline characters. + */ + public Builder beginControlFlow(CodeBlock codeBlock) { + return beginControlFlow("$L", codeBlock); + } + + /** + * @param controlFlow the control flow construct and its code, such as "else if (foo == 10)". + * Shouldn't contain braces or newline characters. + */ + public Builder nextControlFlow(String controlFlow, Object... args) { + code.nextControlFlow(controlFlow, args); + return this; + } + + /** + * @param codeBlock the control flow construct and its code, such as "else if (foo == 10)". + * Shouldn't contain braces or newline characters. + */ + public Builder nextControlFlow(CodeBlock codeBlock) { + return nextControlFlow("$L", codeBlock); + } + + public Builder endControlFlow() { + code.endControlFlow(); + return this; + } + + /** + * @param controlFlow the optional control flow construct and its code, such as + * "while(foo == 20)". Only used for "do/while" control flows. + */ + public Builder endControlFlow(String controlFlow, Object... args) { + code.endControlFlow(controlFlow, args); + return this; + } + + /** + * @param codeBlock the optional control flow construct and its code, such as + * "while(foo == 20)". Only used for "do/while" control flows. + */ + public Builder endControlFlow(CodeBlock codeBlock) { + return endControlFlow("$L", codeBlock); + } + + public Builder addStatement(String format, Object... args) { + code.addStatement(format, args); + return this; + } + + public Builder addStatement(CodeBlock codeBlock) { + code.addStatement(codeBlock); + return this; + } + + public MethodSpec build() { + return new MethodSpec(this); + } + } +} diff --git a/javapoet/src/main/java/org/xbib/javapoet/NameAllocator.java b/javapoet/src/main/java/org/xbib/javapoet/NameAllocator.java new file mode 100644 index 0000000..db3288f --- /dev/null +++ b/javapoet/src/main/java/org/xbib/javapoet/NameAllocator.java @@ -0,0 +1,154 @@ +package org.xbib.javapoet; + +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import javax.lang.model.SourceVersion; +import static org.xbib.javapoet.Util.checkNotNull; + +/** + * Assigns Java identifier names to avoid collisions, keywords, and invalid characters. To use, + * first create an instance and allocate all of the names that you need. Typically this is a + * mix of user-supplied names and constants:

   {@code
+ *
+ *   NameAllocator nameAllocator = new NameAllocator();
+ *   for (MyProperty property : properties) {
+ *     nameAllocator.newName(property.name(), property);
+ *   }
+ *   nameAllocator.newName("sb", "string builder");
+ * }
+ *

+ * Pass a unique tag object to each allocation. The tag scopes the name, and can be used to look up + * the allocated name later. Typically the tag is the object that is being named. In the above + * example we use {@code property} for the user-supplied property names, and {@code "string + * builder"} for our constant string builder. + * + *

Once we've allocated names we can use them when generating code:

   {@code
+ *
+ *   MethodSpec.Builder builder = MethodSpec.methodBuilder("toString")
+ *       .addAnnotation(Override.class)
+ *       .addModifiers(Modifier.PUBLIC)
+ *       .returns(String.class);
+ *
+ *   builder.addStatement("$1T $2N = new $1T()",
+ *       StringBuilder.class, nameAllocator.get("string builder"));
+ *   for (MyProperty property : properties) {
+ *     builder.addStatement("$N.append($N)",
+ *         nameAllocator.get("string builder"), nameAllocator.get(property));
+ *   }
+ *   builder.addStatement("return $N", nameAllocator.get("string builder"));
+ *   return builder.build();
+ * }
+ *

+ * The above code generates unique names if presented with conflicts. Given user-supplied properties + * with names {@code ab} and {@code sb} this generates the following:

   {@code
+ *
+ *   @Override
+ *   public String toString() {
+ *     StringBuilder sb_ = new StringBuilder();
+ *     sb_.append(ab);
+ *     sb_.append(sb);
+ *     return sb_.toString();
+ *   }
+ * }
+ *

+ * The underscore is appended to {@code sb} to avoid conflicting with the user-supplied {@code sb} + * property. Underscores are also prefixed for names that start with a digit, and used to replace + * name-unsafe characters like space or dash. + * + *

When dealing with multiple independent inner scopes, use a {@link #clone()} of the + * NameAllocator used for the outer scope to further refine name allocation for a specific inner + * scope. + */ +public final class NameAllocator implements Cloneable { + private final Set allocatedNames; + private final Map tagToName; + + public NameAllocator() { + this(new LinkedHashSet<>(), new LinkedHashMap<>()); + } + + private NameAllocator(LinkedHashSet allocatedNames, + LinkedHashMap tagToName) { + this.allocatedNames = allocatedNames; + this.tagToName = tagToName; + } + + /** + * Return a new name using {@code suggestion} that will not be a Java identifier or clash with + * other names. + */ + public String newName(String suggestion) { + return newName(suggestion, UUID.randomUUID().toString()); + } + + /** + * Return a new name using {@code suggestion} that will not be a Java identifier or clash with + * other names. The returned value can be queried multiple times by passing {@code tag} to + * {@link #get(Object)}. + */ + public String newName(String suggestion, Object tag) { + checkNotNull(suggestion, "suggestion"); + checkNotNull(tag, "tag"); + + suggestion = toJavaIdentifier(suggestion); + + while (SourceVersion.isKeyword(suggestion) || !allocatedNames.add(suggestion)) { + suggestion = suggestion + "_"; + } + + String replaced = tagToName.put(tag, suggestion); + if (replaced != null) { + tagToName.put(tag, replaced); // Put things back as they were! + throw new IllegalArgumentException("tag " + tag + " cannot be used for both '" + replaced + + "' and '" + suggestion + "'"); + } + + return suggestion; + } + + public static String toJavaIdentifier(String suggestion) { + StringBuilder result = new StringBuilder(); + for (int i = 0; i < suggestion.length(); ) { + int codePoint = suggestion.codePointAt(i); + if (i == 0 + && !Character.isJavaIdentifierStart(codePoint) + && Character.isJavaIdentifierPart(codePoint)) { + result.append("_"); + } + + int validCodePoint = Character.isJavaIdentifierPart(codePoint) ? codePoint : '_'; + result.appendCodePoint(validCodePoint); + i += Character.charCount(codePoint); + } + return result.toString(); + } + + /** + * Retrieve a name created with {@link #newName(String, Object)}. + */ + public String get(Object tag) { + String result = tagToName.get(tag); + if (result == null) { + throw new IllegalArgumentException("unknown tag: " + tag); + } + return result; + } + + /** + * Create a deep copy of this NameAllocator. Useful to create multiple independent refinements + * of a NameAllocator to be used in the respective definition of multiples, independently-scoped, + * inner code blocks. + * + * @return A deep copy of this NameAllocator. + */ + @Override + public NameAllocator clone() { + return new NameAllocator( + new LinkedHashSet<>(this.allocatedNames), + new LinkedHashMap<>(this.tagToName)); + } + +} diff --git a/javapoet/src/main/java/org/xbib/javapoet/ParameterSpec.java b/javapoet/src/main/java/org/xbib/javapoet/ParameterSpec.java new file mode 100644 index 0000000..b92e391 --- /dev/null +++ b/javapoet/src/main/java/org/xbib/javapoet/ParameterSpec.java @@ -0,0 +1,191 @@ +package org.xbib.javapoet; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.ElementKind; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.Modifier; +import javax.lang.model.element.VariableElement; +import static org.xbib.javapoet.Util.checkArgument; +import static org.xbib.javapoet.Util.checkNotNull; + +/** + * A generated parameter declaration. + */ +public final class ParameterSpec { + public final String name; + public final List annotations; + public final Set modifiers; + public final TypeName type; + public final CodeBlock javadoc; + + private ParameterSpec(Builder builder) { + this.name = checkNotNull(builder.name, "name == null"); + this.annotations = Util.immutableList(builder.annotations); + this.modifiers = Util.immutableSet(builder.modifiers); + this.type = checkNotNull(builder.type, "type == null"); + this.javadoc = builder.javadoc.build(); + } + + public boolean hasModifier(Modifier modifier) { + return modifiers.contains(modifier); + } + + void emit(CodeWriter codeWriter, boolean varargs) throws IOException { + codeWriter.emitAnnotations(annotations, true); + codeWriter.emitModifiers(modifiers); + if (varargs) { + TypeName.asArray(type).emit(codeWriter, true); + } else { + type.emit(codeWriter); + } + codeWriter.emit(" $L", name); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null) return false; + if (getClass() != o.getClass()) return false; + return toString().equals(o.toString()); + } + + @Override + public int hashCode() { + return toString().hashCode(); + } + + @Override + public String toString() { + StringBuilder out = new StringBuilder(); + try { + CodeWriter codeWriter = new CodeWriter(out); + emit(codeWriter, false); + return out.toString(); + } catch (IOException e) { + throw new AssertionError(); + } + } + + public static ParameterSpec get(VariableElement element) { + checkArgument(element.getKind().equals(ElementKind.PARAMETER), "element is not a parameter"); + + TypeName type = TypeName.get(element.asType()); + String name = element.getSimpleName().toString(); + // Copying parameter annotations can be incorrect so we're deliberately not including them. + // See https://github.com/square/javapoet/issues/482. + return ParameterSpec.builder(type, name) + .addModifiers(element.getModifiers()) + .build(); + } + + static List parametersOf(ExecutableElement method) { + List result = new ArrayList<>(); + for (VariableElement parameter : method.getParameters()) { + result.add(ParameterSpec.get(parameter)); + } + return result; + } + + private static boolean isValidParameterName(String name) { + // Allow "this" for explicit receiver parameters + // See https://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.4.1. + if (name.endsWith(".this")) { + return SourceVersion.isIdentifier(name.substring(0, name.length() - ".this".length())); + } + return name.equals("this") || SourceVersion.isName(name); + } + + public static Builder builder(TypeName type, String name, Modifier... modifiers) { + checkNotNull(type, "type == null"); + checkArgument(isValidParameterName(name), "not a valid name: %s", name); + return new Builder(type, name) + .addModifiers(modifiers); + } + + public static Builder builder(Type type, String name, Modifier... modifiers) { + return builder(TypeName.get(type), name, modifiers); + } + + public Builder toBuilder() { + return toBuilder(type, name); + } + + Builder toBuilder(TypeName type, String name) { + Builder builder = new Builder(type, name); + builder.annotations.addAll(annotations); + builder.modifiers.addAll(modifiers); + return builder; + } + + public static final class Builder { + private final TypeName type; + private final String name; + private final CodeBlock.Builder javadoc = CodeBlock.builder(); + + public final List annotations = new ArrayList<>(); + public final List modifiers = new ArrayList<>(); + + private Builder(TypeName type, String name) { + this.type = type; + this.name = name; + } + + public Builder addJavadoc(String format, Object... args) { + javadoc.add(format, args); + return this; + } + + public Builder addJavadoc(CodeBlock block) { + javadoc.add(block); + return this; + } + + public Builder addAnnotations(Iterable annotationSpecs) { + checkArgument(annotationSpecs != null, "annotationSpecs == null"); + for (AnnotationSpec annotationSpec : annotationSpecs) { + this.annotations.add(annotationSpec); + } + return this; + } + + public Builder addAnnotation(AnnotationSpec annotationSpec) { + this.annotations.add(annotationSpec); + return this; + } + + public Builder addAnnotation(ClassName annotation) { + this.annotations.add(AnnotationSpec.builder(annotation).build()); + return this; + } + + public Builder addAnnotation(Class annotation) { + return addAnnotation(ClassName.get(annotation)); + } + + public Builder addModifiers(Modifier... modifiers) { + Collections.addAll(this.modifiers, modifiers); + return this; + } + + public Builder addModifiers(Iterable modifiers) { + checkNotNull(modifiers, "modifiers == null"); + for (Modifier modifier : modifiers) { + if (!modifier.equals(Modifier.FINAL)) { + throw new IllegalStateException("unexpected parameter modifier: " + modifier); + } + this.modifiers.add(modifier); + } + return this; + } + + public ParameterSpec build() { + return new ParameterSpec(this); + } + } +} diff --git a/javapoet/src/main/java/org/xbib/javapoet/ParameterizedTypeName.java b/javapoet/src/main/java/org/xbib/javapoet/ParameterizedTypeName.java new file mode 100644 index 0000000..0ce63c5 --- /dev/null +++ b/javapoet/src/main/java/org/xbib/javapoet/ParameterizedTypeName.java @@ -0,0 +1,132 @@ +package org.xbib.javapoet; + +import java.io.IOException; +import java.lang.reflect.Modifier; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import static org.xbib.javapoet.Util.checkArgument; +import static org.xbib.javapoet.Util.checkNotNull; + +public final class ParameterizedTypeName extends TypeName { + private final ParameterizedTypeName enclosingType; + public final ClassName rawType; + public final List typeArguments; + + ParameterizedTypeName(ParameterizedTypeName enclosingType, ClassName rawType, + List typeArguments) { + this(enclosingType, rawType, typeArguments, new ArrayList<>()); + } + + private ParameterizedTypeName(ParameterizedTypeName enclosingType, ClassName rawType, + List typeArguments, List annotations) { + super(annotations); + this.rawType = checkNotNull(rawType, "rawType == null").annotated(annotations); + this.enclosingType = enclosingType; + this.typeArguments = Util.immutableList(typeArguments); + + checkArgument(!this.typeArguments.isEmpty() || enclosingType != null, + "no type arguments: %s", rawType); + for (TypeName typeArgument : this.typeArguments) { + checkArgument(!typeArgument.isPrimitive() && typeArgument != VOID, + "invalid type parameter: %s", typeArgument); + } + } + + @Override + public ParameterizedTypeName annotated(List annotations) { + return new ParameterizedTypeName( + enclosingType, rawType, typeArguments, concatAnnotations(annotations)); + } + + @Override + public TypeName withoutAnnotations() { + return new ParameterizedTypeName( + enclosingType, rawType.withoutAnnotations(), typeArguments, new ArrayList<>()); + } + + @Override + CodeWriter emit(CodeWriter out) throws IOException { + if (enclosingType != null) { + enclosingType.emit(out); + out.emit("."); + if (isAnnotated()) { + out.emit(" "); + emitAnnotations(out); + } + out.emit(rawType.simpleName()); + } else { + rawType.emit(out); + } + if (!typeArguments.isEmpty()) { + out.emitAndIndent("<"); + boolean firstParameter = true; + for (TypeName parameter : typeArguments) { + if (!firstParameter) out.emitAndIndent(", "); + parameter.emit(out); + firstParameter = false; + } + out.emitAndIndent(">"); + } + return out; + } + + /** + * Returns a new {@link ParameterizedTypeName} instance for the specified {@code name} as nested + * inside this class. + */ + public ParameterizedTypeName nestedClass(String name) { + checkNotNull(name, "name == null"); + return new ParameterizedTypeName(this, rawType.nestedClass(name), new ArrayList<>(), + new ArrayList<>()); + } + + /** + * Returns a new {@link ParameterizedTypeName} instance for the specified {@code name} as nested + * inside this class, with the specified {@code typeArguments}. + */ + public ParameterizedTypeName nestedClass(String name, List typeArguments) { + checkNotNull(name, "name == null"); + return new ParameterizedTypeName(this, rawType.nestedClass(name), typeArguments, + new ArrayList<>()); + } + + /** + * Returns a parameterized type, applying {@code typeArguments} to {@code rawType}. + */ + public static ParameterizedTypeName get(ClassName rawType, TypeName... typeArguments) { + return new ParameterizedTypeName(null, rawType, Arrays.asList(typeArguments)); + } + + /** + * Returns a parameterized type, applying {@code typeArguments} to {@code rawType}. + */ + public static ParameterizedTypeName get(Class rawType, Type... typeArguments) { + return new ParameterizedTypeName(null, ClassName.get(rawType), list(typeArguments)); + } + + /** + * Returns a parameterized type equivalent to {@code type}. + */ + public static ParameterizedTypeName get(ParameterizedType type) { + return get(type, new LinkedHashMap<>()); + } + + /** + * Returns a parameterized type equivalent to {@code type}. + */ + static ParameterizedTypeName get(ParameterizedType type, Map map) { + ClassName rawType = ClassName.get((Class) type.getRawType()); + ParameterizedType ownerType = (type.getOwnerType() instanceof ParameterizedType) + && !Modifier.isStatic(((Class) type.getRawType()).getModifiers()) + ? (ParameterizedType) type.getOwnerType() : null; + List typeArguments = TypeName.list(type.getActualTypeArguments(), map); + return (ownerType != null) + ? get(ownerType, map).nestedClass(rawType.simpleName(), typeArguments) + : new ParameterizedTypeName(null, rawType, typeArguments); + } +} diff --git a/javapoet/src/main/java/org/xbib/javapoet/TypeName.java b/javapoet/src/main/java/org/xbib/javapoet/TypeName.java new file mode 100644 index 0000000..25924fd --- /dev/null +++ b/javapoet/src/main/java/org/xbib/javapoet/TypeName.java @@ -0,0 +1,404 @@ +package org.xbib.javapoet; + +import java.io.IOException; +import java.lang.reflect.GenericArrayType; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.lang.reflect.TypeVariable; +import java.lang.reflect.WildcardType; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import javax.lang.model.element.Modifier; +import javax.lang.model.element.TypeElement; +import javax.lang.model.element.TypeParameterElement; +import javax.lang.model.type.ArrayType; +import javax.lang.model.type.DeclaredType; +import javax.lang.model.type.ErrorType; +import javax.lang.model.type.NoType; +import javax.lang.model.type.PrimitiveType; +import javax.lang.model.type.TypeKind; +import javax.lang.model.type.TypeMirror; +import javax.lang.model.util.SimpleTypeVisitor8; + +/** + * Any type in Java's type system, plus {@code void}. This class is an identifier for primitive + * types like {@code int} and raw reference types like {@code String} and {@code List}. It also + * identifies composite types like {@code char[]} and {@code Set}. + * + *

Type names are dumb identifiers only and do not model the values they name. For example, the + * type name for {@code java.util.List} doesn't know about the {@code size()} method, the fact that + * lists are collections, or even that it accepts a single type parameter. + * + *

Instances of this class are immutable value objects that implement {@code equals()} and {@code + * hashCode()} properly. + * + *

Referencing existing types

+ * + *

Primitives and void are constants that you can reference directly: see {@link #INT}, {@link + * #DOUBLE}, and {@link #VOID}. + * + *

In an annotation processor you can get a type name instance for a type mirror by calling + * {@link #get(TypeMirror)}. In reflection code, you can use {@link #get(Type)}. + * + *

Defining new types

+ * + *

Create new reference types like {@code com.example.HelloWorld} with {@link + * ClassName#get(String, String, String...)}. To build composite types like {@code char[]} and + * {@code Set}, use the factory methods on {@link ArrayTypeName}, {@link + * ParameterizedTypeName}, {@link TypeVariableName}, and {@link WildcardTypeName}. + */ +public class TypeName { + public static final TypeName VOID = new TypeName("void"); + public static final TypeName BOOLEAN = new TypeName("boolean"); + public static final TypeName BYTE = new TypeName("byte"); + public static final TypeName SHORT = new TypeName("short"); + public static final TypeName INT = new TypeName("int"); + public static final TypeName LONG = new TypeName("long"); + public static final TypeName CHAR = new TypeName("char"); + public static final TypeName FLOAT = new TypeName("float"); + public static final TypeName DOUBLE = new TypeName("double"); + public static final ClassName OBJECT = ClassName.get("java.lang", "Object"); + + private static final ClassName BOXED_VOID = ClassName.get("java.lang", "Void"); + private static final ClassName BOXED_BOOLEAN = ClassName.get("java.lang", "Boolean"); + private static final ClassName BOXED_BYTE = ClassName.get("java.lang", "Byte"); + private static final ClassName BOXED_SHORT = ClassName.get("java.lang", "Short"); + private static final ClassName BOXED_INT = ClassName.get("java.lang", "Integer"); + private static final ClassName BOXED_LONG = ClassName.get("java.lang", "Long"); + private static final ClassName BOXED_CHAR = ClassName.get("java.lang", "Character"); + private static final ClassName BOXED_FLOAT = ClassName.get("java.lang", "Float"); + private static final ClassName BOXED_DOUBLE = ClassName.get("java.lang", "Double"); + + /** + * The name of this type if it is a keyword, or null. + */ + private final String keyword; + public final List annotations; + + /** + * Lazily-initialized toString of this type name. + */ + private String cachedString; + + private TypeName(String keyword) { + this(keyword, new ArrayList<>()); + } + + private TypeName(String keyword, List annotations) { + this.keyword = keyword; + this.annotations = Util.immutableList(annotations); + } + + // Package-private constructor to prevent third-party subclasses. + TypeName(List annotations) { + this(null, annotations); + } + + public final TypeName annotated(AnnotationSpec... annotations) { + return annotated(Arrays.asList(annotations)); + } + + public TypeName annotated(List annotations) { + Util.checkNotNull(annotations, "annotations == null"); + return new TypeName(keyword, concatAnnotations(annotations)); + } + + public TypeName withoutAnnotations() { + if (annotations.isEmpty()) { + return this; + } + return new TypeName(keyword); + } + + protected final List concatAnnotations(List annotations) { + List allAnnotations = new ArrayList<>(this.annotations); + allAnnotations.addAll(annotations); + return allAnnotations; + } + + public boolean isAnnotated() { + return !annotations.isEmpty(); + } + + /** + * Returns true if this is a primitive type like {@code int}. Returns false for all other types + * types including boxed primitives and {@code void}. + */ + public boolean isPrimitive() { + return keyword != null && this != VOID; + } + + /** + * Returns true if this is a boxed primitive type like {@code Integer}. Returns false for all + * other types types including unboxed primitives and {@code java.lang.Void}. + */ + public boolean isBoxedPrimitive() { + TypeName thisWithoutAnnotations = withoutAnnotations(); + return thisWithoutAnnotations.equals(BOXED_BOOLEAN) + || thisWithoutAnnotations.equals(BOXED_BYTE) + || thisWithoutAnnotations.equals(BOXED_SHORT) + || thisWithoutAnnotations.equals(BOXED_INT) + || thisWithoutAnnotations.equals(BOXED_LONG) + || thisWithoutAnnotations.equals(BOXED_CHAR) + || thisWithoutAnnotations.equals(BOXED_FLOAT) + || thisWithoutAnnotations.equals(BOXED_DOUBLE); + } + + /** + * Returns a boxed type if this is a primitive type (like {@code Integer} for {@code int}) or + * {@code void}. Returns this type if boxing doesn't apply. + */ + public TypeName box() { + if (keyword == null) return this; // Doesn't need boxing. + TypeName boxed = null; + if (keyword.equals(VOID.keyword)) boxed = BOXED_VOID; + else if (keyword.equals(BOOLEAN.keyword)) boxed = BOXED_BOOLEAN; + else if (keyword.equals(BYTE.keyword)) boxed = BOXED_BYTE; + else if (keyword.equals(SHORT.keyword)) boxed = BOXED_SHORT; + else if (keyword.equals(INT.keyword)) boxed = BOXED_INT; + else if (keyword.equals(LONG.keyword)) boxed = BOXED_LONG; + else if (keyword.equals(CHAR.keyword)) boxed = BOXED_CHAR; + else if (keyword.equals(FLOAT.keyword)) boxed = BOXED_FLOAT; + else if (keyword.equals(DOUBLE.keyword)) boxed = BOXED_DOUBLE; + else throw new AssertionError(keyword); + return annotations.isEmpty() ? boxed : boxed.annotated(annotations); + } + + /** + * Returns an unboxed type if this is a boxed primitive type (like {@code int} for {@code + * Integer}) or {@code Void}. Returns this type if it is already unboxed. + * + * @throws UnsupportedOperationException if this type isn't eligible for unboxing. + */ + public TypeName unbox() { + if (keyword != null) return this; // Already unboxed. + TypeName thisWithoutAnnotations = withoutAnnotations(); + TypeName unboxed = null; + if (thisWithoutAnnotations.equals(BOXED_VOID)) unboxed = VOID; + else if (thisWithoutAnnotations.equals(BOXED_BOOLEAN)) unboxed = BOOLEAN; + else if (thisWithoutAnnotations.equals(BOXED_BYTE)) unboxed = BYTE; + else if (thisWithoutAnnotations.equals(BOXED_SHORT)) unboxed = SHORT; + else if (thisWithoutAnnotations.equals(BOXED_INT)) unboxed = INT; + else if (thisWithoutAnnotations.equals(BOXED_LONG)) unboxed = LONG; + else if (thisWithoutAnnotations.equals(BOXED_CHAR)) unboxed = CHAR; + else if (thisWithoutAnnotations.equals(BOXED_FLOAT)) unboxed = FLOAT; + else if (thisWithoutAnnotations.equals(BOXED_DOUBLE)) unboxed = DOUBLE; + else throw new UnsupportedOperationException("cannot unbox " + this); + return annotations.isEmpty() ? unboxed : unboxed.annotated(annotations); + } + + @Override + public final boolean equals(Object o) { + if (this == o) return true; + if (o == null) return false; + if (getClass() != o.getClass()) return false; + return toString().equals(o.toString()); + } + + @Override + public final int hashCode() { + return toString().hashCode(); + } + + @Override + public final String toString() { + String result = cachedString; + if (result == null) { + try { + StringBuilder resultBuilder = new StringBuilder(); + CodeWriter codeWriter = new CodeWriter(resultBuilder); + emit(codeWriter); + result = resultBuilder.toString(); + cachedString = result; + } catch (IOException e) { + throw new AssertionError(); + } + } + return result; + } + + CodeWriter emit(CodeWriter out) throws IOException { + if (keyword == null) throw new AssertionError(); + + if (isAnnotated()) { + out.emit(""); + emitAnnotations(out); + } + return out.emitAndIndent(keyword); + } + + CodeWriter emitAnnotations(CodeWriter out) throws IOException { + for (AnnotationSpec annotation : annotations) { + annotation.emit(out, true); + out.emit(" "); + } + return out; + } + + + /** + * Returns a type name equivalent to {@code mirror}. + */ + public static TypeName get(TypeMirror mirror) { + return get(mirror, new LinkedHashMap<>()); + } + + static TypeName get(TypeMirror mirror, + final Map typeVariables) { + return mirror.accept(new SimpleTypeVisitor8() { + @Override + public TypeName visitPrimitive(PrimitiveType t, Void p) { + switch (t.getKind()) { + case BOOLEAN: + return TypeName.BOOLEAN; + case BYTE: + return TypeName.BYTE; + case SHORT: + return TypeName.SHORT; + case INT: + return TypeName.INT; + case LONG: + return TypeName.LONG; + case CHAR: + return TypeName.CHAR; + case FLOAT: + return TypeName.FLOAT; + case DOUBLE: + return TypeName.DOUBLE; + default: + throw new AssertionError(); + } + } + + @Override + public TypeName visitDeclared(DeclaredType t, Void p) { + ClassName rawType = ClassName.get((TypeElement) t.asElement()); + TypeMirror enclosingType = t.getEnclosingType(); + TypeName enclosing = + (enclosingType.getKind() != TypeKind.NONE) + && !t.asElement().getModifiers().contains(Modifier.STATIC) + ? enclosingType.accept(this, null) + : null; + if (t.getTypeArguments().isEmpty() && !(enclosing instanceof ParameterizedTypeName)) { + return rawType; + } + + List typeArgumentNames = new ArrayList<>(); + for (TypeMirror mirror : t.getTypeArguments()) { + typeArgumentNames.add(get(mirror, typeVariables)); + } + return enclosing instanceof ParameterizedTypeName + ? ((ParameterizedTypeName) enclosing).nestedClass( + rawType.simpleName(), typeArgumentNames) + : new ParameterizedTypeName(null, rawType, typeArgumentNames); + } + + @Override + public TypeName visitError(ErrorType t, Void p) { + return visitDeclared(t, p); + } + + @Override + public ArrayTypeName visitArray(ArrayType t, Void p) { + return ArrayTypeName.get(t, typeVariables); + } + + @Override + public TypeName visitTypeVariable(javax.lang.model.type.TypeVariable t, Void p) { + return TypeVariableName.get(t, typeVariables); + } + + @Override + public TypeName visitWildcard(javax.lang.model.type.WildcardType t, Void p) { + return WildcardTypeName.get(t, typeVariables); + } + + @Override + public TypeName visitNoType(NoType t, Void p) { + if (t.getKind() == TypeKind.VOID) return TypeName.VOID; + return super.visitUnknown(t, p); + } + + @Override + protected TypeName defaultAction(TypeMirror e, Void p) { + throw new IllegalArgumentException("Unexpected type mirror: " + e); + } + }, null); + } + + /** + * Returns a type name equivalent to {@code type}. + */ + public static TypeName get(Type type) { + return get(type, new LinkedHashMap<>()); + } + + static TypeName get(Type type, Map map) { + if (type instanceof Class) { + Class classType = (Class) type; + if (type == void.class) return VOID; + if (type == boolean.class) return BOOLEAN; + if (type == byte.class) return BYTE; + if (type == short.class) return SHORT; + if (type == int.class) return INT; + if (type == long.class) return LONG; + if (type == char.class) return CHAR; + if (type == float.class) return FLOAT; + if (type == double.class) return DOUBLE; + if (classType.isArray()) return ArrayTypeName.of(get(classType.getComponentType(), map)); + return ClassName.get(classType); + + } else if (type instanceof ParameterizedType) { + return ParameterizedTypeName.get((ParameterizedType) type, map); + + } else if (type instanceof WildcardType) { + return WildcardTypeName.get((WildcardType) type, map); + + } else if (type instanceof TypeVariable) { + return TypeVariableName.get((TypeVariable) type, map); + + } else if (type instanceof GenericArrayType) { + return ArrayTypeName.get((GenericArrayType) type, map); + + } else { + throw new IllegalArgumentException("unexpected type: " + type); + } + } + + /** + * Converts an array of types to a list of type names. + */ + static List list(Type[] types) { + return list(types, new LinkedHashMap<>()); + } + + static List list(Type[] types, Map map) { + List result = new ArrayList<>(types.length); + for (Type type : types) { + result.add(get(type, map)); + } + return result; + } + + /** + * Returns the array component of {@code type}, or null if {@code type} is not an array. + */ + static TypeName arrayComponent(TypeName type) { + return type instanceof ArrayTypeName + ? ((ArrayTypeName) type).componentType + : null; + } + + /** + * Returns {@code type} as an array, or null if {@code type} is not an array. + */ + static ArrayTypeName asArray(TypeName type) { + return type instanceof ArrayTypeName + ? ((ArrayTypeName) type) + : null; + } + +} diff --git a/javapoet/src/main/java/org/xbib/javapoet/TypeSpec.java b/javapoet/src/main/java/org/xbib/javapoet/TypeSpec.java new file mode 100644 index 0000000..d8847ac --- /dev/null +++ b/javapoet/src/main/java/org/xbib/javapoet/TypeSpec.java @@ -0,0 +1,832 @@ +package org.xbib.javapoet; + +import java.io.IOException; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.EnumSet; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.Element; +import javax.lang.model.element.Modifier; +import javax.lang.model.element.TypeElement; +import javax.lang.model.type.DeclaredType; +import javax.lang.model.type.NoType; +import javax.lang.model.type.TypeMirror; +import javax.lang.model.util.ElementFilter; +import static org.xbib.javapoet.Util.checkArgument; +import static org.xbib.javapoet.Util.checkNotNull; +import static org.xbib.javapoet.Util.checkState; +import static org.xbib.javapoet.Util.requireExactlyOneOf; + +/** + * A generated class, interface, or enum declaration. + */ +public final class TypeSpec { + public final Kind kind; + public final String name; + public final CodeBlock anonymousTypeArguments; + public final CodeBlock javadoc; + public final List annotations; + public final Set modifiers; + public final List typeVariables; + public final TypeName superclass; + public final List superinterfaces; + public final Map enumConstants; + public final List fieldSpecs; + public final CodeBlock staticBlock; + public final CodeBlock initializerBlock; + public final List methodSpecs; + public final List typeSpecs; + final Set nestedTypesSimpleNames; + public final List originatingElements; + public final Set alwaysQualifiedNames; + + private TypeSpec(Builder builder) { + this.kind = builder.kind; + this.name = builder.name; + this.anonymousTypeArguments = builder.anonymousTypeArguments; + this.javadoc = builder.javadoc.build(); + this.annotations = Util.immutableList(builder.annotations); + this.modifiers = Util.immutableSet(builder.modifiers); + this.typeVariables = Util.immutableList(builder.typeVariables); + this.superclass = builder.superclass; + this.superinterfaces = Util.immutableList(builder.superinterfaces); + this.enumConstants = Util.immutableMap(builder.enumConstants); + this.fieldSpecs = Util.immutableList(builder.fieldSpecs); + this.staticBlock = builder.staticBlock.build(); + this.initializerBlock = builder.initializerBlock.build(); + this.methodSpecs = Util.immutableList(builder.methodSpecs); + this.typeSpecs = Util.immutableList(builder.typeSpecs); + this.alwaysQualifiedNames = Util.immutableSet(builder.alwaysQualifiedNames); + + nestedTypesSimpleNames = new HashSet<>(builder.typeSpecs.size()); + List originatingElementsMutable = new ArrayList<>(); + originatingElementsMutable.addAll(builder.originatingElements); + for (TypeSpec typeSpec : builder.typeSpecs) { + nestedTypesSimpleNames.add(typeSpec.name); + originatingElementsMutable.addAll(typeSpec.originatingElements); + } + + this.originatingElements = Util.immutableList(originatingElementsMutable); + } + + /** + * Creates a dummy type spec for type-resolution only (in CodeWriter) + * while emitting the type declaration but before entering the type body. + */ + private TypeSpec(TypeSpec type) { + assert type.anonymousTypeArguments == null; + this.kind = type.kind; + this.name = type.name; + this.anonymousTypeArguments = null; + this.javadoc = type.javadoc; + this.annotations = Collections.emptyList(); + this.modifiers = Collections.emptySet(); + this.typeVariables = Collections.emptyList(); + this.superclass = null; + this.superinterfaces = Collections.emptyList(); + this.enumConstants = Collections.emptyMap(); + this.fieldSpecs = Collections.emptyList(); + this.staticBlock = type.staticBlock; + this.initializerBlock = type.initializerBlock; + this.methodSpecs = Collections.emptyList(); + this.typeSpecs = Collections.emptyList(); + this.originatingElements = Collections.emptyList(); + this.nestedTypesSimpleNames = Collections.emptySet(); + this.alwaysQualifiedNames = Collections.emptySet(); + } + + public boolean hasModifier(Modifier modifier) { + return modifiers.contains(modifier); + } + + public static Builder classBuilder(String name) { + return new Builder(Kind.CLASS, checkNotNull(name, "name == null"), null); + } + + public static Builder classBuilder(ClassName className) { + return classBuilder(checkNotNull(className, "className == null").simpleName()); + } + + public static Builder interfaceBuilder(String name) { + return new Builder(Kind.INTERFACE, checkNotNull(name, "name == null"), null); + } + + public static Builder interfaceBuilder(ClassName className) { + return interfaceBuilder(checkNotNull(className, "className == null").simpleName()); + } + + public static Builder enumBuilder(String name) { + return new Builder(Kind.ENUM, checkNotNull(name, "name == null"), null); + } + + public static Builder enumBuilder(ClassName className) { + return enumBuilder(checkNotNull(className, "className == null").simpleName()); + } + + public static Builder anonymousClassBuilder(String typeArgumentsFormat, Object... args) { + return anonymousClassBuilder(CodeBlock.of(typeArgumentsFormat, args)); + } + + public static Builder anonymousClassBuilder(CodeBlock typeArguments) { + return new Builder(Kind.CLASS, null, typeArguments); + } + + public static Builder annotationBuilder(String name) { + return new Builder(Kind.ANNOTATION, checkNotNull(name, "name == null"), null); + } + + public static Builder annotationBuilder(ClassName className) { + return annotationBuilder(checkNotNull(className, "className == null").simpleName()); + } + + public Builder toBuilder() { + Builder builder = new Builder(kind, name, anonymousTypeArguments); + builder.javadoc.add(javadoc); + builder.annotations.addAll(annotations); + builder.modifiers.addAll(modifiers); + builder.typeVariables.addAll(typeVariables); + builder.superclass = superclass; + builder.superinterfaces.addAll(superinterfaces); + builder.enumConstants.putAll(enumConstants); + builder.fieldSpecs.addAll(fieldSpecs); + builder.methodSpecs.addAll(methodSpecs); + builder.typeSpecs.addAll(typeSpecs); + builder.initializerBlock.add(initializerBlock); + builder.staticBlock.add(staticBlock); + builder.originatingElements.addAll(originatingElements); + builder.alwaysQualifiedNames.addAll(alwaysQualifiedNames); + return builder; + } + + void emit(CodeWriter codeWriter, String enumName, Set implicitModifiers) + throws IOException { + // Nested classes interrupt wrapped line indentation. Stash the current wrapping state and put + // it back afterwards when this type is complete. + int previousStatementLine = codeWriter.statementLine; + codeWriter.statementLine = -1; + + try { + if (enumName != null) { + codeWriter.emitJavadoc(javadoc); + codeWriter.emitAnnotations(annotations, false); + codeWriter.emit("$L", enumName); + if (!anonymousTypeArguments.formatParts.isEmpty()) { + codeWriter.emit("("); + codeWriter.emit(anonymousTypeArguments); + codeWriter.emit(")"); + } + if (fieldSpecs.isEmpty() && methodSpecs.isEmpty() && typeSpecs.isEmpty()) { + return; // Avoid unnecessary braces "{}". + } + codeWriter.emit(" {\n"); + } else if (anonymousTypeArguments != null) { + TypeName supertype = !superinterfaces.isEmpty() ? superinterfaces.get(0) : superclass; + codeWriter.emit("new $T(", supertype); + codeWriter.emit(anonymousTypeArguments); + codeWriter.emit(") {\n"); + } else { + // Push an empty type (specifically without nested types) for type-resolution. + codeWriter.pushType(new TypeSpec(this)); + + codeWriter.emitJavadoc(javadoc); + codeWriter.emitAnnotations(annotations, false); + codeWriter.emitModifiers(modifiers, Util.union(implicitModifiers, kind.asMemberModifiers)); + if (kind == Kind.ANNOTATION) { + codeWriter.emit("$L $L", "@interface", name); + } else { + codeWriter.emit("$L $L", kind.name().toLowerCase(Locale.US), name); + } + codeWriter.emitTypeVariables(typeVariables); + + List extendsTypes; + List implementsTypes; + if (kind == Kind.INTERFACE) { + extendsTypes = superinterfaces; + implementsTypes = Collections.emptyList(); + } else { + extendsTypes = superclass.equals(ClassName.OBJECT) + ? Collections.emptyList() + : Collections.singletonList(superclass); + implementsTypes = superinterfaces; + } + + if (!extendsTypes.isEmpty()) { + codeWriter.emit(" extends"); + boolean firstType = true; + for (TypeName type : extendsTypes) { + if (!firstType) codeWriter.emit(","); + codeWriter.emit(" $T", type); + firstType = false; + } + } + + if (!implementsTypes.isEmpty()) { + codeWriter.emit(" implements"); + boolean firstType = true; + for (TypeName type : implementsTypes) { + if (!firstType) codeWriter.emit(","); + codeWriter.emit(" $T", type); + firstType = false; + } + } + + codeWriter.popType(); + + codeWriter.emit(" {\n"); + } + + codeWriter.pushType(this); + codeWriter.indent(); + boolean firstMember = true; + boolean needsSeparator = kind == Kind.ENUM + && (!fieldSpecs.isEmpty() || !methodSpecs.isEmpty() || !typeSpecs.isEmpty()); + for (Iterator> i = enumConstants.entrySet().iterator(); + i.hasNext(); ) { + Map.Entry enumConstant = i.next(); + if (!firstMember) codeWriter.emit("\n"); + enumConstant.getValue().emit(codeWriter, enumConstant.getKey(), Collections.emptySet()); + firstMember = false; + if (i.hasNext()) { + codeWriter.emit(",\n"); + } else if (!needsSeparator) { + codeWriter.emit("\n"); + } + } + + if (needsSeparator) codeWriter.emit(";\n"); + + // Static fields. + for (FieldSpec fieldSpec : fieldSpecs) { + if (!fieldSpec.hasModifier(Modifier.STATIC)) continue; + if (!firstMember) codeWriter.emit("\n"); + fieldSpec.emit(codeWriter, kind.implicitFieldModifiers); + firstMember = false; + } + + if (!staticBlock.isEmpty()) { + if (!firstMember) codeWriter.emit("\n"); + codeWriter.emit(staticBlock); + firstMember = false; + } + + // Non-static fields. + for (FieldSpec fieldSpec : fieldSpecs) { + if (fieldSpec.hasModifier(Modifier.STATIC)) continue; + if (!firstMember) codeWriter.emit("\n"); + fieldSpec.emit(codeWriter, kind.implicitFieldModifiers); + firstMember = false; + } + + // Initializer block. + if (!initializerBlock.isEmpty()) { + if (!firstMember) codeWriter.emit("\n"); + codeWriter.emit(initializerBlock); + firstMember = false; + } + + // Constructors. + for (MethodSpec methodSpec : methodSpecs) { + if (!methodSpec.isConstructor()) continue; + if (!firstMember) codeWriter.emit("\n"); + methodSpec.emit(codeWriter, name, kind.implicitMethodModifiers); + firstMember = false; + } + + // Methods (static and non-static). + for (MethodSpec methodSpec : methodSpecs) { + if (methodSpec.isConstructor()) continue; + if (!firstMember) codeWriter.emit("\n"); + methodSpec.emit(codeWriter, name, kind.implicitMethodModifiers); + firstMember = false; + } + + // Types. + for (TypeSpec typeSpec : typeSpecs) { + if (!firstMember) codeWriter.emit("\n"); + typeSpec.emit(codeWriter, null, kind.implicitTypeModifiers); + firstMember = false; + } + + codeWriter.unindent(); + codeWriter.popType(); + codeWriter.popTypeVariables(typeVariables); + + codeWriter.emit("}"); + if (enumName == null && anonymousTypeArguments == null) { + codeWriter.emit("\n"); // If this type isn't also a value, include a trailing newline. + } + } finally { + codeWriter.statementLine = previousStatementLine; + } + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null) return false; + if (getClass() != o.getClass()) return false; + return toString().equals(o.toString()); + } + + @Override + public int hashCode() { + return toString().hashCode(); + } + + @Override + public String toString() { + StringBuilder out = new StringBuilder(); + try { + CodeWriter codeWriter = new CodeWriter(out); + emit(codeWriter, null, Collections.emptySet()); + return out.toString(); + } catch (IOException e) { + throw new AssertionError(); + } + } + + public enum Kind { + CLASS( + Collections.emptySet(), + Collections.emptySet(), + Collections.emptySet(), + Collections.emptySet()), + + INTERFACE( + Util.immutableSet(Arrays.asList(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL)), + Util.immutableSet(Arrays.asList(Modifier.PUBLIC, Modifier.ABSTRACT)), + Util.immutableSet(Arrays.asList(Modifier.PUBLIC, Modifier.STATIC)), + Util.immutableSet(Collections.singletonList(Modifier.STATIC))), + + ENUM( + Collections.emptySet(), + Collections.emptySet(), + Collections.emptySet(), + Collections.singleton(Modifier.STATIC)), + + ANNOTATION( + Util.immutableSet(Arrays.asList(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL)), + Util.immutableSet(Arrays.asList(Modifier.PUBLIC, Modifier.ABSTRACT)), + Util.immutableSet(Arrays.asList(Modifier.PUBLIC, Modifier.STATIC)), + Util.immutableSet(Collections.singletonList(Modifier.STATIC))); + + private final Set implicitFieldModifiers; + private final Set implicitMethodModifiers; + private final Set implicitTypeModifiers; + private final Set asMemberModifiers; + + Kind(Set implicitFieldModifiers, + Set implicitMethodModifiers, + Set implicitTypeModifiers, + Set asMemberModifiers) { + this.implicitFieldModifiers = implicitFieldModifiers; + this.implicitMethodModifiers = implicitMethodModifiers; + this.implicitTypeModifiers = implicitTypeModifiers; + this.asMemberModifiers = asMemberModifiers; + } + } + + public static final class Builder { + private final Kind kind; + private final String name; + private final CodeBlock anonymousTypeArguments; + + private final CodeBlock.Builder javadoc = CodeBlock.builder(); + private TypeName superclass = ClassName.OBJECT; + private final CodeBlock.Builder staticBlock = CodeBlock.builder(); + private final CodeBlock.Builder initializerBlock = CodeBlock.builder(); + + public final Map enumConstants = new LinkedHashMap<>(); + public final List annotations = new ArrayList<>(); + public final List modifiers = new ArrayList<>(); + public final List typeVariables = new ArrayList<>(); + public final List superinterfaces = new ArrayList<>(); + public final List fieldSpecs = new ArrayList<>(); + public final List methodSpecs = new ArrayList<>(); + public final List typeSpecs = new ArrayList<>(); + public final List originatingElements = new ArrayList<>(); + public final Set alwaysQualifiedNames = new LinkedHashSet<>(); + + private Builder(Kind kind, String name, + CodeBlock anonymousTypeArguments) { + checkArgument(name == null || SourceVersion.isName(name), "not a valid name: %s", name); + this.kind = kind; + this.name = name; + this.anonymousTypeArguments = anonymousTypeArguments; + } + + public Builder addJavadoc(String format, Object... args) { + javadoc.add(format, args); + return this; + } + + public Builder addJavadoc(CodeBlock block) { + javadoc.add(block); + return this; + } + + public Builder addAnnotations(Iterable annotationSpecs) { + checkArgument(annotationSpecs != null, "annotationSpecs == null"); + for (AnnotationSpec annotationSpec : annotationSpecs) { + this.annotations.add(annotationSpec); + } + return this; + } + + public Builder addAnnotation(AnnotationSpec annotationSpec) { + checkNotNull(annotationSpec, "annotationSpec == null"); + this.annotations.add(annotationSpec); + return this; + } + + public Builder addAnnotation(ClassName annotation) { + return addAnnotation(AnnotationSpec.builder(annotation).build()); + } + + public Builder addAnnotation(Class annotation) { + return addAnnotation(ClassName.get(annotation)); + } + + public Builder addModifiers(Modifier... modifiers) { + Collections.addAll(this.modifiers, modifiers); + return this; + } + + public Builder addTypeVariables(Iterable typeVariables) { + checkArgument(typeVariables != null, "typeVariables == null"); + for (TypeVariableName typeVariable : typeVariables) { + this.typeVariables.add(typeVariable); + } + return this; + } + + public Builder addTypeVariable(TypeVariableName typeVariable) { + typeVariables.add(typeVariable); + return this; + } + + public Builder superclass(TypeName superclass) { + checkState(this.kind == Kind.CLASS, "only classes have super classes, not " + this.kind); + checkState(this.superclass == ClassName.OBJECT, + "superclass already set to " + this.superclass); + checkArgument(!superclass.isPrimitive(), "superclass may not be a primitive"); + this.superclass = superclass; + return this; + } + + public Builder superclass(Type superclass) { + return superclass(superclass, true); + } + + public Builder superclass(Type superclass, boolean avoidNestedTypeNameClashes) { + superclass(TypeName.get(superclass)); + if (avoidNestedTypeNameClashes) { + Class clazz = getRawType(superclass); + if (clazz != null) { + avoidClashesWithNestedClasses(clazz); + } + } + return this; + } + + public Builder superclass(TypeMirror superclass) { + return superclass(superclass, true); + } + + public Builder superclass(TypeMirror superclass, boolean avoidNestedTypeNameClashes) { + superclass(TypeName.get(superclass)); + if (avoidNestedTypeNameClashes && superclass instanceof DeclaredType) { + TypeElement superInterfaceElement = + (TypeElement) ((DeclaredType) superclass).asElement(); + avoidClashesWithNestedClasses(superInterfaceElement); + } + return this; + } + + public Builder addSuperinterfaces(Iterable superinterfaces) { + checkArgument(superinterfaces != null, "superinterfaces == null"); + for (TypeName superinterface : superinterfaces) { + addSuperinterface(superinterface); + } + return this; + } + + public Builder addSuperinterface(TypeName superinterface) { + checkArgument(superinterface != null, "superinterface == null"); + this.superinterfaces.add(superinterface); + return this; + } + + public Builder addSuperinterface(Type superinterface) { + return addSuperinterface(superinterface, true); + } + + public Builder addSuperinterface(Type superinterface, boolean avoidNestedTypeNameClashes) { + addSuperinterface(TypeName.get(superinterface)); + if (avoidNestedTypeNameClashes) { + Class clazz = getRawType(superinterface); + if (clazz != null) { + avoidClashesWithNestedClasses(clazz); + } + } + return this; + } + + private Class getRawType(Type type) { + if (type instanceof Class) { + return (Class) type; + } else if (type instanceof ParameterizedType) { + return getRawType(((ParameterizedType) type).getRawType()); + } else { + return null; + } + } + + public Builder addSuperinterface(TypeMirror superinterface) { + return addSuperinterface(superinterface, true); + } + + public Builder addSuperinterface(TypeMirror superinterface, + boolean avoidNestedTypeNameClashes) { + addSuperinterface(TypeName.get(superinterface)); + if (avoidNestedTypeNameClashes && superinterface instanceof DeclaredType) { + TypeElement superInterfaceElement = + (TypeElement) ((DeclaredType) superinterface).asElement(); + avoidClashesWithNestedClasses(superInterfaceElement); + } + return this; + } + + public Builder addEnumConstant(String name) { + return addEnumConstant(name, anonymousClassBuilder("").build()); + } + + public Builder addEnumConstant(String name, TypeSpec typeSpec) { + enumConstants.put(name, typeSpec); + return this; + } + + public Builder addFields(Iterable fieldSpecs) { + checkArgument(fieldSpecs != null, "fieldSpecs == null"); + for (FieldSpec fieldSpec : fieldSpecs) { + addField(fieldSpec); + } + return this; + } + + public Builder addField(FieldSpec fieldSpec) { + fieldSpecs.add(fieldSpec); + return this; + } + + public Builder addField(TypeName type, String name, Modifier... modifiers) { + return addField(FieldSpec.builder(type, name, modifiers).build()); + } + + public Builder addField(Type type, String name, Modifier... modifiers) { + return addField(TypeName.get(type), name, modifiers); + } + + public Builder addStaticBlock(CodeBlock block) { + staticBlock.beginControlFlow("static").add(block).endControlFlow(); + return this; + } + + public Builder addInitializerBlock(CodeBlock block) { + if ((kind != Kind.CLASS && kind != Kind.ENUM)) { + throw new UnsupportedOperationException(kind + " can't have initializer blocks"); + } + initializerBlock.add("{\n") + .indent() + .add(block) + .unindent() + .add("}\n"); + return this; + } + + public Builder addMethods(Iterable methodSpecs) { + checkArgument(methodSpecs != null, "methodSpecs == null"); + for (MethodSpec methodSpec : methodSpecs) { + addMethod(methodSpec); + } + return this; + } + + public Builder addMethod(MethodSpec methodSpec) { + methodSpecs.add(methodSpec); + return this; + } + + public Builder addTypes(Iterable typeSpecs) { + checkArgument(typeSpecs != null, "typeSpecs == null"); + for (TypeSpec typeSpec : typeSpecs) { + addType(typeSpec); + } + return this; + } + + public Builder addType(TypeSpec typeSpec) { + typeSpecs.add(typeSpec); + return this; + } + + public Builder addOriginatingElement(Element originatingElement) { + originatingElements.add(originatingElement); + return this; + } + + public Builder alwaysQualify(String... simpleNames) { + checkArgument(simpleNames != null, "simpleNames == null"); + for (String name : simpleNames) { + checkArgument( + name != null, + "null entry in simpleNames array: %s", + Arrays.toString(simpleNames) + ); + alwaysQualifiedNames.add(name); + } + return this; + } + + /** + * Call this to always fully qualify any types that would conflict with possibly nested types of + * this {@code typeElement}. For example - if the following type was passed in as the + * typeElement: + * + *


+         *   class Foo {
+         *     class NestedTypeA {
+         *
+         *     }
+         *     class NestedTypeB {
+         *
+         *     }
+         *   }
+         * 
+ * + *

+ * Then this would add {@code "NestedTypeA"} and {@code "NestedTypeB"} as names that should + * always be qualified via {@link #alwaysQualify(String...)}. This way they would avoid + * possible import conflicts when this JavaFile is written. + * + * @param typeElement the {@link TypeElement} with nested types to avoid clashes with. + * @return this builder instance. + */ + public Builder avoidClashesWithNestedClasses(TypeElement typeElement) { + checkArgument(typeElement != null, "typeElement == null"); + for (TypeElement nestedType : ElementFilter.typesIn(typeElement.getEnclosedElements())) { + alwaysQualify(nestedType.getSimpleName().toString()); + } + TypeMirror superclass = typeElement.getSuperclass(); + if (!(superclass instanceof NoType) && superclass instanceof DeclaredType) { + TypeElement superclassElement = (TypeElement) ((DeclaredType) superclass).asElement(); + avoidClashesWithNestedClasses(superclassElement); + } + for (TypeMirror superinterface : typeElement.getInterfaces()) { + if (superinterface instanceof DeclaredType) { + TypeElement superinterfaceElement + = (TypeElement) ((DeclaredType) superinterface).asElement(); + avoidClashesWithNestedClasses(superinterfaceElement); + } + } + return this; + } + + /** + * Call this to always fully qualify any types that would conflict with possibly nested types of + * this {@code typeElement}. For example - if the following type was passed in as the + * typeElement: + * + *


+         *   class Foo {
+         *     class NestedTypeA {
+         *
+         *     }
+         *     class NestedTypeB {
+         *
+         *     }
+         *   }
+         * 
+ * + *

+ * Then this would add {@code "NestedTypeA"} and {@code "NestedTypeB"} as names that should + * always be qualified via {@link #alwaysQualify(String...)}. This way they would avoid + * possible import conflicts when this JavaFile is written. + * + * @param clazz the {@link Class} with nested types to avoid clashes with. + * @return this builder instance. + */ + public Builder avoidClashesWithNestedClasses(Class clazz) { + checkArgument(clazz != null, "clazz == null"); + for (Class nestedType : clazz.getDeclaredClasses()) { + alwaysQualify(nestedType.getSimpleName()); + } + Class superclass = clazz.getSuperclass(); + if (superclass != null && !Object.class.equals(superclass)) { + avoidClashesWithNestedClasses(superclass); + } + for (Class superinterface : clazz.getInterfaces()) { + avoidClashesWithNestedClasses(superinterface); + } + return this; + } + + public TypeSpec build() { + for (AnnotationSpec annotationSpec : annotations) { + checkNotNull(annotationSpec, "annotationSpec == null"); + } + + if (!modifiers.isEmpty()) { + checkState(anonymousTypeArguments == null, "forbidden on anonymous types."); + for (Modifier modifier : modifiers) { + checkArgument(modifier != null, "modifiers contain null"); + } + } + + for (TypeName superinterface : superinterfaces) { + checkArgument(superinterface != null, "superinterfaces contains null"); + } + + if (!typeVariables.isEmpty()) { + checkState(anonymousTypeArguments == null, + "typevariables are forbidden on anonymous types."); + for (TypeVariableName typeVariableName : typeVariables) { + checkArgument(typeVariableName != null, "typeVariables contain null"); + } + } + + for (Map.Entry enumConstant : enumConstants.entrySet()) { + checkState(kind == Kind.ENUM, "%s is not enum", this.name); + checkArgument(enumConstant.getValue().anonymousTypeArguments != null, + "enum constants must have anonymous type arguments"); + checkArgument(SourceVersion.isName(name), "not a valid enum constant: %s", name); + } + + for (FieldSpec fieldSpec : fieldSpecs) { + if (kind == Kind.INTERFACE || kind == Kind.ANNOTATION) { + requireExactlyOneOf(fieldSpec.modifiers, Modifier.PUBLIC, Modifier.PRIVATE); + Set check = EnumSet.of(Modifier.STATIC, Modifier.FINAL); + checkState(fieldSpec.modifiers.containsAll(check), "%s %s.%s requires modifiers %s", + kind, name, fieldSpec.name, check); + } + } + + for (MethodSpec methodSpec : methodSpecs) { + if (kind == Kind.INTERFACE) { + requireExactlyOneOf(methodSpec.modifiers, Modifier.PUBLIC, Modifier.PRIVATE); + if (methodSpec.modifiers.contains(Modifier.PRIVATE)) { + checkState(!methodSpec.hasModifier(Modifier.DEFAULT), + "%s %s.%s cannot be private and default", kind, name, methodSpec.name); + checkState(!methodSpec.hasModifier(Modifier.ABSTRACT), + "%s %s.%s cannot be private and abstract", kind, name, methodSpec.name); + } else { + requireExactlyOneOf(methodSpec.modifiers, Modifier.ABSTRACT, Modifier.STATIC, + Modifier.DEFAULT); + } + } else if (kind == Kind.ANNOTATION) { + checkState(methodSpec.modifiers.equals(kind.implicitMethodModifiers), + "%s %s.%s requires modifiers %s", + kind, name, methodSpec.name, kind.implicitMethodModifiers); + } + if (kind != Kind.ANNOTATION) { + checkState(methodSpec.defaultValue == null, "%s %s.%s cannot have a default value", + kind, name, methodSpec.name); + } + if (kind != Kind.INTERFACE) { + checkState(!methodSpec.hasModifier(Modifier.DEFAULT), "%s %s.%s cannot be default", + kind, name, methodSpec.name); + } + } + + for (TypeSpec typeSpec : typeSpecs) { + checkArgument(typeSpec.modifiers.containsAll(kind.implicitTypeModifiers), + "%s %s.%s requires modifiers %s", kind, name, typeSpec.name, + kind.implicitTypeModifiers); + } + + boolean isAbstract = modifiers.contains(Modifier.ABSTRACT) || kind != Kind.CLASS; + for (MethodSpec methodSpec : methodSpecs) { + checkArgument(isAbstract || !methodSpec.hasModifier(Modifier.ABSTRACT), + "non-abstract type %s cannot declare abstract method %s", name, methodSpec.name); + } + + boolean superclassIsObject = superclass.equals(ClassName.OBJECT); + int interestingSupertypeCount = (superclassIsObject ? 0 : 1) + superinterfaces.size(); + checkArgument(anonymousTypeArguments == null || interestingSupertypeCount <= 1, + "anonymous type has too many supertypes"); + + return new TypeSpec(this); + } + } +} diff --git a/javapoet/src/main/java/org/xbib/javapoet/TypeVariableName.java b/javapoet/src/main/java/org/xbib/javapoet/TypeVariableName.java new file mode 100644 index 0000000..bfe74d3 --- /dev/null +++ b/javapoet/src/main/java/org/xbib/javapoet/TypeVariableName.java @@ -0,0 +1,168 @@ +package org.xbib.javapoet; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import javax.lang.model.element.TypeParameterElement; +import javax.lang.model.type.TypeMirror; +import javax.lang.model.type.TypeVariable; +import static org.xbib.javapoet.Util.checkArgument; +import static org.xbib.javapoet.Util.checkNotNull; + +public final class TypeVariableName extends TypeName { + public final String name; + public final List bounds; + + private TypeVariableName(String name, List bounds) { + this(name, bounds, new ArrayList<>()); + } + + private TypeVariableName(String name, List bounds, List annotations) { + super(annotations); + this.name = checkNotNull(name, "name == null"); + this.bounds = bounds; + + for (TypeName bound : this.bounds) { + checkArgument(!bound.isPrimitive() && bound != VOID, "invalid bound: %s", bound); + } + } + + @Override + public TypeVariableName annotated(List annotations) { + return new TypeVariableName(name, bounds, annotations); + } + + @Override + public TypeName withoutAnnotations() { + return new TypeVariableName(name, bounds); + } + + public TypeVariableName withBounds(Type... bounds) { + return withBounds(TypeName.list(bounds)); + } + + public TypeVariableName withBounds(TypeName... bounds) { + return withBounds(Arrays.asList(bounds)); + } + + public TypeVariableName withBounds(List bounds) { + ArrayList newBounds = new ArrayList<>(); + newBounds.addAll(this.bounds); + newBounds.addAll(bounds); + return new TypeVariableName(name, newBounds, annotations); + } + + private static TypeVariableName of(String name, List bounds) { + // Strip java.lang.Object from bounds if it is present. + List boundsNoObject = new ArrayList<>(bounds); + boundsNoObject.remove(OBJECT); + return new TypeVariableName(name, Collections.unmodifiableList(boundsNoObject)); + } + + @Override + CodeWriter emit(CodeWriter out) throws IOException { + emitAnnotations(out); + return out.emitAndIndent(name); + } + + /** + * Returns type variable named {@code name} without bounds. + */ + public static TypeVariableName get(String name) { + return TypeVariableName.of(name, Collections.emptyList()); + } + + /** + * Returns type variable named {@code name} with {@code bounds}. + */ + public static TypeVariableName get(String name, TypeName... bounds) { + return TypeVariableName.of(name, Arrays.asList(bounds)); + } + + /** + * Returns type variable named {@code name} with {@code bounds}. + */ + public static TypeVariableName get(String name, Type... bounds) { + return TypeVariableName.of(name, TypeName.list(bounds)); + } + + /** + * Returns type variable equivalent to {@code mirror}. + */ + public static TypeVariableName get(TypeVariable mirror) { + return get((TypeParameterElement) mirror.asElement()); + } + + /** + * Make a TypeVariableName for the given TypeMirror. This form is used internally to avoid + * infinite recursion in cases like {@code Enum>}. When we encounter such a + * thing, we will make a TypeVariableName without bounds and add that to the {@code typeVariables} + * map before looking up the bounds. Then if we encounter this TypeVariable again while + * constructing the bounds, we can just return it from the map. And, the code that put the entry + * in {@code variables} will make sure that the bounds are filled in before returning. + */ + static TypeVariableName get( + TypeVariable mirror, Map typeVariables) { + TypeParameterElement element = (TypeParameterElement) mirror.asElement(); + TypeVariableName typeVariableName = typeVariables.get(element); + if (typeVariableName == null) { + // Since the bounds field is public, we need to make it an unmodifiableList. But we control + // the List that that wraps, which means we can change it before returning. + List bounds = new ArrayList<>(); + List visibleBounds = Collections.unmodifiableList(bounds); + typeVariableName = new TypeVariableName(element.getSimpleName().toString(), visibleBounds); + typeVariables.put(element, typeVariableName); + for (TypeMirror typeMirror : element.getBounds()) { + bounds.add(TypeName.get(typeMirror, typeVariables)); + } + bounds.remove(OBJECT); + } + return typeVariableName; + } + + /** + * Returns type variable equivalent to {@code element}. + */ + public static TypeVariableName get(TypeParameterElement element) { + String name = element.getSimpleName().toString(); + List boundsMirrors = element.getBounds(); + + List boundsTypeNames = new ArrayList<>(); + for (TypeMirror typeMirror : boundsMirrors) { + boundsTypeNames.add(TypeName.get(typeMirror)); + } + + return TypeVariableName.of(name, boundsTypeNames); + } + + /** + * Returns type variable equivalent to {@code type}. + */ + public static TypeVariableName get(java.lang.reflect.TypeVariable type) { + return get(type, new LinkedHashMap<>()); + } + + /** + * @see #get(java.lang.reflect.TypeVariable, Map) + */ + static TypeVariableName get(java.lang.reflect.TypeVariable type, + Map map) { + TypeVariableName result = map.get(type); + if (result == null) { + List bounds = new ArrayList<>(); + List visibleBounds = Collections.unmodifiableList(bounds); + result = new TypeVariableName(type.getName(), visibleBounds); + map.put(type, result); + for (Type bound : type.getBounds()) { + bounds.add(TypeName.get(bound, map)); + } + bounds.remove(OBJECT); + } + return result; + } +} diff --git a/javapoet/src/main/java/org/xbib/javapoet/Util.java b/javapoet/src/main/java/org/xbib/javapoet/Util.java new file mode 100644 index 0000000..64adc84 --- /dev/null +++ b/javapoet/src/main/java/org/xbib/javapoet/Util.java @@ -0,0 +1,125 @@ +package org.xbib.javapoet; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import javax.lang.model.element.Modifier; +import static java.lang.Character.isISOControl; + +/** + * Like Guava, but worse and standalone. This makes it easier to mix JavaPoet with libraries that + * bring their own version of Guava. + */ +final class Util { + private Util() { + } + + static Map> immutableMultimap(Map> multimap) { + LinkedHashMap> result = new LinkedHashMap<>(); + for (Map.Entry> entry : multimap.entrySet()) { + if (entry.getValue().isEmpty()) continue; + result.put(entry.getKey(), immutableList(entry.getValue())); + } + return Collections.unmodifiableMap(result); + } + + static Map immutableMap(Map map) { + return Collections.unmodifiableMap(new LinkedHashMap<>(map)); + } + + static void checkArgument(boolean condition, String format, Object... args) { + if (!condition) throw new IllegalArgumentException(String.format(format, args)); + } + + static T checkNotNull(T reference, String format, Object... args) { + if (reference == null) throw new NullPointerException(String.format(format, args)); + return reference; + } + + static void checkState(boolean condition, String format, Object... args) { + if (!condition) throw new IllegalStateException(String.format(format, args)); + } + + static List immutableList(Collection collection) { + return Collections.unmodifiableList(new ArrayList<>(collection)); + } + + static Set immutableSet(Collection set) { + return Collections.unmodifiableSet(new LinkedHashSet<>(set)); + } + + static Set union(Set a, Set b) { + Set result = new LinkedHashSet<>(); + result.addAll(a); + result.addAll(b); + return result; + } + + static void requireExactlyOneOf(Set modifiers, Modifier... mutuallyExclusive) { + int count = 0; + for (Modifier modifier : mutuallyExclusive) { + if (modifiers.contains(modifier)) count++; + } + checkArgument(count == 1, "modifiers %s must contain one of %s", + modifiers, Arrays.toString(mutuallyExclusive)); + } + + static String characterLiteralWithoutSingleQuotes(char c) { + // see https://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.10.6 + switch (c) { + case '\b': + return "\\b"; /* \u0008: backspace (BS) */ + case '\t': + return "\\t"; /* \u0009: horizontal tab (HT) */ + case '\n': + return "\\n"; /* \u000a: linefeed (LF) */ + case '\f': + return "\\f"; /* \u000c: form feed (FF) */ + case '\r': + return "\\r"; /* \u000d: carriage return (CR) */ + case '\"': + return "\""; /* \u0022: double quote (") */ + case '\'': + return "\\'"; /* \u0027: single quote (') */ + case '\\': + return "\\\\"; /* \u005c: backslash (\) */ + default: + return isISOControl(c) ? String.format("\\u%04x", (int) c) : Character.toString(c); + } + } + + /** + * Returns the string literal representing {@code value}, including wrapping double quotes. + */ + static String stringLiteralWithDoubleQuotes(String value, String indent) { + StringBuilder result = new StringBuilder(value.length() + 2); + result.append('"'); + for (int i = 0; i < value.length(); i++) { + char c = value.charAt(i); + // trivial case: single quote must not be escaped + if (c == '\'') { + result.append("'"); + continue; + } + // trivial case: double quotes must be escaped + if (c == '\"') { + result.append("\\\""); + continue; + } + // default case: just let character literal do its work + result.append(characterLiteralWithoutSingleQuotes(c)); + // need to append indent after linefeed? + if (c == '\n' && i + 1 < value.length()) { + result.append("\"\n").append(indent).append(indent).append("+ \""); + } + } + result.append('"'); + return result.toString(); + } +} diff --git a/javapoet/src/main/java/org/xbib/javapoet/WildcardTypeName.java b/javapoet/src/main/java/org/xbib/javapoet/WildcardTypeName.java new file mode 100644 index 0000000..7b66a21 --- /dev/null +++ b/javapoet/src/main/java/org/xbib/javapoet/WildcardTypeName.java @@ -0,0 +1,116 @@ +package org.xbib.javapoet; + +import java.io.IOException; +import java.lang.reflect.Type; +import java.lang.reflect.WildcardType; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import javax.lang.model.element.TypeParameterElement; +import javax.lang.model.type.TypeMirror; +import static org.xbib.javapoet.Util.checkArgument; + +public final class WildcardTypeName extends TypeName { + public final List upperBounds; + public final List lowerBounds; + + private WildcardTypeName(List upperBounds, List lowerBounds) { + this(upperBounds, lowerBounds, new ArrayList<>()); + } + + private WildcardTypeName(List upperBounds, List lowerBounds, + List annotations) { + super(annotations); + this.upperBounds = Util.immutableList(upperBounds); + this.lowerBounds = Util.immutableList(lowerBounds); + + checkArgument(this.upperBounds.size() == 1, "unexpected extends bounds: %s", upperBounds); + for (TypeName upperBound : this.upperBounds) { + checkArgument(!upperBound.isPrimitive() && upperBound != VOID, + "invalid upper bound: %s", upperBound); + } + for (TypeName lowerBound : this.lowerBounds) { + checkArgument(!lowerBound.isPrimitive() && lowerBound != VOID, + "invalid lower bound: %s", lowerBound); + } + } + + @Override + public WildcardTypeName annotated(List annotations) { + return new WildcardTypeName(upperBounds, lowerBounds, concatAnnotations(annotations)); + } + + @Override + public TypeName withoutAnnotations() { + return new WildcardTypeName(upperBounds, lowerBounds); + } + + @Override + CodeWriter emit(CodeWriter out) throws IOException { + if (lowerBounds.size() == 1) { + return out.emit("? super $T", lowerBounds.get(0)); + } + return upperBounds.get(0).equals(TypeName.OBJECT) + ? out.emit("?") + : out.emit("? extends $T", upperBounds.get(0)); + } + + /** + * Returns a type that represents an unknown type that extends {@code bound}. For example, if + * {@code bound} is {@code CharSequence.class}, this returns {@code ? extends CharSequence}. If + * {@code bound} is {@code Object.class}, this returns {@code ?}, which is shorthand for {@code + * ? extends Object}. + */ + public static WildcardTypeName subtypeOf(TypeName upperBound) { + return new WildcardTypeName(Collections.singletonList(upperBound), Collections.emptyList()); + } + + public static WildcardTypeName subtypeOf(Type upperBound) { + return subtypeOf(TypeName.get(upperBound)); + } + + /** + * Returns a type that represents an unknown supertype of {@code bound}. For example, if {@code + * bound} is {@code String.class}, this returns {@code ? super String}. + */ + public static WildcardTypeName supertypeOf(TypeName lowerBound) { + return new WildcardTypeName(Collections.singletonList(OBJECT), + Collections.singletonList(lowerBound)); + } + + public static WildcardTypeName supertypeOf(Type lowerBound) { + return supertypeOf(TypeName.get(lowerBound)); + } + + public static TypeName get(javax.lang.model.type.WildcardType mirror) { + return get(mirror, new LinkedHashMap<>()); + } + + static TypeName get( + javax.lang.model.type.WildcardType mirror, + Map typeVariables) { + TypeMirror extendsBound = mirror.getExtendsBound(); + if (extendsBound == null) { + TypeMirror superBound = mirror.getSuperBound(); + if (superBound == null) { + return subtypeOf(Object.class); + } else { + return supertypeOf(TypeName.get(superBound, typeVariables)); + } + } else { + return subtypeOf(TypeName.get(extendsBound, typeVariables)); + } + } + + public static TypeName get(WildcardType wildcardName) { + return get(wildcardName, new LinkedHashMap<>()); + } + + static TypeName get(WildcardType wildcardName, Map map) { + return new WildcardTypeName( + list(wildcardName.getUpperBounds(), map), + list(wildcardName.getLowerBounds(), map)); + } +} diff --git a/settings.gradle b/settings.gradle index e6618f7..9f506b5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -33,5 +33,6 @@ dependencyResolutionManagement { } } +include ':javapoet' include ':j2html-codegen' include ':j2html'