org.jboss.errai.codegen.meta.MetaClass.isInterface()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.4k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中org.jboss.errai.codegen.meta.MetaClass.isInterface()方法的一些代码示例,展示了MetaClass.isInterface()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MetaClass.isInterface()方法的具体详情如下:
包路径:org.jboss.errai.codegen.meta.MetaClass
类名称:MetaClass
方法名:isInterface

MetaClass.isInterface介绍

暂无

代码示例

代码示例来源:origin: org.jboss.errai/errai-bus

if (remote.isInterface()) {

代码示例来源:origin: org.jboss.errai/errai-codegen

@Override
public ClassDefinitionBuilderInterfaces<T> implementsInterface(final MetaClass clazz) {
 if (!clazz.isInterface()) {
  throw new RuntimeException("not an interface: " + clazz.getFullyQualifiedName());
 }
 classDefinition.addInterface(clazz);
 return this;
}

代码示例来源:origin: errai/errai

@Override
public ClassDefinitionBuilderInterfaces<T> implementsInterface(final MetaClass clazz) {
 if (!clazz.isInterface()) {
  throw new RuntimeException("not an interface: " + clazz.getFullyQualifiedName());
 }
 classDefinition.addInterface(clazz);
 return this;
}

代码示例来源:origin: errai/errai

/**
 * @return True iff the given type is an interface extending {@code elemental.html.Element}.
 */
public static boolean isElementalIface(final MetaClass type) {
 if (!(type.isInterface() && type.getPackageName().startsWith("elemental."))) {
  return false;
 }
 final Queue<MetaClass> ifaces = new LinkedList<MetaClass>();
 ifaces.add(type);
 while (!ifaces.isEmpty()) {
  final MetaClass iface = ifaces.poll();
  if (iface.getFullyQualifiedName().equals("elemental.dom.Element")) {
   return true;
  } else {
   ifaces.addAll(Arrays.asList(iface.getInterfaces()));
  }
 }
 return false;
}

代码示例来源:origin: errai/errai

@Override
public void callback(final MetaClass type) {
 if (!type.getFullyQualifiedName().startsWith("java.util")) {
  if (type.isInterface()) {
   jsTypeIfaces.add(type);
  }
  else if (type.isConcrete() && type.isPublic()) {
   findJsTypeIfaces(type)
   .forEach(iface -> {
    jsTypeIfaces.add(iface);
    jsTypeIfaceImpls.put(iface, type);
   });
  }
 }
}

代码示例来源:origin: org.jboss.errai/errai-ui

/**
 * @return True iff the given type is an interface extending {@code elemental.html.Element}.
 */
public static boolean isElementalIface(final MetaClass type) {
 if (!(type.isInterface() && type.getPackageName().startsWith("elemental."))) {
  return false;
 }
 final Queue<MetaClass> ifaces = new LinkedList<MetaClass>();
 ifaces.add(type);
 while (!ifaces.isEmpty()) {
  final MetaClass iface = ifaces.poll();
  if (iface.getFullyQualifiedName().equals("elemental.dom.Element")) {
   return true;
  } else {
   ifaces.addAll(Arrays.asList(iface.getInterfaces()));
  }
 }
 return false;
}

代码示例来源:origin: org.jboss.errai/errai-config

private static boolean validateWildcardSerializable(MetaClass mc) {
 if (mc.isInterface() || (mc.isAbstract() && !mc.isEnum())) {
  log.debug("Serializable types cannot be an interface or abstract, ignoring: {}", mc.getFullyQualifiedName());
  return false;
 }
 return true;
}

代码示例来源:origin: errai/errai

private static boolean validateWildcardSerializable(MetaClass mc) {
 if (mc.isInterface() || (mc.isAbstract() && !mc.isEnum())) {
  log.debug("Serializable types cannot be an interface or abstract, ignoring: {}", mc.getFullyQualifiedName());
  return false;
 }
 return true;
}

代码示例来源:origin: org.jboss.errai/errai-data-binding

private static boolean validateWildcard(MetaClass bindable) {
  if (bindable.isInterface()) {
   log.debug("@Bindable types cannot be an interface, ignoring: {}", bindable.getFullyQualifiedName());
   return false;
  }
  else if (bindable.isAbstract()) {
   log.debug("@Bindable types cannot be abstract, ignoring: {}", bindable.getFullyQualifiedName());
   return false;
  }
  else if (bindable.isFinal()) {
   log.debug("@Bindable types cannot be final, ignoring: {}", bindable.getFullyQualifiedName());
   return false;
  }
  return true;
 }
}

代码示例来源:origin: errai/errai

private static boolean validateWildcard(MetaClass bindable) {
  if (bindable.isInterface()) {
   log.debug("@Bindable types cannot be an interface, ignoring: {}", bindable.getFullyQualifiedName());
   return false;
  }
  else if (bindable.isAbstract()) {
   log.debug("@Bindable types cannot be abstract, ignoring: {}", bindable.getFullyQualifiedName());
   return false;
  }
  else if (bindable.isFinal()) {
   log.debug("@Bindable types cannot be final, ignoring: {}", bindable.getFullyQualifiedName());
   return false;
  }
  return true;
 }
}

代码示例来源:origin: errai/errai

@Override
public boolean shouldUseObjectMarshaller(final MetaClass type) {
 final boolean hasPortableSubtypes = inheritanceMap.containsKey(type.getFullyQualifiedName());
 final MappingDefinition definition = getDefinition(type);
 final boolean hasMarshaller = definition != null;
 if (hasMarshaller) {
  if (definition.getClass().isAnnotationPresent(CustomMapping.class)
    || definition.getClientMarshallerClass() != null) {
   return false;
  }
 }
 final boolean isConcrete = !(type.isAbstract() || type.isInterface());
 if (!type.isArray() && !type.isEnum() && !isConcrete && !hasPortableSubtypes) {
  throw new IllegalStateException("A field of type " + type
    + " appears in a portable class, but " + type + " has no portable implementations.");
 }
 return (hasPortableSubtypes && !hasMarshaller) || (hasPortableSubtypes && hasMarshaller && isConcrete);
}

代码示例来源:origin: org.jboss.errai/errai-marshalling

@Override
public boolean shouldUseObjectMarshaller(final MetaClass type) {
 final boolean hasPortableSubtypes = inheritanceMap.containsKey(type.getFullyQualifiedName());
 final MappingDefinition definition = getDefinition(type);
 final boolean hasMarshaller = definition != null;
 if (hasMarshaller) {
  if (definition.getClass().isAnnotationPresent(CustomMapping.class)
    || definition.getClientMarshallerClass() != null) {
   return false;
  }
 }
 final boolean isConcrete = !(type.isAbstract() || type.isInterface());
 if (!type.isArray() && !type.isEnum() && !isConcrete && !hasPortableSubtypes) {
  throw new IllegalStateException("A field of type " + type
    + " appears in a portable class, but " + type + " has no portable implementations.");
 }
 return (hasPortableSubtypes && !hasMarshaller) || (hasPortableSubtypes && hasMarshaller && isConcrete);
}

代码示例来源:origin: org.jboss.errai/errai-codegen

public static int scoreInterface(final MetaClass parm, final MetaClass arg) {
 if (parm.isInterface()) {
  final MetaClass[] iface = arg.getInterfaces();
  if (iface != null) {
   for (final MetaClass c : iface) {
    if (c == parm) return 1;
    else if (parm.isAssignableFrom(c)) return scoreInterface(parm, arg.getSuperClass());
   }
  }
 }
 return 0;
}

代码示例来源:origin: errai/errai

public static int scoreInterface(final MetaClass parm, final MetaClass arg) {
 if (parm.isInterface()) {
  final MetaClass[] iface = arg.getInterfaces();
  if (iface != null) {
   for (final MetaClass c : iface) {
    if (c == parm) return 1;
    else if (parm.isAssignableFrom(c)) return scoreInterface(parm, arg.getSuperClass());
   }
  }
 }
 return 0;
}

代码示例来源:origin: errai/errai

private void maybeImplementConstructor(final ClassStructureBuilder<?> proxyImpl, final Injectable injectable) {
 if (injectable.getInjectedType().isInterface()) {
  return;
 }
 final MetaConstructor accessibleConstructor = getAccessibleConstructor(injectable);
 if (accessibleConstructor.getParameters().length > 0) {
  implementConstructor(proxyImpl, accessibleConstructor);
 }
}

代码示例来源:origin: errai/errai

public boolean isConcrete() {
 return !isInterface()
   && !isAbstract()
   && !isSynthetic()
   && !isAnonymousClass()
   && !isPrimitive()
   && !isArray()
   && !isAnnotation()
   && !isEnum();
}

代码示例来源:origin: org.jboss.errai/errai-codegen

public boolean isConcrete() {
 return !isInterface()
   && !isAbstract()
   && !isSynthetic()
   && !isAnonymousClass()
   && !isPrimitive()
   && !isArray()
   && !isAnnotation()
   && !isEnum();
}

代码示例来源:origin: errai/errai

private boolean shouldProxyMethod(final MetaMethod method, final Multimap<String, MetaMethod> proxiedMethodsByName) {
 return (method.getDeclaringClass() != null && method.getDeclaringClass().isInterface())
     || !method.isStatic() && (method.isPublic() || method.isProtected()) && !method.isFinal()
         && methodIsNotFromObjectUnlessHashCode(method)
     && typesInSignatureAreVisible(method)
     && isNotAlreadyProxied(method, proxiedMethodsByName);
}

代码示例来源:origin: errai/errai

@Override
public String generate(final Context context) {
 final String stmt = statement.generate(context);
 if (!toType.isPrimitive() && !toType.isAssignableFrom(statement.getType())
     && !toType.isAssignableTo(statement.getType()) && !toType.isInterface()
     && !statement.getType().asBoxed().equals(toType)) {
  if (context.isPermissiveMode()) {
   return "(" + LoadClassReference.getClassReference(toType, context) + ") " + stmt;
  }
  else {
   throw new InvalidTypeException(statement.getType() + " cannot be cast to " + toType);
  }
 }
 else if (toType.isAssignableFrom(statement.getType()) && !statement.getType().equals(MetaClassFactory.get(NullType.class))) {
  return stmt;
 }
 else {
  return "(" + LoadClassReference.getClassReference(toType, context) + ") " + stmt;
 }
}

代码示例来源:origin: org.jboss.errai/errai-codegen

@Override
public String generate(final Context context) {
 final String stmt = statement.generate(context);
 if (!toType.isPrimitive() && !toType.isAssignableFrom(statement.getType())
     && !toType.isAssignableTo(statement.getType()) && !toType.isInterface()
     && !statement.getType().asBoxed().equals(toType)) {
  if (context.isPermissiveMode()) {
   return "(" + LoadClassReference.getClassReference(toType, context) + ") " + stmt;
  }
  else {
   throw new InvalidTypeException(statement.getType() + " cannot be cast to " + toType);
  }
 }
 else if (toType.isAssignableFrom(statement.getType()) && !statement.getType().equals(MetaClassFactory.get(NullType.class))) {
  return stmt;
 }
 else {
  return "(" + LoadClassReference.getClassReference(toType, context) + ") " + stmt;
 }
}

相关文章