本文整理汇总了Java中com.google.common.base.Equivalence.Wrapper方法的典型用法代码示例。如果您正苦于以下问题:Java Equivalence.Wrapper方法的具体用法?Java Equivalence.Wrapper怎么用?Java Equivalence.Wrapper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.base.Equivalence
的用法示例。
在下文中一共展示了Equivalence.Wrapper方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: allMethods
import com.google.common.base.Equivalence; //导入方法依赖的package包/类
/**
* @return All candidate methods indexed by signature equivalence
*/
public Map<Equivalence.Wrapper<Method>, Collection<Method>> allMethods() {
ImmutableMap.Builder<Equivalence.Wrapper<Method>, Collection<Method>> builder = ImmutableMap.builder();
for (Map<Equivalence.Wrapper<Method>, Collection<Method>> candidatesForSomeName : candidates.values()) {
builder.putAll(candidatesForSomeName);
}
return builder.build();
}
示例2: methodsNamed
import com.google.common.base.Equivalence; //导入方法依赖的package包/类
/**
* @param methodName Method name
* @return Candidate methods named {@literal methodName} or {@literal null} if none
*/
Map<Equivalence.Wrapper<Method>, Collection<Method>> methodsNamed(String methodName) {
if (candidates.containsKey(methodName)) {
return candidates.get(methodName);
}
return Collections.<Equivalence.Wrapper<Method>, Collection<Method>>emptyMap();
}
示例3: overriddenMethodsNamed
import com.google.common.base.Equivalence; //导入方法依赖的package包/类
/**
* @param methodName Method name
* @return Overridden candidate methods named {@literal methodName} indexed by signature equivalence or
* {@literal null} if none
*/
public Map<Equivalence.Wrapper<Method>, Collection<Method>> overriddenMethodsNamed(String methodName) {
if (candidates.containsKey(methodName)) {
return Maps.filterValues(candidates.get(methodName), new Predicate<Collection<Method>>() {
@Override
public boolean apply(Collection<Method> equivalentMethods) {
return equivalentMethods.size() > 1;
}
});
}
return Collections.<Equivalence.Wrapper<Method>, Collection<Method>>emptyMap();
}
示例4: overloadedMethodsNamed
import com.google.common.base.Equivalence; //导入方法依赖的package包/类
/**
* @param methodName Method name
* @return Overloaded candidate methods named {@literal methodName} indexed by signature equivalence or
* {@literal null} if none
*/
Map<Equivalence.Wrapper<Method>, Collection<Method>> overloadedMethodsNamed(String methodName) {
if (candidates.containsKey(methodName)) {
Map<Equivalence.Wrapper<Method>, Collection<Method>> overloadeds = candidates.get(methodName);
if (overloadeds.size() > 1) {
return overloadeds;
}
}
return Collections.<Equivalence.Wrapper<Method>, Collection<Method>>emptyMap();
}
示例5: apply
import com.google.common.base.Equivalence; //导入方法依赖的package包/类
public Equivalence.Wrapper<Method> apply(@Nullable Method input) {
return SIGNATURE_EQUIVALENCE.wrap(input);
}
示例6: CandidateMethods
import com.google.common.base.Equivalence; //导入方法依赖的package包/类
public CandidateMethods(Map<String, Map<Equivalence.Wrapper<Method>, Collection<Method>>> candidates) {
this.candidates = candidates;
}
示例7: wrap
import com.google.common.base.Equivalence; //导入方法依赖的package包/类
private Equivalence.Wrapper<TypeMirror> wrap(TypeMirror typeMirror) {
return MoreTypes.equivalence().wrap(typeMirror);
}
示例8: format
import com.google.common.base.Equivalence; //导入方法依赖的package包/类
/** Returns the formatted message for an exception with the specified messages. */
public static String format(String heading, Collection<Message> errorMessages) {
Formatter fmt = new Formatter().format(heading).format(":%n%n");
int index = 1;
boolean displayCauses = getOnlyCause(errorMessages) == null;
Map<Equivalence.Wrapper<Throwable>, Integer> causes = Maps.newHashMap();
for (Message errorMessage : errorMessages) {
int thisIdx = index++;
fmt.format("%s) %s%n", thisIdx, errorMessage.getMessage());
List<Object> dependencies = errorMessage.getSources();
for (int i = dependencies.size() - 1; i >= 0; i--) {
Object source = dependencies.get(i);
formatSource(fmt, source);
}
Throwable cause = errorMessage.getCause();
if (displayCauses && cause != null) {
Equivalence.Wrapper<Throwable> causeEquivalence = ThrowableEquivalence.INSTANCE.wrap(cause);
if (!causes.containsKey(causeEquivalence)) {
causes.put(causeEquivalence, thisIdx);
fmt.format("Caused by: %s", Throwables.getStackTraceAsString(cause));
} else {
int causeIdx = causes.get(causeEquivalence);
fmt.format("Caused by: %s (same stack trace as error #%s)",
cause.getClass().getName(), causeIdx);
}
}
fmt.format("%n");
}
if (errorMessages.size() == 1) {
fmt.format("1 error");
} else {
fmt.format("%s errors", errorMessages.size());
}
return fmt.toString();
}
示例9: wrap
import com.google.common.base.Equivalence; //导入方法依赖的package包/类
private Equivalence.Wrapper<TypeMirror> wrap(TypeMirror typeMirror) {
return MoreTypes.equivalence().wrap(typeMirror);
}