org.teamapps.pojo.template.templateBlocks.txt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of universal-db Show documentation
Show all versions of universal-db Show documentation
Ultra fast TeamApps database
{staticFieldName}:
public final static String {staticName} = "{name}";
{staticField}:
protected static {type} {name};
################################################################################
### INTERFACE GET METHODS:
{INTERFACE_GET_METHOD_BOOLEAN}#
boolean get{name}();
#
{INTERFACE_GET_METHOD_BOOLEAN_2}#
boolean is{name}();
#
{INTERFACE_GET_METHOD_SHORT}#
short get{name}();
#
{INTERFACE_GET_METHOD_INT}#
int get{name}();
#
{INTERFACE_GET_METHOD_LONG}#
long get{name}();
#
{INTERFACE_GET_METHOD_FLOAT}#
float get{name}();
#
{INTERFACE_GET_METHOD_DOUBLE}#
double get{name}();
#
{INTERFACE_GET_METHOD_TEXT}#
String get{name}();
#
{INTERFACE_GET_METHOD_TRANSLATABLE_TEXT}#
TranslatableText get{name}();
#
{INTERFACE_GET_METHOD_FILE}#
FileValue get{name}();
#
{INTERFACE_GET_METHOD_BINARY}#
byte[] get{name}();
#
{INTERFACE_GET_METHOD_BINARY_2}#
int get{name}Length();
#
{INTERFACE_GET_METHOD_BINARY_3}#
Supplier get{name}InputStreamSupplier();
#
{INTERFACE_GET_METHOD_SINGLE_REFERENCE}#
{reference} get{name}();
#
{INTERFACE_GET_METHOD_MULTI_REFERENCE}#
List<{reference}> get{name}();
#
{INTERFACE_GET_METHOD_MULTI_REFERENCE_2}#
int get{name}Count();
#
{INTERFACE_GET_METHOD_MULTI_REFERENCE_3}#
BitSet get{name}AsBitSet();
#
{INTERFACE_GET_METHOD_TIMESTAMP}#
Instant get{name}();
#
{INTERFACE_GET_METHOD_TIMESTAMP_2}#
int get{name}AsEpochSecond();
#
{INTERFACE_GET_METHOD_TIMESTAMP_3}#
long get{name}AsEpochMilli();
#
{INTERFACE_GET_METHOD_DATE}#
Instant get{name}();
#
{INTERFACE_GET_METHOD_DATE_2}#
long get{name}AsEpochMilli();
#
{INTERFACE_GET_METHOD_TIME}#
Instant get{name}();
#
{INTERFACE_GET_METHOD_TIME_2}#
int get{name}AsSeconds();
#
{INTERFACE_GET_METHOD_DATE_TIME}#
Instant get{name}();
#
{INTERFACE_GET_METHOD_DATE_TIME_2}#
long get{name}AsEpochMilli();
#
{INTERFACE_GET_METHOD_LOCAL_DATE}#
LocalDate get{name}();
#
{INTERFACE_GET_METHOD_LOCAL_DATE_2}#
long get{name}AsEpochMilli();
#
{INTERFACE_GET_METHOD_ENUM}#
{enum} get{name}();
#
### INTERFACE SET METHODS ####################
{INTERFACE_SET_METHOD_BOOLEAN}#
{type} set{name}(boolean value);
#
{INTERFACE_SET_METHOD_SHORT}#
{type} set{name}(short value);
#
{INTERFACE_SET_METHOD_INT}#
{type} set{name}(int value);
#
{INTERFACE_SET_METHOD_LONG}#
{type} set{name}(long value);
#
{INTERFACE_SET_METHOD_FLOAT}#
{type} set{name}(float value);
#
{INTERFACE_SET_METHOD_DOUBLE}#
{type} set{name}(double value);
#
{INTERFACE_SET_METHOD_TEXT}#
{type} set{name}(String value);
#
{INTERFACE_SET_METHOD_TRANSLATABLE_TEXT}#
{type} set{name}(TranslatableText value);
#
{INTERFACE_SET_METHOD_FILE}#
{type} set{name}(File value);
#
{INTERFACE_SET_METHOD_FILE_2}#
{type} set{name}(File value, String fileName);
#
{INTERFACE_SET_METHOD_BINARY}#
{type} set{name}(byte[] value);
#
{INTERFACE_SET_METHOD_SINGLE_REFERENCE}#
{type} set{name}({reference} value);
#
{INTERFACE_SET_METHOD_MULTI_REFERENCE}#
{type} set{name}(List<{reference}> value);
#
{INTERFACE_SET_METHOD_MULTI_REFERENCE_2}#
{type} set{name}({reference} ... value);
#
{INTERFACE_SET_METHOD_MULTI_REFERENCE_3}#
{type} add{name}(List<{reference}> value);
#
{INTERFACE_SET_METHOD_MULTI_REFERENCE_4}#
{type} add{name}({reference} ... value);
#
{INTERFACE_SET_METHOD_MULTI_REFERENCE_5}#
{type} remove{name}(List<{reference}> value);
#
{INTERFACE_SET_METHOD_MULTI_REFERENCE_6}#
{type} remove{name}({reference} ... value);
#
{INTERFACE_SET_METHOD_MULTI_REFERENCE_7}#
{type} removeAll{name}();
#
{INTERFACE_SET_METHOD_TIMESTAMP}#
{type} set{name}(Instant value);
#
{INTERFACE_SET_METHOD_TIMESTAMP_2}#
{type} set{name}AsEpochSecond(int value);
#
{INTERFACE_SET_METHOD_TIMESTAMP_3}#
{type} set{name}AsEpochMilli(long value);
#
{INTERFACE_SET_METHOD_DATE}#
{type} set{name}(Instant value);
#
{INTERFACE_SET_METHOD_DATE_2}#
{type} set{name}AsEpochMilli(long value);
#
{INTERFACE_SET_METHOD_TIME}#
{type} set{name}(Instant value);
#
{INTERFACE_SET_METHOD_TIME_2}#
{type} set{name}AsSeconds(int value);
#
{INTERFACE_SET_METHOD_DATE_TIME}#
{type} set{name}(Instant value);
#
{INTERFACE_SET_METHOD_DATE_TIME_2}#
{type} set{name}AsEpochMilli(long value);
#
{INTERFACE_SET_METHOD_LOCAL_DATE}#
{type} set{name}(LocalDate value);
#
{INTERFACE_SET_METHOD_LOCAL_DATE_2}#
{type} set{name}AsEpochMilli(long value);
#
{INTERFACE_SET_METHOD_ENUM}#
{type} set{name}({enum} value);
#
################################################################################
### ENTITY GET METHODS:
{ENTITY_GET_METHOD_BOOLEAN}#
@Override
public boolean get{name}() {
return getBooleanValue({name2});
}
#
{ENTITY_GET_METHOD_BOOLEAN_2}#
@Override
public boolean is{name}() {
return getBooleanValue({name2});
}
#
{ENTITY_GET_METHOD_SHORT}#
@Override
public short get{name}() {
return getShortValue({name2});
}
#
{ENTITY_GET_METHOD_INT}#
@Override
public int get{name}() {
return getIntValue({name2});
}
#
{ENTITY_GET_METHOD_LONG}#
@Override
public long get{name}() {
return getLongValue({name2});
}
#
{ENTITY_GET_METHOD_FLOAT}#
@Override
public float get{name}() {
return getFloatValue({name2});
}
#
{ENTITY_GET_METHOD_DOUBLE}#
@Override
public double get{name}() {
return getDoubleValue({name2});
}
#
{ENTITY_GET_METHOD_TEXT}#
@Override
public String get{name}() {
return getTextValue({name2});
}
#
{ENTITY_GET_METHOD_TRANSLATABLE_TEXT}#
@Override
public TranslatableText get{name}() {
return getTranslatableTextValue(this.{name2});
}
#
{ENTITY_GET_METHOD_FILE}#
@Override
public FileValue get{name}() {
if (isChanged({name2})) {
return (FileValue) getChangedValue({name2});
} else {
return {name2}.getValue(getId());
}
}
#
{ENTITY_GET_METHOD_BINARY}#
@Override
public byte[] get{name}() {
if (isChanged({name2})) {
return (byte[]) getChangedValue({name2});
} else {
return {name2}.getValue(getId());
}
}
#
{ENTITY_GET_METHOD_BINARY_2}#
@Override
public int get{name}Length() {
if (isChanged({name2})) {
byte[] bytes = (byte[]) getChangedValue({name2});
return bytes != null ? bytes.length : 0;
} else {
return {name2}.getLength(getId());
}
}
#
{ENTITY_GET_METHOD_BINARY_3}#
@Override
public Supplier get{name}InputStreamSupplier() {
if (isChanged({name2})) {
byte[] bytes = (byte[]) getChangedValue({name2});
if (bytes == null) return null;
return () -> new ByteArrayInputStream(bytes);
} else {
return {name2}.getInputStreamSupplier(getId());
}
}
#
{ENTITY_GET_METHOD_SINGLE_REFERENCE}#
@Override
public {otherType} get{name}() {
if (isChanged({name2})) {
return ({otherType}) getReferenceChangeValue({name2});
} else {
int id = {name2}.getValue(getId());
if (id > 0) {
return {otherType}.getById(id);
} else {
return null;
}
}
}
#
{ENTITY_GET_METHOD_MULTI_REFERENCE}#
@Override
public List<{otherType}> get{name}() {
return getMultiReferenceValue({name2}, {otherType}.getBuilder());
}
#
{ENTITY_GET_METHOD_MULTI_REFERENCE_2}#
@Override
public int get{name}Count() {
return getMultiReferenceValueCount({name2}, {otherType}.getBuilder());
}
#
{ENTITY_GET_METHOD_MULTI_REFERENCE_3}#
@Override
public BitSet get{name}AsBitSet() {
return getMultiReferenceValueAsBitSet({name2}, {otherType}.getBuilder());
}
#
{ENTITY_GET_METHOD_TIMESTAMP}#
@Override
public Instant get{name}() {
return getTimestampValue({name2});
}
#
{ENTITY_GET_METHOD_TIMESTAMP_2}#
@Override
public int get{name}AsEpochSecond() {
return getTimestampAsEpochSecond({name2});
}
#
{ENTITY_GET_METHOD_TIMESTAMP_3}#
@Override
public long get{name}AsEpochMilli() {
return getTimestampAsEpochMilli({name2});
}
#
{ENTITY_GET_METHOD_DATE}#
@Override
public Instant get{name}() {
return getDateValue({name2});
}
#
{ENTITY_GET_METHOD_DATE_2}#
@Override
public long get{name}AsEpochMilli() {
return getDateAsEpochMilli({name2});
}
#
{ENTITY_GET_METHOD_TIME}#
@Override
public Instant get{name}() {
return getTimeValue({name2});
}
#
{ENTITY_GET_METHOD_TIME_2}#
@Override
public int get{name}AsSeconds() {
if (isChanged({name2})) {
return (int) getChangedValue({name2});
} else {
return {name2}.getValue(getId());
}
}
#
{ENTITY_GET_METHOD_DATE_TIME}#
@Override
public Instant get{name}() {
return getDateTimeValue({name2});
}
#
{ENTITY_GET_METHOD_DATE_TIME_2}#
@Override
public long get{name}AsEpochMilli() {
return getDateTimeAsEpochMilli({name2});
}
#
{ENTITY_GET_METHOD_LOCAL_DATE}#
@Override
public LocalDate get{name}() {
return getLocalDateValue({name2});
}
#
{ENTITY_GET_METHOD_LOCAL_DATE_2}#
@Override
public long get{name}AsEpochMilli() {
if (isChanged({name2})) {
return (long) getChangedValue({name2});
} else {
return {name2}.getValue(getId());
}
}
#
{ENTITY_GET_METHOD_ENUM}#
@Override
public {enum} get{name}() {
return getEnumValue({name2}, {enum}.values());
}
#
### ENTITY SET METHODS ####################
{ENTITY_SET_METHOD_BOOLEAN}#
@Override
public {type} set{name}(boolean value) {
setBooleanValue(value, this.{name2});
return this;
}
#
{ENTITY_SET_METHOD_SHORT}#
@Override
public {type} set{name}(short value) {
setShortValue(value, this.{name2});
return this;
}
#
{ENTITY_SET_METHOD_INT}#
@Override
public {type} set{name}(int value) {
setIntValue(value, this.{name2});
return this;
}
#
{ENTITY_SET_METHOD_LONG}#
@Override
public {type} set{name}(long value) {
setLongValue(value, this.{name2});
return this;
}
#
{ENTITY_SET_METHOD_FLOAT}#
@Override
public {type} set{name}(float value) {
setFloatValue(value, this.{name2});
return this;
}
#
{ENTITY_SET_METHOD_DOUBLE}#
@Override
public {type} set{name}(double value) {
setDoubleValue(value, this.{name2});
return this;
}
#
{ENTITY_SET_METHOD_TEXT}#
@Override
public {type} set{name}(String value) {
setTextValue(value, this.{name2});
return this;
}
#
{ENTITY_SET_METHOD_TRANSLATABLE_TEXT}#
@Override
public {type} set{name}(TranslatableText value) {
setTranslatableTextValue(value, this.{name2});
return this;
}
#
{ENTITY_SET_METHOD_FILE}#
@Override
public {type} set{name}(File value) {
FileValue fileValue = createFileValue(value);
setChangeValue(this.{name2}, fileValue, table);
return this;
}
#
{ENTITY_SET_METHOD_FILE_2}#
@Override
public {type} set{name}(File value, String fileName) {
FileValue fileValue = createFileValue(value, fileName);
setChangeValue(this.{name2}, fileValue, table);
return this;
}
#
{ENTITY_SET_METHOD_BINARY}#
@Override
public {type} set{name}(byte[] value) {
setChangeValue(this.{name2}, value, table);
return this;
}
#
{ENTITY_SET_METHOD_SINGLE_REFERENCE}#
@Override
public {type} set{name}({otherType} value) {
setSingleReferenceValue({name2}, value, table);
return this;
}
#
{ENTITY_SET_METHOD_MULTI_REFERENCE}#
@Override
public {type} set{name}(List<{otherType}> value) {
setMultiReferenceValue(value, {name2});
return this;
}
#
{ENTITY_SET_METHOD_MULTI_REFERENCE_2}#
@Override
public {type} set{name}({otherType} ... value) {
setMultiReferenceValue(Arrays.asList(value), {name2});
return this;
}
#
{ENTITY_SET_METHOD_MULTI_REFERENCE_3}#
@Override
public {type} add{name}(List<{otherType}> value) {
addMultiReferenceValue(value, {name2});
return this;
}
#
{ENTITY_SET_METHOD_MULTI_REFERENCE_4}#
@Override
public {type} add{name}({otherType} ... value) {
addMultiReferenceValue(Arrays.asList(value), {name2});
return this;
}
#
{ENTITY_SET_METHOD_MULTI_REFERENCE_5}#
@Override
public {type} remove{name}(List<{otherType}> value) {
removeMultiReferenceValue(value, {name2});
return this;
}
#
{ENTITY_SET_METHOD_MULTI_REFERENCE_6}#
@Override
public {type} remove{name}({otherType} ... value) {
removeMultiReferenceValue(Arrays.asList(value), {name2});
return this;
}
#
{ENTITY_SET_METHOD_MULTI_REFERENCE_7}#
@Override
public {type} removeAll{name}() {
removeAllMultiReferenceValue({name2});
return this;
}
#
{ENTITY_SET_METHOD_TIMESTAMP}#
@Override
public {type} set{name}(Instant value) {
setTimestampValue(value, this.{name2});
return this;
}
#
{ENTITY_SET_METHOD_TIMESTAMP_2}#
@Override
public {type} set{name}AsEpochSecond(int value) {
setTimestampAsEpochSecond(value, this.{name2});
return this;
}
#
{ENTITY_SET_METHOD_TIMESTAMP_3}#
@Override
public {type} set{name}AsEpochMilli(long value) {
setTimestampAsEpochMilli(value, this.{name2});
return this;
}
#
{ENTITY_SET_METHOD_DATE}#
@Override
public {type} set{name}(Instant value) {
setDateValue(value, this.{name2});
return this;
}
#
{ENTITY_SET_METHOD_DATE_2}#
@Override
public {type} set{name}AsEpochMilli(long value) {
setDateAsEpochMilli(value, this.{name2});
return this;
}
#
{ENTITY_SET_METHOD_TIME}#
@Override
public {type} set{name}(Instant value) {
setTimeValue(value, this.{name2});
return this;
}
#
{ENTITY_SET_METHOD_TIME_2}#
@Override
public {type} set{name}AsSeconds(int value) {
setChangeValue(this.{name2}, value, table);
return this;
}
#
{ENTITY_SET_METHOD_DATE_TIME}#
@Override
public {type} set{name}(Instant value) {
setDateTimeValue(value, this.{name2});
return this;
}
#
{ENTITY_SET_METHOD_DATE_TIME_2}#
@Override
public {type} set{name}AsEpochMilli(long value) {
setDateTimeAsEpochMilli(value, this.{name2});
return this;
}
#
{ENTITY_SET_METHOD_LOCAL_DATE}#
@Override
public {type} set{name}(LocalDate value) {
setLocalDateValue(value, this.{name2});
return this;
}
#
{ENTITY_SET_METHOD_LOCAL_DATE_2}#
@Override
public {type} set{name}AsEpochMilli(long value) {
setLocalDateAsEpochMilli(value, this.{name2});
setChangeValue(this.{name2}, value, table);
return this;
}
#
{ENTITY_SET_METHOD_ENUM}#
@Override
public {type} set{name}({enum} value) {
setEnumValue(this.{name2}, value);
return this;
}
#
################################################################################
{QUERY_METHOD}#
@Override
public {query} {name2}({filter} filter) {
and({udbType}.{name2}.createFilter(filter));
return this;
}
#
{QUERY_METHOD_OR}#
@Override
public {query} or{name}({filter} filter) {
or({udbType}.{name2}.createFilter(filter));
return this;
}
#
{QUERY_ENUMS}#
@Override
public {query} {name2}(EnumFilterType filterType, {enumType}... enums) {
and({udbType}.{name2}.createFilter(NumericFilter.createEnumFilter(filterType, enums)));
return this;
}
#
{QUERY_ENUMS_OR}#
@Override
public {query} or{name}(EnumFilterType filterType, {enumType}... enums) {
or({udbType}.{name2}.createFilter(NumericFilter.createEnumFilter(filterType, enums)));
return this;
}
#
{QUERY_MULTI_REFERENCE}#
@Override
public {query} {name2}(MultiReferenceFilterType type, {otherType} ... values) {
List ids = new ArrayList<>();
if (values != null) {
for ({otherType} value : values) {
ids.add(value.getId());
}
}
MultiReferenceFilter filter = MultiReferenceFilter.createFilter(type, ids);
and({udbType}.{name2}.createFilter(filter));
return this;
}
#
{QUERY_MULTI_REFERENCE_2}#
@Override
public {query} {name2}Count(MultiReferenceFilterType type, int count) {
MultiReferenceFilter filter = MultiReferenceFilter.createCountFilter(type, count);
and({udbType}.{name2}.createFilter(filter));
return this;
}
#
{QUERY_SUB_QUERY}#
@Override
public {query} filter{name}({otherQuery} query) {
{udbOtherQuery} udbQuery = ({udbOtherQuery}) query;
IndexPath path = new IndexPath();
path.addPath({udbType}.{name2}, {otherUdbType}.{otherName2});
udbQuery.prependPath(path);
and(udbQuery);
return this;
}
#
{QUERY_SUB_QUERY_2}#
@Override
public {query} filter{name}({otherQuery} query) {
{udbOtherQuery} udbQuery = ({udbOtherQuery}) query;
IndexPath path = new IndexPath();
path.addPath({udbType}.{name2});
udbQuery.prependPath(path);
and(udbQuery);
return this;
}
#