Package adipe.translate

Examples of adipe.translate.WrappedException


            @Override
            public SimpleColumn byColumnName(String columnName) throws WrappedException {
                try {
                    return findColumnInEither(columnName);
                } catch (AmbiguousNameException exc) {
                    throw new WrappedException(exc);
                }
            }

            private SimpleColumn findColumnInEither(String columnName) throws AmbiguousNameException, WrappedException {
                if (r1.getTableIfQualifiedNameAndExists(columnName) != null && r2.getTableIfQualifiedNameAndExists(columnName) != null) {
                    throw new AmbiguousNameException(String.format("The table name '%s' is ambiguous", TableScope.getTableNameIfQualifiedName(columnName)));
                }

                SimpleColumn matchInLeftState = r1.getColumnIcShdNwrapAmbNindNull(columnName);
                if (matchInLeftState != null) {
                    try {
                        r2.getColumnIcShdNwrapAmbInd(columnName);
                        throw new AmbiguousNameException(String.format("The column name '%s' is ambiguous", columnName));
                    } catch (IndexOutOfBoundsException exc) {
                        return matchInLeftState;
                    }
                } else {
                    try {
                        return r2.getColumnIcShdNwrapAmbInd(columnName);
                    } catch (IndexOutOfBoundsException exc2) {
                        throw new WrappedException(exc2);
                    }
                }
            }
        };
    }
View Full Code Here


        // TODO repeated code in TableReferenceTranslation?
        // TODO repeated as columnScope().asColumnNames().byColumnName() ?
        try {
            return new NamedColumn(getColumnIcShdNwrapAmbInd(name), name).column();
        } catch (IndexOutOfBoundsException | AmbiguousNameException e) {
            throw new WrappedException(e);
        }
    }
View Full Code Here

        // TODO merge byColumnName and getIc methods
        // TODO change name to reflect ignore-case, e.g., add suffix ic
        // TODO this code is already duplicated elsewhere
        List<SimpleColumn> matches = getIcNshdNwrapNambNindList(columnName);
        if (matches.isEmpty()) {
            throw new WrappedException(new IndexOutOfBoundsException(String.format("No column name '%s'", columnName)));
        }
        if (matches.size() != 1) {
            throw new WrappedException(new AmbiguousNameException(String.format("The column name '%s' is ambiguous", columnName)));
        }
        return matches.get(0);
    }
View Full Code Here

            public SimpleColumn byColumnName(String columnName) throws WrappedException {
                // TODO repeated code in TableReferenceTranslation and others
                try {
                    return state2.getColumnIcShdNwrapAmbInd(columnName);
                } catch (AmbiguousNameException|IndexOutOfBoundsException exc2) {
                    throw new WrappedException(exc2);
                }
            }
        };
    }
View Full Code Here

    private void insideColumnReference() throws WrappedException {
        int endOfColumnName = s.indexOf('}', pos);
        if (endOfColumnName == -1) {
            // TODO propagate javadoc and throws declarations for the exceptions thrown in @{link ColumnScope#get}
            throw new WrappedException(new RuntimeException("Column reference ${...} found, but right brace missing"));
        }
        String columnNameWithEscapes = s.substring(pos, endOfColumnName);
        String columnName = columnNameWithEscapes.replace("$$","$");
        if ((columnNameWithEscapes.length() - columnNameWithEscapes.replace("$","").length())%2 == 1) {
            throw new WrappedException(new RuntimeException("The dollar-sign seems to be unescaped: use '$$' to represent '$'"));
        }
        objs.add(ex.byColumnName(columnName));
        pos = endOfColumnName + Character.charCount('}');
    }
View Full Code Here

        if (c != null && c == '{') {
            insideColumnReference();
        } else if (c != null && c == '$') {
            objs.add("$");
        } else {
            throw new WrappedException(new RuntimeException("The dollar-sign seems to be unescaped: use '$$' to represent '$'"));
        }
    }
View Full Code Here

TOP

Related Classes of adipe.translate.WrappedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.