org.springframework.roo.classpath.operations
Class ClasspathOperationsImpl

java.lang.Object
  extended by org.springframework.roo.classpath.operations.ClasspathOperationsImpl
All Implemented Interfaces:
ClasspathOperations

@Service
public class ClasspathOperationsImpl
extends Object
implements ClasspathOperations

Provides convenience methods that can be used to create source code and install the JSR 303 validation API when required.

Since:
1.0
Author:
Ben Alex

Constructor Summary
ClasspathOperationsImpl()
           
 
Method Summary
 void addEnumConstant(String physicalTypeIdentifier, org.springframework.roo.model.JavaSymbolName constantName)
           
 void addField(FieldMetadata fieldMetadata)
          Adds a new field to an existing class.
 void generateClassFile(ClassOrInterfaceTypeDetails details)
          Creates a new class, with the location name name provided in the details.
 ClassOrInterfaceTypeDetails getClassOrInterface(org.springframework.roo.model.JavaType requiredClassOrInterface)
          Obtains the requested JavaType, assuming it is a class or interface that exists at this time and can be parsed.
 String getPhysicalLocationCanonicalPath(org.springframework.roo.model.JavaType javaType, org.springframework.roo.project.Path path)
           
 String getPhysicalLocationCanonicalPath(String physicalTypeIdentifier)
           
 ClassOrInterfaceTypeDetails getSuperclass(org.springframework.roo.model.JavaType superclass)
          Obtains the superclass, if one is specified.
 boolean isPersistentClassAvailable()
           
 boolean isProjectAvailable()
           
 void newDod(org.springframework.roo.model.JavaType entity, org.springframework.roo.model.JavaType name, org.springframework.roo.project.Path path)
          Creates a new data on demand provider for the entity.
 void newIntegrationTest(org.springframework.roo.model.JavaType entity)
          Creates an integration test for the entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClasspathOperationsImpl

public ClasspathOperationsImpl()
Method Detail

isProjectAvailable

public boolean isProjectAvailable()
Specified by:
isProjectAvailable in interface ClasspathOperations

isPersistentClassAvailable

public boolean isPersistentClassAvailable()
Specified by:
isPersistentClassAvailable in interface ClasspathOperations

getPhysicalLocationCanonicalPath

public String getPhysicalLocationCanonicalPath(org.springframework.roo.model.JavaType javaType,
                                               org.springframework.roo.project.Path path)
Specified by:
getPhysicalLocationCanonicalPath in interface ClasspathOperations

getPhysicalLocationCanonicalPath

public String getPhysicalLocationCanonicalPath(String physicalTypeIdentifier)
Specified by:
getPhysicalLocationCanonicalPath in interface ClasspathOperations

getSuperclass

public ClassOrInterfaceTypeDetails getSuperclass(org.springframework.roo.model.JavaType superclass)
Description copied from interface: ClasspathOperations
Obtains the superclass, if one is specified.

Throws an exception is a superclass was requested but could not be parsed or found.

Specified by:
getSuperclass in interface ClasspathOperations
Parameters:
superclass - requested superclass (can be null)
Returns:
null if a superclass is not requested or not required (ie java.lang.Object)

getClassOrInterface

public ClassOrInterfaceTypeDetails getClassOrInterface(org.springframework.roo.model.JavaType requiredClassOrInterface)
Description copied from interface: ClasspathOperations
Obtains the requested JavaType, assuming it is a class or interface that exists at this time and can be parsed. If these assumption are not met, an exception will be thrown.

Specified by:
getClassOrInterface in interface ClasspathOperations
Parameters:
requiredClassOrInterface - that should be parsed (required)
Returns:
the details (never returns null)

generateClassFile

public void generateClassFile(ClassOrInterfaceTypeDetails details)
Description copied from interface: ClasspathOperations
Creates a new class, with the location name name provided in the details.

An exception is thrown if the class already exists.

Specified by:
generateClassFile in interface ClasspathOperations
Parameters:
details - to create (required)

addEnumConstant

public void addEnumConstant(String physicalTypeIdentifier,
                            org.springframework.roo.model.JavaSymbolName constantName)
Specified by:
addEnumConstant in interface ClasspathOperations

addField

public void addField(FieldMetadata fieldMetadata)
Description copied from interface: ClasspathOperations
Adds a new field to an existing class.

An exception is thrown if the class does not exist, cannot be modified or a field with the requested name is already declared.

Specified by:
addField in interface ClasspathOperations
Parameters:
fieldMetadata - to add (required)

newIntegrationTest

public void newIntegrationTest(org.springframework.roo.model.JavaType entity)
Description copied from interface: ClasspathOperations
Creates an integration test for the entity. Automatically produces a data on demand if one does not exist. Silently returns if the integration test file already exists.

Specified by:
newIntegrationTest in interface ClasspathOperations
Parameters:
entity - to produce an integration test for (required)

newDod

public void newDod(org.springframework.roo.model.JavaType entity,
                   org.springframework.roo.model.JavaType name,
                   org.springframework.roo.project.Path path)
Description copied from interface: ClasspathOperations
Creates a new data on demand provider for the entity. Silently returns if the DOD already exists.

Specified by:
newDod in interface ClasspathOperations
Parameters:
entity - to produce a data on demand provider for (required)
name - the name of the new data on demand class (required)
path - the location for the new data on demand class (required)


Copyright © 2009-2010 VMware, Inc. All Rights Reserved.