org.springframework.roo.classpath
Class PhysicalTypeIdentifierNamingUtils

java.lang.Object
  extended by org.springframework.roo.classpath.PhysicalTypeIdentifierNamingUtils

public final class PhysicalTypeIdentifierNamingUtils
extends Object

Produces metadata identification strings that represent a JavaType located in a particular LogicalPath.

The metadata identification strings separate the path name from the fully qualified type name via the presence of a question mark character ("?"). A question mark is used given it is reserved by Path. TODO these methods are not specific to physical types; either rename this class, move them somewhere more generic, and/or make them more specific, e.g. hardcode the "metadata class" arguments to that of physical types.

Since:
1.0
Author:
Ben Alex

Method Summary
static String createIdentifier(String metadataClass, org.springframework.roo.model.JavaType projectType, org.springframework.roo.project.LogicalPath path)
          Creates a metadata ID from the given inputs
static org.springframework.roo.model.JavaType getJavaType(String metadataIdentificationString)
           
static org.springframework.roo.model.JavaType getJavaType(String metadataClass, String metadataId)
          Returns the user project type with which the given metadata ID is associated.
static String getModule(String metadataId)
          Returns the name of the project module that contains the metadata item with the given id.
static org.springframework.roo.project.LogicalPath getPath(String metadataId)
          Returns the LogicalPath of the metadata item with the given id.
static org.springframework.roo.project.LogicalPath getPath(String providesType, String metadataIdentificationString)
          Parses the user project path from the given metadata ID.
static boolean isValid(String metadataClass, String metadataId)
          Indicates whether the given metadata id appears to identify an instance of the given metadata class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createIdentifier

public static String createIdentifier(String metadataClass,
                                      org.springframework.roo.model.JavaType projectType,
                                      org.springframework.roo.project.LogicalPath path)
Creates a metadata ID from the given inputs

Parameters:
metadataClass - the fully-qualified name of the metadata class (required)
projectType - the fully-qualified name of the user project type to which the metadata relates (required)
path - the path to that type within the project (required)
Returns:
a non-blank ID

getJavaType

public static org.springframework.roo.model.JavaType getJavaType(String metadataIdentificationString)

getJavaType

public static org.springframework.roo.model.JavaType getJavaType(String metadataClass,
                                                                 String metadataId)
Returns the user project type with which the given metadata ID is associated.

Parameters:
metadataClass - the fully-qualified name of the metadata type (required)
metadataId - the ID of the metadata instance (must identify an instance of the given metadata class)
Returns:
a non-null type

getModule

public static String getModule(String metadataId)
Returns the name of the project module that contains the metadata item with the given id.

Parameters:
metadataId - must be a valid metadata instance id
Returns:
a non-null module name (blank means the root or only module)
Since:
1.2.0

getPath

public static org.springframework.roo.project.LogicalPath getPath(String metadataId)
Returns the LogicalPath of the metadata item with the given id.

Parameters:
metadataId - must be a valid metadata instance id
Returns:
a non-null path

getPath

public static org.springframework.roo.project.LogicalPath getPath(String providesType,
                                                                  String metadataIdentificationString)
Parses the user project path from the given metadata ID.

Parameters:
metadataClass - the fully-qualified name of the metadata type (required)
metadataId - the ID of the metadata instance (must identify an instance of the given metadata class)
Returns:
a non-null path

isValid

public static boolean isValid(String metadataClass,
                              String metadataId)
Indicates whether the given metadata id appears to identify an instance of the given metadata class.

Parameters:
metadataClass - the fully-qualified name of the expected metadata type (can be blank)
metadataId - the ID to evaluate (can be blank)
Returns:
true only if the metadata ID appears to be valid


Copyright © 2009–2015. All rights reserved.