Comments in event definition data classes
Some comments were missing in the classes used to load event definitions from the XML file. They have been added.
This commit is contained in:
parent
75c5245764
commit
1dd1da5ae3
9 changed files with 91 additions and 2 deletions
|
@ -23,6 +23,11 @@ public class EntityEventField
|
||||||
private EventFieldEntityType entityType;
|
private EventFieldEntityType entityType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the type of entities this field references.
|
||||||
|
*
|
||||||
|
* @return the type of entities this field references
|
||||||
|
*/
|
||||||
public EventFieldEntityType getEntityType( )
|
public EventFieldEntityType getEntityType( )
|
||||||
{
|
{
|
||||||
return this.entityType;
|
return this.entityType;
|
||||||
|
|
|
@ -53,30 +53,55 @@ public class EventDefinition
|
||||||
private List< EventFieldBase > fields = new ArrayList< EventFieldBase >( );
|
private List< EventFieldBase > fields = new ArrayList< EventFieldBase >( );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the identifier.
|
||||||
|
*
|
||||||
|
* @return the identifier
|
||||||
|
*/
|
||||||
public String getIdentifier( )
|
public String getIdentifier( )
|
||||||
{
|
{
|
||||||
return this.identifier;
|
return this.identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the priority.
|
||||||
|
*
|
||||||
|
* @return the priority
|
||||||
|
*/
|
||||||
public int getPriority( )
|
public int getPriority( )
|
||||||
{
|
{
|
||||||
return ( this.priority == null ) ? 2 : this.priority;
|
return ( this.priority == null ) ? 2 : this.priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the priority is adjustable.
|
||||||
|
*
|
||||||
|
* @return <code>true</code> if the priority is adjustable
|
||||||
|
*/
|
||||||
public boolean isAdjustable( )
|
public boolean isAdjustable( )
|
||||||
{
|
{
|
||||||
return ( this.adjustable == null ) ? true : this.adjustable;
|
return ( this.adjustable == null ) ? true : this.adjustable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the prefix of the name and template strings.
|
||||||
|
*
|
||||||
|
* @return the prefix of the name and template strings.
|
||||||
|
*/
|
||||||
public String getI18NStrings( )
|
public String getI18NStrings( )
|
||||||
{
|
{
|
||||||
return this.i18nStrings;
|
return this.i18nStrings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows iteration over the event definition's fields
|
||||||
|
*
|
||||||
|
* @return an iterator on the event definition's fields
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Iterator< EventFieldBase > iterator( )
|
public Iterator< EventFieldBase > iterator( )
|
||||||
{
|
{
|
||||||
|
@ -84,6 +109,13 @@ public class EventDefinition
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify fields data
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* If no fields are defined, make sure the list is not <code>null</code>; otherwise iterate over
|
||||||
|
* the fields to call their own data checks methods.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void verifyData( )
|
public void verifyData( )
|
||||||
throws DataImportException
|
throws DataImportException
|
||||||
|
|
|
@ -42,6 +42,12 @@ public class EventDefinitions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify the list of definitions
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Make sure the list of definitions is not empty, then call the definitions' data check method.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void verifyData( )
|
public void verifyData( )
|
||||||
throws DataImportException
|
throws DataImportException
|
||||||
|
|
|
@ -38,12 +38,22 @@ public abstract class EventFieldBase
|
||||||
public abstract EventFieldType getType( );
|
public abstract EventFieldType getType( );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the field's identifier.
|
||||||
|
*
|
||||||
|
* @return the field's identifier
|
||||||
|
*/
|
||||||
public String getIdentifier( )
|
public String getIdentifier( )
|
||||||
{
|
{
|
||||||
return this.identifier;
|
return this.identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the field is required or optional.
|
||||||
|
*
|
||||||
|
* @return <code>true</code> if the field is required
|
||||||
|
*/
|
||||||
public boolean isRequired( )
|
public boolean isRequired( )
|
||||||
{
|
{
|
||||||
return this.required == null ? true : this.required;
|
return this.required == null ? true : this.required;
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
package com.deepclone.lw.cli.xmlimport.data.evdef;
|
package com.deepclone.lw.cli.xmlimport.data.evdef;
|
||||||
|
|
||||||
|
|
||||||
/** Types of entities which can be referenced through entity fields */
|
/** Types of entities which can be referenced through entity fields
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:tseeker@legacyworlds.com">E. Benoît</a>
|
||||||
|
*/
|
||||||
public enum EventFieldEntityType {
|
public enum EventFieldEntityType {
|
||||||
|
|
||||||
/** Empires */
|
/** Empires */
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
package com.deepclone.lw.cli.xmlimport.data.evdef;
|
package com.deepclone.lw.cli.xmlimport.data.evdef;
|
||||||
|
|
||||||
|
|
||||||
/** Types of event fields as they are stored in the definition file */
|
/** Types of event fields as they are stored in the definition file
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:tseeker@legacyworlds.com">E. Benoît</a>
|
||||||
|
*/
|
||||||
public enum EventFieldType {
|
public enum EventFieldType {
|
||||||
|
|
||||||
/** An integer field */
|
/** An integer field */
|
||||||
|
|
|
@ -25,12 +25,22 @@ public class IntegerEventField
|
||||||
private Integer max;
|
private Integer max;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the minimal value allowed for the field.
|
||||||
|
*
|
||||||
|
* @return the minimal value allowed for the field
|
||||||
|
*/
|
||||||
public Integer getMin( )
|
public Integer getMin( )
|
||||||
{
|
{
|
||||||
return this.min;
|
return this.min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the maximal value allowed for the field.
|
||||||
|
*
|
||||||
|
* @return the maximal value allowed for the field
|
||||||
|
*/
|
||||||
public Integer getMax( )
|
public Integer getMax( )
|
||||||
{
|
{
|
||||||
return this.max;
|
return this.max;
|
||||||
|
|
|
@ -26,12 +26,22 @@ public class RealEventField
|
||||||
private Double max;
|
private Double max;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the minimal value for the field.
|
||||||
|
*
|
||||||
|
* @return the minimal value for the field
|
||||||
|
*/
|
||||||
public Double getMin( )
|
public Double getMin( )
|
||||||
{
|
{
|
||||||
return this.min;
|
return this.min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the maximal value for the field.
|
||||||
|
*
|
||||||
|
* @return the maximal value for the field
|
||||||
|
*/
|
||||||
public Double getMax( )
|
public Double getMax( )
|
||||||
{
|
{
|
||||||
return this.max;
|
return this.max;
|
||||||
|
|
|
@ -28,12 +28,22 @@ public class TextEventField
|
||||||
private Integer maxLength;
|
private Integer maxLength;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the field's minimum length.
|
||||||
|
*
|
||||||
|
* @return the field's minimum length
|
||||||
|
*/
|
||||||
public Integer getMinLength( )
|
public Integer getMinLength( )
|
||||||
{
|
{
|
||||||
return this.minLength;
|
return this.minLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the field's maximum length.
|
||||||
|
*
|
||||||
|
* @return the field's maximum length
|
||||||
|
*/
|
||||||
public Integer getMaxLength( )
|
public Integer getMaxLength( )
|
||||||
{
|
{
|
||||||
return this.maxLength;
|
return this.maxLength;
|
||||||
|
|
Reference in a new issue