Skip to content

Commit

Permalink
Merge pull request #79 from jGauravGupta/FISH-9827
Browse files Browse the repository at this point in the history
FISH-9827 Fixes Javadoc error in new Generator module
  • Loading branch information
jGauravGupta authored Oct 28, 2024
2 parents 832f8b9 + 7e02518 commit 3655749
Show file tree
Hide file tree
Showing 5 changed files with 212 additions and 34 deletions.
36 changes: 35 additions & 1 deletion starter-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,45 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<version>3.13.0</version>
<configuration>
<release>17</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.10.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -42,108 +42,223 @@ public class Attribute {
private Boolean display;
private String htmlLabel;

/** Default constructor for Attribute. */
public Attribute() {
}

/**
* Constructor for Attribute with specified name, type, and primary key status.
*
* @param name the name of the attribute
* @param type the type of the attribute
* @param isPrimaryKey indicates if this attribute is a primary key
*/
public Attribute(String name, String type, boolean isPrimaryKey) {
this.name = name;
this.type = type;
this.primaryKey = isPrimaryKey;
}

/**
* Constructor for Attribute with specified name, multi status, and relation type.
*
* @param name the name of the attribute
* @param multi indicates if the attribute can have multiple values
* @param relation the type of relation for the attribute
*/
public Attribute(String name, boolean multi, String relation) {
this.name = name;
this.type = relation;
this.multi = multi;
}

/**
* Returns the name of the attribute.
*
* @return the name of the attribute
*/
public String getName() {
return name;
}

/**
* Returns the name of the attribute in start case format.
*
* @return the start case name
*/
@JsonbTransient
public String getStartCaseName() {
return startCase(name);
}

/**
* Returns the name of the attribute in lower case format.
*
* @return the lower case name
*/
@JsonbTransient
public String getLowerCaseName() {
return name.toLowerCase();
}

/**
* Returns the name of the attribute in title case format.
*
* @return the title case name
*/
@JsonbTransient
public String getTitleCaseName() {
return titleCase(name);
}

/**
* Returns the pluralized lower case name of the attribute.
*
* @return the pluralized lower case name
*/
@JsonbTransient
public String getLowerCasePluralizeName() {
return pluralize(name.toLowerCase());
}

/**
* Returns the pluralized title case name of the attribute.
*
* @return the pluralized title case name
*/
@JsonbTransient
public String getTitleCasePluralizeName() {
return pluralize(titleCase(name));
}

/**
* Returns the type of the attribute.
*
* @return the type of the attribute
*/
public String getType() {
return type;
}

/**
* Checks if the attribute is a number type.
*
* @return true if the attribute type is a number, false otherwise
*/
@JsonbTransient
public boolean isNumber() {
return AttributeType.isNumber(type);
}

/**
* Checks if this attribute is a primary key.
*
* @return true if this attribute is a primary key, false otherwise
*/
public boolean isPrimaryKey() {
return primaryKey;
}

/**
* Checks if this attribute is required.
*
* @return true if this attribute is required, false otherwise
*/
@JsonbTransient
public boolean isRequired() {
return required;
}

/**
* Sets whether this attribute is required.
*
* @param required true if this attribute is required, false otherwise
*/
public void setRequired(boolean required) {
this.required = required;
}

/**
* Checks if this attribute can have multiple values.
*
* @return true if this attribute can have multiple values, false otherwise
*/
public boolean isMulti() {
return multi;
}

/**
* Returns the tooltip text of the attribute.
*
* @return the tooltip text
*/
@JsonbTransient
public String getToolTipText() {
return tooltip;
}

/**
* Checks if the attribute has a tooltip.
*
* @return true if the attribute has a tooltip, false otherwise
*/
@JsonbTransient
public boolean isToolTip() {
return getToolTipText() != null && !getToolTipText().trim().isEmpty();
}

/**
* Sets the tooltip text for the attribute.
*
* @param tooltip the tooltip text to set
*/
public void setTooltip(String tooltip) {
this.tooltip = tooltip;
}

/**
* Returns the HTML label associated with the attribute.
*
* @return the HTML label
*/
@JsonbTransient
public String getHtmlLabel() {
return htmlLabel;
}

/**
* Sets the HTML label for the attribute.
*
* @param htmllabel the HTML label to set
*/
public void setHtmlLabel(String htmllabel) {
this.htmlLabel = htmllabel;
}

/**
* Checks if this attribute should be displayed.
*
* @return true if the attribute is to be displayed, false otherwise
*/
@JsonbTransient
public Boolean isDisplay() {
return display;
}

/**
* Sets the display status for the attribute.
*
* @param display true if the attribute should be displayed, false otherwise
*/
public void setDisplay(Boolean display) {
this.display = display;
}

/**
* Returns a list of imports required for the attribute type.
*
* @return a list of import strings
*/
@JsonbTransient
public List<String> getImports() {
List<String> _import = new ArrayList<>();
Expand All @@ -155,18 +270,38 @@ public List<String> getImports() {
return _import;
}

/**
* Sets the name of the attribute.
*
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}

/**
* Sets the type of the attribute.
*
* @param type the type to set
*/
public void setType(String type) {
this.type = type;
}

/**
* Sets the primary key status for the attribute.
*
* @param isPrimaryKey true if this attribute is a primary key, false otherwise
*/
public void setPrimaryKey(boolean isPrimaryKey) {
this.primaryKey = isPrimaryKey;
}

/**
* Sets whether this attribute can have multiple values.
*
* @param multi true if this attribute can have multiple values, false otherwise
*/
public void setMulti(boolean multi) {
this.multi = multi;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,18 @@
import jakarta.json.bind.serializer.SerializationContext;
import jakarta.json.stream.JsonGenerator;

/**
* A serializer for the {@link Attribute} class that defines how an
* Attribute object should be serialized to JSON.
* This class implements the {@link JsonbSerializer} interface
* to provide custom serialization logic for attributes.
*/
public class AttributeSerializer implements JsonbSerializer<Attribute> {

@Override
public void serialize(Attribute attribute, JsonGenerator generator, SerializationContext ctx) {
generator.writeStartObject();

// Always write the name and type
generator.write("name", attribute.getName());
generator.write("type", attribute.getType());

Expand All @@ -61,4 +66,4 @@ public void serialize(Attribute attribute, JsonGenerator generator, Serializatio

generator.writeEnd();
}
}
}
Loading

0 comments on commit 3655749

Please sign in to comment.