Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Overview

If defined inside <hooks  /> element - validate whole entity,
If defined inside field element - validate field value

Common Attributes

name

type

required

default value

description

class

string

yes

none

Name of the class defining hook.

method

string

yes

none

Name of the method defining hook.

Example #1 - entity validation

<hooks>
    <validatesWith class="com.sample.SampleHook" method="entityHookName" />

</hooks>

Hook method signature for example #1

public boolean entityHookName(final DataDefinition dataDefinition, final Entity entity) {
    // ...
} 

Example #2 - field validation

<string name="someField">
    <validatesWith class="com.sample.SampleHook" method="fieldHookName" />

</string>

Hook method signature for example #2

public boolean fieldHookName(final DataDefinition dataDefinition, final FieldDefinition fieldDefinition, final Entity entity, final Object fieldOldValue, final Object fieldNewValue) {
    // ...
} 

 

  • No labels