@Override public String getJavaPackageName(Definition definition, Mode mode) { String[] split = delegate.getJavaPackageName(definition, mode).split("\\."); for (int i = 0; i < split.length; i++) { split[i] = GenerationUtil.convertToJavaIdentifier(split[i]); } return StringUtils.join(split, "."); }
@Override public String getJavaMethodName(Definition definition, Mode mode) { String methodName; methodName = delegate.getJavaMethodName(definition, mode); methodName = overload(definition, mode, methodName); methodName = GenerationUtil.convertToJavaIdentifier(methodName); return methodName; }
@Override public String getJavaMemberName(Definition definition, Mode mode) { String identifier = GenerationUtil.convertToJavaIdentifier(delegate.getJavaMemberName(definition, mode)); // [#2781] Disambiguate collisions with the leading package name if (identifier.equals(getJavaPackageName(definition, mode).replaceAll("\\..*", ""))) { return identifier + "_"; } return identifier; }
@Override public String getJavaClassName(Definition definition, Mode mode) { if (definition instanceof SchemaDefinition && ((SchemaDefinition) definition).isDefaultSchema()) { return "DefaultSchema"; } String className; className = delegate.getJavaClassName(definition, mode); className = overload(definition, mode, className); className = GenerationUtil.convertToJavaIdentifier(className); return className; }
@Override public List<String> getJavaClassImplements(Definition definition, Mode mode) { // [#1243] All generation modes can accept interfaces Set<String> result = new LinkedHashSet<String>(delegate.getJavaClassImplements(definition, mode)); // [#1528] Generated interfaces (implemented by RECORD and POJO) are // always Serializable if (mode == Mode.INTERFACE) { result.add(Serializable.class.getName()); } // [#1528] POJOs only implement Serializable if they don't inherit // Serializable from INTERFACE already else if (mode == Mode.POJO && !generator.generateInterfaces()) { // replace with annotation // result.add(Serializable.class.getName()); } return new ArrayList<String>(result); }
@Override public String getJavaIdentifier(Definition definition) { if (definition instanceof SchemaDefinition && ((SchemaDefinition) definition).isDefaultSchema()) { return "DEFAULT_SCHEMA"; } String identifier = GenerationUtil.convertToJavaIdentifier(delegate.getJavaIdentifier(definition)); if (definition instanceof ColumnDefinition) { TypedElementDefinition<?> e = (TypedElementDefinition<?>) definition; if (identifier.equals(getJavaIdentifier(e.getContainer()))) { return identifier + "_"; } if (identifier.equals(getJavaPackageName(e.getContainer()).replaceAll("\\..*", ""))) { return identifier + "_"; } } return identifier; }
@Override public String getJavaGetterName(Definition definition, Mode mode) { return GenerationUtil.convertToJavaIdentifier(delegate.getJavaGetterName(definition, mode)); }
@Override public boolean getInstanceFields() { return delegate.getInstanceFields(); }
@Override public void setInstanceFields(boolean instanceFields) { delegate.setInstanceFields(instanceFields); }
@Override public void setTargetPackage(String packageName) { delegate.setTargetPackage(packageName); }
@Override public String getTargetPackage() { return delegate.getTargetPackage(); }
@Override public void setTargetDirectory(String directory) { delegate.setTargetDirectory(directory); }
@Override public String getTargetDirectory() { return delegate.getTargetDirectory(); }
@Override public String getOverloadSuffix(Definition definition, Mode mode, String overloadIndex) { return delegate.getOverloadSuffix(definition, mode, overloadIndex); }
@Override public String getJavaClassExtends(Definition definition, Mode mode) { // [#1243] Only POJO mode can accept super classes return delegate.getJavaClassExtends(definition, mode); }