com.softicar.platform.common.code.java.JavaIdentifier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.code.java;
import java.util.List;
/**
* Represents a Java identifier.
*
* @author Oliver Richers
*/
public class JavaIdentifier {
private final List fragments;
public JavaIdentifier(String name) {
this.fragments = WordFragment.parse(name);
}
public JavaIdentifier(List fragments) {
this.fragments = fragments;
}
public String asField() {
return IdentifierNames.Type.LOWER_CAMEL.get(fragments);
}
public String asParameter() {
return IdentifierNames.Type.LOWER_CAMEL.get(fragments);
}
public String asConstant() {
return IdentifierNames.Type.UPPER_WITH_UNDER_SCORE.get(fragments);
}
public String asClass() {
return IdentifierNames.Type.UPPER_CAMEL.get(fragments);
}
public String asSetter() {
return "set" + IdentifierNames.Type.UPPER_CAMEL.get(fragments);
}
public String asGetter() {
return "get" + IdentifierNames.Type.UPPER_CAMEL.get(fragments);
}
}