JBoss Metadata Common 7.0.4.Final-redhat-1

org.jboss.metadata.lang
Class ClassHelper

java.lang.Object
  extended by org.jboss.metadata.lang.ClassHelper

public class ClassHelper
extends Object

Useful methods on classes.

Version:
$Revision: 74994 $
Author:
Carlo de Wolf

Constructor Summary
ClassHelper()
           
 
Method Summary
static Class<?> extractInterface(Class<?>... interfaces)
          Extracts a single interface.
static Class<?> getDefaultInterface(Class<?> cls)
          Find the default interface of a class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassHelper

public ClassHelper()
Method Detail

extractInterface

public static Class<?> extractInterface(Class<?>... interfaces)
Extracts a single interface.

Parameters:
interfaces -
Returns:
The extracted interface class. null if there are none or more interfaces

getDefaultInterface

public static Class<?> getDefaultInterface(Class<?> cls)
Find the default interface of a class. If a class implements one interface, that interface is considered the default interface. If it does not implement an interface it's super class is considered. If it implements multiple interfaces or no interface can be found an IllegalArgumentException is thrown.

Parameters:
cls - the class to scan
Returns:
the default interface as defined above
Throws:
IllegalArgumentException - if the class does not implement a default interface

JBoss Metadata Common 7.0.4.Final-redhat-1

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.