本文整理汇总了Java中butterknife.internal.ListenerMethod类的典型用法代码示例。如果您正苦于以下问题:Java ListenerMethod类的具体用法?Java ListenerMethod怎么用?Java ListenerMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListenerMethod类属于butterknife.internal包,在下文中一共展示了ListenerMethod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRequiredBindings
import butterknife.internal.ListenerMethod; //导入依赖的package包/类
public List<MemberViewBinding> getRequiredBindings() {
List<MemberViewBinding> requiredBindings = new ArrayList<>();
if (fieldBinding != null && fieldBinding.isRequired()) {
requiredBindings.add(fieldBinding);
}
for (Map<ListenerMethod, Set<MethodViewBinding>> methodBinding : methodBindings.values()) {
for (Set<MethodViewBinding> set : methodBinding.values()) {
for (MethodViewBinding binding : set) {
if (binding.isRequired()) {
requiredBindings.add(binding);
}
}
}
}
return requiredBindings;
}
示例2: addMethodBinding
import butterknife.internal.ListenerMethod; //导入依赖的package包/类
public void addMethodBinding(ListenerClass listener, ListenerMethod method,
MethodViewBinding binding) {
Map<ListenerMethod, Set<MethodViewBinding>> methods = methodBindings.get(listener);
Set<MethodViewBinding> set = null;
if (methods == null) {
methods = new LinkedHashMap<>();
methodBindings.put(listener, methods);
} else {
set = methods.get(method);
}
if (set == null) {
set = new LinkedHashSet<>();
methods.put(method, set);
}
set.add(binding);
}
示例3: getRequiredBindings
import butterknife.internal.ListenerMethod; //导入依赖的package包/类
public List<ViewBinding> getRequiredBindings() {
List<ViewBinding> requiredViewBindings = new ArrayList<>();
if (fieldBinding != null && fieldBinding.isRequired()) {
requiredViewBindings.add(fieldBinding);
}
for (Map<ListenerMethod, Set<MethodViewBinding>> methodBinding : methodBindings.values()) {
for (Set<MethodViewBinding> set : methodBinding.values()) {
for (MethodViewBinding binding : set) {
if (binding.isRequired()) {
requiredViewBindings.add(binding);
}
}
}
}
return requiredViewBindings;
}
示例4: getRequiredBindings
import butterknife.internal.ListenerMethod; //导入依赖的package包/类
/**
* 过滤出 元素不为 Nullable 的 method or field 的 ViewBinding
*
* @return ViewBinding 集合
*/
public List<MemberViewBinding> getRequiredBindings() {
List<MemberViewBinding> requiredBindings = new ArrayList<>();
if (fieldBinding != null && fieldBinding.isRequired()) {
requiredBindings.add(fieldBinding);
}
for (Map<ListenerMethod, Set<MethodViewBinding>> methodBinding : methodBindings.values()) {
for (Set<MethodViewBinding> set : methodBinding.values()) {
for (MethodViewBinding binding : set) {
if (binding.isRequired()) {
requiredBindings.add(binding);
}
}
}
}
return requiredBindings;
}
示例5: addMethodBinding
import butterknife.internal.ListenerMethod; //导入依赖的package包/类
public void addMethodBinding(ListenerClass listener, ListenerMethod method,
MethodViewBinding binding) {
Map<ListenerMethod, Set<MethodViewBinding>> methods = methodBindings.get(listener);
Set<MethodViewBinding> set = null;
if (methods == null) {
methods = new LinkedHashMap<>();
methodBindings.put(listener, methods);
} else {
set = methods.get(method);
}
if (set == null) {
set = new LinkedHashSet<>();
methods.put(method, set);
}
set.add(binding);
}
示例6: addMethod
import butterknife.internal.ListenerMethod; //导入依赖的package包/类
boolean addMethod(
Id id,
ListenerClass listener,
ListenerMethod method,
MethodViewBinding binding) {
ViewBinding.Builder viewBinding = getOrCreateViewBindings(id);
if (viewBinding.hasMethodBinding(listener, method) && !"void".equals(method.returnType())) {
return false;
}
viewBinding.addMethodBinding(listener, method, binding);
return true;
}
示例7: addMethod
import butterknife.internal.ListenerMethod; //导入依赖的package包/类
boolean addMethod(
Id id,
ListenerClass listener,
ListenerMethod method,
MethodViewBinding binding) {
ViewBinding.Builder viewBinding = getOrCreateViewBindings(id);
if (viewBinding.hasMethodBinding(listener, method) && !"void".equals(method.returnType())) {
return false;
}
viewBinding.addMethodBinding(listener, method, binding);
return true;
}
示例8: addMethod
import butterknife.internal.ListenerMethod; //导入依赖的package包/类
boolean addMethod(
Id id,
ListenerClass listener,
ListenerMethod method,
MethodViewBinding binding) {
ViewBindings viewBindings = getOrCreateViewBindings(id);
if (viewBindings.hasMethodBinding(listener, method) && !"void".equals(method.returnType())) {
return false;
}
viewBindings.addMethodBinding(listener, method, binding);
return true;
}
示例9: addMethod
import butterknife.internal.ListenerMethod; //导入依赖的package包/类
boolean addMethod(
Id id,
ListenerClass listener,
ListenerMethod method,
MethodViewBinding binding) {
ViewBinding.Builder viewBinding = getOrCreateViewBindings(id);
if (viewBinding.hasMethodBinding(listener, method) &&
!"void".equals(method.returnType())) {
return false;
}
viewBinding.addMethodBinding(listener, method, binding);
return true;
}
示例10: ViewBinding
import butterknife.internal.ListenerMethod; //导入依赖的package包/类
ViewBinding(Id id, Map<ListenerClass, Map<ListenerMethod, Set<MethodViewBinding>>> methodBindings,
FieldViewBinding fieldBinding) {
this.id = id;
this.methodBindings = methodBindings;
this.fieldBinding = fieldBinding;
}
示例11: getMethodBindings
import butterknife.internal.ListenerMethod; //导入依赖的package包/类
public Map<ListenerClass, Map<ListenerMethod, Set<MethodViewBinding>>> getMethodBindings() {
return methodBindings;
}
示例12: hasMethodBinding
import butterknife.internal.ListenerMethod; //导入依赖的package包/类
public boolean hasMethodBinding(ListenerClass listener, ListenerMethod method) {
Map<ListenerMethod, Set<MethodViewBinding>> methods = methodBindings.get(listener);
return methods != null && methods.containsKey(method);
}
示例13: addFieldAndUnbindStatement
import butterknife.internal.ListenerMethod; //导入依赖的package包/类
private void addFieldAndUnbindStatement(TypeSpec.Builder result, MethodSpec.Builder unbindMethod,
ViewBinding bindings) {
// Only add fields to the binding if there are method bindings.
Map<ListenerClass, Map<ListenerMethod, Set<MethodViewBinding>>> classMethodBindings =
bindings.getMethodBindings();
if (classMethodBindings.isEmpty()) {
return;
}
String fieldName = bindings.isBoundToRoot() ? "viewSource" : "view" + bindings.getId().value;
result.addField(VIEW, fieldName, PRIVATE);
// We only need to emit the null check if there are zero required bindings.
boolean needsNullChecked = bindings.getRequiredBindings().isEmpty();
if (needsNullChecked) {
unbindMethod.beginControlFlow("if ($N != null)", fieldName);
}
for (ListenerClass listenerClass : classMethodBindings.keySet()) {
// We need to keep a reference to the listener
// in case we need to unbind it via a remove method.
boolean requiresRemoval = !"".equals(listenerClass.remover());
String listenerField = "null";
if (requiresRemoval) {
TypeName listenerClassName = bestGuess(listenerClass.type());
listenerField = fieldName + ((ClassName) listenerClassName).simpleName();
result.addField(listenerClassName, listenerField, PRIVATE);
}
if (!VIEW_TYPE.equals(listenerClass.targetType())) {
unbindMethod.addStatement("(($T) $N).$N($N)", bestGuess(listenerClass.targetType()),
fieldName, removerOrSetter(listenerClass, requiresRemoval), listenerField);
} else {
unbindMethod.addStatement("$N.$N($N)", fieldName,
removerOrSetter(listenerClass, requiresRemoval), listenerField);
}
if (requiresRemoval) {
unbindMethod.addStatement("$N = null", listenerField);
}
}
unbindMethod.addStatement("$N = null", fieldName);
if (needsNullChecked) {
unbindMethod.endControlFlow();
}
}
示例14: addFieldAndUnbindStatement
import butterknife.internal.ListenerMethod; //导入依赖的package包/类
private void addFieldAndUnbindStatement(TypeSpec.Builder result, MethodSpec.Builder unbindMethod,
ViewBinding bindings) {
// Only add fields to the binding if there are method bindings.
Map<ListenerClass, Map<ListenerMethod, Set<MethodViewBinding>>> classMethodBindings =
bindings.getMethodBindings();
if (classMethodBindings.isEmpty()) {
return;
}
String fieldName = bindings.isBoundToRoot() ? "viewSource" : "view" + bindings.getId().value;
result.addField(VIEW, fieldName, PRIVATE);
// We only need to emit the null check if there are zero required bindings.
boolean needsNullChecked = bindings.getRequiredBindings().isEmpty();
if (needsNullChecked) {
unbindMethod.beginControlFlow("if ($N != null)", fieldName);
}
for (ListenerClass listenerClass : classMethodBindings.keySet()) {
// We need to keep a reference to the listener
// in case we need to unbind it via a remove method.
boolean requiresRemoval = !"".equals(listenerClass.remover());
String listenerField = "null";
if (requiresRemoval) {
TypeName listenerClassName = bestGuess(listenerClass.type());
listenerField = fieldName + ((ClassName) listenerClassName).simpleName();
result.addField(listenerClassName, listenerField, PRIVATE);
}
if (!VIEW_TYPE.equals(listenerClass.targetType())) {
unbindMethod.addStatement("(($T) $N).$N($N)", bestGuess(listenerClass.targetType()),
fieldName, removerOrSetter(listenerClass, requiresRemoval), listenerField);
} else {
unbindMethod.addStatement("$N.$N($N)", fieldName,
removerOrSetter(listenerClass, requiresRemoval), listenerField);
}
if (requiresRemoval) {
unbindMethod.addStatement("$N = null", listenerField);
}
}
unbindMethod.addStatement("$N = null", fieldName);
if (needsNullChecked) {
unbindMethod.endControlFlow();
}
}
示例15: addFieldAndUnbindStatement
import butterknife.internal.ListenerMethod; //导入依赖的package包/类
private void addFieldAndUnbindStatement(TypeSpec.Builder result, MethodSpec.Builder unbindMethod,
ViewBindings bindings) {
// Only add fields to the binding if there are method bindings.
Map<ListenerClass, Map<ListenerMethod, Set<MethodViewBinding>>> classMethodBindings =
bindings.getMethodBindings();
if (classMethodBindings.isEmpty()) {
return;
}
String fieldName = bindings.isBoundToRoot() ? "viewSource" : "view" + bindings.getId().value;
result.addField(VIEW, fieldName, PRIVATE);
// We only need to emit the null check if there are zero required bindings.
boolean needsNullChecked = bindings.getRequiredBindings().isEmpty();
if (needsNullChecked) {
unbindMethod.beginControlFlow("if ($N != null)", fieldName);
}
for (ListenerClass listenerClass : classMethodBindings.keySet()) {
// We need to keep a reference to the listener
// in case we need to unbind it via a remove method.
boolean requiresRemoval = !"".equals(listenerClass.remover());
String listenerField = "null";
if (requiresRemoval) {
TypeName listenerClassName = bestGuess(listenerClass.type());
listenerField = fieldName + ((ClassName) listenerClassName).simpleName();
result.addField(listenerClassName, listenerField, PRIVATE);
}
if (!VIEW_TYPE.equals(listenerClass.targetType())) {
unbindMethod.addStatement("(($T) $N).$N($N)", bestGuess(listenerClass.targetType()),
fieldName, removerOrSetter(listenerClass, requiresRemoval), listenerField);
} else {
unbindMethod.addStatement("$N.$N($N)", fieldName,
removerOrSetter(listenerClass, requiresRemoval), listenerField);
}
if (requiresRemoval) {
unbindMethod.addStatement("$N = null", listenerField);
}
}
unbindMethod.addStatement("$N = null", fieldName);
if (needsNullChecked) {
unbindMethod.endControlFlow();
}
}