コード例 #1
0
ファイル: AllTermsCache.java プロジェクト: adityavs/compass
 public AllTermsCache(CompassSettings settings, CompassMapping mapping) {
   for (ResourceMapping resourceMapping : mapping.getRootMappings()) {
     if (resourceMapping.getAllMapping().isExcludeAlias()) {
       aliasTokensPerRootAlias.put(resourceMapping.getAlias(), new Token[0]);
     } else {
       List<Token> aliasTokens = new ArrayList<Token>();
       aliasTokens.add(
           new Token(
               resourceMapping.getAlias().toLowerCase(), 0, resourceMapping.getAlias().length()));
       for (String extendedAlias : resourceMapping.getExtendedAliases()) {
         aliasTokens.add(new Token(extendedAlias.toLowerCase(), 0, extendedAlias.length()));
       }
       aliasTokensPerRootAlias.put(
           resourceMapping.getAlias(), aliasTokens.toArray(new Token[aliasTokens.size()]));
     }
   }
 }
コード例 #2
0
 public Resource marshall(Object root) {
   if (root instanceof AliasedObject) {
     return marshall(((AliasedObject) root).getAlias(), root);
   }
   ResourceMapping resourceMapping = mapping.getRootMappingByClass(root.getClass());
   if (resourceMapping == null) {
     return null;
   }
   Resource resource = resourceFactory.createResource(resourceMapping.getAlias());
   resourceMapping.getConverter().marshall(resource, root, resourceMapping, createContext());
   return resource;
 }
コード例 #3
0
ファイル: ResourceKey.java プロジェクト: adityavs/compass
 public ResourceKey(ResourceMapping resourceMapping, Property[] ids) {
   this.resourceMapping = resourceMapping;
   this.ids = ids;
   this.alias = resourceMapping.getAlias();
 }
コード例 #4
0
 public Resource marshallIds(ResourceMapping resourceMapping, Object id) {
   Resource idResource = resourceFactory.createResource(resourceMapping.getAlias());
   marshallIds(idResource, resourceMapping, id, createContext());
   return idResource;
 }