Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Modifiers | Name | Description |
---|---|---|
static int |
DL_CASE |
|
static int |
DL_DELETE |
|
static int |
DL_SUBSTITUTION |
|
static int |
DL_TRANSPOSITION |
|
static int |
MAX_CONSTRUCTOR_SCORE |
|
static int |
MAX_FIELD_SCORE |
|
static int |
MAX_METHOD_SCORE |
|
static int |
MAX_RECOMENDATIONS |
Type | Name and description |
---|---|
protected static Class |
boxVar(Class c) If c is a primitive class this method returns a boxed version otherwise c is returned. |
static int |
damerauLevenshteinDistance(Object[] s, Object[] t) This is a implementation of DL distance between two Object arrays instead of character streams. |
static int |
delDistance(CharSequence s, CharSequence t) This is a slightly modified version of the Damerau Levenshtein distance algorithm. |
static String |
getConstructorSuggestionString(Class type, Object[] arguments) Returns a string detailing possible solutions to a missing constructor if no good solutions can be found a empty string is returned. |
static String |
getMethodSuggestionString(String methodName, Class type, Object[] arguments) Returns a string detailing possible solutions to a missing method if no good solutions can be found a empty string is returned. |
static String |
getPropertySuggestionString(String fieldName, Class type) Returns a string detailing possible solutions to a missing field or property if no good solutions can be found a empty string is returned. |
If c is a primitive class this method returns a boxed version otherwise c is returned. In java 1.5 this can be simplified thanks to the Type class.
This is a implementation of DL distance between two Object arrays instead of character streams. The objects are compared using their equals method. No objects may be null. This implementation is based on Chas Emerick's implementation of Levenshtein Distance for jakarta commons.
s
- a Object arrayt
- this array is compared to sThis is a slightly modified version of the Damerau Levenshtein distance algorithm. It has a additional test to see if a character has switched case, in the original algorithm this counts as a substitution. The "cost" for a substitution is given as 10 instead of 1 in this version, this enables transpositions and case modifications to have a lower cost than substitutions. Currently the lowercase versions of t_j and s_i isn't cached, its probable that some speed could be gained from this. This version is based on Chas Emerick's implementation of Levenshtein Distance for jakarta commons.
s
- a CharSequencet
- the CharSequence to be compared to sReturns a string detailing possible solutions to a missing constructor if no good solutions can be found a empty string is returned.
arguments
- the arguments passed to the constructortype
- the class on which the constructor is invokedReturns a string detailing possible solutions to a missing method if no good solutions can be found a empty string is returned.
methodName
- the name of the method that doesn't existtype
- the class on which the method is invokedarguments
- the arguments passed to the methodReturns a string detailing possible solutions to a missing field or property if no good solutions can be found a empty string is returned.
fieldName
- the missing fieldtype
- the class on which the field is sought