当前位置: 首页>>代码示例>>Java>>正文


Java Messages类代码示例

本文整理汇总了Java中org.apache.harmony.beans.internal.nls.Messages的典型用法代码示例。如果您正苦于以下问题:Java Messages类的具体用法?Java Messages怎么用?Java Messages使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Messages类属于org.apache.harmony.beans.internal.nls包,在下文中一共展示了Messages类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: PropertyDescriptor

import org.apache.harmony.beans.internal.nls.Messages; //导入依赖的package包/类
public PropertyDescriptor(String propertyName, Class<?> beanClass)
        throws IntrospectionException {
    if (beanClass == null) {
        throw new IntrospectionException(Messages.getString("beans.03")); //$NON-NLS-1$
    }
    if (propertyName == null || propertyName.length() == 0) {
        throw new IntrospectionException(Messages.getString("beans.04")); //$NON-NLS-1$
    }
    this.setName(propertyName);
    try {
        setReadMethod(beanClass,
                createDefaultMethodName(propertyName, "is")); //$NON-NLS-1$
    } catch (Exception e) {
        setReadMethod(beanClass, createDefaultMethodName(propertyName,
                "get")); //$NON-NLS-1$
    }

    setWriteMethod(beanClass, createDefaultMethodName(propertyName, "set")); //$NON-NLS-1$
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:20,代码来源:PropertyDescriptor.java

示例2: setWriteMethod

import org.apache.harmony.beans.internal.nls.Messages; //导入依赖的package包/类
public void setWriteMethod(Method setter) throws IntrospectionException {
    if (setter != null) {
        int modifiers = setter.getModifiers();
        if (!Modifier.isPublic(modifiers)) {
            throw new IntrospectionException(Messages.getString("beans.05")); //$NON-NLS-1$
        }
        Class<?>[] parameterTypes = setter.getParameterTypes();
        if (parameterTypes.length != 1) {
            throw new IntrospectionException(Messages.getString("beans.06")); //$NON-NLS-1$
        }
        Class<?> parameterType = parameterTypes[0];
        Class<?> propertyType = getPropertyType();
        if (propertyType != null && !propertyType.equals(parameterType)) {
            throw new IntrospectionException(Messages.getString("beans.07")); //$NON-NLS-1$
        }
    }
    this.setter = setter;
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:19,代码来源:PropertyDescriptor.java

示例3: setReadMethod

import org.apache.harmony.beans.internal.nls.Messages; //导入依赖的package包/类
public void setReadMethod(Method getter) throws IntrospectionException {
    if (getter != null) {
        int modifiers = getter.getModifiers();
        if (!Modifier.isPublic(modifiers)) {
            throw new IntrospectionException(Messages.getString("beans.0A")); //$NON-NLS-1$
        }
        Class<?>[] parameterTypes = getter.getParameterTypes();
        if (parameterTypes.length != 0) {
            throw new IntrospectionException(Messages.getString("beans.08")); //$NON-NLS-1$
        }
        Class<?> returnType = getter.getReturnType();
        if (returnType.equals(Void.TYPE)) {
            throw new IntrospectionException(Messages.getString("beans.33")); //$NON-NLS-1$
        }
        Class<?> propertyType = getPropertyType();
        if ((propertyType != null) && !returnType.equals(propertyType)) {
            throw new IntrospectionException(Messages.getString("beans.09")); //$NON-NLS-1$
        }
    }
    this.getter = getter;
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:22,代码来源:PropertyDescriptor.java

示例4: EventSetDescriptor

import org.apache.harmony.beans.internal.nls.Messages; //导入依赖的package包/类
public EventSetDescriptor(Class<?> sourceClass, String eventSetName,
        Class<?> listenerType, String listenerMethodName)
        throws IntrospectionException {
    checkNotNull(sourceClass, eventSetName, listenerType,
            listenerMethodName);
    setName(eventSetName);
    this.listenerType = listenerType;

    Method method = findListenerMethodByName(listenerMethodName);
    checkEventType(eventSetName, method);
    listenerMethodDescriptors = new ArrayList<MethodDescriptor>();
    listenerMethodDescriptors.add(new MethodDescriptor(method));
    addListenerMethod = findMethodByPrefix(sourceClass, "add", ""); //$NON-NLS-1$ //$NON-NLS-2$
    removeListenerMethod = findMethodByPrefix(sourceClass, "remove", ""); //$NON-NLS-1$ //$NON-NLS-2$

    if (addListenerMethod == null || removeListenerMethod == null) {
        throw new IntrospectionException(Messages.getString("beans.38")); //$NON-NLS-1$
    }

    getListenerMethod = findMethodByPrefix(sourceClass, "get", "s"); //$NON-NLS-1$ //$NON-NLS-2$
    unicast = isUnicastByDefault(addListenerMethod);
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:23,代码来源:EventSetDescriptor.java

示例5: findListenerMethodByName

import org.apache.harmony.beans.internal.nls.Messages; //导入依赖的package包/类
private Method findListenerMethodByName(String listenerMethodName)
        throws IntrospectionException {
    Method result = null;
    Method[] methods = listenerType.getMethods();
    for (Method method : methods) {
        if (listenerMethodName.equals(method.getName())) {
            Class<?>[] paramTypes = method.getParameterTypes();
            if (paramTypes.length == 1
                    && paramTypes[0].getName().endsWith("Event")) { //$NON-NLS-1$
                result = method;
                break;
            }

        }
    }
    if (null == result) {
        throw new IntrospectionException(Messages.getString("beans.31", //$NON-NLS-1$
                listenerMethodName, listenerType.getName()));
    }
    return result;
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:22,代码来源:EventSetDescriptor.java

示例6: checkNotNull

import org.apache.harmony.beans.internal.nls.Messages; //导入依赖的package包/类
@SuppressWarnings("nls")
private void checkNotNull(Object sourceClass, Object eventSetName,
        Object alistenerType, Object listenerMethodName) {
    if (sourceClass == null) {
        throw new NullPointerException(Messages.getString("beans.0C"));
    }
    if (eventSetName == null) {
        throw new NullPointerException(Messages.getString("beans.53"));
    }
    if (alistenerType == null) {
        throw new NullPointerException(Messages.getString("beans.54"));
    }
    if (listenerMethodName == null) {
        throw new NullPointerException(Messages.getString("beans.52"));
    }
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:17,代码来源:EventSetDescriptor.java

示例7: checkEventType

import org.apache.harmony.beans.internal.nls.Messages; //导入依赖的package包/类
/**
 * Checks that given listener method has an argument of the valid type.
 * 
 * @param eventSetName
 *            event set name
 * @param listenerMethod
 *            listener method
 * @throws IntrospectionException
 *             if check fails
 */
private static void checkEventType(String eventSetName,
        Method listenerMethod) throws IntrospectionException {
    Class<?>[] params = listenerMethod.getParameterTypes();
    String firstParamTypeName = null;
    String eventTypeName = prepareEventTypeName(eventSetName);

    if (params.length > 0) {
        firstParamTypeName = extractShortClassName(params[0]
                .getName());
    }

    if (firstParamTypeName == null
            || !firstParamTypeName.equals(eventTypeName)) {
        throw new IntrospectionException(Messages.getString("beans.51", //$NON-NLS-1$
                listenerMethod.getName(), eventTypeName));
    }
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:28,代码来源:EventSetDescriptor.java

示例8: findAddRemoveListnerMethodWithLessCheck

import org.apache.harmony.beans.internal.nls.Messages; //导入依赖的package包/类
private Method findAddRemoveListnerMethodWithLessCheck(
        Class<?> sourceClass, String methodName)
        throws IntrospectionException {
    Method[] methods = sourceClass.getMethods();
    Method result = null;
    for (Method method : methods) {
        if (method.getName().equals(methodName)) {
            Class<?>[] paramTypes = method.getParameterTypes();
            if (paramTypes.length == 1) {
                result = method;
                break;
            }
        }
    }
    if (null == result) {
        throw new IntrospectionException(Messages.getString("beans.31", //$NON-NLS-1$
                methodName, listenerType.getName()));
    }
    return result;
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:21,代码来源:EventSetDescriptor.java

示例9: releaseService

import org.apache.harmony.beans.internal.nls.Messages; //导入依赖的package包/类
/**
 * Release a service which has been requested previously.
 * 
 * @param child
 *            the child that request the service
 * @param requestor
 *            the requestor object
 * @param service
 *            the service instance
 * @throws IllegalArgumentException
 *             if <code>child</code> is not a child of this context
 */
public void releaseService(BeanContextChild child, Object requestor,
        Object service) {
    if (child == null || requestor == null || service == null) {
        throw new NullPointerException();
    }

    synchronized (globalHierarchyLock) {
        BCSSChild bcssChild;
        synchronized (children) {
            bcssChild = (BCSSChild) children.get(child);
        }
        if (bcssChild == null) {
            throw new IllegalArgumentException(
                    Messages.getString("beans.65"));
        }

        releaseServiceWithoutCheck(child, bcssChild, requestor, service,
                false);
    }
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:33,代码来源:BeanContextServicesSupport.java

示例10: serviceAvailable

import org.apache.harmony.beans.internal.nls.Messages; //导入依赖的package包/类
/**
 * Notify all listeners and children that implements
 * <code>BeanContextServices</code> of the event.
 * 
 * @see com.googlecode.openbeans.beancontext.BeanContextServicesListener#serviceAvailable(com.googlecode.openbeans.beancontext.BeanContextServiceAvailableEvent)
 */
public void serviceAvailable(BeanContextServiceAvailableEvent event) {
    if (null == event) {
        throw new NullPointerException(Messages.getString("beans.1C")); //$NON-NLS-1$
    }
    if (services.containsKey(event.serviceClass)) {
        return;
    }
    fireServiceAdded(event);
    Object childs[] = copyChildren();
    for (int i = 0; i < childs.length; i++) {
        if (childs[i] instanceof BeanContextServices) {
            ((BeanContextServices) childs[i]).serviceAvailable(event);
        }
    }
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:22,代码来源:BeanContextServicesSupport.java

示例11: serviceRevoked

import org.apache.harmony.beans.internal.nls.Messages; //导入依赖的package包/类
/**
 * Notify all listeners and children that implements
 * <code>BeanContextServices</code> of the event.
 * 
 * @see com.googlecode.openbeans.beancontext.BeanContextServiceRevokedListener#serviceRevoked(com.googlecode.openbeans.beancontext.BeanContextServiceRevokedEvent)
 */
public void serviceRevoked(BeanContextServiceRevokedEvent event) {
    if (null == event) {
        throw new NullPointerException(Messages.getString("beans.1C")); //$NON-NLS-1$
    }
    if (services.containsKey(event.serviceClass)) {
        return;
    }
    fireServiceRevoked(event);
    Object childs[] = copyChildren();
    for (int i = 0; i < childs.length; i++) {
        if (childs[i] instanceof BeanContextServices) {
            ((BeanContextServices) childs[i]).serviceRevoked(event);
        }
    }
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:22,代码来源:BeanContextServicesSupport.java

示例12: getChildBeanContextChild

import org.apache.harmony.beans.internal.nls.Messages; //导入依赖的package包/类
/**
 * Returns the <code>BeanContextChild</code> related with the given child.
 * <p>
 * If the child implements <code>BeanContextChild</code>, it is returned. 
 * If the child implements <code>BeanContextProxy</code>, the proxy is returned.
 * Otherwise, null is returned.</p>
 * 
 * @param child     a child
 * @return the <code>BeanContextChild</code> related with the given child
 * @throws IllegalStateException if the child implements both <code>BeanContextChild</code> and <code>BeanContextProxy</code>
 */
protected static final BeanContextChild getChildBeanContextChild(
        Object child) {
    if (child instanceof BeanContextChild) {
        if (child instanceof BeanContextProxy) {
            throw new IllegalArgumentException(
                    Messages.getString("beans.6C"));
        }
        return (BeanContextChild) child;
    }
    if (child instanceof BeanContextProxy) {
        if (child instanceof BeanContextChild) {
            throw new IllegalArgumentException(
                    Messages.getString("beans.6C"));
        }
        return ((BeanContextProxy) child).getBeanContextProxy();
    }
    return null;
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:30,代码来源:BeanContextSupport.java

示例13: setIndexedByName

import org.apache.harmony.beans.internal.nls.Messages; //导入依赖的package包/类
private void setIndexedByName(Class<?> beanClass, String indexedGetterName,
        String indexedSetterName) throws IntrospectionException {

    String theIndexedGetterName = indexedGetterName;
    if (theIndexedGetterName == null) {
        if (indexedSetterName != null) {
            setIndexedWriteMethod(beanClass, indexedSetterName);
        }
    } else {
        if (theIndexedGetterName.length() == 0) {
            theIndexedGetterName = "get" + name; //$NON-NLS-1$
        }
        setIndexedReadMethod(beanClass, theIndexedGetterName);
        if (indexedSetterName != null) {
            setIndexedWriteMethod(beanClass, indexedSetterName,
                    indexedPropertyType);
        }
    }

    if (!isCompatible()) {
        // beans.57=Property type is incompatible with the indexed property type
        throw new IntrospectionException(Messages.getString("beans.57")); //$NON-NLS-1$
    }
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:25,代码来源:IndexedPropertyDescriptor.java

示例14: IndexedPropertyDescriptor

import org.apache.harmony.beans.internal.nls.Messages; //导入依赖的package包/类
/**
 * Constructs a new instance of <code>IndexedPropertyDescriptor</code>.
 * 
 * @param propertyName
 *            the specified indexed property's name.
 * @param getter
 *            the array getter
 * @param setter
 *            the array setter
 * @param indexedGetter
 *            the indexed getter
 * @param indexedSetter
 *            the indexed setter
 * @throws IntrospectionException
 */
public IndexedPropertyDescriptor(String propertyName, Method getter,
        Method setter, Method indexedGetter, Method indexedSetter)
        throws IntrospectionException {
    super(propertyName, getter, setter);
    if (indexedGetter != null) {
        internalSetIndexedReadMethod(indexedGetter);
        internalSetIndexedWriteMethod(indexedSetter, true);
    } else {
        internalSetIndexedWriteMethod(indexedSetter, true);
        internalSetIndexedReadMethod(indexedGetter);
    }

    if (!isCompatible()) {
        // beans.57=Property type is incompatible with the indexed property type
        throw new IntrospectionException(Messages.getString("beans.57")); //$NON-NLS-1$
    }
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:33,代码来源:IndexedPropertyDescriptor.java

示例15: findArrayMethod

import org.apache.harmony.beans.internal.nls.Messages; //导入依赖的package包/类
private Method findArrayMethod(String methodName, Object[] args)
        throws NoSuchMethodException {
    // the code below reproduces exact RI exception throwing behavior
    boolean isGet = BeansUtils.GET.equals(methodName); //$NON-NLS-1$
    boolean isSet = BeansUtils.SET.equals(methodName); //$NON-NLS-1$
    if (!isGet && !isSet) {
        throw new NoSuchMethodException(Messages.getString("beans.3C")); //$NON-NLS-1$
    } else if (args.length > 0 && args[0].getClass() != Integer.class) {
        throw new ClassCastException(Messages.getString("beans.3D")); //$NON-NLS-1$
    } else if (isGet && args.length != 1) {
        throw new ArrayIndexOutOfBoundsException(
                Messages.getString("beans.3E")); //$NON-NLS-1$
    } else if (isSet && args.length != 2) {
        throw new ArrayIndexOutOfBoundsException(
                Messages.getString("beans.3F")); //$NON-NLS-1$
    }

    Class<?>[] paraTypes = isGet ? new Class<?>[] { Object.class, int.class }
            : new Class<?>[] { Object.class, int.class, Object.class };
    return Array.class.getMethod(methodName, paraTypes);
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:22,代码来源:Statement.java


注:本文中的org.apache.harmony.beans.internal.nls.Messages类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。