Added annotation field to allow bin generator to ignore certain columns

This commit is contained in:
Collin Smith 2019-09-23 17:42:40 -07:00
parent d9b701901d
commit 814925d76c
2 changed files with 10 additions and 5 deletions

View File

@ -67,15 +67,17 @@ public abstract class Excel<T extends Excel.Entry> implements Iterable<T> {
@Retention(RetentionPolicy.RUNTIME)
public @interface Column {
/** Used to index format */
int startIndex() default 0;
int startIndex() default 0;
/** Used to index format */
int endIndex() default 0;
int endIndex() default 0;
/** Format of column name, if not set, then field name is used */
String format() default "";
String format() default "";
/** Used to index format not non-numerical indexes */
String values()[] default {};
String values()[] default {};
/** Sets index of column of value (used for cases like weapons.txt where one column has no name) */
int columnIndex() default -1;
int columnIndex() default -1;
/** Whether or not to read/write value in bin codec */
boolean bin() default true;
}
@Target(ElementType.FIELD)

View File

@ -15,6 +15,8 @@ public class ExcelGenerationTool {
Field[] fields = clazz.getFields();
for (int i = 0; i < fields.length; i++) {
Field field = fields[i];
Excel.Entry.Column column = field.getAnnotation(Excel.Entry.Column.class);
if (!column.bin()) continue;
Class type = field.getType();
if (type.isArray()) {
type = type.getComponentType();
@ -29,6 +31,7 @@ public class ExcelGenerationTool {
for (int i = 0; i < fields.length; i++) {
Field field = fields[i];
Excel.Entry.Column column = field.getAnnotation(Excel.Entry.Column.class);
if (!column.bin()) continue;
Class type = field.getType();
if (type.isArray()) {
type = type.getComponentType();