/** * Check that specified object is not null. If object is null, throw exception using objName. * @param object Object to check for null * @param objName Object name used when throwing exception * @throws FunctionMetadataException Thrown when object == null */ private static final void validateIsNotNull(Object object, String objName) throws FunctionMetadataException { if(object == null) { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30429, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30429, objName)); } }
public void helpTestValidateName(String name) { try { FunctionMetadataValidator.validateName(name); } catch(FunctionMetadataException e) { fail("Got exception but did not expect it: " + e.getMessage()); //$NON-NLS-1$ } }
public void helpTestValidateFunction(String className, String methodName, PushDown pushdown) { try { FunctionMetadataValidator.validateInvocationMethod(className, methodName, pushdown); } catch(FunctionMetadataException e) { fail("Got exception but did not expect it: " + e.getMessage()); //$NON-NLS-1$ } }
/** * Check that specified string is no longer than maxLength. If string is longer, an exception is thrown * using strName. * @param string String to check for length * @param maxLength Maximum valid length * @param strName Name of string to use in exception message * @throws FunctionMetadataException Thrown when string.length() > maxLength */ private static final void validateLength(String string, int maxLength, String strName) throws FunctionMetadataException { if(string.length() > maxLength) { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30430, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30430,strName, new Integer(maxLength))); } }
MetadataFactory.setDataType(method.getOutputParameter().getRuntimeType(), method.getOutputParameter(), runtimeTypeMap, true); } catch(FunctionMetadataException e) { updateReport(report, method, e.getMessage());
/** * Check that specified object is not null. If object is null, throw exception using objName. * @param object Object to check for null * @param objName Object name used when throwing exception * @throws FunctionMetadataException Thrown when object == null */ private static final void validateIsNotNull(Object object, String objName) throws FunctionMetadataException { if(object == null) { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30429, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30429, objName)); } }
MetadataFactory.setDataType(method.getOutputParameter().getRuntimeType(), method.getOutputParameter(), runtimeTypeMap, true); } catch(FunctionMetadataException e) { updateReport(report, method, e.getMessage());
/** * Check that specified object is not null. If object is null, throw exception using objName. * @param object Object to check for null * @param objName Object name used when throwing exception * @throws FunctionMetadataException Thrown when object == null */ private static final void validateIsNotNull(Object object, String objName) throws FunctionMetadataException { if(object == null) { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30429, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30429, objName)); } }
MetadataFactory.setDataType(method.getOutputParameter().getRuntimeType(), method.getOutputParameter(), runtimeTypeMap, true); } catch(FunctionMetadataException e) { updateReport(report, method, e.getMessage());
/** * Check that specified string is no longer than maxLength. If string is longer, an exception is thrown * using strName. * @param string String to check for length * @param maxLength Maximum valid length * @param strName Name of string to use in exception message * @throws FunctionMetadataException Thrown when string.length() > maxLength */ private static final void validateLength(String string, int maxLength, String strName) throws FunctionMetadataException { if(string.length() > maxLength) { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30430, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30430,strName, new Integer(maxLength))); } }
/** * Check that specified string is no longer than maxLength. If string is longer, an exception is thrown * using strName. * @param string String to check for length * @param maxLength Maximum valid length * @param strName Name of string to use in exception message * @throws FunctionMetadataException Thrown when string.length() > maxLength */ private static final void validateLength(String string, int maxLength, String strName) throws FunctionMetadataException { if(string.length() > maxLength) { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30430, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30430,strName, new Integer(maxLength))); } }
/** * Check that specified string is valid Java identifier. If not, an exception is thrown using * strName for the exception message. * @param identifier String to check * @param strName String to use in exception message * @param allowMultiple True if multiple identifiers are allowed, as in a class name * @throws FunctionMetadataException Thrown when string is not valid Java identifier */ private static final void validateJavaIdentifier(String identifier, String strName, boolean allowMultiple) throws FunctionMetadataException { // First check first character if(identifier.length() > 0) { char firstChar = identifier.charAt(0); if(! Character.isJavaIdentifierStart(firstChar)) { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30432, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30432,strName, new Character(firstChar))); } // Then check the rest of the characters for(int i=1; i<identifier.length(); i++) { char ch = identifier.charAt(i); if(! Character.isJavaIdentifierPart(ch)) { if(! allowMultiple || ! (ch == '.')) { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30431, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30431,strName, new Character(ch))); } } } if(identifier.charAt(identifier.length()-1) == '.') { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30434, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30434,strName)); } } }
/** * Check that specified string is valid Java identifier. If not, an exception is thrown using * strName for the exception message. * @param identifier String to check * @param strName String to use in exception message * @param allowMultiple True if multiple identifiers are allowed, as in a class name * @throws FunctionMetadataException Thrown when string is not valid Java identifier */ private static final void validateJavaIdentifier(String identifier, String strName, boolean allowMultiple) throws FunctionMetadataException { // First check first character if(identifier.length() > 0) { char firstChar = identifier.charAt(0); if(! Character.isJavaIdentifierStart(firstChar)) { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30432, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30432,strName, new Character(firstChar))); } // Then check the rest of the characters for(int i=1; i<identifier.length(); i++) { char ch = identifier.charAt(i); if(! Character.isJavaIdentifierPart(ch)) { if(! allowMultiple || ! (ch == '.')) { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30431, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30431,strName, new Character(ch))); } } } if(identifier.charAt(identifier.length()-1) == '.') { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30434, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30434,strName)); } } }
/** * Check that specified string is valid Java identifier. If not, an exception is thrown using * strName for the exception message. * @param identifier String to check * @param strName String to use in exception message * @param allowMultiple True if multiple identifiers are allowed, as in a class name * @throws FunctionMetadataException Thrown when string is not valid Java identifier */ private static final void validateJavaIdentifier(String identifier, String strName, boolean allowMultiple) throws FunctionMetadataException { // First check first character if(identifier.length() > 0) { char firstChar = identifier.charAt(0); if(! Character.isJavaIdentifierStart(firstChar)) { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30432, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30432,strName, new Character(firstChar))); } // Then check the rest of the characters for(int i=1; i<identifier.length(); i++) { char ch = identifier.charAt(i); if(! Character.isJavaIdentifierPart(ch)) { if(! allowMultiple || ! (ch == '.')) { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30431, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30431,strName, new Character(ch))); } } } if(identifier.charAt(identifier.length()-1) == '.') { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30434, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30434,strName)); } } }
/** * Determine whether a FunctionParameter is valid. The following items are validated: * <UL> * <LI>Validate parameter name</LI> * <LI>Validate description</LI> * <LI>Validate type</LI> * </UL> * @param param The parameter to validate * @throws FunctionMetadataException Thrown if function parameter is not valid in some way */ public static final void validateFunctionParameter(FunctionParameter param) throws FunctionMetadataException { if(param == null) { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30427, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30427)); } // Validate attributes validateName(param.getName()); validateDescription(param.getDescription()); }
/** * Determine whether a FunctionParameter is valid. The following items are validated: * <UL> * <LI>Validate parameter name</LI> * <LI>Validate description</LI> * <LI>Validate type</LI> * </UL> * @param param The parameter to validate * @throws FunctionMetadataException Thrown if function parameter is not valid in some way */ public static final void validateFunctionParameter(FunctionParameter param) throws FunctionMetadataException { if(param == null) { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30427, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30427)); } // Validate attributes validateName(param.getName()); validateDescription(param.getDescription()); }
/** * Determine whether a FunctionParameter is valid. The following items are validated: * <UL> * <LI>Validate parameter name</LI> * <LI>Validate description</LI> * <LI>Validate type</LI> * </UL> * @param param The parameter to validate * @throws FunctionMetadataException Thrown if function parameter is not valid in some way */ public static final void validateFunctionParameter(FunctionParameter param) throws FunctionMetadataException { if(param == null) { throw new FunctionMetadataException(QueryPlugin.Event.TEIID30427, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30427)); } // Validate attributes validateName(param.getName()); validateDescription(param.getDescription()); }