java.beans.Beans Java Examples
The following examples show how to use
java.beans.Beans.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PropertySupport.java From netbeans with Apache License 2.0 | 6 votes |
public T getValue() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { if (getter == null) { throw new IllegalAccessException(); } Object valideInstance = Beans.getInstanceOf(instance, getter.getDeclaringClass()); try { try { return cast(getValueType(), getter.invoke(valideInstance)); } catch (IllegalAccessException ex) { try { getter.setAccessible(true); return cast(getValueType(), getter.invoke(valideInstance)); } finally { getter.setAccessible(false); } } } catch (IllegalArgumentException iae) { //Provide a better message for debugging StringBuffer sb = new StringBuffer("Attempted to invoke method "); sb.append(getter.getName()); sb.append(" from class "); sb.append(getter.getDeclaringClass().getName()); sb.append(" on an instance of "); sb.append(valideInstance.getClass().getName()); sb.append(" Problem:"); sb.append(iae.getMessage()); throw (IllegalArgumentException) new IllegalArgumentException(sb.toString()).initCause(iae); } }
Example #2
Source File: PropertySupport.java From netbeans with Apache License 2.0 | 6 votes |
public void setValue(T val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { if (setter == null) { throw new IllegalAccessException(); } Object valideInstance = Beans.getInstanceOf(instance, setter.getDeclaringClass()); try { setter.invoke(valideInstance, val); } catch (IllegalAccessException ex) { try { setter.setAccessible(true); setter.invoke(valideInstance, val); } finally { setter.setAccessible(false); } } }
Example #3
Source File: IndexedPropertySupport.java From netbeans with Apache License 2.0 | 6 votes |
public void setValue(T val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { if (!canWrite()) { throw new IllegalAccessException(); } Object validInstance = Beans.getInstanceOf(instance, setter.getDeclaringClass()); Object value = val; if ( (val != null) && (setter.getParameterTypes()[0].getComponentType().isPrimitive()) && (!val.getClass().getComponentType().isPrimitive()) ) { value = Utilities.toPrimitiveArray((Object[]) val); } setter.invoke(validInstance, value); }
Example #4
Source File: TestDesignTime.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InterruptedException { if (Beans.isDesignTime()) { throw new Error("unexpected DesignTime property"); } Beans.setDesignTime(!Beans.isDesignTime()); ThreadGroup group = new ThreadGroup("$$$"); Thread thread = new Thread(group, new TestDesignTime()); thread.start(); thread.join(); }
Example #5
Source File: TestDesignTime.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InterruptedException { if (Beans.isDesignTime()) { throw new Error("unexpected DesignTime property"); } Beans.setDesignTime(!Beans.isDesignTime()); ThreadGroup group = new ThreadGroup("$$$"); Thread thread = new Thread(group, new TestDesignTime()); thread.start(); thread.join(); }
Example #6
Source File: Test4080522.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void test(String[] path) { try { Beans.setDesignTime(true); Beans.setGuiAvailable(true); Introspector.setBeanInfoSearchPath(path); PropertyEditorManager.setEditorSearchPath(path); } catch (SecurityException exception) { throw new Error("unexpected security exception", exception); } }
Example #7
Source File: Test4144543.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Class type = Beans.instantiate(null, "Test4144543").getClass(); // try all the various places that this would break before Introspector.getBeanInfo(type); new PropertyDescriptor("value", type); new PropertyDescriptor("value", type, "getValue", "setValue"); }
Example #8
Source File: PurApArrayList.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
/** * Checks the type of an element matches the underlying list type. */ private void checkType(Object element) { if (element != null) { if (!Beans.isInstanceOf(element, listObjectType)) { throw new RuntimeException("element is not of correct type."); } } }
Example #9
Source File: IndexedPropertySupport.java From netbeans with Apache License 2.0 | 5 votes |
public T getValue() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { if (!canRead()) { throw new IllegalAccessException(); } Object validInstance = Beans.getInstanceOf(instance, getter.getDeclaringClass()); return PropertySupport.cast(getValueType(), getter.invoke(validInstance)); }
Example #10
Source File: IndexedPropertySupport.java From netbeans with Apache License 2.0 | 5 votes |
public void setIndexedValue(int index, E val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { if (!canIndexedWrite()) { throw new IllegalAccessException(); } Object validInstance = Beans.getInstanceOf(instance, indexedSetter.getDeclaringClass()); indexedSetter.invoke(validInstance, new Object[] { new Integer(index), val }); }
Example #11
Source File: Test4080522.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static void test(String[] path) { try { Beans.setDesignTime(true); Beans.setGuiAvailable(true); Introspector.setBeanInfoSearchPath(path); PropertyEditorManager.setEditorSearchPath(path); } catch (SecurityException exception) { throw new Error("unexpected security exception", exception); } }
Example #12
Source File: TestGuiAvailable.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InterruptedException { if (Beans.isGuiAvailable() == GraphicsEnvironment.isHeadless()) { throw new Error("unexpected GuiAvailable property"); } Beans.setGuiAvailable(!Beans.isGuiAvailable()); ThreadGroup group = new ThreadGroup("$$$"); Thread thread = new Thread(group, new TestGuiAvailable()); thread.start(); thread.join(); }
Example #13
Source File: TestDesignTime.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InterruptedException { if (Beans.isDesignTime()) { throw new Error("unexpected DesignTime property"); } Beans.setDesignTime(!Beans.isDesignTime()); ThreadGroup group = new ThreadGroup("$$$"); Thread thread = new Thread(group, new TestDesignTime()); thread.start(); thread.join(); }
Example #14
Source File: Test4080522.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void test(String[] path) { try { Beans.setDesignTime(true); Beans.setGuiAvailable(true); Introspector.setBeanInfoSearchPath(path); PropertyEditorManager.setEditorSearchPath(path); } catch (SecurityException exception) { throw new Error("unexpected security exception", exception); } }
Example #15
Source File: TestGuiAvailable.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InterruptedException { if (Beans.isGuiAvailable() == GraphicsEnvironment.isHeadless()) { throw new Error("unexpected GuiAvailable property"); } Beans.setGuiAvailable(!Beans.isGuiAvailable()); ThreadGroup group = new ThreadGroup("$$$"); Thread thread = new Thread(group, new TestGuiAvailable()); thread.start(); thread.join(); }
Example #16
Source File: IndexedPropertySupport.java From netbeans with Apache License 2.0 | 5 votes |
public E getIndexedValue(int index) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { if (!canIndexedRead()) { throw new IllegalAccessException(); } Object validInstance = Beans.getInstanceOf(instance, indexedGetter.getDeclaringClass()); return PropertySupport.cast(getElementType(), indexedGetter.invoke(validInstance, index)); }
Example #17
Source File: TestDesignTime.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InterruptedException { if (Beans.isDesignTime()) { throw new Error("unexpected DesignTime property"); } Beans.setDesignTime(!Beans.isDesignTime()); ThreadGroup group = new ThreadGroup("$$$"); Thread thread = new Thread(group, new TestDesignTime()); thread.start(); thread.join(); }
Example #18
Source File: Test4080522.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void test(String[] path) { try { Beans.setDesignTime(true); Beans.setGuiAvailable(true); Introspector.setBeanInfoSearchPath(path); PropertyEditorManager.setEditorSearchPath(path); } catch (SecurityException exception) { throw new Error("unexpected security exception", exception); } }
Example #19
Source File: TestGuiAvailable.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InterruptedException { if (Beans.isGuiAvailable() == GraphicsEnvironment.isHeadless()) { throw new Error("unexpected GuiAvailable property"); } Beans.setGuiAvailable(!Beans.isGuiAvailable()); ThreadGroup group = new ThreadGroup("$$$"); Thread thread = new Thread(group, new TestGuiAvailable()); thread.start(); thread.join(); }
Example #20
Source File: Test4144543.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Class type = Beans.instantiate(null, "Test4144543").getClass(); // try all the various places that this would break before Introspector.getBeanInfo(type); new PropertyDescriptor("value", type); new PropertyDescriptor("value", type, "getValue", "setValue"); }
Example #21
Source File: Test4080522.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static void test(String[] path) { try { Beans.setDesignTime(true); Beans.setGuiAvailable(true); Introspector.setBeanInfoSearchPath(path); PropertyEditorManager.setEditorSearchPath(path); } catch (SecurityException exception) { throw new Error("unexpected security exception", exception); } }
Example #22
Source File: Test4144543.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Class type = Beans.instantiate(null, "Test4144543").getClass(); // try all the various places that this would break before Introspector.getBeanInfo(type); new PropertyDescriptor("value", type); new PropertyDescriptor("value", type, "getValue", "setValue"); }
Example #23
Source File: Test4080522.java From hottub with GNU General Public License v2.0 | 5 votes |
private static void test(String[] path) { try { Beans.setDesignTime(true); Beans.setGuiAvailable(true); Introspector.setBeanInfoSearchPath(path); PropertyEditorManager.setEditorSearchPath(path); } catch (SecurityException exception) { throw new Error("unexpected security exception", exception); } }
Example #24
Source File: Test4144543.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Class type = Beans.instantiate(null, "Test4144543").getClass(); // try all the various places that this would break before Introspector.getBeanInfo(type); new PropertyDescriptor("value", type); new PropertyDescriptor("value", type, "getValue", "setValue"); }
Example #25
Source File: Test4080522.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private static void test(String[] path) { try { Beans.setDesignTime(true); Beans.setGuiAvailable(true); Introspector.setBeanInfoSearchPath(path); PropertyEditorManager.setEditorSearchPath(path); } catch (SecurityException exception) { throw new Error("unexpected security exception", exception); } }
Example #26
Source File: TestDesignTime.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InterruptedException { if (Beans.isDesignTime()) { throw new Error("unexpected DesignTime property"); } Beans.setDesignTime(!Beans.isDesignTime()); ThreadGroup group = new ThreadGroup("$$$"); Thread thread = new Thread(group, new TestDesignTime()); thread.start(); thread.join(); }
Example #27
Source File: Test4144543.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Class type = Beans.instantiate(null, "Test4144543").getClass(); // try all the various places that this would break before Introspector.getBeanInfo(type); new PropertyDescriptor("value", type); new PropertyDescriptor("value", type, "getValue", "setValue"); }
Example #28
Source File: Test4080522.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static void test(String[] path) { try { Beans.setDesignTime(true); Beans.setGuiAvailable(true); Introspector.setBeanInfoSearchPath(path); PropertyEditorManager.setEditorSearchPath(path); } catch (SecurityException exception) { throw new Error("unexpected security exception", exception); } }
Example #29
Source File: TestDesignTime.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws InterruptedException { if (Beans.isDesignTime()) { throw new Error("unexpected DesignTime property"); } Beans.setDesignTime(!Beans.isDesignTime()); ThreadGroup group = new ThreadGroup("$$$"); Thread thread = new Thread(group, new TestDesignTime()); thread.start(); thread.join(); }
Example #30
Source File: Test4144543.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Class type = Beans.instantiate(null, "Test4144543").getClass(); // try all the various places that this would break before Introspector.getBeanInfo(type); new PropertyDescriptor("value", type); new PropertyDescriptor("value", type, "getValue", "setValue"); }