} else {
fileScope.append("ObjectValueBase");
}
fileScope.append(" implements " + typeClassName + " {\n");
ClassScope classScope = fileScope.newClassScope();
classScope.indentRight();
classScope.startLine("public static " + valueImplClassName + " parse(Object input)" +
Util.THROWS_CLAUSE + " {\n");
classScope.indentRight();
subtypeAspect.writeParseMethodJava(classScope, valueImplClassName, "input");
classScope.indentLeft();
classScope.startLine("}");
classScope.append("\n");
classScope.startLine(valueImplClassName + "(Object input");
subtypeAspect.writeSuperConstructorParamJava(classScope);
classScope.append(")" + Util.THROWS_CLAUSE + " {\n");
{
MethodScope methodScope = classScope.newMethodScope();
methodScope.indentRight();
methodScope.startLine("super(input);\n");
subtypeAspect.writeSuperConstructorInitializationJava(methodScope);
for (FieldLoader fieldLoader : fieldLoaders) {
String valueRef = methodScope.newMethodScopedName("value");
String hasValueRef = methodScope.newMethodScopedName("hasValue");
String fieldName = fieldLoader.getFieldName();
methodScope.append("\n");
Util.writeReadValueAndHasValue(methodScope, fieldName, "underlying", valueRef,
hasValueRef);
fieldLoader.writeFieldLoadJava(methodScope, valueRef, hasValueRef);
}
if (algCasesData != null) {
algCasesData.writeConstructorCodeJava(methodScope);
}
methodScope.indentLeft();
}
classScope.startLine("}\n");
for (VolatileFieldBinding field : volatileFields) {
field.writeFieldDeclarationJava(classScope);
}
for (FieldLoader loader : this.fieldLoaders) {
loader.writeFieldDeclarationJava(classScope);
}
if (algCasesData != null) {
algCasesData.writeFiledsJava(classScope);
}
subtypeAspect.writeSuperFieldJava(classScope);
for (Map.Entry<Method, MethodHandler> en : this.methodHandlerMap.entrySet()) {
Method m = en.getKey();
MethodHandler methodHandler = en.getValue();
methodHandler.writeMethodImplementationJava(classScope, m);
}
BaseHandlersLibrary.writeBaseMethodsJava(classScope, this);
subtypeAspect.writeHelperMethodsJava(classScope);
classScope.indentLeft();
classScope.startLine("}\n");
fileScope.append("\n");
}