类java.beans.Beans源码实例Demo

下面列出了怎么用java.beans.Beans的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: netbeans   文件: PropertySupport.java
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);
        }
    }
}
 
源代码2 项目: netbeans   文件: IndexedPropertySupport.java
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);
}
 
源代码3 项目: dragonwell8_jdk   文件: Test4080522.java
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);
    }
}
 
源代码4 项目: dragonwell8_jdk   文件: TestGuiAvailable.java
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();
}
 
源代码5 项目: dragonwell8_jdk   文件: TestDesignTime.java
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();
}
 
源代码6 项目: dragonwell8_jdk   文件: Test4144543.java
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");
}
 
源代码7 项目: TencentKona-8   文件: Test4080522.java
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);
    }
}
 
源代码8 项目: TencentKona-8   文件: TestGuiAvailable.java
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();
}
 
源代码9 项目: jdk8u-dev-jdk   文件: TestDesignTime.java
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();
}
 
源代码10 项目: TencentKona-8   文件: TestDesignTime.java
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();
}
 
源代码11 项目: openjdk-8   文件: TestGuiAvailable.java
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();
}
 
源代码12 项目: jdk8u60   文件: TestGuiAvailable.java
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();
}
 
源代码13 项目: jdk8u60   文件: TestDesignTime.java
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();
}
 
源代码14 项目: jdk8u_jdk   文件: Test4080522.java
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);
    }
}
 
源代码15 项目: openjdk-jdk8u   文件: Test4080522.java
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);
    }
}
 
源代码16 项目: openjdk-jdk8u   文件: TestGuiAvailable.java
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();
}
 
源代码17 项目: openjdk-jdk8u   文件: TestDesignTime.java
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();
}
 
源代码18 项目: jdk8u-jdk   文件: Test4080522.java
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);
    }
}
 
源代码19 项目: openjdk-jdk8u   文件: Test4144543.java
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");
}
 
源代码20 项目: netbeans   文件: PropertySupport.java
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);
    }
}
 
源代码21 项目: kfs   文件: PurApArrayList.java
/**
 * 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.");
        }
    }
}
 
源代码22 项目: netbeans   文件: IndexedPropertySupport.java
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));
}
 
源代码23 项目: netbeans   文件: IndexedPropertySupport.java
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));
}
 
源代码24 项目: netbeans   文件: IndexedPropertySupport.java
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 });
}
 
源代码25 项目: openjdk-jdk8u-backup   文件: Test4080522.java
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);
    }
}
 
源代码26 项目: openjdk-jdk8u-backup   文件: TestGuiAvailable.java
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();
}
 
源代码27 项目: openjdk-jdk8u-backup   文件: TestDesignTime.java
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();
}
 
源代码28 项目: openjdk-jdk9   文件: Test4080522.java
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);
    }
}
 
源代码29 项目: openjdk-jdk9   文件: TestGuiAvailable.java
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();
}
 
源代码30 项目: openjdk-jdk9   文件: TestDesignTime.java
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();
}
 
 类所在包
 同包方法