-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
530 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/** | ||
* Copyright 2009-2017 the original author or authors. | ||
* <p> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.ibatis.reflection.property; | ||
|
||
import java.util.Iterator; | ||
|
||
/** | ||
* @author Clinton Begin | ||
*/ | ||
public class PropertyTokenizer implements Iterator<PropertyTokenizer> { | ||
private final String indexedName; | ||
private final String children; | ||
private String name; | ||
private String index; | ||
|
||
|
||
/** | ||
* 数据初始化 | ||
* | ||
* @param fullname | ||
*/ | ||
public PropertyTokenizer(String fullname) { | ||
// 分割 . | ||
int delim = fullname.indexOf('.'); | ||
if (delim > -1) { | ||
name = fullname.substring(0, delim); | ||
children = fullname.substring(delim + 1); | ||
} else { | ||
name = fullname; | ||
children = null; | ||
} | ||
indexedName = name; | ||
// 分割[ | ||
delim = name.indexOf('['); | ||
if (delim > -1) { | ||
index = name.substring(delim + 1, name.length() - 1); | ||
name = name.substring(0, delim); | ||
} | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getIndex() { | ||
return index; | ||
} | ||
|
||
public String getIndexedName() { | ||
return indexedName; | ||
} | ||
|
||
public String getChildren() { | ||
return children; | ||
} | ||
|
||
@Override | ||
public boolean hasNext() { | ||
return children != null; | ||
} | ||
|
||
@Override | ||
public PropertyTokenizer next() { | ||
return new PropertyTokenizer(children); | ||
} | ||
|
||
@Override | ||
public void remove() { | ||
throw new UnsupportedOperationException("Remove is not supported, as it has no meaning in the context of properties."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.huifer.bilibili.redis.entity.bo; | ||
|
||
import com.huifer.bilibili.redis.entity.BookEntity; | ||
import com.huifer.bilibili.redis.entity.UserEntity; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* 假设存在这么一个对象 | ||
*/ | ||
public class UserInfo { | ||
private UserEntity userEntity; | ||
private List<BookEntity> bookEntity; | ||
|
||
public UserEntity getUserEntity() { | ||
return userEntity; | ||
} | ||
|
||
public void setUserEntity(UserEntity userEntity) { | ||
this.userEntity = userEntity; | ||
} | ||
|
||
public List<BookEntity> getBookEntity() { | ||
return bookEntity; | ||
} | ||
|
||
public void setBookEntity(List<BookEntity> bookEntity) { | ||
this.bookEntity = bookEntity; | ||
} | ||
} |
Oops, something went wrong.