Creates a code location URL from a class

@param codeLocationClass the class
@return A URL created from Class
@throws InvalidCodeLocation if URL creation fails
10876
public static URL codeLocationFromClass(Class<?> codeLocationClass) {
        String pathOfClass = codeLocationClass.getName().replace(".", "/") + ".class";
        URL classResource = codeLocationClass.getClassLoader().getResource(pathOfClass);
        String codeLocationPath = removeEnd(getPathFromURL(classResource), pathOfClass);
        if(codeLocationPath.endsWith(".jar!/")) {
            codeLocationPath=removeEnd(codeLocationPath,"!/");
        }
        return codeLocationFromPath(codeLocationPath);
    }
141677
public static Identifier create(String identifier, SourceLocation location) {
    checkArgument(!identifier.isEmpty());
    return new AutoValue_Identifier(identifier, location);
  }
1043164
public static <T> GenericResponseBuilder<T> created(T entity, URI location) {
    return genericResponseBuilderFactory.create(Response.Status.CREATED.getStatusCode(), entity)
        .location(location);
  }
15555
public Location getLocationAtEntry() {
        InstructionHandle handle = getEntry().getFirstInstruction();
        assert handle != null;
        return new Location(handle, getEntry());
    }
746371
public static MozuUrl updateLocationInventoryUrl(String productCode)
	{
		UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{ProductCode}/LocationInventory");
		formatter.formatUrl("productCode", productCode);
		return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
	}
1356082
private synchronized CodeSource mapSignersToCodeSource(URL url, CodeSigner[] signers) {
        Map map;
        if (url == lastURL) {
            map = lastURLMap;
        } else {
            map = (Map) urlToCodeSourceMap.get(url);
            if (map == null) {
                map = new HashMap();
                urlToCodeSourceMap.put(url, map);
            }
            lastURLMap = map;
            lastURL = url;
        }
        CodeSource cs = (CodeSource) map.get(signers);
        if (cs == null) {
            cs = new VerifierCodeSource(csdomain, url, signers);
            signerToCodeSource.put(signers, cs);
        }
        return cs;
    }
562110
public static URL url(final String url) {
        if (url == null) {
            return null;
        }
        try {
            if (url.startsWith("classpath:")) {
                return new URL(null, url, new ClasspathURLStreamHandler());
            }
            return new URL(url);
        } catch (final MalformedURLException ex) {
            throw new IllegalArgumentException("Invalid URL: " + url, ex);
        }
    }
140278
public Project.Storepoints.Storepoint.Activities.Activity.CodeAssignment createProjectStorepointsStorepointActivitiesActivityCodeAssignment()
   {
      return new Project.Storepoints.Storepoint.Activities.Activity.CodeAssignment();
   }
614681
private void setLocationFromUri(String location) throws IOException
    {
        try
        {
            if (!location.startsWith("cassandra://"))
                throw new Exception("Bad scheme." + location);
            
            String[] urlParts = location.split("\\?");
            if (urlParts.length > 1)
            {
                Map<String, String> urlQuery = getQueryMap(urlParts[1]);
                AbstractType comparator = BytesType.instance;
                if (urlQuery.containsKey("comparator"))
                    comparator = TypeParser.parse(urlQuery.get("comparator"));
                if (urlQuery.containsKey("slice_start"))
                    slice_start = comparator.fromString(urlQuery.get("slice_start"));
                if (urlQuery.containsKey("slice_end"))
                    slice_end = comparator.fromString(urlQuery.get("slice_end"));
                if (urlQuery.containsKey("reversed"))
                    slice_reverse = Boolean.parseBoolean(urlQuery.get("reversed"));
                if (urlQuery.containsKey("limit"))
                    limit = Integer.parseInt(urlQuery.get("limit"));
                if (urlQuery.containsKey("allow_deletes"))
                    allow_deletes = Boolean.parseBoolean(urlQuery.get("allow_deletes"));
                if (urlQuery.containsKey("widerows"))
                    widerows = Boolean.parseBoolean(urlQuery.get("widerows"));
                if (urlQuery.containsKey("use_secondary"))
                    usePartitionFilter = Boolean.parseBoolean(urlQuery.get("use_secondary"));
                if (urlQuery.containsKey("split_size"))
                    splitSize = Integer.parseInt(urlQuery.get("split_size"));
                if (urlQuery.containsKey("partitioner"))
                    partitionerClass = urlQuery.get("partitioner");
                if (urlQuery.containsKey("init_address"))
                    initHostAddress = urlQuery.get("init_address");
                if (urlQuery.containsKey("rpc_port"))
                    rpcPort = urlQuery.get("rpc_port");
            }
            String[] parts = urlParts[0].split("/+");
            String[] credentialsAndKeyspace = parts[1].split("@");
            if (credentialsAndKeyspace.length > 1)
            {
                String[] credentials = credentialsAndKeyspace[0].split(":");
                username = credentials[0];
                password = credentials[1];
                keyspace = credentialsAndKeyspace[1];
            }
            else
            {
                keyspace = parts[1];
            }
            column_family = parts[2];
        }
        catch (Exception e)
        {
            throw new IOException("Expected 'cassandra://[username:password@]<keyspace>/<columnfamily>" +
                    "[?slice_start=<start>&slice_end=<end>[&reversed=true][&limit=1]" +
                    "[&allow_deletes=true][&widerows=true][&use_secondary=true]" +
                    "[&comparator=<comparator>][&split_size=<size>][&partitioner=<partitioner>]" +
                    "[&init_address=<host>][&rpc_port=<port>]]': " + e.getMessage());
        }
    }
940815
@Override
    public void visitClassContext(ClassContext classContext) {
        try {
            queryLocations = new ArrayList<>();
            loops = new ArrayList<>();
            super.visitClassContext(classContext);
        } finally {
            queryLocations = null;
            loops = null;
        }
    }
146476
function createLocation() {
    $cnt = count( $this->location );
    if( 0 >= $cnt )
      return;
    $attributes = $this->_createParams( $this->location['params'], array( 'ALTREP', 'LANGUAGE' ));
    $content    = $this->_strrep( $this->location['value'] );
    return $this->_createElement( 'LOCATION', $attributes, $content );
  }
444471
public Expression withSourceLocation(SourceLocation location) {
    checkNotNull(location);
    if (location.equals(this.location)) {
      return this;
    }
    return new Expression(resultType, features, location) {
      @Override
      protected void doGen(CodeBuilder adapter) {
        Expression.this.gen(adapter);
      }
    };
  }
220821
public static String findCodeBaseInClassPath(@Nonnull String codeBaseName, String classPath) {
        if (classPath == null) {
            return null;
        }

        StringTokenizer tok = new StringTokenizer(classPath, File.pathSeparator);
        while (tok.hasMoreTokens()) {
            String t = tok.nextToken();
            File f = new File(t);
            if (f.getName().equals(codeBaseName)) {
                return t;
            }
        }

        return null;
    }
509988
public static RedirectionAction buildRedirectUrlAction(final WebContext context, final String location) {
        if (ContextHelper.isPost(context) && useModernHttpCodes) {
            return new SeeOtherAction(location);
        } else {
            return new FoundAction(location);
        }
    }
697648
public static URL codeLocationFromPath(String filePath) {
        try {
            return new File(filePath).toURI().toURL();
        } catch (Exception e) {
            throw new InvalidCodeLocation(filePath);
        }
    }
261016
public final Statement withSourceLocation(SourceLocation location) {
    checkNotNull(location);
    if (location.equals(this.location)) {
      return this;
    }
    return new Statement(location) {
      @Override
      protected void doGen(CodeBuilder adapter) {
        Statement.this.gen(adapter);
      }
    };
  }
1114582
public CodeSource getCodeSource(String path)
  {
    try {
      PathImpl jarPath = _jarPath.lookup(path);
      
      Certificate []certificates = jarPath.getCertificates();
      
      URL url = new URL(_jarPath.getContainer().getURL());

      return new CodeSource(url, certificates);
    } catch (Exception e) {
      log.log(Level.WARNING, e.toString(), e);

      return null;
    }
  }