io.permazen.JFieldSwitchAdapter Maven / Gradle / Ivy
Show all versions of permazen-main Show documentation
/*
* Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
*/
package io.permazen;
/**
* Adapter class for {@link JFieldSwitch}.
*
* @param switch method return type
*/
public class JFieldSwitchAdapter implements JFieldSwitch {
/**
* Handle a {@link JSetField}.
*
*
* The implementation in {@link JFieldSwitchAdapter} delegates to {@link #caseJCollectionField caseJCollectionField()}.
*/
@Override
public R caseJSetField(JSetField field) {
return this.caseJCollectionField(field);
}
/**
* Handle a {@link JListField}.
*
*
* The implementation in {@link JFieldSwitchAdapter} delegates to {@link #caseJCollectionField caseJCollectionField()}.
*/
@Override
public R caseJListField(JListField field) {
return this.caseJCollectionField(field);
}
/**
* Handle a {@link JMapField}.
*
*
* The implementation in {@link JFieldSwitchAdapter} delegates to {@link #caseJComplexField caseJComplexField()}.
*/
@Override
public R caseJMapField(JMapField field) {
return this.caseJComplexField(field);
}
/**
* Handle a {@link JSimpleField}.
*
*
* The implementation in {@link JFieldSwitchAdapter} delegates to {@link #caseJField caseJField()}.
*/
@Override
public R caseJSimpleField(JSimpleField field) {
return this.caseJField(field);
}
/**
* Handle a {@link JReferenceField}.
*
*
* The implementation in {@link JFieldSwitchAdapter} delegates to {@link #caseJSimpleField caseJSimpleField()}.
*/
@Override
public R caseJReferenceField(JReferenceField field) {
return this.caseJSimpleField(field);
}
/**
* Handle a {@link JEnumField}.
*
*
* The implementation in {@link JFieldSwitchAdapter} delegates to {@link #caseJSimpleField caseJSimpleField()}.
*/
@Override
public R caseJEnumField(JEnumField field) {
return this.caseJSimpleField(field);
}
/**
* Handle a {@link JCounterField}.
*
*
* The implementation in {@link JFieldSwitchAdapter} delegates to {@link #caseJField caseJField()}.
*/
@Override
public R caseJCounterField(JCounterField field) {
return this.caseJField(field);
}
/**
* Adapter class roll-up method.
*
*
* The implementation in {@link JFieldSwitchAdapter} delegates to {@link #caseJComplexField caseJComplexField()}.
*
* @param field the visiting field
* @return visitor return value
*/
protected R caseJCollectionField(JCollectionField field) {
return this.caseJComplexField(field);
}
/**
* Adapter class roll-up method.
*
*
* The implementation in {@link JFieldSwitchAdapter} delegates to {@link #caseJField caseJField()}.
*
* @param field the visiting field
* @return visitor return value
*/
protected R caseJComplexField(JComplexField field) {
return this.caseJField(field);
}
/**
* Adapter class roll-up method.
*
*
* The implementation in {@link JFieldSwitchAdapter} always throws {@link UnsupportedOperationException}.
*
* @param field the visiting field
* @return visitor return value
*/
protected R caseJField(JField field) {
throw new UnsupportedOperationException("field type not handled: " + field);
}
}