1. /*
  2. * Copyright 2012 Red Hat, Inc. and/or its affiliates.
  3. *
  4. * Licensed under the Eclipse Public License version 1.0, available at
  5. * http://www.eclipse.org/legal/epl-v10.html
  6. */
  7. package org.jboss.forge.addon.parser.java.resources;
  8. import java.io.FileNotFoundException;
  9. import org.jboss.forge.addon.resource.FileResource;
  10. import org.jboss.forge.addon.resource.Resource;
  11. import org.jboss.forge.parser.java.JavaSource;
  12. import org.jboss.forge.roaster.model.JavaType;
  13. /**
  14. * A {@link Resource} that represents a Java {@link Class}.
  15. *
  16. * @author Mike Brock
  17. * @author <a href="mailto:[email protected]">Lincoln Baxter, III</a>
  18. */
  19. public interface JavaResource extends FileResource<JavaResource>
  20. {
  21. /**
  22. * Set the content of this {@link Resource} to the value of the given {@link JavaSource}.
  23. */
  24. JavaResource setContents(final JavaSource<?> source);
  25. /**
  26. * Set the content of this {@link Resource} to the value of the given
  27. * {@link org.jboss.forge.roaster.model.source.JavaSource}.
  28. */
  29. JavaResource setContents(final org.jboss.forge.roaster.model.source.JavaSource<?> source);
  30. /**
  31. * Attempt to determine and return the {@link JavaSource} type of the underlying class.
  32. */
  33. JavaSource<?> getJavaSource() throws FileNotFoundException;
  34. /**
  35. * Attempt to determine and return the {@link JavaType} type of the underlying class.
  36. */
  37. <T extends JavaType<?>> T getJavaType() throws FileNotFoundException;
  38. }