package com.perforce.p4simulink.util; import com.perforce.p4java.client.IClient; import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class ClientRequiredProcessor { public static void processAnnotations(Object obj) { try { Class cl = obj.getClass(); for (Method method : cl.getDeclaredMethods()) { for (Annotation annotation : cl.getAnnotations()) { try { if (annotation.annotationType() == ClientRequired.class) { // might need to check private methods method.setAccessible(true); Field client = cl.getDeclaredField("client"); client.setAccessible(true); // client value is null, so generate it and assign if (client.get(obj) == null) { Method getClient = cl.getDeclaredMethod("getClient"); client.set(obj, (IClient) getClient.invoke(obj)); } } } catch (NoSuchFieldException e) { // no client field declared, so don't worry about it } } } } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 12023 | Paul Allen | Copying using p4Simulink_dev->main | ||
#4 | 11681 | Paul Allen |
Fixes to unit tests. - Fixed paths for testMove in OverrideTests - Removed adding of target before a move. - Closing of resources; writer - Added missing serialisation ID - removed unused variables. |
||
#3 | 11672 | Paul Allen |
Tidy up formatting and imports. No functional change. |
||
#2 | 11659 | Paul Allen |
Performance improvements, continued: improved performance of getFileState() by replacing the client haveList call with a direct server command. Also improved isLatest by removing fstat calls and replacing with simpler calls to diff and sync. Transferred from p4://perforce.perforce.com:1666@983506 |
||
#1 | 11653 | Paul Allen |
Fixes for R2014b of MATLAB/Simulink, including: * No longer prompting for connection information in isDirSandboxForThisAdapter * Fixed up commit logic, so it no longer uses the current changelist * Added back logic to walk the directory tree to find a .p4config file, rather than needing one in the sandbox directory * Added new buttons for re-connecting to p4d, and editing .p4config * Investigated conflict issues - fixed some, better logic coming * Removed .p4ignore generation - wrong spot for it Transferred from p4://perforce.perforce.com:1666@976888 |