+ private IllegalArgumentException getIllegalArgumentException(AttributeIfc attributeIfc) {
+ return new IllegalArgumentException("Unknown attribute type " + attributeIfc.getClass() + ", " + attributeIfc
+ + " with open type:" + attributeIfc.getOpenType());
+ }
+
+ public final T caseJavaAttribute(OpenType<?> openType) {
+ if (openType instanceof SimpleType<?>) {
+ return caseJavaSimpleAttribute((SimpleType<?>) openType);
+ } else if (openType instanceof ArrayType<?>) {
+ return caseJavaArrayAttribute((ArrayType<?>) openType);
+ } else if (openType instanceof CompositeType) {
+ return caseJavaCompositeAttribute((CompositeType) openType);
+ }
+
+ throw new UnknownOpenTypeException("Unknown attribute open type " + openType);
+ }
+
+ protected abstract T caseJavaSimpleAttribute(SimpleType<?> openType);
+
+ protected abstract T caseJavaArrayAttribute(ArrayType<?> openType);
+
+ protected abstract T caseJavaCompositeAttribute(CompositeType openType);
+
+ protected abstract T caseDependencyAttribute(SimpleType<?> attributeIfc);
+
+ protected abstract T caseTOAttribute(CompositeType openType);
+
+ protected abstract T caseListAttribute(ArrayType<?> openType);
+
+ protected abstract T caseListDependeciesAttribute(ArrayType<?> openType);
+
+ private static class UnknownOpenTypeException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
+ public UnknownOpenTypeException(String message) {
+ super(message);
+ }
+ }