org.ckkloverdos.source
Class SourceType

java.lang.Object
  extended by org.ckkloverdos.source.SourceType

public class SourceType
extends java.lang.Object

Type representation for sources.

Author:
Christos KK Loverdos
See Also:
ISource

Constructor Summary
SourceType(java.lang.String name)
           
 
Method Summary
 boolean equals(java.lang.Object o)
          Returns true iff other has the same name as this type.
 java.lang.String getContentSubtype()
          Returns the Content Subtype for this type.
 java.lang.String getContentType()
          Returns the Content Type for this type.
 java.lang.String getName()
          Returns the name of this type.
 int hashCode()
           
 boolean is(SourceType other)
          Returns true iff the other type has the same name as this one.
 boolean isContentSubtype(SourceType other)
          Returns true iff the other type has the same Content Subtype as this one.
 boolean isContentSubtype(java.lang.String other)
          Returns true iff other equals the Content Subtype of this instance.
 boolean isContentType(SourceType other)
          Returns true iff the other type has the same Content Type as this one.
 boolean isContentType(java.lang.String other)
          Returns true iff other equals the Content Type of this instance.
 boolean isText()
          Returns true iff the Content Type of this instance is "text".
 boolean isTextOverride()
          Returns true if setTextOverride() has been called.
 SourceType setTextOverride()
          Make isText() always return true, regardless of the Content Type.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceType

public SourceType(java.lang.String name)
Method Detail

is

public boolean is(SourceType other)
Returns true iff the other type has the same name as this one.

Parameters:
other -

isContentType

public boolean isContentType(SourceType other)
Returns true iff the other type has the same Content Type as this one.

Parameters:
other -

isContentType

public boolean isContentType(java.lang.String other)
Returns true iff other equals the Content Type of this instance.

Parameters:
other -

isContentSubtype

public boolean isContentSubtype(SourceType other)
Returns true iff the other type has the same Content Subtype as this one.

Parameters:
other -

isContentSubtype

public boolean isContentSubtype(java.lang.String other)
Returns true iff other equals the Content Subtype of this instance.

Parameters:
other -

getName

public java.lang.String getName()
Returns the name of this type.


getContentType

public java.lang.String getContentType()
Returns the Content Type for this type. If the name of this type is of the form:
 content-type/content-subtype
 
(notice the slash) then the string content-type is returned, otherwise the whole name of this type is returned.


getContentSubtype

public java.lang.String getContentSubtype()
Returns the Content Subtype for this type. If the name of this type is of the form:
 content-type/content-subtype
 
(notice the slash) then the string content-subtype is returned, otherwise the whole name of this type is returned.


isText

public boolean isText()
Returns true iff the Content Type of this instance is "text".


equals

public boolean equals(java.lang.Object o)
Returns true iff other has the same name as this type.

Overrides:
equals in class java.lang.Object
Parameters:
o -

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

isTextOverride

public boolean isTextOverride()
Returns true if setTextOverride() has been called.


setTextOverride

public SourceType setTextOverride()
Make isText() always return true, regardless of the Content Type.

Returns:
this


Copyright © 1999-2007 Christos KK Loverdos. All Rights Reserved.