/** This class can be used as the base class for UNO components. It implements the capability *tobekeptweak(com.sun.star.uno.XWeak)anditimplementscom.sun.star.lang.XTypeProvider *whichisnecessaryforusingthecomponentwithStarBasic.
*/ publicclass WeakBase implements XWeak, XTypeProvider
{ // Contains all WeakAdapter which have been created in this class // They have to be notified when this object dies private WeakAdapter m_adapter;
protectedstatic Map<Class<?>,Type[]> _mapTypes = new HashMap<Class<?>,Type[]>();
/** Method of XWeak. The returned XAdapter implementation can be used to keep *aweakreferencetothisobject. *@returnacom.sun.star.uno.XAdapterimplementation.
*/ synchronizedpublic XAdapter queryAdapter()
{ if (m_adapter == null)
m_adapter= new WeakAdapter(this); return m_adapter;
}
/** Override of Object.finalize. When there are no references to this object anymore *thenthegarbagecollectorcallsthismethod.Therebycausingtheadapterobject *tobenotified.Theadapter,inturn,notifiesalllisteners(com.sun.star.uno.XReference)
*/
@Override protectedvoid finalize() throws java.lang.Throwable
{ if (m_adapter != null)
m_adapter.referentDying(); super.finalize();
}
/** Method of XTypeProvider. It returns an array of Type objects which represent *allimplementedUNOinterfacesofthisobject. *@returnTypeobjectsofallimplementedinterfaces.
*/ public Type[] getTypes()
{
Type[] arTypes= _mapTypes.get( getClass()); if (arTypes == null)
{
ArrayList<Type> vec= new ArrayList<Type>(); Class currentClass= getClass(); do
{ Class interfaces[]= currentClass.getInterfaces(); for(int i = 0; i < interfaces.length; ++ i)
{ // Test if it is a UNO interface if (com.sun.star.uno.XInterface.class.isAssignableFrom(interfaces[i]))
vec.add(new Type(interfaces[i]));
} // get the superclass the currentClass inherits from
currentClass= currentClass.getSuperclass();
} while (currentClass != null);
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.4Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.