Skip to content

Commit

Permalink
write a line into test.file
Browse files Browse the repository at this point in the history
  • Loading branch information
huifer committed Oct 2, 2024
1 parent 2325e1a commit 363d900
Show file tree
Hide file tree
Showing 9 changed files with 924 additions and 0 deletions.
471 changes: 471 additions & 0 deletions docs/spring/cs875dbd78-8064-11ef-9872-acde48001122.java

Large diffs are not rendered by default.

68 changes: 68 additions & 0 deletions docs/spring/cs878d943a-8064-11ef-9872-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.github.huifer.simple.shiro.boot.entity;

import java.util.Objects;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "user_bind_resource", schema = "simple-shiro", catalog = "")
public class UserBindResourceEntity {

private int id;
private Integer userId;
private Integer resourceId;

@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

@Basic
@Column(name = "user_id")
public Integer getUserId() {
return userId;
}

public void setUserId(Integer userId) {
this.userId = userId;
}

@Basic
@Column(name = "resource_id")
public Integer getResourceId() {
return resourceId;
}

public void setResourceId(Integer resourceId) {
this.resourceId = resourceId;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
UserBindResourceEntity that = (UserBindResourceEntity) o;
return id == that.id && Objects.equals(userId, that.userId) && Objects
.equals(resourceId, that.resourceId);
}

@Override
public int hashCode() {
return Objects.hash(id, userId, resourceId);
}
}
21 changes: 21 additions & 0 deletions docs/spring/cs87bbd408-8064-11ef-9872-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright 2009-2018 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.
* <p>
* logger using standard out.
*/
/**
* logger using standard out.
*/
package org.apache.ibatis.logging.stdout;
114 changes: 114 additions & 0 deletions docs/spring/cs87e9da7e-8064-11ef-9872-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/**
* Copyright 2009-2019 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.cache.decorators;

import org.apache.ibatis.cache.Cache;

import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.util.Deque;
import java.util.LinkedList;

/**
* Weak Reference cache decorator.
* Thanks to Dr. Heinz Kabutz for his guidance here.
* WEAK 缓存策略 弱引用:更积极地移除基于垃圾收集器状态和弱引用规则的对象。
*
* @author Clinton Begin
*/
public class WeakCache implements Cache {
private final Deque<Object> hardLinksToAvoidGarbageCollection;
private final ReferenceQueue<Object> queueOfGarbageCollectedEntries;
private final Cache delegate;
private int numberOfHardLinks;

public WeakCache(Cache delegate) {
this.delegate = delegate;
this.numberOfHardLinks = 256;
this.hardLinksToAvoidGarbageCollection = new LinkedList<>();
this.queueOfGarbageCollectedEntries = new ReferenceQueue<>();
}

@Override
public String getId() {
return delegate.getId();
}

@Override
public int getSize() {
removeGarbageCollectedItems();
return delegate.getSize();
}

public void setSize(int size) {
this.numberOfHardLinks = size;
}

@Override
public void putObject(Object key, Object value) {
removeGarbageCollectedItems();
delegate.putObject(key, new WeakEntry(key, value, queueOfGarbageCollectedEntries));
}

@Override
public Object getObject(Object key) {
Object result = null;
@SuppressWarnings("unchecked") // assumed delegate cache is totally managed by this cache
WeakReference<Object> weakReference = (WeakReference<Object>) delegate.getObject(key);
if (weakReference != null) {
result = weakReference.get();
if (result == null) {
delegate.removeObject(key);
} else {
hardLinksToAvoidGarbageCollection.addFirst(result);
if (hardLinksToAvoidGarbageCollection.size() > numberOfHardLinks) {
hardLinksToAvoidGarbageCollection.removeLast();
}
}
}
return result;
}

@Override
public Object removeObject(Object key) {
removeGarbageCollectedItems();
return delegate.removeObject(key);
}

@Override
public void clear() {
hardLinksToAvoidGarbageCollection.clear();
removeGarbageCollectedItems();
delegate.clear();
}

private void removeGarbageCollectedItems() {
WeakEntry sv;
while ((sv = (WeakEntry) queueOfGarbageCollectedEntries.poll()) != null) {
delegate.removeObject(sv.key);
}
}

private static class WeakEntry extends WeakReference<Object> {
private final Object key;

private WeakEntry(Object key, Object value, ReferenceQueue<Object> garbageCollectionQueue) {
super(value, garbageCollectionQueue);
this.key = key;
}
}

}
70 changes: 70 additions & 0 deletions docs/spring/cs8817c89e-8064-11ef-9872-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* Copyright 2009-2019 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.scripting.xmltags;

import ognl.MemberAccess;
import org.apache.ibatis.reflection.Reflector;

import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Member;
import java.util.Map;

/**
* The {@link MemberAccess} class that based on <a href=
* 'https://github.com/jkuhnert/ognl/blob/OGNL_3_2_1/src/java/ognl/DefaultMemberAccess.java'>DefaultMemberAccess</a>.
*
* @author Kazuki Shimizu
* @since 3.5.0
*
* @see <a href=
* 'https://github.com/jkuhnert/ognl/blob/OGNL_3_2_1/src/java/ognl/DefaultMemberAccess.java'>DefaultMemberAccess</a>
* @see <a href='https://github.com/jkuhnert/ognl/issues/47'>#47 of ognl</a>
*/
class OgnlMemberAccess implements MemberAccess {

private final boolean canControlMemberAccessible;

OgnlMemberAccess() {
this.canControlMemberAccessible = Reflector.canControlMemberAccessible();
}

@Override
public Object setup(Map context, Object target, Member member, String propertyName) {
Object result = null;
if (isAccessible(context, target, member, propertyName)) {
AccessibleObject accessible = (AccessibleObject) member;
if (!accessible.isAccessible()) {
result = Boolean.FALSE;
accessible.setAccessible(true);
}
}
return result;
}

@Override
public void restore(Map context, Object target, Member member, String propertyName,
Object state) {
if (state != null) {
((AccessibleObject) member).setAccessible((Boolean) state);
}
}

@Override
public boolean isAccessible(Map context, Object target, Member member, String propertyName) {
return canControlMemberAccessible;
}

}
37 changes: 37 additions & 0 deletions docs/spring/cs8845e56c-8064-11ef-9872-acde48001122.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* 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.submitted.foreach;

import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface Mapper {

User getUser(User user);

int countByUserList(List<User> users);

int countByBestFriend(List<User> users);

String selectWithNullItemCheck(List<User> users);

int typoInItemProperty(List<User> users);

int itemVariableConflict(@Param("id") Integer id, @Param("ids") List<Integer> ids, @Param("ids2") List<Integer> ids2);

int indexVariableConflict(@Param("idx") Integer id, @Param("idxs") List<Integer> ids, @Param("idxs2") List<Integer> ids2);
}
Loading

0 comments on commit 363d900

Please sign in to comment.