Package com.tll.model.schema

Examples of com.tll.model.schema.RelationInfo


      IModelProperty prop = createValueProperty(ptype, pname, obj, pdata);

      if(prop == null) {
        // related one
        if(IEntity.class.isAssignableFrom(ptype)) {
          final RelationInfo ri = schemaInfo.getRelationInfo(entityClass, pname);
          final boolean reference = ri.isReference();
          if(shouldMarshalRelation(reference, depth, options)) {
            final IEntity e = (IEntity) obj;
            final Model m = e == null ? null : marshalEntity(e, options, visited, depth + 1);
            final IEntityType etype =
              ri.getRelatedType() == null ? null : etResolver.resolveEntityType(e == null ? ri.getRelatedType() : e
                  .entityClass());
            prop = new RelatedOneProperty(etype, m, pname, reference);
          }
        }

        // related many collection
        else if(Collection.class.isAssignableFrom(ptype)) {
          final RelationInfo ri = schemaInfo.getRelationInfo(entityClass, pname);
          final boolean reference = ri.isReference();
          if(shouldMarshalRelation(reference, depth, options)) {
            List<Model> list = null;
            if(obj != null) {
              list = new ArrayList<Model>();
              final Collection<IEntity> set = (Collection<IEntity>) obj;
              for(final IEntity e : set) {
                final Model nested = marshalEntity(e, options, visited, depth + 1);
                list.add(nested);
              }
            }
            prop = new RelatedManyProperty(etResolver.resolveEntityType(ri.getRelatedType()), pname, reference, list);
          }
        }

        // map (assume <String, String> type)
        else if(Map.class.isAssignableFrom(ptype)) {
View Full Code Here

TOP

Related Classes of com.tll.model.schema.RelationInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.