import java.io.IOException;\r
import java.io.InputStream;\r
\r
+import org.tizen.common.util.Assert;\r
import org.tizen.common.verrari.ITemplate;\r
\r
/**\r
final ClassLoader loader\r
)\r
{\r
- if ( null == path )\r
- {\r
- throw new IllegalArgumentException();\r
- }\r
- if ( null == loader )\r
- {\r
- throw new IllegalArgumentException();\r
- }\r
+ Assert.notNull( path );\r
+ Assert.notNull( loader );\r
this.path = path;\r
this.loader = loader;\r
}\r
import java.util.HashMap;\r
import java.util.Map;\r
\r
+import org.tizen.common.util.Assert;\r
import org.tizen.common.verrari.ITemplate;\r
import org.tizen.common.verrari.ITemplateProvider;\r
\r
final Map<String, ITemplate> templates\r
)\r
{\r
- if ( null == templates )\r
- {\r
- throw new IllegalArgumentException();\r
- }\r
+ Assert.notNull( templates );\r
this.templates = templates;\r
}\r
\r
\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
+import org.tizen.common.util.Assert;\r
import org.tizen.common.verrari.ITemplate;\r
import org.tizen.common.verrari.ITemplateProvider;\r
\r
final ITemplateProvider provider\r
)\r
{\r
- if ( null == provider )\r
- {\r
- throw new IllegalArgumentException();\r
- }\r
+ Assert.notNull( provider );\r
this.provider = provider;\r
}\r
\r
import java.net.MalformedURLException;\r
import java.net.URL;\r
\r
+import org.tizen.common.util.Assert;\r
import org.tizen.common.verrari.ITemplate;\r
\r
/**\r
)\r
{\r
super( encoding );\r
- if ( null == url )\r
- {\r
- throw new IllegalArgumentException();\r
- }\r
+ Assert.notNull( url );\r
this.url = url;\r
}\r
\r
import java.io.InputStream;
import java.net.URL;
+import org.tizen.common.util.Assert;
+
/**
* <p>
* JarClassSource.
)
{
logger.info( "URL :{}", url );
- if ( null == url )
- {
- throw new IllegalArgumentException();
- }
+ Assert.notNull( url );
this.url = url;
}
package org.tizen.common.config.loader;\r
\r
import org.tizen.common.config.Loader;\r
+import org.tizen.common.util.Assert;\r
\r
/**\r
* AbstractLoader.\r
)\r
{\r
this.src = src;\r
- if ( null == src ) \r
- {\r
- throw new IllegalArgumentException();\r
- }\r
+ Assert.notNull( src );\r
}\r
\r
/**\r
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.ui.IViewPart;
+import org.tizen.common.util.Assert;
public class StatusLineMessageManager
{
final IStatusLineManager manager
)
{
- if ( null == manager )
- { // Fast Fail
- throw new IllegalArgumentException();
- }
+ Assert.notNull( manager );
this.manager = manager;
}
import org.tizen.common.file.Filter;
import org.tizen.common.file.SimpleFileFilter;
import org.tizen.common.file.filter.WildCardFilterFactory;
+import org.tizen.common.util.Assert;
/**
* FileHandlingCommand.
void
setFilter( SimpleFileFilter filter )
{
- if ( null == filter )
- {
- throw new IllegalArgumentException();
- }
+ Assert.notNull( filter );
this.filter = filter;
logger.debug( "Configured filter :{}", filter );
}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.common.core.command.Prompter;
+import org.tizen.common.util.Assert;
/**
* AbstractPrompter.
protected
void
- checkOptions( ChoiceOption[] options )
+ checkOptions(
+ final ChoiceOption[] options
+ )
{
- if ( null == options )
- {
- throw new IllegalArgumentException();
- }
+ Assert.notNull( options );
final HashSet<Option> reducedOptions = new LinkedHashSet<Option>();
Option defaultOption = null;
*/
package org.tizen.common.file;
+import org.tizen.common.util.Assert;
+
/**
* <p>
* PatternFilter.
final String pattern
)
{
- if ( null == pattern )
- {
- throw new IllegalArgumentException();
- }
+ Assert.notNull( pattern );
this.pattern = pattern;
}
import org.eclipse.ui.console.IConsoleManager;
import org.eclipse.ui.console.IConsoleView;
import org.eclipse.ui.console.MessageConsoleStream;
+import org.tizen.common.util.Assert;
/**
* ConsoleManager2.
final String newName
)
{
- if ( null == newName )
- {
- throw new IllegalArgumentException();
- }
+ Assert.notNull( newName );
this.consoleName = newName;
asyncExec( new Runnable()
{
final int end
)
{
- if ( null == array )
- {
- throw new IllegalArgumentException();
- }
+ Assert.notNull( array );
Assert.isTrue(
start <= end,
"start indnex(" + start + ") is greater than end index(" + end + ")"
final Enumeration<K> enumeration
)
{
- if ( null == enumeration )
- { // Fast fail
- throw new IllegalArgumentException();
- }
-
+ Assert.notNull( enumeration );
this.enumeration = enumeration;
}
final Collection<Object> collection
)
{
- if ( null == collection )
- {
- throw new IllegalArgumentException();
- }
-
+ Assert.notNull( collection );
final Object[] arr = ArrayUtil.toObjectArray( array );
for ( int i=0, n=arr.length ; i<n ; ++i )
{
* @return If directory couldn't be created, return false. Otherwise, return true.
*/
public static boolean createDirectory(String dirName, String destDir) {
- if (dirName == null)
- {
- throw new IllegalArgumentException();
- }
+ Assert.notNull( dirName );
if (destDir == null)
{
* @throws IOException If creating file's directory does not exist, it throws IOException
*/
public static boolean createTextFile(String fileName, String text, String destDir, String encoding) throws IOException {
- if (fileName == null)
- {
- throw new IllegalArgumentException();
- }
+ Assert.notNull( fileName );
if (destDir == null)
{
*/
private static void validateDirectory(File aDirectory)
throws FileNotFoundException {
- if (aDirectory == null) {
- throw new IllegalArgumentException("Directory should not be null.");
- }
+ Assert.notNull( aDirectory, "Directory should not be null." );
if (!aDirectory.exists()) {
throw new FileNotFoundException("Directory does not exist: "
+ aDirectory);
}
- if (!aDirectory.isDirectory()) {
- throw new IllegalArgumentException("Is not a directory: "
- + aDirectory);
- }
- if (!aDirectory.canRead()) {
- throw new IllegalArgumentException("Directory cannot be read: "
- + aDirectory);
- }
+ Assert.isTrue( aDirectory.isDirectory(), "Is not a directory: " + aDirectory );
+ Assert.isTrue( aDirectory.canRead(), "Directory cannot be read: " + aDirectory );
}
}
*/
public static String getName( final String nameWithExt )
{
- if ( null == nameWithExt )
- {
- throw new IllegalArgumentException();
- }
+ Assert.notNull( nameWithExt );
final int index = nameWithExt.lastIndexOf( '.' );
*/
public static String getExtension( final String nameWithExt )
{
- if ( null == nameWithExt )
- {
- throw new IllegalArgumentException();
- }
+ Assert.notNull( nameWithExt );
final int index = nameWithExt.lastIndexOf( '.' );
);
} catch ( final IOException e )
{
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException( e );
}
}
final Map<Object, Object> map
)
{
- if ( null == map )
- {
- throw new IllegalArgumentException();
- }
+ Assert.notNull( map );
if ( null == props )
{
return ;
import java.io.InputStream;
import java.nio.ByteBuffer;
+import org.tizen.common.util.Assert;
+
/**
* <p>
* BufferInputStream.
final Buffer buffer
)
{
- if ( null == buffer )
- {
- throw new IllegalArgumentException();
- }
-
+ Assert.notNull( buffer );
this.buffer = buffer;
}
import java.io.IOException;
import java.io.OutputStream;
+import org.tizen.common.util.Assert;
+
/**
* <p>
* BufferOutputStream.
final Buffer buffer
)
{
- if ( null == buffer )
- {
- throw new IllegalArgumentException();
- }
+ Assert.notNull( buffer );
this.buffer = buffer;
}