com.github.lucapino.confluence.macro.ExpandMacro Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of confluence-maven-plugin Show documentation
Show all versions of confluence-maven-plugin Show documentation
Maven plugin for accessing Atlassian Confluence
The newest version!
/*
* Copyright 2013 Luca Tagliani
* Copyright 2015 Jonathon Hope
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.lucapino.confluence.macro;
/**
* Represents an expandable body of rich text.
*
* @author Jonathon Hope
* @see Expand Macro docs
*/
public class ExpandMacro {
/**
* The title of the expandable.
*/
private final String title;
/**
* The contents of the expandable.
*/
private final String body;
/**
* @param builder the builder factory to use.
*/
protected ExpandMacro(final Builder builder) {
this.title = builder.title;
this.body = builder.body;
}
/**
* @return converts this instance to confluence markup.
*/
public String toMarkup() {
StringBuilder sb = new StringBuilder();
sb.append("");
sb.append("");
sb.append(title);
sb.append(" ");
sb.append("");
sb.append(body);
sb.append(" ");
sb.append(" ");
return sb.toString();
}
/**
* Builder factory method.
*
* @return a {@code Builder} instance for chain-building a {@code ExpandMacro}.
*/
public static Builder builder() {
return new Builder();
}
/**
* A class for implementing the Builder Pattern for {@code ExpandMacro}.
*/
public static class Builder {
private String title;
private String body;
public Builder title(final String title) {
this.title = title;
return this;
}
public Builder body(final String body) {
this.body = body;
return this;
}
public ExpandMacro build() {
return new ExpandMacro(this);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy