metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From LosD <...@git.apache.org>
Subject [GitHub] metamodel pull request #113: Dynamic DataContext factory (MM 1099)
Date Fri, 08 Jul 2016 07:28:24 GMT
Github user LosD commented on a diff in the pull request:

    https://github.com/apache/metamodel/pull/113#discussion_r70035620
  
    --- Diff: core/src/main/java/org/apache/metamodel/util/ResourceUtils.java ---
    @@ -18,11 +18,31 @@
      */
     package org.apache.metamodel.util;
     
    +import java.net.URI;
    +
    +import org.apache.metamodel.factory.ResourceFactoryRegistryImpl;
    +import org.apache.metamodel.factory.ResourceProperties;
    +import org.apache.metamodel.factory.SimpleResourceProperties;
    +import org.apache.metamodel.factory.UnsupportedResourcePropertiesException;
    +
     /**
      * Static utility methods for handling {@link Resource}s.
      */
     public class ResourceUtils {
     
    +    public static Resource toResource(URI uri) {
    +        return toResource(new SimpleResourceProperties(uri));
    +    }
    +
    +    public static Resource toResource(String uri) {
    +        return toResource(new SimpleResourceProperties(uri));
    +    }
    +
    +    public static Resource toResource(ResourceProperties resourceProperties)
    +            throws UnsupportedResourcePropertiesException {
    --- End diff --
    
    Joshua Block's _Effective Java_ item 62 is pretty clear: 
    > Use the JavaDoc `@throws` tag to document each unchecked exception that a method
can throw, but do _not_ use the `throws` keyword to include unchecked exceptions in the method
declaration
    
    Of course that doesn't really solve the "how far down the chain should you go", but at
least it doesn't look like a checked exception.
    
    Regarding how far to document these, I think it's a good thing to do for stuff like the
almost direct overloads here, and also methods closely coupled tightly enough that it would
make sense.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message