Java 类org.joda.time.tz.NameProvider 实例源码

项目:RIT-Dining-Planner-Android    文件:TestDateTimeZone.java   
public void testNameProvider() {
    try {
        assertNotNull(DateTimeZone.getNameProvider());

        NameProvider provider = DateTimeZone.getNameProvider();
        DateTimeZone.setNameProvider(null);
        assertEquals(provider.getClass(), DateTimeZone.getNameProvider().getClass());

        provider = new MockOKButNullNameProvider();
        DateTimeZone.setNameProvider(provider);
        assertSame(provider, DateTimeZone.getNameProvider());

        assertEquals("+00:00", DateTimeZone.UTC.getShortName(TEST_TIME_SUMMER));
        assertEquals("+00:00", DateTimeZone.UTC.getName(TEST_TIME_SUMMER));
    } finally {
        DateTimeZone.setNameProvider(null);
    }

    try {
        System.setProperty("org.joda.time.DateTimeZone.NameProvider", "org.joda.time.tz.DefaultNameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    } finally {
        System.getProperties().remove("org.joda.time.DateTimeZone.NameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    }
}
项目:TinyTravelTracker    文件:DateTimeZone.java   
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
项目:astor    文件:DateTimeZone.java   
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
项目:astor    文件:TestDateTimeZone.java   
public void testNameProvider() {
    try {
        assertNotNull(DateTimeZone.getNameProvider());

        NameProvider provider = DateTimeZone.getNameProvider();
        DateTimeZone.setNameProvider(null);
        assertEquals(provider.getClass(), DateTimeZone.getNameProvider().getClass());

        provider = new MockOKButNullNameProvider();
        DateTimeZone.setNameProvider(provider);
        assertSame(provider, DateTimeZone.getNameProvider());

        assertEquals("+00:00", DateTimeZone.UTC.getShortName(TEST_TIME_SUMMER));
        assertEquals("+00:00", DateTimeZone.UTC.getName(TEST_TIME_SUMMER));
    } finally {
        DateTimeZone.setNameProvider(null);
    }

    try {
        System.setProperty("org.joda.time.DateTimeZone.NameProvider", "org.joda.time.tz.DefaultNameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    } finally {
        System.getProperties().remove("org.joda.time.DateTimeZone.NameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    }
}
项目:astor    文件:DateTimeZone.java   
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
项目:joda-time-android    文件:TestDateTimeZone.java   
public void testNameProvider() {
    try {
        assertNotNull(DateTimeZone.getNameProvider());

        NameProvider provider = DateTimeZone.getNameProvider();
        DateTimeZone.setNameProvider(null);
        assertEquals(provider.getClass(), DateTimeZone.getNameProvider().getClass());

        provider = new MockOKButNullNameProvider();
        DateTimeZone.setNameProvider(provider);
        assertSame(provider, DateTimeZone.getNameProvider());

        assertEquals("+00:00", DateTimeZone.UTC.getShortName(TEST_TIME_SUMMER));
        assertEquals("+00:00", DateTimeZone.UTC.getName(TEST_TIME_SUMMER));
    } finally {
        DateTimeZone.setNameProvider(null);
    }

    try {
        System.setProperty("org.joda.time.DateTimeZone.NameProvider", "org.joda.time.tz.DefaultNameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    } finally {
        System.getProperties().remove("org.joda.time.DateTimeZone.NameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    }
}
项目:idylfin    文件:DateTimeZone.java   
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
项目:versemem-android    文件:DateTimeZone.java   
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
项目:astor    文件:TestDateTimeZone.java   
public void testNameProvider() {
    try {
        assertNotNull(DateTimeZone.getNameProvider());

        NameProvider provider = DateTimeZone.getNameProvider();
        DateTimeZone.setNameProvider(null);
        assertEquals(provider.getClass(), DateTimeZone.getNameProvider().getClass());

        provider = new MockOKButNullNameProvider();
        DateTimeZone.setNameProvider(provider);
        assertSame(provider, DateTimeZone.getNameProvider());

        assertEquals("+00:00", DateTimeZone.UTC.getShortName(TEST_TIME_SUMMER));
        assertEquals("+00:00", DateTimeZone.UTC.getName(TEST_TIME_SUMMER));
    } finally {
        DateTimeZone.setNameProvider(null);
    }

    try {
        System.setProperty("org.joda.time.DateTimeZone.NameProvider", "org.joda.time.tz.DefaultNameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    } finally {
        System.getProperties().remove("org.joda.time.DateTimeZone.NameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    }

    PrintStream syserr = System.err;
    try {
        System.setProperty("org.joda.time.DateTimeZone.NameProvider", "xxx");
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        System.setErr(new PrintStream(baos));

        DateTimeZone.setNameProvider(null);

        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
        String str = new String(baos.toByteArray());
        assertTrue(str.indexOf("java.lang.ClassNotFoundException") >= 0);
    } finally {
        System.setErr(syserr);
        System.getProperties().remove("org.joda.time.DateTimeZone.NameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    }
}
项目:versemem-android    文件:TestDateTimeZone.java   
public void testNameProvider() {
    try {
        assertNotNull(DateTimeZone.getNameProvider());

        NameProvider provider = DateTimeZone.getNameProvider();
        DateTimeZone.setNameProvider(null);
        assertEquals(provider.getClass(), DateTimeZone.getNameProvider().getClass());

        provider = new MockOKButNullNameProvider();
        DateTimeZone.setNameProvider(provider);
        assertSame(provider, DateTimeZone.getNameProvider());

        assertEquals("+00:00", DateTimeZone.UTC.getShortName(TEST_TIME_SUMMER));
        assertEquals("+00:00", DateTimeZone.UTC.getName(TEST_TIME_SUMMER));
    } finally {
        DateTimeZone.setNameProvider(null);
    }

    try {
        System.setProperty("org.joda.time.DateTimeZone.NameProvider", "org.joda.time.tz.DefaultNameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    } finally {
        System.getProperties().remove("org.joda.time.DateTimeZone.NameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    }

    PrintStream syserr = System.err;
    try {
        System.setProperty("org.joda.time.DateTimeZone.NameProvider", "xxx");
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        System.setErr(new PrintStream(baos));

        DateTimeZone.setNameProvider(null);

        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
        String str = new String(baos.toByteArray());
        assertTrue(str.indexOf("java.lang.ClassNotFoundException") >= 0);
    } finally {
        System.setErr(syserr);
        System.getProperties().remove("org.joda.time.DateTimeZone.NameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    }
}
项目:TinyTravelTracker    文件:DateTimeZone.java   
/**
 * Sets the name provider factory.
 * <p>
 * The name provider is a pluggable instance factory that supplies the
 * names of each DateTimeZone.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws SecurityException if you do not have the permission DateTimeZone.setNameProvider
 * @throws IllegalArgumentException if the provider is invalid
 */
public static void setNameProvider(NameProvider nameProvider) throws SecurityException {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new JodaTimePermission("DateTimeZone.setNameProvider"));
    }
    setNameProvider0(nameProvider);
}
项目:astor    文件:DateTimeZone.java   
/**
 * Sets the name provider factory.
 * <p>
 * The name provider is a pluggable instance factory that supplies the
 * names of each DateTimeZone.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws SecurityException if you do not have the permission DateTimeZone.setNameProvider
 * @throws IllegalArgumentException if the provider is invalid
 */
public static void setNameProvider(NameProvider nameProvider) throws SecurityException {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new JodaTimePermission("DateTimeZone.setNameProvider"));
    }
    setNameProvider0(nameProvider);
}
项目:astor    文件:DateTimeZone.java   
/**
 * Sets the name provider factory.
 * <p>
 * The name provider is a pluggable instance factory that supplies the
 * names of each DateTimeZone.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws SecurityException if you do not have the permission DateTimeZone.setNameProvider
 * @throws IllegalArgumentException if the provider is invalid
 */
public static void setNameProvider(NameProvider nameProvider) throws SecurityException {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new JodaTimePermission("DateTimeZone.setNameProvider"));
    }
    setNameProvider0(nameProvider);
}
项目:idylfin    文件:DateTimeZone.java   
/**
 * Sets the name provider factory.
 * <p>
 * The name provider is a pluggable instance factory that supplies the
 * names of each DateTimeZone.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws SecurityException if you do not have the permission DateTimeZone.setNameProvider
 * @throws IllegalArgumentException if the provider is invalid
 */
public static void setNameProvider(NameProvider nameProvider) throws SecurityException {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new JodaTimePermission("DateTimeZone.setNameProvider"));
    }
    setNameProvider0(nameProvider);
}
项目:versemem-android    文件:DateTimeZone.java   
/**
 * Sets the name provider factory.
 * <p>
 * The name provider is a pluggable instance factory that supplies the
 * names of each DateTimeZone.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws SecurityException if you do not have the permission DateTimeZone.setNameProvider
 * @throws IllegalArgumentException if the provider is invalid
 */
public static void setNameProvider(NameProvider nameProvider) throws SecurityException {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new JodaTimePermission("DateTimeZone.setNameProvider"));
    }
    setNameProvider0(nameProvider);
}
项目:TinyTravelTracker    文件:DateTimeZone.java   
/**
 * Gets the name provider factory.
 * <p>
 * The name provider is a pluggable instance factory that supplies the
 * names of each DateTimeZone.
 * 
 * @return the provider
 */
public static NameProvider getNameProvider() {
    return cNameProvider;
}
项目:astor    文件:DateTimeZone.java   
/**
 * Gets the name provider factory.
 * <p>
 * The name provider is a pluggable instance factory that supplies the
 * names of each DateTimeZone.
 * 
 * @return the provider
 */
public static NameProvider getNameProvider() {
    return cNameProvider;
}
项目:astor    文件:DateTimeZone.java   
/**
 * Gets the name provider factory.
 * <p>
 * The name provider is a pluggable instance factory that supplies the
 * names of each DateTimeZone.
 * 
 * @return the provider
 */
public static NameProvider getNameProvider() {
    return cNameProvider;
}
项目:idylfin    文件:DateTimeZone.java   
/**
 * Gets the name provider factory.
 * <p>
 * The name provider is a pluggable instance factory that supplies the
 * names of each DateTimeZone.
 * 
 * @return the provider
 */
public static NameProvider getNameProvider() {
    return cNameProvider;
}
项目:versemem-android    文件:DateTimeZone.java   
/**
 * Gets the name provider factory.
 * <p>
 * The name provider is a pluggable instance factory that supplies the
 * names of each DateTimeZone.
 * 
 * @return the provider
 */
public static NameProvider getNameProvider() {
    return cNameProvider;
}