Codota Logo
MCollectionType
Code IndexAdd Codota to your IDE (free)

How to use
MCollectionType
in
leap.lang.meta

Best Java code snippets using leap.lang.meta.MCollectionType (Showing top 19 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: org.leapframework/jmms-core

private static MType doResolveType(MetaApi api, MType type) {
  if(type instanceof MUnresolvedTypeRef) {
    return resolveType(api, ((MUnresolvedTypeRef) type).getRefTypeName());
  }
  if(type instanceof MCollectionType) {
    return new MCollectionType(doResolveType(api, type.asCollectionType().getElementType()));
  }
  if(type instanceof MDictionaryType) {
    return new MDictionaryType(type.asDictionaryType().getKeyType(), doResolveType(api, type.asDictionaryType().getValueType()));
  }
  throw new IllegalStateException("Unsupported type '" + type + "'");
}
origin: org.leapframework/jmms-core

protected static Validator ofArray(MetaApi api, String name, boolean required, MCollectionType t, @Nullable MetaObjFormatted p) {
  MType elementType = t.getElementType();
  Validator elementValidator = of(api, name + ".items", elementType);
  return new ArrayValidator(name, required, p, elementValidator);
}
origin: org.leapframework/leap-webapi

protected MCollectionType readCollectionType(JsonObject items, SwaggerExtension ex) {
  return new MCollectionType(readType(items, ex));
}
origin: org.leapframework/leap-webapi

protected void writeArrayType(WriteContext context, ApiMetadata m, JsonWriter w, MCollectionType ct) {
  w.property(TYPE, ARRAY)
   .property(ITEMS,() -> {
     w.startObject();
     writeType(context, m, w, ct.getElementType());
     w.endObject();
   });
}

origin: org.leapframework/jmms-core

return new MCollectionType(elementType);
return new MCollectionType(MObjectType.TYPE);
    throw new IllegalStateException("Invalid array type '" + typeName + "'");
  return new MCollectionType(resolveType(api, elementType));
origin: org.leapframework/jmms-engine

Class<?> toJavaType(MType type) {
  if(type.isSimpleType()) {
    return type.asSimpleType().getJavaType();
  }
  if(type.isCollectionType()) {
    return Array.newInstance(toJavaType(type.asCollectionType().getElementType()), 0).getClass();
  }
  if(type.isComplexType() || type.isDictionaryType() || type.isTypeRef()) {
    return Map.class;
  }
  if(type.isObjectType()) {
    return Object.class;
  }
  throw new IllegalStateException("Unsupported data type '" + type + "'");
}
origin: org.leapframework/leap-lang

return new MCollectionType(root.getMType(declaringType, type.getComponentType(), null, context));
return new MCollectionType(elementType);
origin: org.leapframework/leap-lang

/**
 * Returns the referenced type name.
 */
public String getRefTypeName() {
  return type.isCollectionType() ?
      type.asCollectionType().getElementType().asTypeRef().getRefTypeName() :
      type.asTypeRef().getRefTypeName();
}
origin: org.leapframework/leap-webapi

protected void addQueryResponse(RestdContext ctx, SqlCommand sc, FuncActionBuilder action, MApiOperationBuilder mo) {
  //todo:
  MApiResponseBuilder r = new MApiResponseBuilder();
  r.setStatus(200);
  r.setType(new MCollectionType(MDictionaryType.INSTANCE));
  r.setDescription("Success");
  /*
  MApiHeaderBuilder header = new MApiHeaderBuilder();
  header.setName("X-Total-Count");
  header.setType(MSimpleTypes.BIGINT);
  header.setDescription("The total count of query records.");
  r.addHeader(header);
  */
  mo.addResponse(r);
}
origin: org.leapframework/jmms-core

private static boolean hasUnresolvedType(MType type) {
  if(type instanceof MUnresolvedTypeRef) {
    return true;
  }
  if(type.isCollectionType()) {
    return hasUnresolvedType(type.asCollectionType().getElementType());
  }
  if(type.isDictionaryType()) {
    return hasUnresolvedType(type.asDictionaryType().getValueType());
  }
  return false;
}
origin: org.leapframework/leap-webapi

private MApiResponseBuilder newModelQueryResponse(RestdModel model) {
  MApiResponseBuilder r = new MApiResponseBuilder();
  r.setStatus(200);
  r.setType(new MCollectionType(new MComplexTypeRef(model.getName())));
  r.setDescription("Success");
  MApiHeaderBuilder header = new MApiHeaderBuilder();
  header.setName("X-Total-Count");
  header.setType(MSimpleTypes.BIGINT);
  header.setDescription("The total count of query records.");
  r.addHeader(header);
  return r;
}
origin: org.leapframework/jmms-engine

protected boolean isBodyType(MType type) {
  if(type.isComplexType()) {
    return true;
  }
  if(type.isTypeRef()) {
    return true;
  }
  if(type.isDictionaryType()) {
    return true;
  }
  if(type.isCollectionType()) {
    MType elementType = type.asCollectionType().getElementType();
    return isBodyType(elementType);
  }
  return false;
}
origin: org.leapframework/jmms-engine

p.setExpandable(r.getExpandable());
if(r.isOneToMany() || r.isManyToMany()) {
  p.setType(new MCollectionType(new MComplexTypeRef(r.getTargetEntity())));
}else {
  p.setType(new MComplexTypeRef(r.getTargetEntity()));
origin: org.leapframework/leap-core

  private void onTypeResolved(MType mtype) {
    if (mtype.isComplexType()) {
      MComplexType ct = mtype.asComplexType();

      if (!complexTypes.containsKey(ct.getJavaType())) {
        listener.onComplexTypeResolved(ct.getJavaType(), mtype.asComplexType());
        complexTypes.put(ct.getJavaType(), ct);
      }

      for (MProperty p : ct.getProperties()) {
        onTypeResolved(p.getType());
      }
    } else if (mtype.isCollectionType()) {
      MType elementType = mtype.asCollectionType().getElementType();
      onTypeResolved(elementType);
    }
  }
}
origin: org.leapframework/leap-orm

  p.setType(new MCollectionType(new MComplexTypeRef(targetEntity.getEntityName())));
}else{
  p.setType(new MComplexTypeRef(targetEntity.getEntityName()));
origin: org.leapframework/jmms-engine

private void checkType(MetaApi api, MetaModel model, MetaProperty p, MType type) {
  if (type.isTypeRef()) {
    String name = type.asTypeRef().getRefTypeName();
    if (null == api.getEntity(name) && null == api.getModel(name)) {
      if (Strings.containsIgnoreCase(name, "definitions/")) {
        throw new IllegalStateException("The ref type + '" + name + "' at '" +
            model.getName() + "#" + p.getName() +
            "' not exists, should use '#/definitions/' prefix!");
      } else {
        throw new IllegalStateException("The ref type + '" + name + "' at '" +
            model.getName() + "#" + p.getName() + "' not exists!");
      }
    }
  } else if (type.isCollectionType()) {
    checkType(api, model, p, type.asCollectionType().getElementType());
  }
}
origin: org.leapframework/jmms-core

public static String toTypeName(MType type) {
  if(type.isSimpleType()) {
    SwaggerType st = swaggerWriter.convertSimpleType(type.asSimpleType());
    if(null == st) {
      throw new IllegalStateException("Unsupported type '" + type + "'");
    }
    return st.name().toLowerCase();
  }
  if(type.isCollectionType()) {
    MType elementType = type.asCollectionType().getElementType();
    return "array<" + toTypeName(elementType) + ">";
  }
  if(type.isComplexType()) {
    return type.asComplexType().getName();
  }
  if(type.isTypeRef()) {
    return type.asTypeRef().getRefTypeName();
  }
  if(type.isDictionaryType()) {
    return "map<string," + toTypeName(type.asDictionaryType().getValueType()) + ">";
  }
  if(type.isObjectType()) {
    return "object";
  }
  if(type.isVoidType()) {
    return "";
  }
  throw new IllegalStateException("Unsupported type '" + type + "'");
}
origin: org.leapframework/leap-webapi

MType elementType = type.asCollectionType().getElementType();
if(elementType.isSimpleType()) {
  arg.setType(Array.newInstance(elementType.asSimpleType().getJavaType(),0).getClass());
origin: org.leapframework/leap-webapi

@Override
public Object apply(ActionParams params) {
  Map<String,Object> map = params.toMap();
  Object result;
  if(command.getMetadata().isSelect()) {
    //todo: page query, total count
    Query query = dao.createQuery(command).params(map);
    if(null != returnType) {
      if(returnType.isSimpleType()) {
        result = Converts.convert(query.scalarValueOrNull(), returnType.asSimpleType().getJavaType());
      }else if(returnType.isCollectionType() && returnType.asCollectionType().getElementType().isSimpleType()) {
        result = query.scalars().list(returnType.asCollectionType().getElementType().asSimpleType().getJavaType());
      }else {
        result = query.list();
      }
    }else {
      result = query.list();
    }
  }else{
    //todo: the return type must be simple type
    result = dao.executeUpdate(command, map);
    if(null != returnType) {
      result = Converts.convert(result, returnType.asSimpleType().getJavaType());
    }
  }
  return ApiResponse.of(result);
}
leap.lang.metaMCollectionType

Most used methods

  • <init>
  • getElementType

Popular in Java

  • Finding current android device location
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • orElseThrow (Optional)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • DecimalFormat (java.text)
    DecimalFormat is a concrete subclass ofNumberFormat that formats decimal numbers. It has a variety o
  • HashSet (java.util)
    This class implements the Set interface, backed by a hash table (actually a HashMap instance). It m
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now