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

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

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

MetaClass.isEnum介绍

暂无

代码示例

代码示例来源: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-jaxrs-client

public static boolean canHandle(final MetaClass type, final String mimeType) {
 boolean canHandle = false;
 if (("text/plain".equals(mimeType) && type.asUnboxed().isPrimitive())
   || type.equals(MetaClassFactory.get(String.class))
   || type.equals(MetaClassFactory.get(Date.class))
   || type.isEnum()) {
  canHandle = true;
 }
 return canHandle;
}

代码示例来源: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: 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

final Class cls = o.getClass();
if (definition.getMappingClass().isEnum()) {
 final Enum enumer = (Enum) o;

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

final Class cls = o.getClass();
if (definition.getMappingClass().isEnum()) {
 final Enum enumer = (Enum) o;

代码示例来源: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

if ((toMap.isAbstract() || toMap.isInterface()) && !toMap.isEnum()) {
 throw new RuntimeException("cannot map an abstract class or interface: " + toMap.getFullyQualifiedName());

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

public Statement unwrapJSON(final Statement valueStatement, final MetaClass toType, final MetaClass targetType) {
 if (toType.isEnum()) {
  return demarshallEnum(Stmt.nestedCall(valueStatement).invoke("isObject"), valueStatement, toType);
 }
 else {
  final String varName = MarshallingGenUtil.getVarName(toType);
  if (toType.equals(MetaClassFactory.get(Object.class))) {
   return Stmt.castTo(ObjectMarshaller.class, Stmt.loadVariable(varName))
     .invoke("demarshall", targetType.asClass(), valueStatement, loadVariable("a1"));
  }
  return Stmt.loadVariable(varName)
    .invoke("demarshall", valueStatement, loadVariable("a1"));
 }
}

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

public Statement unwrapJSON(final Statement valueStatement, final MetaClass toType, final MetaClass targetType) {
 if (toType.isEnum()) {
  return demarshallEnum(Stmt.nestedCall(valueStatement).invoke("isObject"), valueStatement, toType);
 }
 else {
  final String varName = MarshallingGenUtil.getVarName(toType);
  if (toType.equals(MetaClassFactory.get(Object.class))) {
   return Stmt.castTo(ObjectMarshaller.class, Stmt.loadVariable(varName))
     .invoke("demarshall", targetType.asClass(), valueStatement, loadVariable("a1"));
  }
  return Stmt.loadVariable(varName)
    .invoke("demarshall", valueStatement, loadVariable("a1"));
 }
}

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

if (mapping.getType().isEnum()) {
 enums.add(mapping.getType());

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

if (mapping.getType().isEnum()) {
 enums.add(mapping.getType());

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

public static MappingDefinition map(final MetaClass toMap, final DefinitionsFactory definitionsFactory) {
 if ((toMap.isAbstract() && !toMap.isEnum()) || toMap.isInterface()) {
  throw new RuntimeException("cannot marshal an abstract class or interface: " + toMap.getFullyQualifiedName());
 definition.setInstantiationMapping(simpleConstructorMapping);
 if (toMap.isEnum()) {
  return definition;
   final MetaClass compType = type.isArray() ? type.getOuterComponentType().asBoxed() : type.asBoxed();
   if (!(compType.isAbstract() || compType.isInterface() || compType.isEnum()) && !definitionsFactory.isExposedClass(compType)) {
    throw new InvalidMappingException("portable entity " + toMap.getFullyQualifiedName()
        + " contains a field (" + field.getName() + ") that is not known to the marshaller framework: "

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

public static MappingDefinition map(final MetaClass toMap, final DefinitionsFactory definitionsFactory) {
 if ((toMap.isAbstract() && !toMap.isEnum()) || toMap.isInterface()) {
  throw new RuntimeException("cannot marshal an abstract class or interface: " + toMap.getFullyQualifiedName());
 definition.setInstantiationMapping(simpleConstructorMapping);
 if (toMap.isEnum()) {
  return definition;
   final MetaClass compType = type.isArray() ? type.getOuterComponentType().asBoxed() : type.asBoxed();
   if (!(compType.isAbstract() || compType.isInterface() || compType.isEnum()) && !definitionsFactory.isExposedClass(compType)) {
    throw new InvalidMappingException("portable entity " + toMap.getFullyQualifiedName()
        + " contains a field (" + field.getName() + ") that is not known to the marshaller framework: "

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

if (toMap.isEnum()) {
 builder.append(Stmt.load(marshallEnum(loadVariable("a0"), toMap)).returnValue());
 return;
   targetType.isArray() ? targetType.getOuterComponentType().asBoxed() : targetType.asBoxed();
 if (!(compType.isAbstract() || compType.isInterface() || compType.isEnum())
   && !context.canMarshal(compType.getFullyQualifiedName())) {
  throw new NoAvailableMarshallerException(compType.getFullyQualifiedName());
 concat = Str.expr(concat, StringOperator.Concat, "\":");
 if (targetType.isEnum()) {
  concat = Str.expr(concat, StringOperator.Concat, Expr.qualify(marshallEnum(valueStatement, targetType)));

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

if (toMap.isEnum()) {
 builder.append(Stmt.load(marshallEnum(loadVariable("a0"), toMap)).returnValue());
 return;
   targetType.isArray() ? targetType.getOuterComponentType().asBoxed() : targetType.asBoxed();
 if (!(compType.isAbstract() || compType.isInterface() || compType.isEnum())
   && !context.canMarshal(compType.getFullyQualifiedName())) {
  throw new NoAvailableMarshallerException(compType.getFullyQualifiedName());
 concat = Str.expr(concat, StringOperator.Concat, "\":");
 if (targetType.isEnum()) {
  concat = Str.expr(concat, StringOperator.Concat, Expr.qualify(marshallEnum(valueStatement, targetType)));

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

.initializeWith(loadVariable("a0").invoke("isObject")));
if (toMap.isEnum()) {
 builder.append(Stmt.declareVariable(toMap).named("entity")
   .initializeWith(demarshallEnum(loadVariable("obj"), loadVariable("a0"), toMap)));

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

.initializeWith(loadVariable("a0").invoke("isObject")));
if (toMap.isEnum()) {
 builder.append(Stmt.declareVariable(toMap).named("entity")
   .initializeWith(demarshallEnum(loadVariable("obj"), loadVariable("a0"), toMap)));

相关文章