public class Utils extends Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
assertNotNull(T argument,
String msg)
Throws IllegalArgumentException with the specified error message if the input
is null, otherwise return the input as is.
|
static String |
capitialize(String name) |
static void |
closeQuietly(Closeable closeable) |
static void |
createDirectory(File dir) |
static File |
createDirectory(String path) |
static File |
createFile(String dir,
String fileName) |
static ShapeMarshaller |
createInputShapeMarshaller(ServiceMetadata service,
Operation operation)
Create the ShapeMarshaller to the input shape from the specified Operation.
|
static void |
deleteDirectoryIfExists(File dir) |
static void |
deleteDirectoryIfExists(String path) |
static String |
deriveServiceId(String interfaceName) |
static String |
directoryToPackage(String directoryPath)
Converts a directory to a Java package name.
|
static ShapeModel |
findShapeModelByC2jName(IntermediateModel intermediateModel,
String shapeC2jName)
Search for intermediate shape model by its c2j name.
|
static ShapeModel |
findShapeModelByC2jNameIfExists(IntermediateModel intermediateModel,
String shapeC2jName)
Search for intermediate shape model by its c2j name.
|
static String |
getAsyncInterfaceName(String interfaceNamePrefix) |
static String |
getClientName(String clientNamePrefix) |
static String |
getDefaultEndpointWithoutHttpProtocol(String endpoint) |
static String |
getFileNamePrefix(ServiceModel serviceModel,
CustomizationConfig customizationConfig)
* @param serviceModel Service model to get prefix for.
|
static String |
getOptionalSystemProperty(String propertyName)
Retrieve optional system property by name, returning null if not found
|
static InputStream |
getRequiredResourceAsStream(Class<?> clzz,
String location)
Return an InputStream of the specified resource, failing if it can't be found.
|
static String |
getRequiredSystemProperty(String propertyName,
String errorMsgIfNotFound)
Retrieve system property by name, failing if it's not found
|
static boolean |
isEnumShape(Shape shape) |
static boolean |
isExceptionShape(Shape shape) |
static boolean |
isListShape(Shape shape) |
static boolean |
isMapShape(Shape shape) |
static boolean |
isNullOrEmpty(String str) |
static boolean |
isScalar(Shape shape) |
static boolean |
isStructure(Shape shape) |
static java.util.stream.Stream<String> |
sanitize(String toBeSanitized) |
static String |
unCapitialize(String name) |
public static boolean isScalar(Shape shape)
public static boolean isStructure(Shape shape)
public static boolean isListShape(Shape shape)
public static boolean isMapShape(Shape shape)
public static boolean isEnumShape(Shape shape)
public static boolean isExceptionShape(Shape shape)
public static java.util.stream.Stream<String> sanitize(String toBeSanitized)
public static String getFileNamePrefix(ServiceModel serviceModel, CustomizationConfig customizationConfig)
public static String directoryToPackage(String directoryPath)
directoryPath - Directory to convert.public static String getDefaultEndpointWithoutHttpProtocol(String endpoint)
public static void createDirectory(File dir)
public static void deleteDirectoryIfExists(String path)
public static void deleteDirectoryIfExists(File dir)
public static File createFile(String dir, String fileName) throws IOException
IOExceptionpublic static boolean isNullOrEmpty(String str)
public static void closeQuietly(Closeable closeable)
public static InputStream getRequiredResourceAsStream(Class<?> clzz, String location)
clzz - location - Location of resourcepublic static String getRequiredSystemProperty(String propertyName, String errorMsgIfNotFound)
propertyName - errorMsgIfNotFound - public static String getOptionalSystemProperty(String propertyName)
propertyName - public static <T> T assertNotNull(T argument,
String msg)
public static ShapeModel findShapeModelByC2jName(IntermediateModel intermediateModel, String shapeC2jName) throws IllegalArgumentException
IllegalArgumentException - if the specified c2j name is not found in the intermediate model.public static ShapeModel findShapeModelByC2jNameIfExists(IntermediateModel intermediateModel, String shapeC2jName)
public static ShapeMarshaller createInputShapeMarshaller(ServiceMetadata service, Operation operation)
service - operation - Copyright © 2020. All rights reserved.