Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
generated.docs.javadoc.org.eclipse.dawnsci.nexus.validation.AbstractNexusValidator.html Maven / Gradle / Ivy
AbstractNexusValidator (h5jan API)
JavaScript is disabled on your browser.
java.lang.Object
org.eclipse.dawnsci.nexus.validation.AbstractNexusValidator
All Implemented Interfaces:
NexusApplicationValidator
Direct Known Subclasses:
NXarchiveValidator , NXarpesValidator , NXcanSASValidator , NXdirecttofValidator , NXfluoValidator , NXindirecttofValidator , NXiqprocValidator , NXlauetofValidator , NXmonopdValidator , NXmxValidator , NXrefscanValidator , NXreftofValidator , NXsastofValidator , NXsasValidator , NXscanValidator , NXspeValidator , NXsqomValidator , NXstxmValidator , NXtasValidator , NXtofnpdValidator , NXtofrawValidator , NXtofsingleValidator , NXtomophaseValidator , NXtomoprocValidator , NXtomoValidator , NXxasprocValidator , NXxasValidator , NXxbaseValidator , NXxeulerValidator , NXxkappaValidator , NXxlaueplateValidator , NXxlaueValidator , NXxnbValidator , NXxrotValidator
public abstract class AbstractNexusValidator
extends java.lang.Object
implements NexusApplicationValidator
Abstract superclass for Nexus application definition validators.
The logic for validating that nodes are not null, that fields and attributes
have the correct type etc. are in this abstract superclass.
A subclass exists for each application definition, generated by XSLT. Each subclass
invokes the methods in this abstract superclass as appropriate according to the
application definition as defined by the appropriate NXDL file.
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
protected void
clearLocalGroupDimensionPlaceholderValues ()
Clears the map of values of dimension placeholders, as these are local only to the current group.
protected void
failValidation (java.lang.String message)
protected void
validate (java.lang.String message,
boolean condition)
protected void
validateAttributeEnumeration (java.lang.String attributeName,
Attribute attribute,
java.lang.String... permittedValues)
Validates that an enumeration attribute has one of the given permitted values.
protected void
validateAttributeNotNull (java.lang.String attributeName,
Attribute attribute)
Validates that the given attribute node is not null
.
protected void
validateAttributeType (java.lang.String fieldName,
Attribute attribute,
NexusDataType type)
Validates that the type of the given attribute is that given.
protected void
validateFieldDimensions (java.lang.String fieldName,
IDataset dataset,
java.lang.String groupName,
java.lang.Object... dimensions)
Validate the dimensions of the given field.
protected void
validateFieldEnumeration (java.lang.String fieldName,
IDataset dataset,
java.lang.String... permittedValues)
Validates that an enumeration field has one of the given permitted values.
protected void
validateFieldNotNull (java.lang.String fieldName,
IDataset dataset)
Validates that the given field value is not null
.
protected void
validateFieldRank (java.lang.String fieldName,
IDataset dataset,
int rank)
Validates that the given field has the expected rank.
protected void
validateFieldType (java.lang.String fieldName,
IDataset dataset,
NexusDataType type)
Validates that the type of the given field is that given.
protected void
validateFieldUnits (java.lang.String fieldName,
IDataset dataset,
NexusUnitCategory unitCategory)
Validates that the given field has units consistent with the given unit category.
protected void
validateGroupNotNull (java.lang.String groupName,
java.lang.Class<? extends NXobject > type,
GroupNode groupNode)
Validates that the given group is not null.
protected void
validateNotNull (java.lang.String message,
java.lang.Object object)
Validates that the given object is not null
.
protected void
validateTransformations (java.util.Map<java.lang.String,NXtransformations > transformations,
java.lang.String dependsOnStr)
Validate the given transformations.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Method Detail
validateNotNull
protected void validateNotNull(java.lang.String message,
java.lang.Object object)
throws NexusValidationException
Validates that the given object is not null
.
Parameters:
message
- message
object
- object to check for null
Throws:
NexusValidationException
- if the given object is null
validateGroupNotNull
protected void validateGroupNotNull(java.lang.String groupName,
java.lang.Class<? extends NXobject > type,
GroupNode groupNode)
throws NexusValidationException
Validates that the given group is not null.
Parameters:
groupName
- name of group
type
- type of group
groupNode
- group node
Throws:
NexusValidationException
validateFieldNotNull
protected void validateFieldNotNull(java.lang.String fieldName,
IDataset dataset)
throws NexusValidationException
Validates that the given field value is not null
.
Parameters:
fieldName
- name of field
dataset
- the field value, an IDataset
Throws:
NexusValidationException
- if the field is null
validateAttributeNotNull
protected void validateAttributeNotNull(java.lang.String attributeName,
Attribute attribute)
throws NexusValidationException
Validates that the given attribute node is not null
.
Parameters:
attributeName
- name of attribute
attribute
- attribute
Throws:
NexusValidationException
- if the attribute is null
validateFieldEnumeration
protected void validateFieldEnumeration(java.lang.String fieldName,
IDataset dataset,
java.lang.String... permittedValues)
throws NexusValidationException
Validates that an enumeration field has one of the given permitted values.
Parameters:
fieldName
- name of the field
dataset
- the field value, a Dataset
permittedValues
- the permitted values
Throws:
NexusValidationException
- if the value of the field is not one of the permitted values
validateFieldType
protected void validateFieldType(java.lang.String fieldName,
IDataset dataset,
NexusDataType type)
throws NexusValidationException
Validates that the type of the given field is that given.
Parameters:
fieldName
- field name
dataset
- field value, an IDataset
type
- expected type
Throws:
NexusValidationException
- if the type of the field is not that given
validateFieldUnits
protected void validateFieldUnits(java.lang.String fieldName,
IDataset dataset,
NexusUnitCategory unitCategory)
throws NexusValidationException
Validates that the given field has units consistent with the given unit category.
Parameters:
fieldName
- field name
dataset
- field value, an IDataset
unitCategory
- expected unit category
Throws:
java.lang.Exception
- if an unexpected exception occurs
NexusValidationException
- if the field's units are not consistent with the given unit category
validateFieldRank
protected void validateFieldRank(java.lang.String fieldName,
IDataset dataset,
int rank)
throws NexusValidationException
Validates that the given field has the expected rank.
Parameters:
fieldName
- field name
dataset
- field value, an IDataset
rank
- expected rank
Throws:
NexusValidationException
- if the field does not have the expected rank
validateFieldDimensions
protected void validateFieldDimensions(java.lang.String fieldName,
IDataset dataset,
java.lang.String groupName,
java.lang.Object... dimensions)
throws NexusValidationException
Validate the dimensions of the given field.
Parameters:
fieldName
- field name
dataset
- dataset to validate
groupName
- the name of the group
dimensions
- the dimensions, each value must be either an integer, interpreted as the expected size of
that dimension, or a placeholder string, in which case the size of this dimension will be validated
against any previous dimension with the same placeholder string
Throws:
NexusValidationException
- if a dimension did not have the expected size
validateAttributeType
protected void validateAttributeType(java.lang.String fieldName,
Attribute attribute,
NexusDataType type)
throws NexusValidationException
Validates that the type of the given attribute is that given.
Parameters:
fieldName
- field name
dataset
- field value, an IDataset
type
- expected type
Throws:
NexusValidationException
- if the type of the field is not that given
validateAttributeEnumeration
protected void validateAttributeEnumeration(java.lang.String attributeName,
Attribute attribute,
java.lang.String... permittedValues)
throws NexusValidationException
Validates that an enumeration attribute has one of the given permitted values.
Parameters:
attributeName
- name of the attribute
attribute
- the attribute
permittedValues
- the permitted values
Throws:
NexusValidationException
- if the value of the field is not one of the permitted values
validateTransformations
protected void validateTransformations(java.util.Map<java.lang.String,NXtransformations > transformations,
java.lang.String dependsOnStr)
throws NexusValidationException
Validate the given transformations. Transformations have an order, whereby the initial dependsOnStr
identifies the first transformation, and thereafter each transformation is identified by the
value of the depends_on
attribute of the previous transformation. The
final transformation is identified by having "."
as the value of its depends_on attribute.
Parameters:
transformations
- transformations
dependsOnStr
- the name of the first transformation
Throws:
NexusValidationException
- if an expected transformation does not exist
clearLocalGroupDimensionPlaceholderValues
protected void clearLocalGroupDimensionPlaceholderValues()
Clears the map of values of dimension placeholders, as these are local only to the current group.