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


Java Converters类代码示例

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


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

示例1: convert

import org.pac4j.core.profile.converter.Converters; //导入依赖的package包/类
@Override
public Date convert(final Object attribute) {
    if (attribute instanceof Long) {
        final long seconds = (Long) attribute;
        return new FormattedDate(new Date(seconds * 1000), Converters.DATE_TZ_GENERAL_FORMAT, Locale.getDefault());
    } else if (attribute instanceof String) {
        final SimpleDateFormat sdf = new SimpleDateFormat(Converters.DATE_TZ_GENERAL_FORMAT);
        try {
            return new FormattedDate(sdf.parse((String) attribute), Converters.DATE_TZ_GENERAL_FORMAT, Locale.getDefault());
        } catch (final ParseException e) {
            throw new TechnicalException(e);
        }
    } else if (attribute instanceof FormattedDate) {
        return (Date) attribute;
    }
    return null;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:18,代码来源:OidcLongTimeConverter.java

示例2: YahooAttributesDefinition

import org.pac4j.core.profile.converter.Converters; //导入依赖的package包/类
public YahooAttributesDefinition() {
    Arrays.stream(new String[] {ABOUT_ME, FAMILY_NAME, GIVEN_NAME, LOCATION, NICKNAME, PROFILE_URL, TIME_ZONE, URI, AGE_CATEGORY})
            .forEach(a -> primary(a, Converters.STRING));
    primary(IS_CONNECTED, Converters.BOOLEAN);
    primary(BIRTH_YEAR, Converters.INTEGER);
    primary(LANG, Converters.LOCALE);
    primary(DISPLAY_AGE, Converters.INTEGER);
    primary(BIRTHDATE, new FormattedDateConverter("MM/dd"));
    primary(ADDRESSES, new JsonListConverter(YahooAddress.class, YahooAddress[].class));
    primary(DISCLOSURES, new JsonListConverter(YahooDisclosure.class, YahooDisclosure[].class));
    primary(EMAILS, new JsonListConverter(YahooEmail.class, YahooEmail[].class));
    primary(GENDER, new GenderConverter("m", "f"));
    primary(IMAGE, new JsonConverter<>(YahooImage.class));
    primary(INTERESTS, new JsonListConverter(YahooInterest.class, YahooInterest[].class));
    primary(CREATED, Converters.DATE_TZ_RFC822);
    primary(MEMBER_SINCE, Converters.DATE_TZ_RFC822);
    primary(UPDATED, Converters.DATE_TZ_RFC822);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:19,代码来源:YahooAttributesDefinition.java

示例3: TwitterAttributesDefinition

import org.pac4j.core.profile.converter.Converters; //导入依赖的package包/类
public TwitterAttributesDefinition() {
    Arrays.stream(new String[] {DESCRIPTION, LOCATION, NAME, SCREEN_NAME, TIME_ZONE, URL})
            .forEach(a -> primary(a, Converters.STRING));
    Arrays.stream(new String[] {CONTRIBUTORS_ENABLED, DEFAULT_PROFILE, DEFAULT_PROFILE_IMAGE, FOLLOW_REQUEST_SENT, FOLLOWING,
            GEO_ENABLED, IS_TRANSLATOR, NOTIFICATIONS, PROFILE_USE_BACKGROUND_IMAGE, PROTECTED, SHOW_ALL_INLINE_MEDIA,
            PROFILE_BACKGROUND_TILE, VERIFIED})
            .forEach(a -> primary(a, Converters.BOOLEAN));
    Arrays.stream(new String[] {FAVOURITES_COUNT, FOLLOWERS_COUNT, FRIENDS_COUNT, LISTED_COUNT, STATUSES_COUNT, UTC_OFFSET})
            .forEach(a -> primary(a, Converters.INTEGER));
    Arrays.stream(new String[] {PROFILE_BACKGROUND_IMAGE_URL, PROFILE_BACKGROUND_IMAGE_URL_HTTPS,
            PROFILE_IMAGE_URL, PROFILE_IMAGE_URL_HTTPS}).forEach(a -> primary(a, Converters.URL));
    Arrays.stream(new String[] {PROFILE_BACKGROUND_COLOR, PROFILE_LINK_COLOR, PROFILE_SIDEBAR_BORDER_COLOR,
            PROFILE_SIDEBAR_FILL_COLOR, PROFILE_TEXT_COLOR}).forEach(a -> primary(a, Converters.COLOR));
    primary(LANG, Converters.LOCALE);
    primary(CREATED_AT, new FormattedDateConverter("EEE MMM dd HH:mm:ss Z yyyy", Locale.US));
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:17,代码来源:TwitterAttributesDefinition.java

示例4: StravaAttributesDefinition

import org.pac4j.core.profile.converter.Converters; //导入依赖的package包/类
public StravaAttributesDefinition() {
    Arrays.stream(new String[] { FIRST_NAME, LAST_NAME, PROFILE_MEDIUM, PROFILE, CITY, STATE, COUNTRY,
            DATE_PREFERENCE, MEASUREMENT_PREFERENCE, EMAIL }).forEach(a -> primary(a, Converters.STRING));
    primary(ID, Converters.LONG);
    primary(RESOURCE_STATE, Converters.INTEGER);
    primary(BADGE_TYPE_ID, Converters.INTEGER);
    primary(FOLLOWER_COUNT, Converters.INTEGER);
    primary(FRIEND_COUNT, Converters.INTEGER);
    primary(PREMIUM, Converters.BOOLEAN);
    primary(SEX, new GenderConverter("m", "f"));
    primary(CREATED_AT, Converters.DATE_TZ_RFC822);
    primary(UPDATED_AT, Converters.DATE_TZ_RFC822);
    primary(CLUBS, new JsonListConverter(StravaClub.class, StravaClub[].class));
    final JsonListConverter multiGearConverter = new JsonListConverter(StravaGear.class, StravaGear[].class);
    primary(BIKES, multiGearConverter);
    primary(SHOES, multiGearConverter);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:18,代码来源:StravaAttributesDefinition.java

示例5: QQAttributesDefinition

import org.pac4j.core.profile.converter.Converters; //导入依赖的package包/类
public QQAttributesDefinition() {
    Arrays.stream(new String[] {DESCRIPTION, LOCATION, NAME, SCREEN_NAME, TIME_ZONE, URL})
            .forEach(a -> primary(a, Converters.STRING));
    Arrays.stream(new String[] {CONTRIBUTORS_ENABLED, DEFAULT_PROFILE, DEFAULT_PROFILE_IMAGE, FOLLOW_REQUEST_SENT, FOLLOWING,
            GEO_ENABLED, IS_TRANSLATOR, NOTIFICATIONS, PROFILE_USE_BACKGROUND_IMAGE, PROTECTED, SHOW_ALL_INLINE_MEDIA,
            PROFILE_BACKGROUND_TILE, VERIFIED})
            .forEach(a -> primary(a, Converters.BOOLEAN));
    Arrays.stream(new String[] {FAVOURITES_COUNT, FOLLOWERS_COUNT, FRIENDS_COUNT, LISTED_COUNT, STATUSES_COUNT, UTC_OFFSET})
            .forEach(a -> primary(a, Converters.INTEGER));
    Arrays.stream(new String[] {PROFILE_BACKGROUND_IMAGE_URL, PROFILE_BACKGROUND_IMAGE_URL_HTTPS,
            PROFILE_IMAGE_URL, PROFILE_IMAGE_URL_HTTPS}).forEach(a -> primary(a, Converters.URL));
    Arrays.stream(new String[] {PROFILE_BACKGROUND_COLOR, PROFILE_LINK_COLOR, PROFILE_SIDEBAR_BORDER_COLOR,
            PROFILE_SIDEBAR_FILL_COLOR, PROFILE_TEXT_COLOR}).forEach(a -> primary(a, Converters.COLOR));
    primary(LANG, Converters.LOCALE);
    primary(CREATED_AT, new FormattedDateConverter("EEE MMM dd HH:mm:ss Z yyyy", Locale.US));
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:17,代码来源:QQAttributesDefinition.java

示例6: SinaAttributesDefinition

import org.pac4j.core.profile.converter.Converters; //导入依赖的package包/类
public SinaAttributesDefinition() {
    Arrays.stream(new String[] {DESCRIPTION, LOCATION, NAME, SCREEN_NAME, TIME_ZONE, URL})
            .forEach(a -> primary(a, Converters.STRING));
    Arrays.stream(new String[] {CONTRIBUTORS_ENABLED, DEFAULT_PROFILE, DEFAULT_PROFILE_IMAGE, FOLLOW_REQUEST_SENT, FOLLOWING,
            GEO_ENABLED, IS_TRANSLATOR, NOTIFICATIONS, PROFILE_USE_BACKGROUND_IMAGE, PROTECTED, SHOW_ALL_INLINE_MEDIA,
            PROFILE_BACKGROUND_TILE, VERIFIED})
            .forEach(a -> primary(a, Converters.BOOLEAN));
    Arrays.stream(new String[] {FAVOURITES_COUNT, FOLLOWERS_COUNT, FRIENDS_COUNT, LISTED_COUNT, STATUSES_COUNT, UTC_OFFSET})
            .forEach(a -> primary(a, Converters.INTEGER));
    Arrays.stream(new String[] {PROFILE_BACKGROUND_IMAGE_URL, PROFILE_BACKGROUND_IMAGE_URL_HTTPS,
            PROFILE_IMAGE_URL, PROFILE_IMAGE_URL_HTTPS}).forEach(a -> primary(a, Converters.URL));
    Arrays.stream(new String[] {PROFILE_BACKGROUND_COLOR, PROFILE_LINK_COLOR, PROFILE_SIDEBAR_BORDER_COLOR,
            PROFILE_SIDEBAR_FILL_COLOR, PROFILE_TEXT_COLOR}).forEach(a -> primary(a, Converters.COLOR));
    primary(LANG, Converters.LOCALE);
    primary(CREATED_AT, new FormattedDateConverter("EEE MMM dd HH:mm:ss Z yyyy", Locale.US));
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:17,代码来源:SinaAttributesDefinition.java

示例7: WeiXinAttributesDefinition

import org.pac4j.core.profile.converter.Converters; //导入依赖的package包/类
public WeiXinAttributesDefinition(){
    addAttribute(OPEN_ID, Converters.stringConverter);
    addAttribute(NICK_NAME, Converters.stringConverter);
    addAttribute(SEX, Converters.integerConverter);
    addAttribute(COUNTRY, Converters.stringConverter);
    addAttribute(PROVINCE, Converters.stringConverter);
    addAttribute(CITY, Converters.stringConverter);
    addAttribute(HEAD_IMG_URL, Converters.stringConverter);
    addAttribute(UNION_ID, Converters.stringConverter);
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:11,代码来源:WeiXinAttributesDefinition.java

示例8: FacebookProfileDefinition

import org.pac4j.core.profile.converter.Converters; //导入依赖的package包/类
public FacebookProfileDefinition() {
    super(x -> new FacebookProfile());
    Arrays.stream(new String[] {
        NAME, MIDDLE_NAME, LAST_NAME, THIRD_PARTY_ID, ABOUT, POLITICAL, QUOTES, RELIGION, WEBSITE
    }).forEach(a -> primary(a, Converters.STRING));
    primary(TIMEZONE, Converters.INTEGER);
    primary(VERIFIED, Converters.BOOLEAN);
    primary(LINK, Converters.URL);
    final JsonConverter<FacebookObject> objectConverter = new JsonConverter<>(FacebookObject.class);
    final JsonConverter multiObjectConverter = new JsonConverter(List.class, new TypeReference<List<FacebookObject>>() {});
    final JsonConverter multiInfoConverter = new JsonConverter(List.class, new TypeReference<List<FacebookInfo>>() {});
    primary(UPDATED_TIME, Converters.DATE_TZ_GENERAL);
    primary(BIRTHDAY, new DateConverter("MM/dd/yyyy"));
    primary(RELATIONSHIP_STATUS, new FacebookRelationshipStatusConverter());
    primary(LANGUAGES, multiObjectConverter);
    primary(EDUCATION, new JsonConverter(List.class, new TypeReference<List<FacebookEducation>>() {}));
    primary(HOMETOWN, objectConverter);
    primary(INTERESTED_IN, new JsonConverter(List.class, new TypeReference<List<String>>() {}));
    primary(LOCATION, objectConverter);
    primary(FAVORITE_ATHLETES, multiObjectConverter);
    primary(FAVORITE_TEAMS, multiObjectConverter);
    primary(SIGNIFICANT_OTHER, objectConverter);
    primary(WORK, new JsonConverter(List.class, new TypeReference<List<FacebookWork>>() {}));
    secondary(FRIENDS, multiObjectConverter);
    secondary(MOVIES, multiInfoConverter);
    secondary(MUSIC, multiInfoConverter);
    secondary(BOOKS, multiInfoConverter);
    secondary(LIKES, multiInfoConverter);
    secondary(ALBUMS, new JsonConverter(List.class, new TypeReference<List<FacebookPhoto>>() {}));
    secondary(EVENTS, new JsonConverter(List.class, new TypeReference<List<FacebookEvent>>() {}));
    secondary(GROUPS, new JsonConverter(List.class, new TypeReference<List<FacebookGroup>>() {}));
    secondary(MUSIC_LISTENS, new JsonConverter(List.class, new TypeReference<List<FacebookMusicListen>>() {}));
    secondary(PICTURE, new JsonConverter<>(FacebookPicture.class));
}
 
开发者ID:millross,项目名称:pac4j-async,代码行数:35,代码来源:FacebookProfileDefinition.java

示例9: OrcidAttributesDefinition

import org.pac4j.core.profile.converter.Converters; //导入依赖的package包/类
public OrcidAttributesDefinition() {
    primary(ORCID, Converters.STRING);
    primary(FIRST_NAME, Converters.STRING);
    primary(FAMILY_NAME, Converters.STRING);
    primary(URI, Converters.STRING);
    primary(CREATION_METHOD, Converters.STRING);
    primary(CLAIMED, Converters.BOOLEAN);
    primary(LOCALE, Converters.LOCALE);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:10,代码来源:OrcidAttributesDefinition.java

示例10: GitHubAttributesDefinition

import org.pac4j.core.profile.converter.Converters; //导入依赖的package包/类
public GitHubAttributesDefinition() {
    Arrays.asList(new String[] {
        URL, COMPANY, NAME, BLOG, LOGIN, EMAIL, LOCATION, TYPE, GRAVATAR_ID, AVATAR_URL, HTML_URL, BIO
    }).forEach(a -> primary(a, Converters.STRING));
    Arrays.asList(new String[] {
        FOLLOWING, PUBLIC_REPOS, PUBLIC_GISTS, DISK_USAGE, COLLABORATORS, OWNED_PRIVATE_REPOS, TOTAL_PRIVATE_REPOS,
        PRIVATE_GISTS, FOLLOWERS
    }).forEach(a -> primary(a, Converters.INTEGER));
    primary(HIREABLE, Converters.BOOLEAN);
    primary(CREATED_AT, Converters.DATE_TZ_RFC822);
    primary(UPDATED_AT, Converters.DATE_TZ_RFC822);
    primary(PLAN, new JsonConverter<>(GitHubPlan.class));
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:14,代码来源:GitHubAttributesDefinition.java

示例11: DefaultGenericAttributesDefinition

import org.pac4j.core.profile.converter.Converters; //导入依赖的package包/类
public DefaultGenericAttributesDefinition() {
    primary(EMAIL, Converters.STRING);
    primary(FIRST_NAME, Converters.STRING);
    primary(FAMILY_NAME, Converters.STRING);
    primary(DISPLAY_NAME, Converters.STRING);
    primary(GENDER, Converters.GENDER);
    primary(LOCALE, Converters.LOCALE);
    primary(PICTURE_URL, Converters.URL);
    primary(PROFILE_URL, Converters.URL);
    primary(EMAIL, Converters.STRING);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:12,代码来源:DefaultGenericAttributesDefinition.java

示例12: WordPressAttributesDefinition

import org.pac4j.core.profile.converter.Converters; //导入依赖的package包/类
public WordPressAttributesDefinition() {
    primary(DISPLAY_NAME, Converters.STRING);
    primary(Pac4jConstants.USERNAME, Converters.STRING);
    primary(EMAIL, Converters.STRING);
    primary(PRIMARY_BLOG, Converters.INTEGER);
    primary(AVATAR_URL, Converters.URL);
    primary(PROFILE_URL, Converters.URL);
    secondary(LINKS, new JsonConverter<>(WordPressLinks.class));
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:10,代码来源:WordPressAttributesDefinition.java

示例13: FoursquareAttributesDefinition

import org.pac4j.core.profile.converter.Converters; //导入依赖的package包/类
public FoursquareAttributesDefinition() {
    Arrays.stream(new String[] {
            FIRST_NAME, LAST_NAME, GENDER, HOME_CITY, BIO, EMAIL, PHOTO
    }).forEach(a -> primary(a, Converters.STRING));
    primary(GENDER, Converters.GENDER);
    primary(FIRENDS, new JsonConverter<>(FoursquareUserFriends.class));
    primary(CONTACT, new JsonConverter<>(FoursquareUserContact.class));
    primary(PHOTO, new JsonConverter<>(FoursquareUserPhoto.class));
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:10,代码来源:FoursquareAttributesDefinition.java

示例14: CasOAuthWrapperAttributesDefinition

import org.pac4j.core.profile.converter.Converters; //导入依赖的package包/类
public CasOAuthWrapperAttributesDefinition() {
    primary(IS_FROM_NEW_LOGIN, Converters.BOOLEAN);
    primary(AUTHENTICATION_DATE, new CasAuthenticationDateFormatter());
    primary(AUTHENTICATION_METHOD, Converters.STRING);
    primary(SUCCESSFUL_AUTHENTICATION_HANDLERS, Converters.STRING);
    primary(LONG_TERM_AUTHENTICATION_REQUEST_TOKEN_USED, Converters.BOOLEAN);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:8,代码来源:CasOAuthWrapperAttributesDefinition.java

示例15: LinkedIn2AttributesDefinition

import org.pac4j.core.profile.converter.Converters; //导入依赖的package包/类
public LinkedIn2AttributesDefinition() {
    Arrays.stream(new String[] { FIRST_NAME, LAST_NAME, MAIDEN_NAME, FORMATTED_NAME, PHONETIC_FIRST_NAME, PHONETIC_LAST_NAME,
            FORMATTED_PHONETIC_NAME, HEADLINE, INDUSTRY, CURRENT_SHARE, SUMMARY, SPECIALTIES, PICTURE_URL, PUBLIC_PROFILE_URL,
            EMAIL_ADDRESS}).forEach(a -> primary(a, Converters.STRING));
    primary(NUM_CONNECTIONS, Converters.INTEGER);
    primary(NUM_CONNECTIONS_CAPPED, Converters.BOOLEAN);
    primary(LOCATION, new JsonConverter<>(LinkedIn2Location.class));
    secondary(POSITIONS, new JsonListConverter(LinkedIn2Position.class, LinkedIn2Position[].class));
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:10,代码来源:LinkedIn2AttributesDefinition.java


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