Package com.google.sitebricks

Examples of com.google.sitebricks.At


    // tuple.
    for (Method method : pageClass.getDeclaredMethods()) {
      if (method.isAnnotationPresent(At.class)) {

        // This is a subpath expression.
        At at = method.getAnnotation(At.class);
        String subpath = at.value();

        // Validate subpath
        if (!subpath.startsWith("/") || subpath.isEmpty() || subpath.length() == 1) {
          throw new IllegalArgumentException(String.format(
              "Subpath At(\"%s\") on %s.%s() must begin with a \"/\" and must not be empty",
View Full Code Here


      // tuple.
      for (Method method : clazz.getDeclaredMethods()) {
        if (method.isAnnotationPresent(At.class)) {

          // This is a subpath expression.
          At at = method.getAnnotation(At.class);
          String subpath = at.value();

          // Validate subpath
          if (!subpath.startsWith("/") || subpath.isEmpty() || subpath.length() == 1) {
            throw new IllegalArgumentException(String.format(
                "Subpath At(\"%s\") on %s.%s() must begin with a \"/\" and must not be empty",
View Full Code Here

    this.request = request;
  }

  @Override @SuppressWarnings("deprecation") // For URL encoder.
  public String to(Class<?> pageClass, Map<String, String> parameters) {
    At at = pageClass.getAnnotation(At.class);

    String uriTemplate;
    if (at == null) {
      // Fall back to see if this class was registered some other way (i.e. at().show())
      PageBook.Page page = pageBook.forClass(pageClass);

      if (page == null)
        throw new IllegalArgumentException("No such page class was registered (missing @At annotation?): "
            + pageClass.getName());

      uriTemplate = page.getUri();
    } else
      uriTemplate = at.value();

    // Contextualize this request if necessary.
    if (uriTemplate.startsWith("/"))
      uriTemplate = request.get().context() + uriTemplate;
View Full Code Here

    // tuple.
    for (Method method : pageClass.getDeclaredMethods()) {
      if (method.isAnnotationPresent(At.class)) {

        // This is a subpath expression.
        At at = method.getAnnotation(At.class);
        String subpath = at.value();

        // Validate subpath
        if (!subpath.startsWith("/") || subpath.isEmpty() || subpath.length() == 1) {
          throw new IllegalArgumentException(String.format(
              "Subpath At(\"%s\") on %s.%s() must begin with a \"/\" and must not be empty",
View Full Code Here

TOP

Related Classes of com.google.sitebricks.At

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.